mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-10 01:29:49 +02:00
axis calculation fixed for mix of line and bar charts
This commit is contained in:
@@ -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
|
// 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);
|
||||||
for (let i = 0; i < data.length; i++) {
|
if (plotType === PlotType.BAR) {
|
||||||
for (const entry of dataSets) {
|
dataSets.push(data);
|
||||||
sum[i] += entry[i];
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
for (const entry of dataSets) {
|
||||||
|
sum[i] += entry[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user