mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-24 17:59:39 +02:00
fix 0 values
This commit is contained in:
@@ -32,15 +32,14 @@ export class BarPlot {
|
|||||||
groupTexts: ['plot', `bar-plot-${this.plotIndex}-${dataIndex}`],
|
groupTexts: ['plot', `bar-plot-${this.plotIndex}-${dataIndex}`],
|
||||||
type: 'rect',
|
type: 'rect',
|
||||||
data: finalData.map((data, index) => {
|
data: finalData.map((data, index) => {
|
||||||
|
const adjustForAxisOuterPadding = dataIndex > 0 ? this.yAxis.getAxisOuterPadding() : 0;
|
||||||
let x = offset[index] + this.boundingRect.x;
|
let x = offset[index] + this.boundingRect.x;
|
||||||
let width =
|
let width = data[1] - this.boundingRect.x - adjustForAxisOuterPadding;
|
||||||
data[1] -
|
|
||||||
this.boundingRect.x -
|
|
||||||
(dataIndex > 0 ? this.yAxis.getAxisOuterPadding() : 0);
|
|
||||||
if (enlarge[index] > 0) {
|
if (enlarge[index] > 0) {
|
||||||
x -= enlarge[index];
|
x -= enlarge[index];
|
||||||
width += enlarge[index];
|
width += enlarge[index];
|
||||||
enlarge[index] = 0;
|
enlarge[index] = 0;
|
||||||
|
offset[index] -= adjustForAxisOuterPadding;
|
||||||
}
|
}
|
||||||
offset[index] += width;
|
offset[index] += width;
|
||||||
if (barData.data[index][1] === 0 && enlarge[index] === 0) {
|
if (barData.data[index][1] === 0 && enlarge[index] === 0) {
|
||||||
@@ -72,6 +71,7 @@ export class BarPlot {
|
|||||||
if (enlarge[index] > 0) {
|
if (enlarge[index] > 0) {
|
||||||
height += enlarge[index];
|
height += enlarge[index];
|
||||||
enlarge[index] = 0;
|
enlarge[index] = 0;
|
||||||
|
offset[index] -= adjustForAxisOuterPadding;
|
||||||
}
|
}
|
||||||
offset[index] += height;
|
offset[index] += height;
|
||||||
if (barData.data[index][1] === 0 && enlarge[index] === 0) {
|
if (barData.data[index][1] === 0 && enlarge[index] === 0) {
|
||||||
|
Reference in New Issue
Block a user