mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 18:34:56 +00:00
Refactor chart data generation in EnergyConsumptionPerDeviceChart for improved readability and maintainability
This commit is contained in:
@ -15,37 +15,15 @@ class EnergyConsumptionPerDeviceChart extends StatelessWidget {
|
|||||||
lineTouchData: EnergyManagementChartsHelper.lineTouchData(),
|
lineTouchData: EnergyManagementChartsHelper.lineTouchData(),
|
||||||
lineBarsData: [
|
lineBarsData: [
|
||||||
_buildChartBar(
|
_buildChartBar(
|
||||||
spots: const [
|
spots: [
|
||||||
FlSpot(1, 100),
|
for (var i = 0; i < 12; i++) FlSpot(i.toDouble(), (i + 1) * 100),
|
||||||
FlSpot(2, 200),
|
|
||||||
FlSpot(3, 300),
|
|
||||||
FlSpot(4, 400),
|
|
||||||
FlSpot(5, 500),
|
|
||||||
FlSpot(6, 600),
|
|
||||||
FlSpot(7, 700),
|
|
||||||
FlSpot(8, 800),
|
|
||||||
FlSpot(9, 900),
|
|
||||||
FlSpot(10, 1000),
|
|
||||||
FlSpot(11, 1100),
|
|
||||||
FlSpot(12, 1200),
|
|
||||||
],
|
],
|
||||||
color: Colors.amber,
|
color: Colors.amber,
|
||||||
),
|
),
|
||||||
_buildChartBar(
|
_buildChartBar(
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
spots: const [
|
spots: [
|
||||||
FlSpot(1, 100),
|
for (var i = 0; i < 12; i++) FlSpot(i.toDouble(), (i + 1) * 110),
|
||||||
FlSpot(2, 300),
|
|
||||||
FlSpot(3, 400),
|
|
||||||
FlSpot(4, 500),
|
|
||||||
FlSpot(5, 600),
|
|
||||||
FlSpot(6, 700),
|
|
||||||
FlSpot(7, 800),
|
|
||||||
FlSpot(8, 900),
|
|
||||||
FlSpot(9, 1000),
|
|
||||||
FlSpot(10, 1100),
|
|
||||||
FlSpot(11, 1200),
|
|
||||||
FlSpot(12, 1300),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user