WIP #120 Remove custom renderers for dots

This commit is contained in:
Yegor Vialov 2018-10-29 23:30:11 +02:00
parent efa5a1958c
commit d30c9d574b
4 changed files with 10 additions and 34 deletions

View File

@ -15,8 +15,6 @@ class EntityColors {
"default": Color.fromRGBO(68, 115, 158, 1.0), "default": Color.fromRGBO(68, 115, 158, 1.0),
"heat": Colors.redAccent, "heat": Colors.redAccent,
"cool": Colors.lightBlue, "cool": Colors.lightBlue,
"closing": Colors.cyan,
"opening": Colors.purple,
"unavailable": Colors.black26, "unavailable": Colors.black26,
"unknown": Colors.black26, "unknown": Colors.black26,
}; };

View File

@ -52,15 +52,10 @@ class _CombinedHistoryChartWidgetState extends State<CombinedHistoryChartWidget>
tickProviderSpec: tickProviderSpec:
new charts.BasicNumericTickProviderSpec(zeroBound: false)), new charts.BasicNumericTickProviderSpec(zeroBound: false)),
dateTimeFactory: const charts.LocalDateTimeFactory(), dateTimeFactory: const charts.LocalDateTimeFactory(),
defaultRenderer: charts.LineRendererConfig(includeArea: false), defaultRenderer: charts.LineRendererConfig(
customSeriesRenderers: [ includeArea: false,
new charts.PointRendererConfig( includePoints: true
// ID used to link series to this renderer. ),
customRendererId: 'valuePoints')
],
/*primaryMeasureAxis: charts.NumericAxisSpec(
renderSpec: charts.NoneRenderSpec()
),*/
selectionModels: [ selectionModels: [
new charts.SelectionModelConfig( new charts.SelectionModelConfig(
type: charts.SelectionModelType.info, type: charts.SelectionModelType.info,
@ -118,18 +113,11 @@ class _CombinedHistoryChartWidgetState extends State<CombinedHistoryChartWidget>
new charts.Series<CombinedEntityStateHistoryMoment, DateTime>( new charts.Series<CombinedEntityStateHistoryMoment, DateTime>(
id: "value", id: "value",
colorFn: (CombinedEntityStateHistoryMoment historyMoment, __) => EntityColors.chartHistoryStateColor("_", historyMoment.colorId), colorFn: (CombinedEntityStateHistoryMoment historyMoment, __) => EntityColors.chartHistoryStateColor("_", historyMoment.colorId),
domainFn: (CombinedEntityStateHistoryMoment historyMoment, _) => historyMoment.time,
measureFn: (CombinedEntityStateHistoryMoment historyMoment, _) => historyMoment.value,
data: dataItem,
),
new charts.Series<CombinedEntityStateHistoryMoment, DateTime>(
id: "points",
radiusPxFn: (CombinedEntityStateHistoryMoment historyMoment, __) => (historyMoment.id == _selectedId) ? 5.0 : 1.0, radiusPxFn: (CombinedEntityStateHistoryMoment historyMoment, __) => (historyMoment.id == _selectedId) ? 5.0 : 1.0,
colorFn: (CombinedEntityStateHistoryMoment historyMoment, __) => EntityColors.chartHistoryStateColor("_", historyMoment.colorId),
domainFn: (CombinedEntityStateHistoryMoment historyMoment, _) => historyMoment.time, domainFn: (CombinedEntityStateHistoryMoment historyMoment, _) => historyMoment.time,
measureFn: (CombinedEntityStateHistoryMoment historyMoment, _) => historyMoment.value, measureFn: (CombinedEntityStateHistoryMoment historyMoment, _) => historyMoment.value,
data: dataItem, data: dataItem,
)..setAttribute(charts.rendererIdKey, 'valuePoints') )
]); ]);
}); });
return result; return result;

View File

@ -48,12 +48,9 @@ class _NumericStateHistoryChartWidgetState extends State<NumericStateHistoryChar
tickProviderSpec: tickProviderSpec:
new charts.BasicNumericTickProviderSpec(zeroBound: false)), new charts.BasicNumericTickProviderSpec(zeroBound: false)),
dateTimeFactory: const charts.LocalDateTimeFactory(), dateTimeFactory: const charts.LocalDateTimeFactory(),
defaultRenderer: charts.LineRendererConfig(), defaultRenderer: charts.LineRendererConfig(
customSeriesRenderers: [ includePoints: true
new charts.PointRendererConfig( ),
// ID used to link series to this renderer.
customRendererId: 'valuePoints')
],
/*primaryMeasureAxis: charts.NumericAxisSpec( /*primaryMeasureAxis: charts.NumericAxisSpec(
renderSpec: charts.NoneRenderSpec() renderSpec: charts.NoneRenderSpec()
),*/ ),*/
@ -91,15 +88,8 @@ class _NumericStateHistoryChartWidgetState extends State<NumericStateHistoryChar
domainFn: (NumericEntityStateHistoryMoment historyMoment, _) => historyMoment.time, domainFn: (NumericEntityStateHistoryMoment historyMoment, _) => historyMoment.time,
measureFn: (NumericEntityStateHistoryMoment historyMoment, _) => historyMoment.value, measureFn: (NumericEntityStateHistoryMoment historyMoment, _) => historyMoment.value,
data: data, data: data,
),
new charts.Series<NumericEntityStateHistoryMoment, DateTime>(
id: 'State',
radiusPxFn: (NumericEntityStateHistoryMoment historyMoment, __) => (historyMoment.id == _selectedId) ? 5.0 : 1.0, radiusPxFn: (NumericEntityStateHistoryMoment historyMoment, __) => (historyMoment.id == _selectedId) ? 5.0 : 1.0,
colorFn: (NumericEntityStateHistoryMoment historyMoment, __) => EntityColors.chartHistoryStateColor("on", -1), )
domainFn: (NumericEntityStateHistoryMoment historyMoment, _) => historyMoment.time,
measureFn: (NumericEntityStateHistoryMoment historyMoment, _) => historyMoment.value,
data: data,
)..setAttribute(charts.rendererIdKey, 'valuePoints')
]; ];
} }

View File

@ -98,7 +98,7 @@ class _SimpleStateHistoryChartWidgetState extends State<SimpleStateHistoryChartW
return [ return [
new charts.Series<SimpleEntityStateHistoryMoment, DateTime>( new charts.Series<SimpleEntityStateHistoryMoment, DateTime>(
id: 'State', id: 'State',
strokeWidthPxFn: (SimpleEntityStateHistoryMoment historyMoment, __) => (historyMoment.id == _selectedId) ? 6.0 : 4.0, strokeWidthPxFn: (SimpleEntityStateHistoryMoment historyMoment, __) => (historyMoment.id == _selectedId) ? 6.0 : 3.0,
colorFn: (SimpleEntityStateHistoryMoment historyMoment, __) => EntityColors.chartHistoryStateColor(historyMoment.state, historyMoment.colorId), colorFn: (SimpleEntityStateHistoryMoment historyMoment, __) => EntityColors.chartHistoryStateColor(historyMoment.state, historyMoment.colorId),
domainFn: (SimpleEntityStateHistoryMoment historyMoment, _) => historyMoment.startTime, domainFn: (SimpleEntityStateHistoryMoment historyMoment, _) => historyMoment.startTime,
measureFn: (SimpleEntityStateHistoryMoment historyMoment, _) => 10, measureFn: (SimpleEntityStateHistoryMoment historyMoment, _) => 10,