@oliasoft-open-source/charts-library 5.9.0-beta-7 → 5.9.0-beta-9
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.d.ts +18 -24
- package/dist/index.js +148 -155
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -32,9 +32,7 @@ export declare const BarChart: (props: IBarChartProps) => JSX_2.Element;
|
|
|
32
32
|
|
|
33
33
|
export declare enum ChartDirection {
|
|
34
34
|
VERTICAL = "vertical",
|
|
35
|
-
HORIZONTAL = "horizontal"
|
|
36
|
-
Vertical = "vertical",
|
|
37
|
-
Horizontal = "horizontal"
|
|
35
|
+
HORIZONTAL = "horizontal"
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
export declare enum ChartHoverMode {
|
|
@@ -45,11 +43,7 @@ export declare enum ChartType {
|
|
|
45
43
|
LINE = "line",
|
|
46
44
|
BAR = "bar",
|
|
47
45
|
PIE = "pie",
|
|
48
|
-
SCATTER = "scatter"
|
|
49
|
-
Line = "line",
|
|
50
|
-
Bar = "bar",
|
|
51
|
-
Pie = "pie",
|
|
52
|
-
Scatter = "scatter"
|
|
46
|
+
SCATTER = "scatter"
|
|
53
47
|
}
|
|
54
48
|
|
|
55
49
|
export declare const COLORS: string[];
|
|
@@ -904,6 +898,22 @@ export declare type UnusedParameter = unknown | any;
|
|
|
904
898
|
export { }
|
|
905
899
|
|
|
906
900
|
|
|
901
|
+
declare module 'chart.js' {
|
|
902
|
+
interface PluginOptionsByType<TType extends ChartType> {
|
|
903
|
+
annotationDraggerPlugin?: AnnotationDraggerPluginOptions;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
declare module 'chart.js' {
|
|
909
|
+
interface PluginOptionsByType<TType extends ChartType> {
|
|
910
|
+
calloutConnectorPlugin?: {
|
|
911
|
+
enableCalloutAnnotation?: boolean;
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
|
|
907
917
|
/**
|
|
908
918
|
* Vertical Markers Plugin
|
|
909
919
|
*
|
|
@@ -955,19 +965,3 @@ declare module 'chart.js' {
|
|
|
955
965
|
} | TVerticalMarkersOptions;
|
|
956
966
|
}
|
|
957
967
|
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
declare module 'chart.js' {
|
|
961
|
-
interface PluginOptionsByType<TType extends ChartType> {
|
|
962
|
-
annotationDraggerPlugin?: AnnotationDraggerPluginOptions;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
declare module 'chart.js' {
|
|
968
|
-
interface PluginOptionsByType<TType extends ChartType> {
|
|
969
|
-
calloutConnectorPlugin?: {
|
|
970
|
-
enableCalloutAnnotation?: boolean;
|
|
971
|
-
};
|
|
972
|
-
}
|
|
973
|
-
}
|
package/dist/index.js
CHANGED
|
@@ -18627,6 +18627,140 @@ function drawElement(ctx, chartArea, state, item) {
|
|
|
18627
18627
|
invokeHook(state, el, "afterDraw");
|
|
18628
18628
|
} else el.draw(ctx, chartArea);
|
|
18629
18629
|
}
|
|
18630
|
+
var MouseEvents = /* @__PURE__ */ function(MouseEvents) {
|
|
18631
|
+
MouseEvents["MOUSEDOWN"] = "mousedown";
|
|
18632
|
+
MouseEvents["MOUSEMOVE"] = "mousemove";
|
|
18633
|
+
MouseEvents["MOUSEUP"] = "mouseup";
|
|
18634
|
+
return MouseEvents;
|
|
18635
|
+
}({});
|
|
18636
|
+
var AnnotationType$1 = /* @__PURE__ */ function(AnnotationType) {
|
|
18637
|
+
AnnotationType["POINT"] = "point";
|
|
18638
|
+
AnnotationType["BOX"] = "box";
|
|
18639
|
+
AnnotationType["LINE"] = "line";
|
|
18640
|
+
AnnotationType["ELLIPSE"] = "ellipse";
|
|
18641
|
+
AnnotationType["LABEL"] = "label";
|
|
18642
|
+
return AnnotationType;
|
|
18643
|
+
}({});
|
|
18644
|
+
var DragAxis = /* @__PURE__ */ function(DragAxis) {
|
|
18645
|
+
DragAxis["X"] = "x";
|
|
18646
|
+
DragAxis["Y"] = "y";
|
|
18647
|
+
DragAxis["Both"] = "both";
|
|
18648
|
+
return DragAxis;
|
|
18649
|
+
}({});
|
|
18650
|
+
//#endregion
|
|
18651
|
+
//#region src/components/common/plugins/gradient-background-plugin/enums.ts
|
|
18652
|
+
var GradientDirection = /* @__PURE__ */ function(GradientDirection) {
|
|
18653
|
+
GradientDirection[GradientDirection["TopToBottom"] = 0] = "TopToBottom";
|
|
18654
|
+
GradientDirection[GradientDirection["BottomToTop"] = 1] = "BottomToTop";
|
|
18655
|
+
GradientDirection[GradientDirection["LeftToRight"] = 2] = "LeftToRight";
|
|
18656
|
+
GradientDirection[GradientDirection["RightToLeft"] = 3] = "RightToLeft";
|
|
18657
|
+
GradientDirection[GradientDirection["TopLeftToBottomRight"] = 4] = "TopLeftToBottomRight";
|
|
18658
|
+
GradientDirection[GradientDirection["BottomRightToTopLeft"] = 5] = "BottomRightToTopLeft";
|
|
18659
|
+
GradientDirection[GradientDirection["BottomLeftToTopRight"] = 6] = "BottomLeftToTopRight";
|
|
18660
|
+
GradientDirection[GradientDirection["TopRightToBottomLeft"] = 7] = "TopRightToBottomLeft";
|
|
18661
|
+
return GradientDirection;
|
|
18662
|
+
}({});
|
|
18663
|
+
//#endregion
|
|
18664
|
+
//#region src/components/common/enums.ts
|
|
18665
|
+
var AxisType = /* @__PURE__ */ function(AxisType) {
|
|
18666
|
+
AxisType["X"] = "x";
|
|
18667
|
+
AxisType["Y"] = "y";
|
|
18668
|
+
return AxisType;
|
|
18669
|
+
}({});
|
|
18670
|
+
var Position = /* @__PURE__ */ function(Position) {
|
|
18671
|
+
Position["Bottom"] = "bottom";
|
|
18672
|
+
Position["Top"] = "top";
|
|
18673
|
+
Position["Left"] = "left";
|
|
18674
|
+
Position["Right"] = "right";
|
|
18675
|
+
Position["TopRight"] = "top-right";
|
|
18676
|
+
Position["TopLeft"] = "top-left";
|
|
18677
|
+
Position["BottomLeft"] = "bottom-left";
|
|
18678
|
+
Position["BottomRight"] = "bottom-right";
|
|
18679
|
+
return Position;
|
|
18680
|
+
}({});
|
|
18681
|
+
var ChartType = /* @__PURE__ */ function(ChartType) {
|
|
18682
|
+
ChartType["LINE"] = "line";
|
|
18683
|
+
ChartType["BAR"] = "bar";
|
|
18684
|
+
ChartType["PIE"] = "pie";
|
|
18685
|
+
ChartType["SCATTER"] = "scatter";
|
|
18686
|
+
return ChartType;
|
|
18687
|
+
}({});
|
|
18688
|
+
var CursorStyle = /* @__PURE__ */ function(CursorStyle) {
|
|
18689
|
+
CursorStyle["Pointer"] = "pointer";
|
|
18690
|
+
CursorStyle["Initial"] = "initial";
|
|
18691
|
+
CursorStyle["Grab"] = "grab";
|
|
18692
|
+
CursorStyle["Grabbing"] = "grabbing";
|
|
18693
|
+
CursorStyle["Crosshair"] = "crosshair";
|
|
18694
|
+
CursorStyle["Move"] = "move";
|
|
18695
|
+
return CursorStyle;
|
|
18696
|
+
}({});
|
|
18697
|
+
var ScaleType = /* @__PURE__ */ function(ScaleType) {
|
|
18698
|
+
ScaleType["Category"] = "category";
|
|
18699
|
+
ScaleType["Linear"] = "linear";
|
|
18700
|
+
ScaleType["Logarithmic"] = "logarithmic";
|
|
18701
|
+
return ScaleType;
|
|
18702
|
+
}({});
|
|
18703
|
+
var ChartDirection = /* @__PURE__ */ function(ChartDirection) {
|
|
18704
|
+
ChartDirection["VERTICAL"] = "vertical";
|
|
18705
|
+
ChartDirection["HORIZONTAL"] = "horizontal";
|
|
18706
|
+
return ChartDirection;
|
|
18707
|
+
}({});
|
|
18708
|
+
var TooltipLabel = /* @__PURE__ */ function(TooltipLabel) {
|
|
18709
|
+
TooltipLabel["Y"] = "yLabel";
|
|
18710
|
+
TooltipLabel["X"] = "xLabel";
|
|
18711
|
+
return TooltipLabel;
|
|
18712
|
+
}({});
|
|
18713
|
+
var AlignOptions = /* @__PURE__ */ function(AlignOptions) {
|
|
18714
|
+
AlignOptions["End"] = "end";
|
|
18715
|
+
AlignOptions["Start"] = "start";
|
|
18716
|
+
AlignOptions["Center"] = "center";
|
|
18717
|
+
AlignOptions["Right"] = "right";
|
|
18718
|
+
AlignOptions["Left"] = "left";
|
|
18719
|
+
return AlignOptions;
|
|
18720
|
+
}({});
|
|
18721
|
+
var PointType = /* @__PURE__ */ function(PointType) {
|
|
18722
|
+
PointType["Casing"] = "casing";
|
|
18723
|
+
return PointType;
|
|
18724
|
+
}({});
|
|
18725
|
+
var AnnotationType = /* @__PURE__ */ function(AnnotationType) {
|
|
18726
|
+
AnnotationType["Box"] = "box";
|
|
18727
|
+
AnnotationType["Ellipse"] = "ellipse";
|
|
18728
|
+
AnnotationType["Line"] = "line";
|
|
18729
|
+
AnnotationType["Text"] = "text";
|
|
18730
|
+
AnnotationType["Label"] = "label";
|
|
18731
|
+
return AnnotationType;
|
|
18732
|
+
}({});
|
|
18733
|
+
var PointStyle = /* @__PURE__ */ function(PointStyle) {
|
|
18734
|
+
PointStyle["Circle"] = "circle";
|
|
18735
|
+
PointStyle["Square"] = "rect";
|
|
18736
|
+
PointStyle["Diamond"] = "rectRot";
|
|
18737
|
+
PointStyle["Triangle"] = "triangle";
|
|
18738
|
+
return PointStyle;
|
|
18739
|
+
}({});
|
|
18740
|
+
var ChartHoverMode = /* @__PURE__ */ function(ChartHoverMode) {
|
|
18741
|
+
ChartHoverMode["Nearest"] = "nearest";
|
|
18742
|
+
return ChartHoverMode;
|
|
18743
|
+
}({});
|
|
18744
|
+
var PanZoomMode = /* @__PURE__ */ function(PanZoomMode) {
|
|
18745
|
+
PanZoomMode["X"] = "x";
|
|
18746
|
+
PanZoomMode["Y"] = "y";
|
|
18747
|
+
PanZoomMode["XY"] = "xy";
|
|
18748
|
+
PanZoomMode["Z"] = "z";
|
|
18749
|
+
return PanZoomMode;
|
|
18750
|
+
}({});
|
|
18751
|
+
var Key = /* @__PURE__ */ function(Key) {
|
|
18752
|
+
Key["Shift"] = "Shift";
|
|
18753
|
+
return Key;
|
|
18754
|
+
}({});
|
|
18755
|
+
var Events = /* @__PURE__ */ function(Events) {
|
|
18756
|
+
Events["Mousemove"] = "mousemove";
|
|
18757
|
+
Events["Mouseout"] = "mouseout";
|
|
18758
|
+
Events["Click"] = "click";
|
|
18759
|
+
Events["Touchstart"] = "touchstart";
|
|
18760
|
+
Events["Touchmove"] = "touchmove";
|
|
18761
|
+
Events["Dblclick"] = "dblclick";
|
|
18762
|
+
return Events;
|
|
18763
|
+
}({});
|
|
18630
18764
|
//#endregion
|
|
18631
18765
|
//#region src/components/line-chart/plugins/line-chart.minor-gridlines-plugin.ts
|
|
18632
18766
|
var MINOR_TICKS_PER_MAJOR = 10;
|
|
@@ -18639,7 +18773,7 @@ var getLargestMajorTickWidth = (majorTickPositions) => {
|
|
|
18639
18773
|
};
|
|
18640
18774
|
var isValidPosition = (minorTickPosition, majorTickPositions, scale) => {
|
|
18641
18775
|
const { axis, left, top, right, bottom } = scale ?? {};
|
|
18642
|
-
const isHorizontal = axis ===
|
|
18776
|
+
const isHorizontal = axis === AxisType.X;
|
|
18643
18777
|
const start = isHorizontal ? left : top;
|
|
18644
18778
|
const end = isHorizontal ? right : bottom;
|
|
18645
18779
|
const isAfterStart = minorTickPosition > start;
|
|
@@ -18665,7 +18799,7 @@ var drawMinorTicksForScale = (scale) => {
|
|
|
18665
18799
|
const config = chart?.config;
|
|
18666
18800
|
if (!config?.options?.scales?.[scale?.id]?.grid?.drawOnChartArea) return;
|
|
18667
18801
|
if (config?.options?.indexAxis === scale?.axis) return;
|
|
18668
|
-
const isHorizontal = scale?.axis ===
|
|
18802
|
+
const isHorizontal = scale?.axis === AxisType.X;
|
|
18669
18803
|
const majorTickPositions = scale?.ticks?.map((_, index) => scale?.getPixelForTick(index))?.sort((a, b) => a - b);
|
|
18670
18804
|
const minorTickPositions = getMinorTickPositions(majorTickPositions, scale);
|
|
18671
18805
|
ctx?.save?.();
|
|
@@ -18770,146 +18904,6 @@ var GRADIENT_COLORS = [
|
|
|
18770
18904
|
color: "rgba(255,182,193,0.8)"
|
|
18771
18905
|
}
|
|
18772
18906
|
];
|
|
18773
|
-
var MouseEvents = /* @__PURE__ */ function(MouseEvents) {
|
|
18774
|
-
MouseEvents["MOUSEDOWN"] = "mousedown";
|
|
18775
|
-
MouseEvents["MOUSEMOVE"] = "mousemove";
|
|
18776
|
-
MouseEvents["MOUSEUP"] = "mouseup";
|
|
18777
|
-
return MouseEvents;
|
|
18778
|
-
}({});
|
|
18779
|
-
var AnnotationType$1 = /* @__PURE__ */ function(AnnotationType) {
|
|
18780
|
-
AnnotationType["POINT"] = "point";
|
|
18781
|
-
AnnotationType["BOX"] = "box";
|
|
18782
|
-
AnnotationType["LINE"] = "line";
|
|
18783
|
-
AnnotationType["ELLIPSE"] = "ellipse";
|
|
18784
|
-
AnnotationType["LABEL"] = "label";
|
|
18785
|
-
return AnnotationType;
|
|
18786
|
-
}({});
|
|
18787
|
-
var DragAxis = /* @__PURE__ */ function(DragAxis) {
|
|
18788
|
-
DragAxis["X"] = "x";
|
|
18789
|
-
DragAxis["Y"] = "y";
|
|
18790
|
-
DragAxis["Both"] = "both";
|
|
18791
|
-
return DragAxis;
|
|
18792
|
-
}({});
|
|
18793
|
-
//#endregion
|
|
18794
|
-
//#region src/components/common/plugins/gradient-background-plugin/enums.ts
|
|
18795
|
-
var GradientDirection = /* @__PURE__ */ function(GradientDirection) {
|
|
18796
|
-
GradientDirection[GradientDirection["TopToBottom"] = 0] = "TopToBottom";
|
|
18797
|
-
GradientDirection[GradientDirection["BottomToTop"] = 1] = "BottomToTop";
|
|
18798
|
-
GradientDirection[GradientDirection["LeftToRight"] = 2] = "LeftToRight";
|
|
18799
|
-
GradientDirection[GradientDirection["RightToLeft"] = 3] = "RightToLeft";
|
|
18800
|
-
GradientDirection[GradientDirection["TopLeftToBottomRight"] = 4] = "TopLeftToBottomRight";
|
|
18801
|
-
GradientDirection[GradientDirection["BottomRightToTopLeft"] = 5] = "BottomRightToTopLeft";
|
|
18802
|
-
GradientDirection[GradientDirection["BottomLeftToTopRight"] = 6] = "BottomLeftToTopRight";
|
|
18803
|
-
GradientDirection[GradientDirection["TopRightToBottomLeft"] = 7] = "TopRightToBottomLeft";
|
|
18804
|
-
return GradientDirection;
|
|
18805
|
-
}({});
|
|
18806
|
-
//#endregion
|
|
18807
|
-
//#region src/components/common/enums.ts
|
|
18808
|
-
var AxisType = /* @__PURE__ */ function(AxisType) {
|
|
18809
|
-
AxisType["X"] = "x";
|
|
18810
|
-
AxisType["Y"] = "y";
|
|
18811
|
-
return AxisType;
|
|
18812
|
-
}({});
|
|
18813
|
-
var Position = /* @__PURE__ */ function(Position) {
|
|
18814
|
-
Position["Bottom"] = "bottom";
|
|
18815
|
-
Position["Top"] = "top";
|
|
18816
|
-
Position["Left"] = "left";
|
|
18817
|
-
Position["Right"] = "right";
|
|
18818
|
-
Position["TopRight"] = "top-right";
|
|
18819
|
-
Position["TopLeft"] = "top-left";
|
|
18820
|
-
Position["BottomLeft"] = "bottom-left";
|
|
18821
|
-
Position["BottomRight"] = "bottom-right";
|
|
18822
|
-
return Position;
|
|
18823
|
-
}({});
|
|
18824
|
-
var ChartType = /* @__PURE__ */ function(ChartType) {
|
|
18825
|
-
ChartType["LINE"] = "line";
|
|
18826
|
-
ChartType["BAR"] = "bar";
|
|
18827
|
-
ChartType["PIE"] = "pie";
|
|
18828
|
-
ChartType["SCATTER"] = "scatter";
|
|
18829
|
-
ChartType["Line"] = "line";
|
|
18830
|
-
ChartType["Bar"] = "bar";
|
|
18831
|
-
ChartType["Pie"] = "pie";
|
|
18832
|
-
ChartType["Scatter"] = "scatter";
|
|
18833
|
-
return ChartType;
|
|
18834
|
-
}({});
|
|
18835
|
-
var CursorStyle = /* @__PURE__ */ function(CursorStyle) {
|
|
18836
|
-
CursorStyle["Pointer"] = "pointer";
|
|
18837
|
-
CursorStyle["Initial"] = "initial";
|
|
18838
|
-
CursorStyle["Grab"] = "grab";
|
|
18839
|
-
CursorStyle["Grabbing"] = "grabbing";
|
|
18840
|
-
CursorStyle["Crosshair"] = "crosshair";
|
|
18841
|
-
CursorStyle["Move"] = "move";
|
|
18842
|
-
return CursorStyle;
|
|
18843
|
-
}({});
|
|
18844
|
-
var ScaleType = /* @__PURE__ */ function(ScaleType) {
|
|
18845
|
-
ScaleType["Category"] = "category";
|
|
18846
|
-
ScaleType["Linear"] = "linear";
|
|
18847
|
-
ScaleType["Logarithmic"] = "logarithmic";
|
|
18848
|
-
return ScaleType;
|
|
18849
|
-
}({});
|
|
18850
|
-
var ChartDirection = /* @__PURE__ */ function(ChartDirection) {
|
|
18851
|
-
ChartDirection["VERTICAL"] = "vertical";
|
|
18852
|
-
ChartDirection["HORIZONTAL"] = "horizontal";
|
|
18853
|
-
ChartDirection["Vertical"] = "vertical";
|
|
18854
|
-
ChartDirection["Horizontal"] = "horizontal";
|
|
18855
|
-
return ChartDirection;
|
|
18856
|
-
}({});
|
|
18857
|
-
var TooltipLabel = /* @__PURE__ */ function(TooltipLabel) {
|
|
18858
|
-
TooltipLabel["Y"] = "yLabel";
|
|
18859
|
-
TooltipLabel["X"] = "xLabel";
|
|
18860
|
-
return TooltipLabel;
|
|
18861
|
-
}({});
|
|
18862
|
-
var AlignOptions = /* @__PURE__ */ function(AlignOptions) {
|
|
18863
|
-
AlignOptions["End"] = "end";
|
|
18864
|
-
AlignOptions["Start"] = "start";
|
|
18865
|
-
AlignOptions["Center"] = "center";
|
|
18866
|
-
AlignOptions["Right"] = "right";
|
|
18867
|
-
AlignOptions["Left"] = "left";
|
|
18868
|
-
return AlignOptions;
|
|
18869
|
-
}({});
|
|
18870
|
-
var PointType = /* @__PURE__ */ function(PointType) {
|
|
18871
|
-
PointType["Casing"] = "casing";
|
|
18872
|
-
return PointType;
|
|
18873
|
-
}({});
|
|
18874
|
-
var AnnotationType = /* @__PURE__ */ function(AnnotationType) {
|
|
18875
|
-
AnnotationType["Box"] = "box";
|
|
18876
|
-
AnnotationType["Ellipse"] = "ellipse";
|
|
18877
|
-
AnnotationType["Line"] = "line";
|
|
18878
|
-
AnnotationType["Text"] = "text";
|
|
18879
|
-
AnnotationType["Label"] = "label";
|
|
18880
|
-
return AnnotationType;
|
|
18881
|
-
}({});
|
|
18882
|
-
var PointStyle = /* @__PURE__ */ function(PointStyle) {
|
|
18883
|
-
PointStyle["Circle"] = "circle";
|
|
18884
|
-
PointStyle["Square"] = "rect";
|
|
18885
|
-
PointStyle["Diamond"] = "rectRot";
|
|
18886
|
-
PointStyle["Triangle"] = "triangle";
|
|
18887
|
-
return PointStyle;
|
|
18888
|
-
}({});
|
|
18889
|
-
var ChartHoverMode = /* @__PURE__ */ function(ChartHoverMode) {
|
|
18890
|
-
ChartHoverMode["Nearest"] = "nearest";
|
|
18891
|
-
return ChartHoverMode;
|
|
18892
|
-
}({});
|
|
18893
|
-
var PanZoomMode = /* @__PURE__ */ function(PanZoomMode) {
|
|
18894
|
-
PanZoomMode["X"] = "x";
|
|
18895
|
-
PanZoomMode["Y"] = "y";
|
|
18896
|
-
PanZoomMode["XY"] = "xy";
|
|
18897
|
-
PanZoomMode["Z"] = "z";
|
|
18898
|
-
return PanZoomMode;
|
|
18899
|
-
}({});
|
|
18900
|
-
var Key = /* @__PURE__ */ function(Key) {
|
|
18901
|
-
Key["Shift"] = "Shift";
|
|
18902
|
-
return Key;
|
|
18903
|
-
}({});
|
|
18904
|
-
var Events = /* @__PURE__ */ function(Events) {
|
|
18905
|
-
Events["Mousemove"] = "mousemove";
|
|
18906
|
-
Events["Mouseout"] = "mouseout";
|
|
18907
|
-
Events["Click"] = "click";
|
|
18908
|
-
Events["Touchstart"] = "touchstart";
|
|
18909
|
-
Events["Touchmove"] = "touchmove";
|
|
18910
|
-
Events["Dblclick"] = "dblclick";
|
|
18911
|
-
return Events;
|
|
18912
|
-
}({});
|
|
18913
18907
|
//#endregion
|
|
18914
18908
|
//#region src/components/common/helpers/chart-border-plugin.ts
|
|
18915
18909
|
/**
|
|
@@ -21648,8 +21642,8 @@ var calculateMaxWidth = (initialMaxWidth, chartAreaWidth) => {
|
|
|
21648
21642
|
var getLegendDimensions = (chart) => {
|
|
21649
21643
|
const { legend } = chart ?? {};
|
|
21650
21644
|
return {
|
|
21651
|
-
legendWidth: legend && legend?.display && legend?.options?.position ===
|
|
21652
|
-
legendHeight: legend && legend.display && (legend?.options?.position ===
|
|
21645
|
+
legendWidth: legend && legend?.display && legend?.options?.position === Position.Left ? legend?.width + legend?.options?.labels?.padding * 2 : 0,
|
|
21646
|
+
legendHeight: legend && legend.display && (legend?.options?.position === Position.Top || legend?.options?.position === Position.Bottom) ? legend?.height + legend?.options?.labels?.padding * 2 : 0
|
|
21653
21647
|
};
|
|
21654
21648
|
};
|
|
21655
21649
|
/**
|
|
@@ -21863,14 +21857,14 @@ var updateAnnotationPositionWithinBounds = (axis, newPosition, activeAnnotation,
|
|
|
21863
21857
|
yScaleID
|
|
21864
21858
|
})) return;
|
|
21865
21859
|
if (activeAnnotation.type === AnnotationType$1.POINT || activeAnnotation.type === AnnotationType$1.LABEL) {
|
|
21866
|
-
if (axis ===
|
|
21867
|
-
else if (axis ===
|
|
21860
|
+
if (axis === DragAxis.X) activeAnnotation.xValue = newPosition;
|
|
21861
|
+
else if (axis === DragAxis.Y) activeAnnotation.yValue = newPosition;
|
|
21868
21862
|
} else if (activeAnnotation.type === AnnotationType$1.BOX && metrics) {
|
|
21869
|
-
if (axis ===
|
|
21863
|
+
if (axis === DragAxis.X && metrics.width) {
|
|
21870
21864
|
activeAnnotation.xMin = newPosition - metrics.width / 2;
|
|
21871
21865
|
activeAnnotation.xMax = newPosition + metrics.width / 2;
|
|
21872
21866
|
}
|
|
21873
|
-
if (axis ===
|
|
21867
|
+
if (axis === DragAxis.Y && metrics.height) {
|
|
21874
21868
|
activeAnnotation.yMin = newPosition - metrics.height / 2;
|
|
21875
21869
|
activeAnnotation.yMax = newPosition + metrics.height / 2;
|
|
21876
21870
|
}
|
|
@@ -21886,7 +21880,7 @@ var setAnnotationBorderWidth = (chart, annotationId, borderWidth) => {
|
|
|
21886
21880
|
var handleAnnotationMouseDown = (event, canvas, scales, annotations, setDraggingState, hoveredAnnotationId) => {
|
|
21887
21881
|
const annotation = hoveredAnnotationId ? annotations?.[hoveredAnnotationId] : null;
|
|
21888
21882
|
if (!annotation) return;
|
|
21889
|
-
const { xScaleID =
|
|
21883
|
+
const { xScaleID = AxisType.X, yScaleID = AxisType.Y } = annotation;
|
|
21890
21884
|
const { x, y } = getMousePositionInCoordinates(event, canvas, scales, xScaleID, yScaleID);
|
|
21891
21885
|
const metrics = calculateAnnotationMetricsInValues(annotation);
|
|
21892
21886
|
if (annotation && annotation.enableDrag && !isNil(metrics.centerY) && !isNil(metrics.centerX)) {
|
|
@@ -21904,7 +21898,7 @@ var handleAnnotationMouseMove = (event, canvas, scales, isDragging, activeAnnota
|
|
|
21904
21898
|
const annotationId = activeAnnotation?.id;
|
|
21905
21899
|
setAnnotationBorderWidth(chart, annotationId, BORDER_WIDTH.HOVERED);
|
|
21906
21900
|
const dragAxis = activeAnnotation?.dragAxis ?? DragAxis.Both;
|
|
21907
|
-
const { xScaleID =
|
|
21901
|
+
const { xScaleID = AxisType.X, yScaleID = AxisType.Y } = activeAnnotation;
|
|
21908
21902
|
const { x, y } = getMousePositionInCoordinates(event, canvas, scales, xScaleID, yScaleID);
|
|
21909
21903
|
const metrics = calculateAnnotationMetricsInValues(activeAnnotation);
|
|
21910
21904
|
let newCenterX = x - dragStartX;
|
|
@@ -21964,7 +21958,7 @@ var annotationLabel = (ctx, annotations, scales) => {
|
|
|
21964
21958
|
Object.values(annotations).forEach((annotation) => {
|
|
21965
21959
|
if (annotation.type === AnnotationType$1.POINT && !isNil(annotation?.label) && annotation?.label?.display) {
|
|
21966
21960
|
const { content, font, color, position, padding } = annotation?.label ?? {};
|
|
21967
|
-
const { xScaleID =
|
|
21961
|
+
const { xScaleID = AxisType.X, yScaleID = AxisType.Y } = annotation;
|
|
21968
21962
|
ctx?.save?.();
|
|
21969
21963
|
ctx.font = font;
|
|
21970
21964
|
ctx.fillStyle = color;
|
|
@@ -23171,7 +23165,7 @@ var PieChart = (props) => {
|
|
|
23171
23165
|
maintainAspectRatio: options.chartStyling.maintainAspectRatio,
|
|
23172
23166
|
animation: options.chartStyling.performanceMode ? false : { duration: ANIMATION_DURATION.FAST },
|
|
23173
23167
|
hover: {
|
|
23174
|
-
mode:
|
|
23168
|
+
mode: ChartHoverMode.Nearest,
|
|
23175
23169
|
intersect: true
|
|
23176
23170
|
},
|
|
23177
23171
|
onHover,
|
|
@@ -37042,7 +37036,7 @@ var useBarChartConfig = (_chartRef, chart) => {
|
|
|
37042
37036
|
backgroundColor: annotation?.color || COLORS[index],
|
|
37043
37037
|
borderColor: annotation?.color || COLORS[index],
|
|
37044
37038
|
data: [],
|
|
37045
|
-
type:
|
|
37039
|
+
type: ChartType.BAR
|
|
37046
37040
|
})) : [];
|
|
37047
37041
|
const barDatasetsCopy = [...datasets, ...annotationsDatasets];
|
|
37048
37042
|
return barDatasetsCopy?.map((barDataset, index) => {
|
|
@@ -37077,8 +37071,7 @@ var useBarChartConfig = (_chartRef, chart) => {
|
|
|
37077
37071
|
setPointHover(true);
|
|
37078
37072
|
if (interactions?.onHover) {
|
|
37079
37073
|
const { index, datasetIndex } = hoveredItems?.[0] ?? {};
|
|
37080
|
-
|
|
37081
|
-
interactions?.onHover(evt, datasetIndex, index, generatedDataset);
|
|
37074
|
+
interactions?.onHover(evt, datasetIndex, index, generatedDatasets);
|
|
37082
37075
|
}
|
|
37083
37076
|
}
|
|
37084
37077
|
}, [
|
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
|
+
"version": "5.9.0-beta-9",
|
|
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": {
|