@oliasoft-open-source/charts-library 5.9.0-beta-3 → 5.9.0-beta-5

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.
Files changed (26) hide show
  1. package/dist/assets/{Color-6BZIO3FS-DhiCnlR7.js → Color-6BZIO3FS-DdowJmIE.js} +1 -1
  2. package/dist/assets/{DocsRenderer-LL677BLK-CLTp7LBe.js → DocsRenderer-LL677BLK-Bh3SSh9b.js} +4 -4
  3. package/dist/assets/{WithTooltip-65CFNBJE-nlhXDghh.js → WithTooltip-65CFNBJE-jPKxajlJ.js} +1 -1
  4. package/dist/assets/{bar-chart.stories-Be0sO_B7.js → bar-chart.stories-BflbVUPC.js} +1 -1
  5. package/dist/assets/{chunk-YKABRMAI-CLqhon1S.js → chunk-YKABRMAI-DEtioWGg.js} +1 -1
  6. package/dist/assets/{components-DbZbxf23.js → components-CVnPnJrM.js} +4 -4
  7. package/dist/assets/formatter-EIJCOSYU-CFg7KAGQ.js +1 -0
  8. package/dist/assets/{get-draggableData-D9mEzSRR.js → get-draggableData-7QedQGoF.js} +1 -1
  9. package/dist/assets/{iframe-BRmN2xGD.js → iframe-gWDSyY5r.js} +3 -3
  10. package/dist/assets/{legend-Dp1wGMqq.js → legend-RH4DOORv.js} +1 -1
  11. package/dist/assets/{legend-context-CsgeM7Ef.js → legend-context-BhFJ15-e.js} +4 -4
  12. package/dist/assets/{line-chart-CmggAPJL.js → line-chart-8HLWYRar.js} +1 -1
  13. package/dist/assets/{line-chart.stories-DKASrDEu.js → line-chart.stories-B8gghA-c.js} +1 -1
  14. package/dist/assets/{line-chart.test-case.stories-Vi5KSfuS.js → line-chart.test-case.stories-D3lffJw3.js} +1 -1
  15. package/dist/assets/{pie-chart.stories-quF2SShg.js → pie-chart.stories-CQ6148pO.js} +1 -1
  16. package/dist/assets/{react-18-LnLgmPpm.js → react-18-DZdrvSyo.js} +1 -1
  17. package/dist/assets/{react-B3OBiEIY.js → react-DrmbVkNb.js} +1 -1
  18. package/dist/assets/{react-dom-7mcTV0j1.js → react-dom-CUqZc1lH.js} +1 -1
  19. package/dist/assets/{scatter-chart.stories-27nhXtcG.js → scatter-chart.stories-BmCRLBrB.js} +1 -1
  20. package/dist/assets/{syntaxhighlighter-ED5Y7EFY-CU6vABwV.js → syntaxhighlighter-ED5Y7EFY-CirqknGz.js} +1 -1
  21. package/dist/assets/{theming-CZ2tB5Pm.js → theming-BqNSGASu.js} +1 -1
  22. package/dist/iframe.html +1 -1
  23. package/dist/index.js +41 -13
  24. package/dist/project.json +1 -1
  25. package/package.json +1 -1
  26. package/dist/assets/formatter-EIJCOSYU-Bl_ix4lj.js +0 -1
package/dist/iframe.html CHANGED
@@ -547,7 +547,7 @@
547
547
  }
548
548
  </script>
549
549
 
550
- <script type="module" crossorigin src="./assets/iframe-BRmN2xGD.js"></script>
550
+ <script type="module" crossorigin src="./assets/iframe-gWDSyY5r.js"></script>
551
551
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-Bhb7V-Yo.js">
552
552
 
553
553
  </head>
package/dist/index.js CHANGED
@@ -19401,6 +19401,7 @@ var DEFAULT_HORIZONTAL_OFFSET = 18;
19401
19401
  var DEFAULT_VERTICAL_OFFSET = -18;
19402
19402
  var DEFAULT_ROW_GAP = 22;
