mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-13 03:34:28 +05:00
fix: decimation for Equitherm chart fixed; chartjs updated
This commit is contained in:
@@ -897,7 +897,8 @@
|
|||||||
unitSystem: null,
|
unitSystem: null,
|
||||||
targetTemp: null,
|
targetTemp: null,
|
||||||
minTemp: null,
|
minTemp: null,
|
||||||
maxTemp: null
|
maxTemp: null,
|
||||||
|
decimated: false
|
||||||
};
|
};
|
||||||
|
|
||||||
const hasNeedDecimationChart = () => {
|
const hasNeedDecimationChart = () => {
|
||||||
@@ -957,12 +958,6 @@
|
|||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
display: false
|
display: false
|
||||||
},
|
|
||||||
decimation: {
|
|
||||||
enabled: hasNeedDecimationChart(),
|
|
||||||
algorithm: 'lttb',
|
|
||||||
samples: 30,
|
|
||||||
threshold: 30
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scales: {
|
scales: {
|
||||||
@@ -1008,19 +1003,18 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (etChart.data.datasets[0].data.length) {
|
let data = [];
|
||||||
etChart.data.datasets[0].data.pop();
|
etChartConfig.decimated = hasNeedDecimationChart();
|
||||||
}
|
for (let value = 30; value >= -30; value -= etChartConfig.decimated ? 2 : 1) {
|
||||||
|
|
||||||
for (let value = 30; value >= -30; value--) {
|
|
||||||
const outdoorTemp = etChartConfig.unitSystem == 0 ? value : c2f(value);
|
const outdoorTemp = etChartConfig.unitSystem == 0 ? value : c2f(value);
|
||||||
|
|
||||||
etChart.data.datasets[0].data.push({
|
data.push({
|
||||||
x: parseFloat(outdoorTemp.toFixed(1)),
|
x: parseFloat(outdoorTemp.toFixed(1)),
|
||||||
y: parseFloat(calculateEquithermTemp(outdoorTemp).toFixed(1))
|
y: parseFloat(calculateEquithermTemp(outdoorTemp).toFixed(1))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
etChart.data.datasets[0].data = data;
|
||||||
etChart.data.datasets[0].label = i18n("settings.equitherm.chart.setpointTemp");
|
etChart.data.datasets[0].label = i18n("settings.equitherm.chart.setpointTemp");
|
||||||
etChart.options.scales.x.title.text = i18n("settings.equitherm.chart.outdoorTemp");
|
etChart.options.scales.x.title.text = i18n("settings.equitherm.chart.outdoorTemp");
|
||||||
etChart.options.scales.y.title.text = i18n("settings.equitherm.chart.setpointTemp");
|
etChart.options.scales.y.title.text = i18n("settings.equitherm.chart.setpointTemp");
|
||||||
@@ -1336,9 +1330,8 @@
|
|||||||
if (etChart) {
|
if (etChart) {
|
||||||
etChart.resize();
|
etChart.resize();
|
||||||
|
|
||||||
if (etChart.options.plugins.decimation.enabled != hasNeedDecimationChart()) {
|
if (etChartConfig.decimated != hasNeedDecimationChart()) {
|
||||||
etChart.options.plugins.decimation.enabled = hasNeedDecimationChart();
|
makeEquithermChart();
|
||||||
etChart.update();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user