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,12 +113,13 @@ 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
function setYAxisRangeFromPlotData(data: number[], plotType: PlotType) {
dataSets.push(data);
const sum = new Array(data.length).fill(0);
for (let i = 0; i < data.length; i++) {
for (const entry of dataSets) {
sum[i] += entry[i];
if (plotType === PlotType.BAR) {
dataSets.push(data);
for (let i = 0; i < data.length; i++) {
for (const entry of dataSets) {
sum[i] += entry[i];
}
}
}