Package selection guidance compiled from public package information, community data, and project usage.
fl_heatmap is a Flutter package that provides a customizable heatmap widget for visualizing data across two dimensions. It supports various styling options, including color schemes, cell sizing, and label customization, making it ideal for displaying density or frequency patterns in datasets. The widget integrates seamlessly into Flutter apps across multiple platforms, offering smooth rendering and responsive behavior. It's particularly useful for analytics dashboards, geographical data visualization, and time-series heatmaps. Built with performance in mind, it handles large datasets efficiently while maintaining a clean, intuitive API.
Use cases
Data density visualization
Analytics dashboards
Geospatial data representation
Time-series heatmaps
User activity tracking
Key features
Customizable color schemes
Configurable cell sizes
Support for labels and tooltips
Responsive design
Efficient rendering for large datasets
Cross-platform compatibility
Suitable for
Developers building data visualization features
Teams creating analytical dashboards
Apps requiring pattern recognition in data
Educational tools with interactive charts
Projects involving spatial or temporal data
Considerations
Requires understanding of 2D data structure
Performance may vary with very large datasets
Limited built-in interactivity beyond tooltips
Styling options require careful configuration for optimal appearance
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
fl_heatmap
A heatmap widget for Flutter apps.
Usage
1 - Depend on it
Add it to your package's pubspec.yaml file
dependencies:fl_heatmap:^0.1.0
2 - Install it
Install packages from the command line
flutter packages get
3 - Use it
This is an example for the months of four years:
import'package:fl_heatmap/fl_heatmap.dart';
class_ExampleStateextendsState<ExampleApp> {
HeatmapItem? selectedItem;
lateHeatmapData heatmapData;
@overridevoidinitState() {
_initExampleData();
super.initState();
}
void_initExampleData() {
const rows = [
'2022',
'2021',
'2020',
'2019',
];
const columns = [
'Jan',
'Feb',
'Mär',
'Apr',
'Mai',
'Jun',
'Jul',
'Aug',
'Sep',
'Okt',
'Nov',
'Dez',
];
final r = Random();
constString unit = 'kWh';
heatmapData = HeatmapData(rows: rows, columns: columns, items: [
for (int row = 0; row < rows.length; row++)
for (int col = 0; col < columns.length; col++)
HeatmapItem(
value: r.nextDouble() * 6,
unit: unit,
xAxisLabel: columns[col],
yAxisLabel: rows[row]),
]);
}
@overrideWidgetbuild(BuildContext context) {
final title = selectedItem != null
? '${selectedItem!.value.toStringAsFixed(2)}${selectedItem!.unit}'
: '--- ${heatmapData.items.first.unit}';
final subtitle = selectedItem != null
? '${selectedItem!.xAxisLabel}${selectedItem!.yAxisLabel}'
: '---';
returnMaterialApp(
home: Scaffold(
appBar: AppBar(
title: constText('Heatmap plugin example app'),
),
body: SingleChildScrollView(
child: Column(
children: [
constSizedBox(height: 16),
Text(title, textScaleFactor: 1.4),
Text(subtitle),
constSizedBox(height: 8),
Heatmap(
onItemSelectedListener: (HeatmapItem? selectedItem) {
debugPrint(
'Item ${selectedItem?.yAxisLabel}/${selectedItem?.xAxisLabel} with value ${selectedItem?.value} selected');
setState(() {
this.selectedItem = selectedItem;
});
},
rowsVisible: 5, // Only the first 5 rows are visible
heatmapData: heatmapData)
],
),
),
),
);
}
}
If necessary you can inherit from HeatmapItem and attach some payload, e.g. the electricity costs for the consumption: