@oliasoft-open-source/charts-library 5.0.7 → 5.1.0-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 (29) 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 +65 -23
  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/common/common.interface.d.ts +3 -0
  24. package/dist/src/components/common/helpers/get-chart-annotation.d.ts +1 -0
  25. package/dist/src/components/common/plugins/ellipsis-annotation-plugin/ellipsis-annotation-plugin.d.ts +5 -0
  26. package/dist/src/components/line-chart/utils/get-axes-data-from-metasets.d.ts +1 -1
  27. package/package.json +1 -1
  28. package/dist/assets/line-chart-BB4vwCIU.js +0 -1
  29. package/dist/assets/line-chart.test-case.stories-bDrTAoiw.js +0 -428
package/dist/index.js.js CHANGED
@@ -22774,6 +22774,48 @@ const isNilOrEmpty = (value) => {
22774
22774
  return false;
22775
22775
  };
22776
22776
  const isEmptyString = (value) => value === "";
22777
+ const ellipsisAnnotationPlugin = {
22778
+ id: "ellipsisAnnotationPlugin",
22779
+ afterDatasetsDraw(chart2) {
22780
+ const ctx = chart2.ctx;
22781
+ const xScale = chart2.scales.x;
22782
+ const yScale = chart2.scales.y;
22783
+ chart2.data.datasets.forEach((dataset) => {
22784
+ const customDataset = dataset;
22785
+ customDataset.data.forEach((item) => {
22786
+ const { ellipsePoints } = item;
22787
+ if (!ellipsePoints) return;
22788
+ const [p1, p2] = ellipsePoints.major;
22789
+ const [p3, p4] = ellipsePoints.minor;
22790
+ const centerX = (p1.x + p2.x + p3.x + p4.x) / 4;
22791
+ const centerY = (p1.y + p2.y + p3.y + p4.y) / 4;
22792
+ const dx = p2.x - p1.x;
22793
+ const dy = p2.y - p1.y;
22794
+ const angle = Math.atan2(
22795
+ yScale.getPixelForValue(centerY + dy / 2) - yScale.getPixelForValue(centerY - dy / 2),
22796
+ xScale.getPixelForValue(centerX + dx / 2) - xScale.getPixelForValue(centerX - dx / 2)
22797
+ );
22798
+ const radiusX = Math.hypot(
22799
+ xScale.getPixelForValue(p1.x) - xScale.getPixelForValue(p2.x),
22800
+ yScale.getPixelForValue(p1.y) - yScale.getPixelForValue(p2.y)
22801
+ ) / 2;
22802
+ const radiusY = Math.hypot(
22803
+ xScale.getPixelForValue(p3.x) - xScale.getPixelForValue(p4.x),
22804
+ yScale.getPixelForValue(p3.y) - yScale.getPixelForValue(p4.y)
22805
+ ) / 2;
22806
+ const cx2 = xScale.getPixelForValue(centerX);
22807
+ const cy = yScale.getPixelForValue(centerY);
22808
+ ctx.save();
22809
+ ctx.beginPath();
22810
+ ctx.ellipse(cx2, cy, radiusX, radiusY, angle, 0, 2 * Math.PI);
22811
+ ctx.strokeStyle = customDataset.borderColor || DEFAULT_COLOR;
22812
+ ctx.lineWidth = customDataset.borderWidth || 1;
22813
+ ctx.stroke();
22814
+ ctx.restore();
22815
+ });
22816
+ });
22817
+ }
22818
+ };
22777
22819
  const chart$3 = "_chart_e3qdd_1";
22778
22820
  const canvas$2 = "_canvas_e3qdd_11";
22779
22821
  const fixedHeight$3 = "_fixedHeight_e3qdd_20";
@@ -25313,8 +25355,8 @@ const estimateDataSeriesHaveCloseValues = (generatedDatasets) => {
25313
25355
  }
