axis calculation fixed for mix of line and bar charts

This commit is contained in:
Axel Müller
2024-01-27 17:11:40 +01:00
parent 533a921ef5
commit 25160d9688

View File

@@ -113,14 +113,15 @@ function setYAxisRangeData(min: number, max: number) {
// this function does not set `hasSetYAxis` as there can be multiple data so we should calculate the range accordingly // this function does not set `hasSetYAxis` as there can be multiple data so we should calculate the range accordingly
function setYAxisRangeFromPlotData(data: number[], plotType: PlotType) { function setYAxisRangeFromPlotData(data: number[], plotType: PlotType) {
dataSets.push(data);
const sum = new Array(data.length).fill(0); const sum = new Array(data.length).fill(0);
if (plotType === PlotType.BAR) {
dataSets.push(data);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
for (const entry of dataSets) { for (const entry of dataSets) {
sum[i] += entry[i]; sum[i] += entry[i];
} }
} }
}
xyChartData.yAxis = { xyChartData.yAxis = {
type: 'linear', type: 'linear',