@opendata-ai/openchart-engine 7.2.3 → 7.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1482,7 +1482,9 @@ function computeBarMarks(spec, scales, _chartArea, _strategy) {
1482
1482
  return [];
1483
1483
  }
1484
1484
  const bandwidth = yScale.bandwidth();
1485
- const baseline = xScale(0);
1485
+ const xDomain = xScale.domain();
1486
+ const xIncludesZero = xDomain[0] <= 0 && xDomain[1] >= 0;
1487
+ const baseline = xIncludesZero ? xScale(0) : xScale(xDomain[0]);
1486
1488
  const colorEnc = encoding.color && "field" in encoding.color ? encoding.color : void 0;
1487
1489
  const conditionalColor = encoding.color && isConditionalValueDef(encoding.color) ? encoding.color : void 0;
1488
1490
  const colorField = colorEnc?.field;