mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-06 23:59:37 +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
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user