@hestia-earth/ui-components 0.41.29 → 0.41.30

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.
@@ -5654,7 +5654,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
5654
5654
  // show label 8px from bar
5655
5655
  const gapX = 8;
5656
5656
  const placementGap = (placement) => (placement === 'right' ? +gapX : -gapX);
5657
- const placementX = (x, chart, data, placement) => placement === 'right' ? (data < 0 ? positionAtZero(chart) : x) : x;
5657
+ const placementX = (x, chart, data, placement) => placement === 'right' ? (!Array.isArray(data) && data < 0 ? positionAtZero(chart) : x) : x;
5658
5658
  const positionAtZero = (chart) => chart.scales.x.getPixelForValue(0);
5659
5659
  const defaultBarDrawSettings = {
5660
5660
  placement: 'right',
@@ -5699,7 +5699,8 @@ const afterBarDrawPlugin = settings => ({
5699
5699
  const { x, y, base } = element;
5700
5700
  const label = chart.data.labels?.[index] ?? '';
5701
5701
  const data = dataset.data[index];
5702
- const anchorX = placement === 'left' ? base : x;
5702
+ // use min/max as both negative values would inverse the positions
5703
+ const anchorX = placement === 'left' ? Math.min(base, x) : Math.max(base, x);
5703
5704
  const xPos = xPosFn(anchorX, index, width, chart, data, placement);
5704
5705
  const yPos = yPosFn(y, index, height, chart, data, placement);
5705
5706
  const text = isUndefined(data) ? emptyValueLabel : textFn({ label, data }, index, chart);