From 57c3083f9fe359afb57811d126284c0f8cb97f09 Mon Sep 17 00:00:00 2001 From: "Chris \"koying\" Browet" Date: Tue, 25 Jun 2019 19:49:10 +0200 Subject: [PATCH 1/2] CHG: [history widget] select last measurement initally --- lib/entity_widgets/history_chart/combined_history_chart.dart | 2 +- .../history_chart/numeric_state_history_chart.dart | 2 +- .../history_chart/simple_state_history_chart.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/entity_widgets/history_chart/combined_history_chart.dart b/lib/entity_widgets/history_chart/combined_history_chart.dart index ac5ae8e..d352742 100644 --- a/lib/entity_widgets/history_chart/combined_history_chart.dart +++ b/lib/entity_widgets/history_chart/combined_history_chart.dart @@ -148,7 +148,7 @@ class _CombinedHistoryChartWidgetState extends State }); if ((_selectedId == -1) && (numericDataLists.isNotEmpty)) { - _selectedId = 0; + _selectedId = numericDataLists.length -1; } List> result = []; numericDataLists.forEach((attrName, dataList) { diff --git a/lib/entity_widgets/history_chart/numeric_state_history_chart.dart b/lib/entity_widgets/history_chart/numeric_state_history_chart.dart index 8e6aaab..d854206 100644 --- a/lib/entity_widgets/history_chart/numeric_state_history_chart.dart +++ b/lib/entity_widgets/history_chart/numeric_state_history_chart.dart @@ -103,7 +103,7 @@ class _NumericStateHistoryChartWidgetState extends State( diff --git a/lib/entity_widgets/history_chart/simple_state_history_chart.dart b/lib/entity_widgets/history_chart/simple_state_history_chart.dart index 3868fb7..1a7b20a 100644 --- a/lib/entity_widgets/history_chart/simple_state_history_chart.dart +++ b/lib/entity_widgets/history_chart/simple_state_history_chart.dart @@ -101,7 +101,7 @@ class _SimpleStateHistoryChartWidgetState extends State( From 13102a6b048ad0e6fe9226cd7c212253f01e7f02 Mon Sep 17 00:00:00 2001 From: "Chris \"koying\" Browet" Date: Thu, 27 Jun 2019 17:26:03 +0200 Subject: [PATCH 2/2] CHG: [history] wrap around --- .../history_chart/combined_history_chart.dart | 11 +++++++++++ .../history_chart/numeric_state_history_chart.dart | 11 +++++++++++ .../history_chart/simple_state_history_chart.dart | 13 ++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/lib/entity_widgets/history_chart/combined_history_chart.dart b/lib/entity_widgets/history_chart/combined_history_chart.dart index d352742..785a227 100644 --- a/lib/entity_widgets/history_chart/combined_history_chart.dart +++ b/lib/entity_widgets/history_chart/combined_history_chart.dart @@ -202,6 +202,11 @@ class _CombinedHistoryChartWidgetState extends State _selectedId -= 1; }); } + else { + setState(() { + _selectedId = _parsedHistory.first.data.length - 1; + }); + } } void _selectNext() { @@ -210,6 +215,12 @@ class _CombinedHistoryChartWidgetState extends State _selectedId += 1; }); } + else { + setState(() { + _selectedId = 0; + }); + + } } void _onSelectionChanged(charts.SelectionModel model) { diff --git a/lib/entity_widgets/history_chart/numeric_state_history_chart.dart b/lib/entity_widgets/history_chart/numeric_state_history_chart.dart index d854206..8645a37 100644 --- a/lib/entity_widgets/history_chart/numeric_state_history_chart.dart +++ b/lib/entity_widgets/history_chart/numeric_state_history_chart.dart @@ -132,6 +132,11 @@ class _NumericStateHistoryChartWidgetState extends State