@oliasoft-open-source/charts-library 4.7.0-beta-7 → 4.7.0-beta-8
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 +45 -19
- package/dist/index.js.map +1 -1
- package/dist/src/components/bar-chart/bar-chart.stories.d.ts +89 -89
- package/dist/src/components/common/common.interface.d.ts +1 -0
- package/dist/src/components/common/helpers/chart-utils.d.ts +1 -1
- package/dist/src/components/common/helpers/get-chart-annotation.d.ts +1 -0
- package/dist/src/components/line-chart/line-chart.interface.d.ts +1 -0
- package/dist/src/components/line-chart/line-chart.stories.d.ts +118 -104
- package/dist/src/components/line-chart/line-chart.test-case.stories.d.ts +4 -4
- package/dist/src/components/pie-chart/pie-chart.stories.d.ts +24 -24
- package/dist/src/components/scatter-chart/scatter-chart.stories.d.ts +26 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22936,10 +22936,15 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22936
22936
|
const {
|
|
22937
22937
|
additionalAxesOptions: { range: customAxesRange = {} },
|
|
22938
22938
|
axes,
|
|
22939
|
-
chartOptions: {
|
|
22939
|
+
chartOptions: {
|
|
22940
|
+
enableZoom,
|
|
22941
|
+
enablePan,
|
|
22942
|
+
showPoints,
|
|
22943
|
+
showLine,
|
|
22944
|
+
enableDragAnnotation
|
|
22945
|
+
},
|
|
22940
22946
|
legend: { display },
|
|
22941
|
-
dragData
|
|
22942
|
-
annotations: { enableDragAnnotation }
|
|
22947
|
+
dragData
|
|
22943
22948
|
} = options;
|
|
22944
22949
|
const getStateAxesByType = (axisType, customAxesRange2) => {
|
|
22945
22950
|
var _a2, _b2, _c2, _d2, _e2;
|
|
@@ -22990,7 +22995,7 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22990
22995
|
enableDragAnnotation: enableDragAnnotationStorage
|
|
22991
22996
|
} = getChartStateFromStorage(persistenceId) || {};
|
|
22992
22997
|
return {
|
|
22993
|
-
zoomEnabled: zoomEnabled ?? enableZoom,
|
|
22998
|
+
zoomEnabled: enableDragAnnotation ?? enableDragAnnotationStorage ? false : zoomEnabled ?? enableZoom,
|
|
22994
22999
|
panEnabled: panEnabled ?? enablePan,
|
|
22995
23000
|
pointsEnabled: pointsEnabled ?? showPoints,
|
|
22996
23001
|
lineEnabled: lineEnabled ?? showLine,
|
|
@@ -22998,7 +23003,7 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22998
23003
|
axes: stateAxes,
|
|
22999
23004
|
showTable: false,
|
|
23000
23005
|
enableDragPoints: (dragData == null ? void 0 : dragData.enableDragData) && enableDragPoints,
|
|
23001
|
-
enableDragAnnotation: enableDragAnnotation
|
|
23006
|
+
enableDragAnnotation: enableDragAnnotation ?? enableDragAnnotationStorage,
|
|
23002
23007
|
initialAxesRanges: []
|
|
23003
23008
|
};
|
|
23004
23009
|
};
|
|
@@ -24981,9 +24986,10 @@ const defaultLegend$3 = (legend2) => ({
|
|
|
24981
24986
|
});
|
|
24982
24987
|
const defaultChartOptions$3 = (options) => ({
|
|
24983
24988
|
showPoints: (options == null ? void 0 : options.showPoints) ?? true,
|
|
24989
|
+
showLine: (options == null ? void 0 : options.showLine) ?? true,
|
|
24984
24990
|
enableZoom: (options == null ? void 0 : options.enableZoom) ?? true,
|
|
24985
24991
|
enablePan: (options == null ? void 0 : options.enablePan) ?? false,
|
|
24986
|
-
|
|
24992
|
+
enableDragAnnotation: (options == null ? void 0 : options.enableDragAnnotation) ?? false,
|
|
24987
24993
|
closeOnOutsideClick: (options == null ? void 0 : options.closeOnOutsideClick) ?? false
|
|
24988
24994
|
});
|
|
24989
24995
|
const defaultInteractions$3 = (interactions) => ({
|
|
@@ -25800,7 +25806,8 @@ const generateAnnotations = (annotationsData) => {
|
|
|
25800
25806
|
onDrag,
|
|
25801
25807
|
onDragEnd,
|
|
25802
25808
|
pointStyle: (ann == null ? void 0 : ann.pointStyle) ?? PointStyle.Circle,
|
|
25803
|
-
resizable: (ann == null ? void 0 : ann.resizable) ??
|
|
25809
|
+
resizable: (ann == null ? void 0 : ann.resizable) ?? true,
|
|
25810
|
+
displayDragCoordinates: (ann == null ? void 0 : ann.displayDragCoordinates) ?? true
|
|
25804
25811
|
};
|
|
25805
25812
|
});
|
|
25806
25813
|
};
|
|
@@ -26539,18 +26546,20 @@ const handleAnnotationMouseMove = (event, canvas2, scales, isDragging2, activeAn
|
|
|
26539
26546
|
chart2.draw();
|
|
26540
26547
|
ctx.font = DEFAULT_FONT_FAMILY;
|
|
26541
26548
|
ctx.fillStyle = "black";
|
|
26542
|
-
|
|
26543
|
-
|
|
26544
|
-
|
|
26545
|
-
|
|
26546
|
-
|
|
26547
|
-
labelY
|
|
26548
|
-
|
|
26549
|
-
|
|
26550
|
-
labelY
|
|
26549
|
+
if (activeAnnotation == null ? void 0 : activeAnnotation.displayDragCoordinates) {
|
|
26550
|
+
let labelX = xValue - 45;
|
|
26551
|
+
let labelY = yValue - 20;
|
|
26552
|
+
const labelText = `X: ${round$2(centerX, 2)}, Y: ${round$2(centerY, 2)}`;
|
|
26553
|
+
const labelHeight = 14;
|
|
26554
|
+
if (labelY - labelHeight < 0) {
|
|
26555
|
+
labelY = yValue + labelHeight + 15;
|
|
26556
|
+
}
|
|
26557
|
+
if (labelY > height) {
|
|
26558
|
+
labelY = height - 7;
|
|
26559
|
+
}
|
|
26560
|
+
ctx.fillText(labelText, labelX, labelY);
|
|
26561
|
+
ctx.restore();
|
|
26551
26562
|
}
|
|
26552
|
-
ctx.fillText(labelText, labelX, labelY);
|
|
26553
|
-
ctx.restore();
|
|
26554
26563
|
}
|
|
26555
26564
|
}
|
|
26556
26565
|
};
|
|
@@ -26633,7 +26642,7 @@ const annotationDraggerPlugin = {
|
|
|
26633
26642
|
}
|
|
26634
26643
|
},
|
|
26635
26644
|
afterUpdate(chart2) {
|
|
26636
|
-
var _a2, _b2, _c2, _d2;
|
|
26645
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
26637
26646
|
const { canvas: canvas2, scales, hoveredAnnotationId } = chart2;
|
|
26638
26647
|
const pluginOptions = ((_b2 = (_a2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a2.plugins) == null ? void 0 : _b2.annotationDraggerPlugin) || {
|
|
26639
26648
|
enabled: false
|
|
@@ -26641,6 +26650,23 @@ const annotationDraggerPlugin = {
|
|
|
26641
26650
|
const typedScales = { x: scales.x, y: scales.y };
|
|
26642
26651
|
let annotations = ((_d2 = (_c2 = chart2.options.plugins) == null ? void 0 : _c2.annotation) == null ? void 0 : _d2.annotations) ?? {};
|
|
26643
26652
|
if (!chart2 && !annotations) return;
|
|
26653
|
+
if (pluginOptions.enabled) {
|
|
26654
|
+
if ((_f2 = (_e2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _e2.plugins) == null ? void 0 : _f2.tooltip) {
|
|
26655
|
+
chart2.options.plugins.tooltip.enabled = false;
|
|
26656
|
+
}
|
|
26657
|
+
chart2.options.hover = {
|
|
26658
|
+
mode: void 0,
|
|
26659
|
+
intersect: false
|
|
26660
|
+
};
|
|
26661
|
+
} else {
|
|
26662
|
+
if ((_h2 = (_g2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _g2.plugins) == null ? void 0 : _h2.tooltip) {
|
|
26663
|
+
chart2.options.plugins.tooltip.enabled = true;
|
|
26664
|
+
}
|
|
26665
|
+
chart2.options.hover = {
|
|
26666
|
+
mode: ChartHoverMode.Nearest,
|
|
26667
|
+
intersect: true
|
|
26668
|
+
};
|
|
26669
|
+
}
|
|
26644
26670
|
let isDragging2 = false;
|
|
26645
26671
|
let dragStartX, dragStartY;
|
|
26646
26672
|
let activeAnnotation = null;
|