diff --git a/src/layout/barGrid.ts b/src/layout/barGrid.ts index 726c084f82..ae8112665d 100644 --- a/src/layout/barGrid.ts +++ b/src/layout/barGrid.ts @@ -545,7 +545,13 @@ export function createProgressiveLayout(seriesType: string): StageHandler { else { const coord = cartesian.dataToPoint([baseValue, value]); if (stacked) { - const startCoord = cartesian.dataToPoint([baseValue, startValue]); + let adjustedStartValue = startValue; + if (startValue === 0 && valueAxis.type === 'log') { + // Since log(0) == -Infinity, we adjust the start value to 1 + // so that log(1) == 0, and the bars go from 0. + adjustedStartValue = 1; + } + const startCoord = cartesian.dataToPoint([baseValue, adjustedStartValue]); baseCoord = startCoord[1]; } x = coord[0] + columnOffset; diff --git a/test/bar-log.html b/test/bar-log.html index 568d57e213..5e872857de 100644 --- a/test/bar-log.html +++ b/test/bar-log.html @@ -40,6 +40,7 @@
+ + +