@oliasoft-open-source/charts-library 5.0.7 → 5.0.8-beta-1

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-YHDXOIA2-CKZWfRaj.js → Color-YHDXOIA2-CdwL15G5.js} +1 -1
  2. package/dist/assets/{DocsRenderer-CFRXHY34-DXXhWvFD.js → DocsRenderer-CFRXHY34-Dg2X56DC.js} +3 -3
  3. package/dist/assets/{bar-chart.stories-BtoqoUxl.js → bar-chart.stories-CMHZnlP4.js} +1 -1
  4. package/dist/assets/{entry-preview-C9dwO6KG.js → entry-preview-Dk_wWDkt.js} +1 -1
  5. package/dist/assets/{get-draggableData-DpL-PCw1.js → get-draggableData-Dccb4oAz.js} +1 -1
  6. package/dist/assets/{iframe-BVS9KHX7.js → iframe-BAfMmzoz.js} +2 -2
  7. package/dist/assets/{legend-DU0eJsZy.js → legend-Dl2DUlTl.js} +1 -1
  8. package/dist/assets/{legend-context-BD2-S1C1.js → legend-context-CUxjGljk.js} +18 -18
  9. package/dist/assets/line-chart-BvC78NXq.js +1 -0
  10. package/dist/assets/{line-chart.stories-CzpnMzGD.js → line-chart.stories-DNpxHMyZ.js} +1 -1
  11. package/dist/assets/line-chart.test-case.stories-iWaQFA2t.js +430 -0
  12. package/dist/assets/{pie-chart.stories-DkA8tvR7.js → pie-chart.stories-DQH7bOja.js} +1 -1
  13. package/dist/assets/{preview-DMJYKZvZ.js → preview-CfXyMlir.js} +2 -2
  14. package/dist/assets/{preview-D5-NxrZG.js → preview-CsgyCU-7.js} +1 -1
  15. package/dist/assets/{scatter-chart.stories-H8K5l3_j.js → scatter-chart.stories-CM6nYYvv.js} +1 -1
  16. package/dist/iframe.html +1 -1
  17. package/dist/index.js.js +84 -44
  18. package/dist/index.js.js.map +1 -1
  19. package/dist/index.json +1 -1
  20. package/dist/line-chart/plugins/tooltip-null-guard.d.ts +2 -0
  21. package/dist/line-chart/utils/get-axes-data-from-metasets.d.ts +1 -1
  22. package/dist/project.json +1 -1
  23. package/dist/src/components/line-chart/plugins/tooltip-null-guard.d.ts +2 -0
  24. package/package.json +2 -2
  25. package/dist/assets/line-chart-BB4vwCIU.js +0 -1
  26. package/dist/assets/line-chart.test-case.stories-bDrTAoiw.js +0 -428
package/dist/index.js.js CHANGED
@@ -572,7 +572,7 @@ let Color$1 = class Color {
572
572
  }
573
573
  };