19403
19403
  var DEFAULT_ITEM_GAP = 8;
19404
+ var DEFAULT_OVERLAP_ONLY_ITEM_GAP = 14;
19404
19405
  var DEFAULT_SIDE_SPREAD_STEP = 12;
19405
19406
  var DEFAULT_SIDE_SPREAD_MAX = 48;
19406
19407
  var clamp$1 = (value, min, max) => {
@@ -19632,14 +19633,12 @@ var getPreferredX = (chart, area, annotation, calloutCfg, width) => {
19632
19633
  const minConnectorLength = calloutCfg?.minConnectorLengthPx ?? DEFAULT_MIN_CONNECTOR_LENGTH;
19633
19634
  return clamp$1(reference.x + direction * (halfWidth + gap + minConnectorLength), area.left + margin + halfWidth, area.right - margin - halfWidth);
19634
19635
  };
19635
- var getPreferredY = (chart, area, annotation, calloutCfg, index) => {
19636
+ var getPreferredY = (chart, area, annotation, calloutCfg) => {
19636
19637
  const yScale = getYScale(chart, getAxisId(annotation, "y"));
19637
19638
  const explicitYValue = typeof calloutCfg?.yValue === "number" ? calloutCfg.yValue : void 0;
19638
19639
  if (typeof explicitYValue === "number" && yScale) return yScale.getPixelForValue(explicitYValue);
19639
19640
  const reference = getReferencePoint$1(chart, area, annotation);
19640
- const hasCustomOffset = typeof calloutCfg?.yAdjust === "number";
19641
- const row = Math.floor(index / 3);
19642
- const dy = hasCustomOffset ? 0 : DEFAULT_VERTICAL_OFFSET - row * DEFAULT_ROW_GAP;
19641
+ const dy = typeof calloutCfg?.yAdjust === "number" ? 0 : DEFAULT_VERTICAL_OFFSET;
19643
19642
  return reference.y + dy;
19644
19643
  };
19645
19644
  var getCalloutItems = (chart, area) => {
@@ -19654,7 +19653,7 @@ var getCalloutItems = (chart, area) => {
19654
19653
  const yScale = getYScale(chart, getAxisId(annotation, "y"));
19655
19654
  const reference = getReferencePoint$1(chart, area, annotation);
19656
19655
  const preferredX = getPreferredX(chart, area, annotation, calloutCfg, size.width);
19657
- const preferredY = getPreferredY(chart, area, annotation, calloutCfg, index);
19656
+ const preferredY = getPreferredY(chart, area, annotation, calloutCfg);
19658
19657
  const hasStoredX = typeof calloutCfg?.xValue === "number" || !xScale;
19659
19658
  const hasStoredY = typeof calloutCfg?.yValue === "number" || !yScale;
19660
19659
  const side = reference.side;
@@ -19664,6 +19663,7 @@ var getCalloutItems = (chart, area) => {
19664
19663
  calloutCfg,
19665
19664
  id,
19666
19665
  index,
19666
+ anchorY: reference.y,
19667
19667
  preferredX,
19668
19668
  preferredY,
19669
19669
  width: size.width,
@@ -19693,8 +19693,14 @@ var overlapsOccupiedRect = (centerY, height, occupiedRects) => {
19693
19693
  const bottom = centerY + height / 2;
19694
19694
  return occupiedRects.find((rect) => !(bottom <= rect.top || top >= rect.bottom));
19695
19695
  };
19696
+ var getLayoutGap = (item) => {
19697
+ return item.overlapOnly ? DEFAULT_OVERLAP_ONLY_ITEM_GAP : DEFAULT_ITEM_GAP;
19698
+ };
19699
+ var getLayoutOrderY = (item) => {
19700
+ return item.isFixed ? item.preferredY : item.anchorY;
19701
+ };
19696
19702
  var layoutSide = (items, occupiedRects = []) => {
19697
- const sorted = [...items].sort((left, right) => left.preferredY - right.preferredY);
19703
+ const sorted = [...items].sort((left, right) => getLayoutOrderY(left) - getLayoutOrderY(right));
19698
19704
  const result = /* @__PURE__ */ new Map();
19699
19705
  if (!sorted.filter((item) => !item.isFixed).length) {
19700
19706
  sorted.forEach((item) => {
@@ -19724,11 +19730,11 @@ var layoutSide = (items, occupiedRects = []) => {
19724
19730
  previousBottom = yValue + item.height / 2;
19725
19731
  return;
19726
19732
  }
19727
- const minCenter = Math.max(item.minY, previousBottom + item.height / 2 + DEFAULT_ITEM_GAP);
19733
+ const minCenter = Math.max(item.minY, previousBottom + item.height / 2 + getLayoutGap(item));
19728
19734
  let yValue = clamp$1(item.preferredY, minCenter, item.maxY);
19729
19735
  let overlappingRect = overlapsOccupiedRect(yValue, item.height, occupiedRects);
19730
19736
  while (overlappingRect) {
19731
- yValue = clamp$1(overlappingRect.bottom + DEFAULT_ITEM_GAP + item.height / 2, item.minY, item.maxY);
19737
+ yValue = clamp$1(overlappingRect.bottom + getLayoutGap(item) + item.height / 2, item.minY, item.maxY);
19732
19738
  overlappingRect = overlapsOccupiedRect(yValue, item.height, occupiedRects);
19733
19739
  }
19734
19740
  result.set(item.id, {
@@ -19745,7 +19751,7 @@ var layoutSide = (items, occupiedRects = []) => {
19745
19751
  nextTop = current.yValue - item.height / 2;
19746
19752
  return;
19747
19753
  }
19748
- const maxCenter = Math.min(item.maxY, nextTop - item.height / 2 - DEFAULT_ITEM_GAP);
19754
+ const maxCenter = Math.min(item.maxY, nextTop - item.height / 2 - getLayoutGap(item));
19749
19755
  const yValue = clamp$1(current.yValue, item.minY, maxCenter);
19750
19756
  result.set(item.id, {
19751
19757
  ...current,
@@ -19753,6 +19759,29 @@ var layoutSide = (items, occupiedRects = []) => {
19753
19759
  });
19754
19760
  nextTop = yValue - item.height / 2;
19755
19761
  });
19762
+ const overlapOnlyMovable = sorted.filter((item) => {
19763
+ return item.overlapOnly && !item.isFixed;
19764
+ });
19765
+ if (overlapOnlyMovable.length > 1) {
19766
+ const sortedOverlapOnlyMovable = [...overlapOnlyMovable].sort((left, right) => getLayoutOrderY(left) - getLayoutOrderY(right));
19767
+ const sharedOuterEdge = sortedOverlapOnlyMovable[0]?.side === "right" ? Math.max(...sortedOverlapOnlyMovable.map((item) => {
19768
+ return (result.get(item.id)?.xValue ?? item.preferredX) + item.width / 2;
19769
+ })) : Math.min(...sortedOverlapOnlyMovable.map((item) => {
19770
+ return (result.get(item.id)?.xValue ?? item.preferredX) - item.width / 2;
19771
+ }));
19772
+ sortedOverlapOnlyMovable.forEach((item, index) => {
19773
+ const current = result.get(item.id);
19774
+ if (!current) return;
19775
+ const spreadOffset = Math.min(index * DEFAULT_SIDE_SPREAD_STEP, DEFAULT_SIDE_SPREAD_MAX);
19776
+ const direction = item.side === "right" ? -1 : 1;
19777
+ const alignedXValue = item.side === "right" ? sharedOuterEdge - item.width / 2 : sharedOuterEdge + item.width / 2;
19778
+ result.set(item.id, {
19779
+ ...current,
19780
+ xValue: clamp$1(alignedXValue + direction * spreadOffset, item.minX, item.maxX)
19781
+ });
19782
+ });
19783
+ return result;
19784
+ }
19756
19785
  sorted.forEach((item, index) => {
19757
19786
  const current = result.get(item.id);
19758
19787
  if (!current || item.isFixed) return;
@@ -21039,11 +21068,10 @@ const computeConnectorPoints = (fromEl, labelEl, connector) => {
21039
21068
  const dx = ux / len;
21040
21069
  const dy = uy / len;
21041
21070
  const startOffset = connector?.startOffset ?? 6;
21042
- const pointRadius = fromEl?.options?.radius;
21043
- const isPointAnchor = typeof pointRadius === "number";
21071
+ const isPointAnchor = typeof fromEl?.options?.radius === "number";
21044
21072
  const referencePoint = connector?.anchor && !isPointAnchor ? getReferencePoint(fromEl, connector) : isPointAnchor ? {
21045
- x: x1c + dx * (pointRadius + startOffset),
21046
- y: y1c + dy * (pointRadius + startOffset)
21073
+ x: x1c,
21074
+ y: y1c
21047
21075
  } : getRectangleEdgePoint(fromEl, cx, cy, startOffset);
21048
21076
  const endOffset = connector?.endOffset ?? 1;
21049
21077
  const end = typeof labelEl?.width === "number" && typeof labelEl?.height === "number" ? getLabelEdgePoint(labelEl, referencePoint.x, endOffset) : {
package/dist/project.json CHANGED
@@ -1 +1 @@
1
- {"generatedAt":1773144580120,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"knownPackages":{"testPackages":{"@vitest/coverage-v8":"4.0.18","eslint-plugin-vitest":"0.5.4","eslint-plugin-vitest-globals":"1.5.0","vitest":"4.0.18"},"stylingPackages":{"less":"^4.3.0"}},"hasRouterPackage":false,"packageManager":{"type":"pnpm","version":"10.28.1","agent":"pnpm","nodeLinker":"undefined"},"typescriptOptions":{"reactDocgen":"react-docgen"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","portableStoriesFileCount":0,"applicationFileCount":0,"storybookVersion":"10.2.8","storybookVersionSpecifier":"^10.2.8","language":"javascript","storybookPackages":{"@storybook/react-vite":{"version":"10.2.8"},"@storybook/testing-library":{"version":"0.2.2"},"eslint-plugin-storybook":{"version":"10.2.8"},"storybook":{}},"addons":{"@storybook/addon-themes":{"version":"10.2.8"},"@storybook/addon-docs":{"version":"10.2.8"}},"packageJsonType":"module"}
1
+ {"generatedAt":1773303672747,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"knownPackages":{"testPackages":{"@vitest/coverage-v8":"4.0.18","eslint-plugin-vitest":"0.5.4","eslint-plugin-vitest-globals":"1.5.0","vitest":"4.0.18"},"stylingPackages":{"less":"^4.3.0"}},"hasRouterPackage":false,"packageManager":{"type":"pnpm","version":"10.28.1","agent":"pnpm","nodeLinker":"undefined"},"typescriptOptions":{"reactDocgen":"react-docgen"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","portableStoriesFileCount":0,"applicationFileCount":0,"storybookVersion":"10.2.8","storybookVersionSpecifier":"^10.2.8","language":"javascript","storybookPackages":{"@storybook/react-vite":{"version":"10.2.8"},"@storybook/testing-library":{"version":"0.2.2"},"eslint-plugin-storybook":{"version":"10.2.8"},"storybook":{}},"addons":{"@storybook/addon-themes":{"version":"10.2.8"},"@storybook/addon-docs":{"version":"10.2.8"}},"packageJsonType":"module"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "5.9.0-beta-3",
3
+ "version": "5.9.0-beta-5",
4
4
  "description": "React Chart Library (based on Chart.js and react-chart-js-2)",
5
5
  "homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
6
6
  "bugs": {
@@ -1 +0,0 @@
1
- import{C as e,l as t,u as n}from"./iframe-BRmN2xGD.js";var r=(0,e(n(),1).default)(2)(async(e,n)=>e===!1?n:t(n));export{r as formatter};