From efa5a1958c11c4824ef06ebae268f8f65f586e0e Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Mon, 29 Oct 2018 23:06:36 +0200 Subject: [PATCH] WIP #120 Simple state chart improvements --- .../simple_state_history_chart.dart | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) 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 be95494..523bc64 100644 --- a/lib/entity_widgets/history_chart/simple_state_history_chart.dart +++ b/lib/entity_widgets/history_chart/simple_state_history_chart.dart @@ -56,6 +56,14 @@ class _SimpleStateHistoryChartWidgetState extends State _onSelectionChanged(model), ) ], + customSeriesRenderers: [ + new charts.PointRendererConfig( + // ID used to link series to this renderer. + customRendererId: 'startValuePoints'), + new charts.PointRendererConfig( + // ID used to link series to this renderer. + customRendererId: 'endValuePoints') + ], behaviors: [ charts.PanAndZoomBehavior(), ], @@ -90,12 +98,28 @@ class _SimpleStateHistoryChartWidgetState extends State( id: 'State', - strokeWidthPxFn: (SimpleEntityStateHistoryMoment historyMoment, __) => (historyMoment.id == _selectedId) ? 70.0 : 40.0, + strokeWidthPxFn: (SimpleEntityStateHistoryMoment historyMoment, __) => (historyMoment.id == _selectedId) ? 6.0 : 4.0, colorFn: (SimpleEntityStateHistoryMoment historyMoment, __) => EntityColors.chartHistoryStateColor(historyMoment.state, historyMoment.colorId), domainFn: (SimpleEntityStateHistoryMoment historyMoment, _) => historyMoment.startTime, - measureFn: (SimpleEntityStateHistoryMoment historyMoment, _) => 0, + measureFn: (SimpleEntityStateHistoryMoment historyMoment, _) => 10, data: data, - ) + ), + new charts.Series( + id: 'State', + radiusPxFn: (SimpleEntityStateHistoryMoment historyMoment, __) => (historyMoment.id == _selectedId) ? 5.0 : 3.0, + colorFn: (SimpleEntityStateHistoryMoment historyMoment, __) => EntityColors.chartHistoryStateColor(historyMoment.state, historyMoment.colorId), + domainFn: (SimpleEntityStateHistoryMoment historyMoment, _) => historyMoment.startTime, + measureFn: (SimpleEntityStateHistoryMoment historyMoment, _) => 10, + data: data, + )..setAttribute(charts.rendererIdKey, 'startValuePoints'), + new charts.Series( + id: 'State', + radiusPxFn: (SimpleEntityStateHistoryMoment historyMoment, __) => (historyMoment.id == _selectedId) ? 5.0 : 3.0, + colorFn: (SimpleEntityStateHistoryMoment historyMoment, __) => EntityColors.chartHistoryStateColor(historyMoment.state, historyMoment.colorId), + domainFn: (SimpleEntityStateHistoryMoment historyMoment, _) => historyMoment.endTime ?? DateTime.now(), + measureFn: (SimpleEntityStateHistoryMoment historyMoment, _) => 10, + data: data, + )..setAttribute(charts.rendererIdKey, 'endValuePoints') ]; }