574
574
  /*!
575
- * Chart.js v4.4.8
575
+ * Chart.js v4.4.9
576
576
  * https://www.chartjs.org
577
577
  * (c) 2025 Chart.js Contributors
578
578
  * Released under the MIT License
@@ -2899,8 +2899,36 @@ function styleChanged$1(style, prevStyle) {
2899
2899
  };
2900
2900
  return JSON.stringify(style, replacer) !== JSON.stringify(prevStyle, replacer);
2901
2901
  }
2902
+ function getSizeForArea(scale, chartArea, field) {
2903
+ return scale.options.clip ? scale[field] : chartArea[field];
2904
+ }
2905
+ function getDatasetArea(meta, chartArea) {
2906
+ const { xScale, yScale } = meta;
2907
+ if (xScale && yScale) {
2908
+ return {
2909
+ left: getSizeForArea(xScale, chartArea, "left"),
2910
+ right: getSizeForArea(xScale, chartArea, "right"),
2911
+ top: getSizeForArea(yScale, chartArea, "top"),
2912
+ bottom: getSizeForArea(yScale, chartArea, "bottom")
2913
+ };
2914
+ }
2915
+ return chartArea;
2916
+ }
2917
+ function getDatasetClipArea(chart2, meta) {
2918
+ const clip = meta._clip;
2919
+ if (clip.disabled) {
2920
+ return false;
2921
+ }
2922
+ const area = getDatasetArea(meta, chart2.chartArea);
2923
+ return {
2924
+ left: clip.left === false ? 0 : area.left - (clip.left === true ? 0 : clip.left),
2925
+ right: clip.right === false ? chart2.width : area.right + (clip.right === true ? 0 : clip.right),
2926
+ top: clip.top === false ? 0 : area.top - (clip.top === true ? 0 : clip.top),
2927
+ bottom: clip.bottom === false ? chart2.height : area.bottom + (clip.bottom === true ? 0 : clip.bottom)
2928
+ };
2929
+ }
2902
2930
  /*!
2903
- * Chart.js v4.4.8
2931
+ * Chart.js v4.4.9
2904
2932
  * https://www.chartjs.org
2905
2933
  * (c) 2025 Chart.js Contributors
2906
2934
  * Released under the MIT License
@@ -8002,7 +8030,7 @@ function needContext$1(proxy, names2) {
8002
8030
  }
8003
8031
  return false;
8004
8032
  }
8005
- var version$3 = "4.4.8";
8033
+ var version$3 = "4.4.9";
8006
8034
  const KNOWN_POSITIONS$1 = [
8007
8035
  "top",
8008
8036
  "bottom",
@@ -8071,21 +8099,6 @@ function determineLastEvent$1(e2, lastEvent, inChartArea, isClick) {
8071
8099
  }
8072
8100
  return e2;
8073
8101
  }
8074
- function getSizeForArea(scale, chartArea, field) {
8075
- return scale.options.clip ? scale[field] : chartArea[field];
8076
- }
8077
- function getDatasetArea(meta, chartArea) {
8078
- const { xScale, yScale } = meta;
8079
- if (xScale && yScale) {
8080
- return {
8081
- left: getSizeForArea(xScale, chartArea, "left"),
8082
- right: getSizeForArea(xScale, chartArea, "right"),
8083
- top: getSizeForArea(yScale, chartArea, "top"),
8084
- bottom: getSizeForArea(yScale, chartArea, "bottom")
8085
- };
8086
- }
8087
- return chartArea;
8088
- }
8089
8102
  let Chart$2 = (_h = class {
8090
8103
  static register(...items) {
8091
8104
  registry$1.add(...items);
@@ -8578,27 +8591,20 @@ let Chart$2 = (_h = class {
8578
8591
  }
8579
8592
  _drawDataset(meta) {
8580
8593
  const ctx = this.ctx;
8581
- const clip = meta._clip;
8582
- const useClip = !clip.disabled;
8583
- const area = getDatasetArea(meta, this.chartArea);
8584
8594
  const args = {
8585
8595
  meta,
8586
8596
  index: meta.index,
8587
8597
  cancelable: true
8588
8598
  };
8599
+ const clip = getDatasetClipArea(this, meta);
8589
8600
  if (this.notifyPlugins("beforeDatasetDraw", args) === false) {
8590
8601
  return;
8591
8602
  }
8592
- if (useClip) {
8593
- clipArea$1(ctx, {
8594
- left: clip.left === false ? 0 : area.left - clip.left,
8595
- right: clip.right === false ? this.width : area.right + clip.right,
8596
- top: clip.top === false ? 0 : area.top - clip.top,
8597
- bottom: clip.bottom === false ? this.height : area.bottom + clip.bottom
8598
- });
8603
+ if (clip) {
8604
+ clipArea$1(ctx, clip);
8599
8605
  }
8600
8606
  meta.controller.draw();
8601
- if (useClip) {
8607
+ if (clip) {
8602
8608
  unclipArea$1(ctx);
8603
8609
  }
8604
8610
  args.cancelable = false;
@@ -10097,11 +10103,13 @@ function computeCircularBoundary(source) {
10097
10103
  }
10098
10104
  function _drawfill(ctx, source, area) {
10099
10105
  const target = _getTarget(source);
10100
- const { line, scale, axis } = source;
10106
+ const { chart: chart2, index: index2, line, scale, axis } = source;
10101
10107
  const lineOpts = line.options;
10102
10108
  const fillOption = lineOpts.fill;
10103
10109
  const color2 = lineOpts.backgroundColor;
10104
10110
  const { above = color2, below = color2 } = fillOption || {};
10111
+ const meta = chart2.getDatasetMeta(index2);
10112
+ const clip = getDatasetClipArea(chart2, meta);
10105
10113
  if (target && line.points.length) {
10106
10114
  clipArea$1(ctx, area);
10107
10115
  doFill(ctx, {
@@ -10111,13 +10119,14 @@ function _drawfill(ctx, source, area) {
10111
10119
  below,
10112
10120
  area,
10113
10121
  scale,
10114
- axis
10122
+ axis,
10123
+ clip
10115
10124
  });
10116
10125
  unclipArea$1(ctx);
10117
10126
  }
10118
10127
  }
10119
10128
  function doFill(ctx, cfg) {
10120
- const { line, target, above, below, area, scale } = cfg;
10129
+ const { line, target, above, below, area, scale, clip } = cfg;
10121
10130
  const property = line._loop ? "angle" : cfg.axis;
10122
10131
  ctx.save();
10123
10132
  if (property === "x" && below !== above) {
@@ -10127,7 +10136,8 @@ function doFill(ctx, cfg) {
10127
10136
  target,
10128
10137
  color: above,
10129
10138
  scale,
10130
- property
10139
+ property,
10140
+ clip
10131
10141
  });
10132
10142
  ctx.restore();
10133
10143
  ctx.save();
@@ -10138,7 +10148,8 @@ function doFill(ctx, cfg) {
10138
10148
  target,
10139
10149
  color: below,
10140
10150
  scale,
10141
- property
10151
+ property,
10152
+ clip
10142
10153
  });
10143
10154
  ctx.restore();
10144
10155
  }
@@ -10172,14 +10183,14 @@ function clipVertical(ctx, target, clipY) {
10172
10183
  ctx.clip();
10173
10184
  }
10174
10185
  function fill(ctx, cfg) {
10175
- const { line, target, property, color: color2, scale } = cfg;
10186
+ const { line, target, property, color: color2, scale, clip } = cfg;
10176
10187
  const segments = _segments(line, target, property);
10177
10188
  for (const { source: src, target: tgt, start, end } of segments) {
10178
10189
  const { style: { backgroundColor = color2 } = {} } = src;
10179
10190
  const notShape = target !== true;
10180
10191
  ctx.save();
10181
10192
  ctx.fillStyle = backgroundColor;
10182
- clipBounds(ctx, scale, notShape && _getBounds(property, start, end));
10193
+ clipBounds(ctx, scale, clip, notShape && _getBounds(property, start, end));
10183
10194
  ctx.beginPath();
10184
10195
  const lineLoop = !!line.pathSegment(ctx, src);
10185
10196
  let loop;
@@ -10203,12 +10214,30 @@ function fill(ctx, cfg) {
10203
10214
  ctx.restore();
10204
10215
  }
10205
10216
  }
10206
- function clipBounds(ctx, scale, bounds) {
10207
- const { top: top2, bottom: bottom2 } = scale.chart.chartArea;
10217
+ function clipBounds(ctx, scale, clip, bounds) {
10218
+ const chartArea = scale.chart.chartArea;
10208
10219
  const { property, start, end } = bounds || {};
10209
- if (property === "x") {
10220
+ if (property === "x" || property === "y") {
10221
+ let left2, top2, right2, bottom2;
10222
+ if (property === "x") {
10223
+ left2 = start;
10224
+ top2 = chartArea.top;
10225
+ right2 = end;
10226
+ bottom2 = chartArea.bottom;
10227
+ } else {
10228
+ left2 = chartArea.left;
10229
+ top2 = start;
10230
+ right2 = chartArea.right;
10231
+ bottom2 = end;
10232
+ }
10210
10233
  ctx.beginPath();
10211
- ctx.rect(start, top2, end - start, bottom2 - top2);
10234
+ if (clip) {
10235
+ left2 = Math.max(left2, clip.left);
10236
+ right2 = Math.min(right2, clip.right);
10237
+ top2 = Math.max(top2, clip.top);
10238
+ bottom2 = Math.min(bottom2, clip.bottom);
10239
+ }
10240
+ ctx.rect(left2, top2, right2 - left2, bottom2 - top2);
10212
10241
  ctx.clip();
10213
10242
  }
10214
10243
  }
@@ -24358,11 +24387,9 @@ const useChartFunctions = ({
24358
24387
  const onHover = useCallback(
24359
24388
  (hoveredPoint, setHoveredPoint, datasets) => {
24360
24389
  return (evt, hoveredItems) => {
24361
- var _a2, _b2;
24362
24390
  if (!(hoveredItems == null ? void 0 : hoveredItems.length) && onPointUnhover && hoveredPoint) {
24363
24391
  setHoveredPoint(null);
24364
24392
  onPointUnhover(evt);
24365
- (_a2 = chartRef == null ? void 0 : chartRef.current) == null ? void 0 : _a2.update();
24366
24393
  }
24367
24394
  if ((hoveredItems == null ? void 0 : hoveredItems.length) && onPointHover) {
24368
24395
  const { index: index2, datasetIndex } = hoveredItems[0];
@@ -24371,7 +24398,6 @@ const useChartFunctions = ({
24371
24398
  if (point && !isEqual(hoveredPoint, point)) {
24372
24399
  setHoveredPoint(point);
24373
24400
  onPointHover(evt, datasetIndex, index2, datasets);
24374
- (_b2 = chartRef == null ? void 0 : chartRef.current) == null ? void 0 : _b2.update();
24375
24401
  }
24376
24402
  }
24377
24403
  };
@@ -26781,6 +26807,19 @@ const annotationDraggerPlugin = {
26781
26807
  }
26782
26808
  }
26783
26809
  };
26810
+ const tooltipNullGuard = {
26811
+ id: "tooltipNullGuard",
26812
+ beforeUpdate(chart2) {
26813
+ var _a2;
26814
+ const tt2 = chart2 == null ? void 0 : chart2.tooltip;
26815
+ if (tt2 && ((_a2 = tt2 == null ? void 0 : tt2.getActiveElements()) == null ? void 0 : _a2.some(({ datasetIndex }) => {
26816
+ const meta = chart2 == null ? void 0 : chart2.getDatasetMeta(datasetIndex);
26817
+ return !meta || !(meta == null ? void 0 : meta.controller);
26818
+ }))) {
26819
+ tt2 == null ? void 0 : tt2.setActiveElements([], { x: 0, y: 0 });
26820
+ }
26821
+ }
26822
+ };
26784
26823
  var defaultTranslations = /* @__PURE__ */ ((defaultTranslations2) => {
26785
26824
  defaultTranslations2["label"] = "Label";
26786
26825
  defaultTranslations2["pointsLines"] = "Points & lines";
@@ -27264,7 +27303,8 @@ Chart$2.register(
27264
27303
  plugin,
27265
27304
  annotation,
27266
27305
  chartAreaTextPlugin,
27267
- annotationDraggerPlugin
27306
+ annotationDraggerPlugin,
27307
+ tooltipNullGuard
27268
27308
  );
27269
27309
  const LineChart = (props) => {
27270
27310
  var _a2, _b2;