25314
25356
  const axesFirstLast = generatedDatasets == null ? void 0 : generatedDatasets.reduce((acc, dataset) => {
25315
25357
  var _a3, _b2, _c2, _d2;
25316
- const xAxisId = (dataset == null ? void 0 : dataset.xAxisID) ?? "x";
25317
- const yAxisId = (dataset == null ? void 0 : dataset.yAxisID) ?? "y";
25358
+ const xAxisId = (dataset == null ? void 0 : dataset.xAxisID) ?? "defaultX";
25359
+ const yAxisId = (dataset == null ? void 0 : dataset.yAxisID) ?? "defaultY";
25318
25360
  const data = (dataset == null ? void 0 : dataset.data) ?? [];
25319
25361
  if (data && (data == null ? void 0 : data.length)) {
25320
25362
  const { x: xFirstCurrent, y: yFirstCurrent } = (data == null ? void 0 : data[0]) ?? {};
@@ -25393,24 +25435,18 @@ const getSuggestedAxisRange = ({
25393
25435
  max: round$2(maxAxisValue, DECIMAL_POINT_TOLERANCE)
25394
25436
  };
25395
25437
  };
25396
- const getAxesDataFromMetasets = (generatedDatasets, scalesKeys, annotationsData) => {
25397
- if (!Array.isArray(generatedDatasets) || !Array.isArray(scalesKeys)) {
25398
- return {};
25399
- }
25400
- const annotations = getAnnotationsData(annotationsData);
25401
- return scalesKeys.reduce((acc, axisKey) => {
25402
- const axisType = getAxisTypeFromKey(axisKey);
25403
- const datasetValues = generatedDatasets.filter((dataset) => {
25404
- const axisId = dataset[`${axisType}AxisID`] ?? axisType;
25405
- return axisId === axisKey;
25406
- }).flatMap((dataset) => {
25407
- const data = (dataset == null ? void 0 : dataset.data) ?? [];
25408
- return data.map((point) => point[axisType]);
25409
- });
25410
- const annotationValues = (annotations == null ? void 0 : annotations[axisKey]) ?? [];
25411
- acc[axisKey] = [.../* @__PURE__ */ new Set([...datasetValues, ...annotationValues])];
25412
- return acc;
25413
- }, {});
25438
+ const getAxesDataFromMetasets = (chartRef, scalesKeys, annotationsData) => {
25439
+ var _a2;
25440
+ if (!chartRef || !scalesKeys) return {};
25441
+ const metasets = ((_a2 = chartRef == null ? void 0 : chartRef.current) == null ? void 0 : _a2.getSortedVisibleDatasetMetas()) ?? [];
25442
+ const annotData = getAnnotationsData(annotationsData);
25443
+ return metasets && (scalesKeys == null ? void 0 : scalesKeys.reduce((acc, key) => {
25444
+ const data = metasets.filter((dataset) => Object.values(dataset).includes(key)).flatMap((dataset) => dataset._parsed).map((parsedData) => parsedData[getAxisTypeFromKey(key)]).concat((annotData == null ? void 0 : annotData[key]) ?? []);
25445
+ return {
25446
+ ...acc,
25447
+ [key]: [...new Set(data)]
25448
+ };
25449
+ }, {}));
25414
25450
  };
25415
25451
  const shouldCalculate = (min, max) => !isNil(min) || !isNil(max);
25416
25452
  const autoScale = (options, state, generatedDatasets, chartRef) => {
@@ -25425,7 +25461,7 @@ const autoScale = (options, state, generatedDatasets, chartRef) => {
25425
25461
  }
25426
25462
  const scalesKeys = Object.keys(scales) ?? [];
25427
25463
  const data = getAxesDataFromMetasets(
25428
- generatedDatasets,
25464
+ chartRef,
25429
25465
  scalesKeys,
25430
25466
  annotationsData
25431
25467
  );
@@ -25754,7 +25790,12 @@ const generateAnnotations = (annotationsData) => {
25754
25790
  [AnnotationType.BOX]: color2,
25755
25791
  [AnnotationType.ELLIPSE]: TRANSPARENT
25756
25792
  }[type] || TRANSPARENT;
25757
- const borderWidth = type === AnnotationType.LINE ? BORDER_WIDTH.INITIAL : 0;
25793
+ const borderWidth = {
25794
+ [AnnotationType.LINE]: BORDER_WIDTH.INITIAL,
25795
+ [AnnotationType.BOX]: BORDER_WIDTH.ZERO,
25796
+ [AnnotationType.POINT]: BORDER_WIDTH.ZERO,
25797
+ [AnnotationType.ELLIPSE]: (ann == null ? void 0 : ann.borderWidth) ?? 0
25798
+ }[type] ?? 0;
25758
25799
  const borderDash = type === AnnotationType.LINE ? ANNOTATION_DASH : void 0;
25759
25800
  const defLabel = {
25760
25801
  content: ann == null ? void 0 : ann.label,
@@ -27264,7 +27305,8 @@ Chart$2.register(
27264
27305
  plugin,
27265
27306
  annotation,
27266
27307
  chartAreaTextPlugin,
27267
- annotationDraggerPlugin
27308
+ annotationDraggerPlugin,
27309
+ ellipsisAnnotationPlugin
27268
27310
  );
27269
27311
  const LineChart = (props) => {
27270
27312
  var _a2, _b2;