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),
"heat": Colors.redAccent,
"cool": Colors.lightBlue,
"closing": Colors.cyan,
"opening": Colors.purple,
"unavailable": Colors.black26,
"unknown": Colors.black26,
};

View File

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

View File

@ -48,12 +48,9 @@ class _NumericStateHistoryChartWidgetState extends State<NumericStateHistoryChar
tickProviderSpec:
new charts.BasicNumericTickProviderSpec(zeroBound: false)),
dateTimeFactory: const charts.LocalDateTimeFactory(),
defaultRenderer: charts.LineRendererConfig(),
customSeriesRenderers: [
new charts.PointRendererConfig(
// ID used to link series to this renderer.
customRendererId: 'valuePoints')
],
defaultRenderer: charts.LineRendererConfig(
includePoints: true
),
/*primaryMeasureAxis: charts.NumericAxisSpec(
renderSpec: charts.NoneRenderSpec()
),*/
@ -91,15 +88,8 @@ class _NumericStateHistoryChartWidgetState extends State<NumericStateHistoryChar
domainFn: (NumericEntityStateHistoryMoment historyMoment, _) => historyMoment.time,
measureFn: (NumericEntityStateHistoryMoment historyMoment, _) => historyMoment.value,
data: data,
),
new charts.Series<NumericEntityStateHistoryMoment, DateTime>(
id: 'State',
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 [
new charts.Series<SimpleEntityStateHistoryMoment, DateTime>(
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),
domainFn: (SimpleEntityStateHistoryMoment historyMoment, _) => historyMoment.startTime,
measureFn: (SimpleEntityStateHistoryMoment historyMoment, _) => 10,