@oliasoft-open-source/charts-library 5.2.0 → 5.2.1-beta-2
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/assets/Color-YHDXOIA2-BH-AgNhy.js +1 -0
- package/dist/assets/DocsRenderer-CFRXHY34-Dx3M1XwG.js +1 -0
- package/dist/assets/bar-chart-const-DT-Qreyz.js +1 -0
- package/dist/assets/bar-chart.stories-BGngamFz.js +145 -0
- package/dist/assets/chunk-2PTXLE6R-BSsKYLj_.js +1 -0
- package/dist/assets/chunk-H6MOWX77-Ds8Hqw1O.js +1 -0
- package/dist/assets/chunk-NUUEMKO5-2vSX1C-f.js +56 -0
- package/dist/assets/chunk-PRSJUHPQ-ClaE-lMK.js +2 -0
- package/dist/assets/chunk-XP5HYGXS-DyEAuB1b.js +1 -0
- package/dist/assets/client-mhWrpqNE.js +1 -0
- package/dist/assets/components-BTILpkCb.js +1 -0
- package/dist/assets/components-BUMWgrws.js +534 -0
- package/dist/assets/docs-tools-C8juKH9v.js +8 -0
- package/dist/assets/entry-preview-D8bkngdo.js +2 -0
- package/dist/assets/entry-preview-docs-DkpGzTK0.js +48 -0
- package/dist/assets/fast-deep-equal-GJSfJzsC.js +1 -0
- package/dist/assets/get-custom-legend-plugin-example-DlEN0LEe.js +1 -0
- package/dist/assets/get-draggableData-DyVot8Zl.js +2 -0
- package/dist/assets/iframe-BC9QdfhZ.js +226 -0
- package/dist/assets/jsx-runtime-BNVfsWEC.js +1 -0
- package/dist/assets/legend-Be3VjYcC.js +1266 -0
- package/dist/assets/legend-context-Bh42wyEh.js +47 -0
- package/dist/assets/line-chart-B0hmsdC3.js +1 -0
- package/dist/assets/line-chart.stories-tGGdFPhQ.js +1162 -0
- package/dist/assets/line-chart.test-case.stories-Cv2J7QkQ.js +430 -0
- package/dist/assets/pie-chart.stories-Cmh7O_JI.js +45 -0
- package/dist/assets/preview-Ba4CwQIJ.js +1 -0
- package/dist/assets/preview-Dihi2lh7.js +3 -0
- package/dist/assets/preview-xQjOlnQG.js +1 -0
- package/dist/assets/react-18-D9p-ZSzh.js +1 -0
- package/dist/assets/react-B_00WdD4.js +1 -0
- package/dist/assets/react-CJCPsloc.js +1 -0
- package/dist/assets/react-dom-BggwCd6n.js +8 -0
- package/dist/assets/react-lj49T_jL.js +1 -0
- package/dist/assets/scatter-chart.stories-Ch-mWz43.js +41 -0
- package/dist/assets/test-utils-D1bSFP61.js +1 -0
- package/dist/bar-chart/bar-chart-const.d.ts +2 -0
- package/dist/bar-chart/bar-chart-default-props.d.ts +2 -0
- package/dist/bar-chart/bar-chart.d.ts +3 -0
- package/dist/bar-chart/bar-chart.interface.d.ts +96 -0
- package/dist/bar-chart/utils/get-bar-chart-data-labels.d.ts +10 -0
- package/dist/bar-chart/utils/get-bar-chart-scales.d.ts +3 -0
- package/dist/bar-chart/utils/get-bar-chart-tooltips.d.ts +6 -0
- package/dist/bar-chart/utils/use-bar-chart-config.d.ts +13 -0
- package/dist/bar-chart/utils/use-bar-chart-options.d.ts +55 -0
- package/dist/common/common.interface.d.ts +210 -0
- package/dist/common/controls-portal.d.ts +7 -0
- package/dist/common/enums.d.ts +10 -0
- package/dist/common/helpers/chart-border-plugin.d.ts +16 -0
- package/dist/common/helpers/chart-consts.d.ts +39 -0
- package/dist/common/helpers/chart-utils.d.ts +86 -0
- package/dist/common/helpers/container.d.ts +18 -0
- package/dist/common/helpers/custom-format-number.d.ts +1 -0
- package/dist/common/helpers/download-pgn.d.ts +3 -0
- package/dist/common/helpers/enums.d.ts +80 -0
- package/dist/common/helpers/get-chart-annotation.d.ts +91 -0
- package/dist/common/helpers/get-custom-legend-plugin-example.d.ts +8 -0
- package/dist/common/helpers/get-draggableData.d.ts +18 -0
- package/dist/common/helpers/range/estimate-data-series-have-close-values.d.ts +8 -0
- package/dist/common/helpers/range/range.d.ts +33 -0
- package/dist/common/helpers/text.d.ts +1 -0
- package/dist/common/helpers/to-annotation.d.ts +4 -0
- package/dist/common/hooks/use-generated-labels.d.ts +4 -0
- package/dist/common/hooks/use-legend-state.d.ts +28 -0
- package/dist/common/hooks/use-legend.d.ts +4 -0
- package/dist/common/hooks/use-reset.d.ts +3 -0
- package/dist/common/hooks/use-update-annotations.d.ts +7 -0
- package/dist/common/legend-component/legend-dropzone.d.ts +3 -0
- package/dist/common/legend-component/legend-interface.d.ts +48 -0
- package/dist/common/legend-component/legend-item/LegendItemLine.d.ts +5 -0
- package/dist/common/legend-component/legend-item/legend-item.d.ts +3 -0
- package/dist/common/legend-component/legend-panel.d.ts +3 -0
- package/dist/common/legend-component/legend.d.ts +3 -0
- package/dist/common/legend-component/state/legend-action-types.d.ts +3 -0
- package/dist/common/legend-component/state/legend-context.d.ts +14 -0
- package/dist/common/legend-component/state/legend-state-reducer.d.ts +30 -0
- package/dist/common/legend-component/utils/create-style-object.d.ts +27 -0
- package/dist/common/legend-component/utils/get-generated-labels.d.ts +2 -0
- package/dist/common/plugins/annotation-dragger-plugin/annotation-dragger-plugin.d.ts +15 -0
- package/dist/common/plugins/annotation-dragger-plugin/enums.d.ts +20 -0
- package/dist/common/plugins/annotation-dragger-plugin/event-helpers.d.ts +6 -0
- package/dist/common/plugins/annotation-dragger-plugin/helpers.d.ts +53 -0
- package/dist/common/plugins/annotation-dragger-plugin/point-annotation-label.d.ts +5 -0
- package/dist/common/plugins/ellipsis-annotation-plugin/compute-ellipse-geometry.d.ts +9 -0
- package/dist/common/plugins/ellipsis-annotation-plugin/ellipsis-annotation-plugin.d.ts +18 -0
- package/dist/common/plugins/gradient-background-plugin/enums.d.ts +10 -0
- package/dist/common/plugins/gradient-background-plugin/gradient-background-plugin.d.ts +2 -0
- package/dist/favicon.svg +1 -0
- package/dist/iframe.html +666 -0
- package/dist/index.html +149 -0
- package/dist/index.js +4298 -38749
- package/dist/index.json +1 -0
- package/dist/line-chart/constants/default-translations.d.ts +25 -0
- package/dist/line-chart/constants/line-chart-consts.d.ts +13 -0
- package/dist/line-chart/controls/axes-options/axes-options-interfaces.d.ts +57 -0
- package/dist/line-chart/controls/axes-options/axes-options.d.ts +6 -0
- package/dist/line-chart/controls/axes-options/axes-validation.d.ts +8 -0
- package/dist/line-chart/controls/controls-interfaces.d.ts +20 -0
- package/dist/line-chart/controls/controls.d.ts +3 -0
- package/dist/line-chart/controls/drag-options-interfaces.d.ts +14 -0
- package/dist/line-chart/controls/drag-options.d.ts +23 -0
- package/dist/line-chart/controls/line-options.d.ts +19 -0
- package/dist/line-chart/hooks/use-chart-functions.d.ts +33 -0
- package/dist/line-chart/hooks/use-chart-options.d.ts +16 -0
- package/dist/line-chart/hooks/use-chart-plugins.d.ts +7 -0
- package/dist/line-chart/hooks/use-chart-state.d.ts +12 -0
- package/dist/line-chart/hooks/use-toggle-handler.d.ts +12 -0
- package/dist/line-chart/initialize/config.d.ts +12 -0
- package/dist/line-chart/initialize/initialize-line-chart.d.ts +12 -0
- package/dist/line-chart/line-chart-get-default-props.d.ts +2 -0
- package/dist/line-chart/line-chart.d.ts +3 -0
- package/dist/line-chart/line-chart.interface.d.ts +150 -0
- package/dist/line-chart/plugins/chart-area-text-plugin.d.ts +17 -0
- package/dist/line-chart/plugins/line-chart.minor-gridlines-plugin.d.ts +8 -0
- package/dist/line-chart/plugins/plugin-constants.d.ts +11 -0
- package/dist/line-chart/plugins/plugins.interface.d.ts +9 -0
- package/dist/line-chart/state/action-types.d.ts +12 -0
- package/dist/line-chart/state/helpers.d.ts +13 -0
- package/dist/line-chart/state/initial-state.d.ts +11 -0
- package/dist/line-chart/state/line-chart-reducer.d.ts +2 -0
- package/dist/line-chart/state/manage-state-in-local-storage.d.ts +15 -0
- package/dist/line-chart/state/state.interfaces.d.ts +26 -0
- package/dist/line-chart/utils/axis-formatting/axis-formatting.d.ts +2 -0
- package/dist/line-chart/utils/axis-scales/axis-scales.d.ts +9 -0
- package/dist/line-chart/utils/check-custom-option/check-custom-option.d.ts +12 -0
- package/dist/line-chart/utils/datalabels-alignment/datalabels-alignment.interface.d.ts +20 -0
- package/dist/line-chart/utils/datalabels-alignment/get-alignment-condition.d.ts +8 -0
- package/dist/line-chart/utils/datalabels-alignment/get-alignment-data.d.ts +11 -0
- package/dist/line-chart/utils/datalabels-alignment/get-datalabels-position.d.ts +6 -0
- package/dist/line-chart/utils/enums.d.ts +4 -0
- package/dist/line-chart/utils/generate-line-chart-datasets.d.ts +8 -0
- package/dist/line-chart/utils/get-annotations-data.d.ts +1 -0
- package/dist/line-chart/utils/get-axes-data-from-metasets.d.ts +1 -0
- package/dist/line-chart/utils/get-axes-ranges-from-chart.d.ts +9 -0
- package/dist/line-chart/utils/get-axis-range-by-type.d.ts +10 -0
- package/dist/line-chart/utils/get-generated-labels.d.ts +2 -0
- package/dist/line-chart/utils/get-line-chart-data-labels.d.ts +16 -0
- package/dist/line-chart/utils/get-line-chart-scales.d.ts +4 -0
- package/dist/line-chart/utils/get-line-chart-tooltips.d.ts +34 -0
- package/dist/line-chart/utils/line-chart-utils.d.ts +24 -0
- package/dist/line-chart/utils/translations/get-translations.d.ts +8 -0
- package/dist/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/nunito-sans-bold.woff2 +0 -0
- package/dist/nunito-sans-italic.woff2 +0 -0
- package/dist/nunito-sans-regular.woff2 +0 -0
- package/dist/pie-chart/pie-chart-defalut-props.interface.d.ts +50 -0
- package/dist/pie-chart/pie-chart-get-default-props.d.ts +3 -0
- package/dist/pie-chart/pie-chart.d.ts +3 -0
- package/dist/pie-chart/pie-chart.interface.d.ts +70 -0
- package/dist/pie-chart/use-pie-chart-config.d.ts +42 -0
- package/dist/project.json +1 -0
- package/dist/sb-addons/actions-1/manager-bundle.js +3 -0
- package/dist/sb-addons/docs-2/manager-bundle.js +242 -0
- package/dist/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +3 -0
- package/dist/sb-addons/storybook-dark-mode-esm-preset-3/manager-bundle.js +5 -0
- package/dist/sb-common-assets/favicon.svg +1 -0
- package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/sb-manager/globals-module-info.js +1051 -0
- package/dist/sb-manager/globals-runtime.js +41591 -0
- package/dist/sb-manager/globals.js +48 -0
- package/dist/sb-manager/runtime.js +12048 -0
- package/dist/scatter-chart/hooks/use-scatter-chart-config.d.ts +113 -0
- package/dist/scatter-chart/scatter-chart-default-props.interface.d.ts +71 -0
- package/dist/scatter-chart/scatter-chart-get-default-props.d.ts +3 -0
- package/dist/scatter-chart/scatter-chart.d.ts +3 -0
- package/dist/scatter-chart/scatter-chart.interface.d.ts +81 -0
- package/dist/scatter-chart/utils/get-scales-config.d.ts +49 -0
- package/dist/scatter-chart/utils/get-tooltip-config.d.ts +21 -0
- package/package.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { MutableRefObject } from '../../../../node_modules/react';
|
|
2
|
+
import { Chart } from 'chart.js';
|
|
3
|
+
import { AxisType, ChartHoverMode } from '../../common/helpers/enums';
|
|
4
|
+
import { IBarDefaultProps } from '../bar-chart.interface';
|
|
5
|
+
export interface IUseBarChartOptionsProps {
|
|
6
|
+
chart: IBarDefaultProps;
|
|
7
|
+
chartRef: MutableRefObject<Chart | null>;
|
|
8
|
+
}
|
|
9
|
+
export declare const useBarChartOptions: ({ chart, chartRef, }: IUseBarChartOptionsProps) => {
|
|
10
|
+
onClick: (_evt: import('chart.js').ChartEvent, _elements: import('chart.js').ActiveElement[], chartInstance: Chart) => void;
|
|
11
|
+
onHover: (evt: import('chart.js').ChartEvent, hoveredItems: import('../../common/common.interface').ICommonHoveredItems[]) => void;
|
|
12
|
+
indexAxis: AxisType;
|
|
13
|
+
maintainAspectRatio: boolean | undefined;
|
|
14
|
+
animation: false | {
|
|
15
|
+
duration: number;
|
|
16
|
+
} | undefined;
|
|
17
|
+
hover: {
|
|
18
|
+
mode: ChartHoverMode;
|
|
19
|
+
intersect: boolean;
|
|
20
|
+
};
|
|
21
|
+
scales: any;
|
|
22
|
+
plugins: {
|
|
23
|
+
title: {
|
|
24
|
+
display: boolean;
|
|
25
|
+
text: string | string[];
|
|
26
|
+
} | {
|
|
27
|
+
display?: undefined;
|
|
28
|
+
text?: undefined;
|
|
29
|
+
};
|
|
30
|
+
datalabels: import('./get-bar-chart-data-labels').IExtendedDataLabelsOptions;
|
|
31
|
+
annotation: {
|
|
32
|
+
annotations: {};
|
|
33
|
+
};
|
|
34
|
+
tooltip: Record<string, any>;
|
|
35
|
+
legend: {
|
|
36
|
+
display: boolean;
|
|
37
|
+
events: never[];
|
|
38
|
+
position: any;
|
|
39
|
+
align: "center" | "start" | "end";
|
|
40
|
+
labels: {
|
|
41
|
+
boxHeight: number;
|
|
42
|
+
boxWidth: number | undefined;
|
|
43
|
+
usePointStyle: boolean | undefined;
|
|
44
|
+
};
|
|
45
|
+
onClick: (_: import('../../common/common.interface').UnusedParameter, legendItem: import('chart.js').LegendItem) => void;
|
|
46
|
+
};
|
|
47
|
+
customLegendPlugin: {
|
|
48
|
+
htmlLegend: any;
|
|
49
|
+
};
|
|
50
|
+
chartAreaBorder: {
|
|
51
|
+
borderColor: string;
|
|
52
|
+
};
|
|
53
|
+
dragData: false | object | import('../../common/helpers/get-draggableData').IDraggableData | undefined;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { ChartEvent, ChartTypeRegistry, LinearScaleOptions, Plugin } from 'chart.js';
|
|
2
|
+
import { LabelOptions } from 'chartjs-plugin-annotation';
|
|
3
|
+
import { GradientDirection } from './plugins/gradient-background-plugin/enums';
|
|
4
|
+
import { AnnotationType, DragAxis } from './plugins/annotation-dragger-plugin/enums';
|
|
5
|
+
import { AlignOptions, Position } from './helpers/enums';
|
|
6
|
+
export type TAxisPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
7
|
+
export interface ICommonDataValue {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
label?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ICommonDataset {
|
|
13
|
+
label?: string;
|
|
14
|
+
borderColor?: string;
|
|
15
|
+
backgroundColor?: string | string[];
|
|
16
|
+
borderWidth?: number;
|
|
17
|
+
data: ICommonDataValue[];
|
|
18
|
+
hidden?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ICommonScales extends Partial<Record<string, LinearScaleOptions>> {
|
|
21
|
+
x: LinearScaleOptions;
|
|
22
|
+
y: LinearScaleOptions;
|
|
23
|
+
}
|
|
24
|
+
export interface ICommonAnnotationElement {
|
|
25
|
+
display: boolean;
|
|
26
|
+
annotationIndex: number;
|
|
27
|
+
label: {
|
|
28
|
+
options: LabelOptions;
|
|
29
|
+
content: string;
|
|
30
|
+
};
|
|
31
|
+
options: {
|
|
32
|
+
id?: string;
|
|
33
|
+
scaleID?: string;
|
|
34
|
+
borderColor?: string;
|
|
35
|
+
borderWidth?: number;
|
|
36
|
+
radius?: number;
|
|
37
|
+
label?: {
|
|
38
|
+
content?: string;
|
|
39
|
+
position?: string;
|
|
40
|
+
enabled?: boolean;
|
|
41
|
+
xAdjust?: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface ICoordinates {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
}
|
|
49
|
+
export interface ICommonAnnotationsData {
|
|
50
|
+
display?: boolean;
|
|
51
|
+
hideLegend?: boolean;
|
|
52
|
+
id?: string;
|
|
53
|
+
adjustScaleRange: boolean;
|
|
54
|
+
annotationAxis: 'x' | 'y';
|
|
55
|
+
rotation: number;
|
|
56
|
+
color: string;
|
|
57
|
+
endValue: number;
|
|
58
|
+
borderWidth?: number;
|
|
59
|
+
backgroundColor?: string;
|
|
60
|
+
label: string;
|
|
61
|
+
labelConfig?: Record<string, any>;
|
|
62
|
+
type: AnnotationType;
|
|
63
|
+
value: number;
|
|
64
|
+
xMin: number;
|
|
65
|
+
xMax: number;
|
|
66
|
+
yMin: number;
|
|
67
|
+
yMax: number;
|
|
68
|
+
xValue?: number;
|
|
69
|
+
yValue?: number;
|
|
70
|
+
radius?: number;
|
|
71
|
+
enableDrag?: boolean;
|
|
72
|
+
onDragStart?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
73
|
+
onDrag?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
74
|
+
onDragEnd?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
75
|
+
dragAxis?: DragAxis;
|
|
76
|
+
pointStyle?: string;
|
|
77
|
+
resizable?: boolean;
|
|
78
|
+
dragRange?: {
|
|
79
|
+
x?: [number, number];
|
|
80
|
+
y?: [number, number];
|
|
81
|
+
};
|
|
82
|
+
displayDragCoordinates?: boolean;
|
|
83
|
+
xScaleID?: string;
|
|
84
|
+
yScaleID?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface ICommonGradientColor {
|
|
87
|
+
offset: number;
|
|
88
|
+
color: string;
|
|
89
|
+
}
|
|
90
|
+
export interface ICommonGradient {
|
|
91
|
+
display: boolean;
|
|
92
|
+
gradientColors?: ICommonGradientColor[];
|
|
93
|
+
direction?: GradientDirection;
|
|
94
|
+
}
|
|
95
|
+
export interface ICommonStyling {
|
|
96
|
+
width?: number | string;
|
|
97
|
+
height?: number | string;
|
|
98
|
+
maintainAspectRatio?: boolean;
|
|
99
|
+
staticChartHeight?: boolean;
|
|
100
|
+
performanceMode?: boolean;
|
|
101
|
+
gradient?: ICommonGradient;
|
|
102
|
+
}
|
|
103
|
+
export interface ICommonLegend {
|
|
104
|
+
display: boolean;
|
|
105
|
+
position: Position;
|
|
106
|
+
align: AlignOptions;
|
|
107
|
+
}
|
|
108
|
+
export interface ICommonTooltip {
|
|
109
|
+
tooltips: boolean;
|
|
110
|
+
showLabelsInTooltips: boolean;
|
|
111
|
+
scientificNotation: boolean;
|
|
112
|
+
}
|
|
113
|
+
export interface ICommonAdditionalAxesOptions {
|
|
114
|
+
chartScaleType?: 'linear' | 'logarithmic';
|
|
115
|
+
reverse: boolean;
|
|
116
|
+
beginAtZero: boolean;
|
|
117
|
+
stepSize?: number;
|
|
118
|
+
stacked?: boolean;
|
|
119
|
+
suggestedMin?: number;
|
|
120
|
+
suggestedMax?: number;
|
|
121
|
+
min?: number;
|
|
122
|
+
max?: number;
|
|
123
|
+
}
|
|
124
|
+
export interface ICommonAnnotation {
|
|
125
|
+
showLabel: boolean;
|
|
126
|
+
text: string | string[];
|
|
127
|
+
position: string;
|
|
128
|
+
fontSize: number;
|
|
129
|
+
xOffset: number;
|
|
130
|
+
yOffset: number;
|
|
131
|
+
maxWidth: number;
|
|
132
|
+
lineHeight: number;
|
|
133
|
+
}
|
|
134
|
+
export interface ICommonAnnotations {
|
|
135
|
+
showAnnotations?: boolean;
|
|
136
|
+
controlAnnotation?: boolean;
|
|
137
|
+
enableDragAnnotation?: boolean;
|
|
138
|
+
annotationsData?: ICommonAnnotationsData[];
|
|
139
|
+
labelAnnotation?: ICommonAnnotation;
|
|
140
|
+
}
|
|
141
|
+
export interface ICommonGraph {
|
|
142
|
+
lineTension?: number;
|
|
143
|
+
spanGaps?: boolean;
|
|
144
|
+
showDataLabels?: boolean;
|
|
145
|
+
showMinorGridlines?: boolean;
|
|
146
|
+
}
|
|
147
|
+
export interface ICommonInteractions {
|
|
148
|
+
onLegendClick?: (text: string, hidden: boolean) => void;
|
|
149
|
+
onHover?: (event?: ChartEvent, datasetIndex?: number, index?: number, generatedDataset?: any[]) => void;
|
|
150
|
+
onUnhover?: (event?: ChartEvent, datasetIndex?: number, index?: number, generatedDataset?: any[]) => void;
|
|
151
|
+
}
|
|
152
|
+
export interface ICommonCustomLegend<T extends keyof ChartTypeRegistry> {
|
|
153
|
+
customLegendPlugin: Plugin<T> | null;
|
|
154
|
+
customLegendContainerID: string;
|
|
155
|
+
}
|
|
156
|
+
export interface ICommonChartOptions {
|
|
157
|
+
enableZoom: boolean;
|
|
158
|
+
enablePan: boolean;
|
|
159
|
+
}
|
|
160
|
+
export interface ICommonDragData {
|
|
161
|
+
enableDragData?: boolean;
|
|
162
|
+
showTooltip?: boolean;
|
|
163
|
+
roundPoints?: boolean;
|
|
164
|
+
dragX?: boolean;
|
|
165
|
+
dragY?: boolean;
|
|
166
|
+
onDragStart?: () => void;
|
|
167
|
+
onDrag?: () => void;
|
|
168
|
+
onDragEnd?: () => void;
|
|
169
|
+
}
|
|
170
|
+
export interface ICommonOptions {
|
|
171
|
+
title?: string | string[];
|
|
172
|
+
chartStyling?: ICommonStyling;
|
|
173
|
+
tooltip?: ICommonTooltip;
|
|
174
|
+
legend?: ICommonLegend;
|
|
175
|
+
chartOptions?: ICommonChartOptions;
|
|
176
|
+
interactions?: ICommonInteractions;
|
|
177
|
+
dragData?: ICommonDragData;
|
|
178
|
+
annotations?: ICommonAnnotations;
|
|
179
|
+
}
|
|
180
|
+
export interface ICommonData {
|
|
181
|
+
testId?: string;
|
|
182
|
+
data?: {
|
|
183
|
+
labels?: string[];
|
|
184
|
+
datasets?: ICommonDataset[];
|
|
185
|
+
};
|
|
186
|
+
options: ICommonOptions;
|
|
187
|
+
}
|
|
188
|
+
export interface ICommonHoveredItems {
|
|
189
|
+
index: number;
|
|
190
|
+
datasetIndex: number;
|
|
191
|
+
}
|
|
192
|
+
export interface ICommonChartPlugins {
|
|
193
|
+
legend: {
|
|
194
|
+
position: TAxisPosition;
|
|
195
|
+
};
|
|
196
|
+
title: {
|
|
197
|
+
display: boolean;
|
|
198
|
+
text: string;
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
export interface ICommonAxis<PositionType = any> {
|
|
202
|
+
label: string;
|
|
203
|
+
position: PositionType;
|
|
204
|
+
color: string | string[];
|
|
205
|
+
unit?: string;
|
|
206
|
+
gridLines?: boolean;
|
|
207
|
+
stepSize?: number;
|
|
208
|
+
}
|
|
209
|
+
export type UnusedParameter = unknown | any;
|
|
210
|
+
export type TPrimitive = string | number | boolean | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactElement } from '../../../node_modules/react';
|
|
2
|
+
interface ControlsPortalProps {
|
|
3
|
+
children: ReactElement;
|
|
4
|
+
controlsPortalId: string;
|
|
5
|
+
}
|
|
6
|
+
declare const ControlsPortal: ({ children, controlsPortalId, }: ControlsPortalProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default ControlsPortal;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Chart } from 'chart.js';
|
|
2
|
+
import { UnusedParameter } from '../common.interface';
|
|
3
|
+
interface IChartAreaBorderPluginOptions {
|
|
4
|
+
borderColor: string;
|
|
5
|
+
borderWidth: number;
|
|
6
|
+
borderDash: number[];
|
|
7
|
+
borderDashOffset?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Chart border plugin config
|
|
11
|
+
*/
|
|
12
|
+
export declare const chartAreaBorderPlugin: {
|
|
13
|
+
id: string;
|
|
14
|
+
beforeDraw(chart: Chart, _: UnusedParameter, options: IChartAreaBorderPluginOptions): void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ICommonGradientColor } from '../common.interface';
|
|
2
|
+
export declare const BORDER_WIDTH: {
|
|
3
|
+
ZERO: number;
|
|
4
|
+
INITIAL: number;
|
|
5
|
+
HOVERED: number;
|
|
6
|
+
POINT_HOVERED: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const BORDER_COLOR = "rgba(0,0,0,0.1)";
|
|
9
|
+
export declare const ANNOTATION_DASH: number[];
|
|
10
|
+
export declare const DEFAULT_FONT_SIZE = 12;
|
|
11
|
+
export declare const DEFAULT_FONT_FAMILY = "\"Roobert\", \"Noto Sans\", sans-serif";
|
|
12
|
+
export declare const DEFAULT_COLOR = "hsl(60, 10.34482759%, 12.5%)";
|
|
13
|
+
export declare const LEGEND_LABEL_BOX_SIZE = 12;
|
|
14
|
+
export declare const TOOLTIP_PADDING = 8;
|
|
15
|
+
export declare const TOOLTIP_BOX_PADDING = 4;
|
|
16
|
+
export declare const TRANSPARENT = "transparent";
|
|
17
|
+
export declare const LOGARITHMIC_STEPS: number[];
|
|
18
|
+
export declare const COLORS: string[];
|
|
19
|
+
/**
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @desc equivalent of 0.6 rgba alpha chanel
|
|
22
|
+
*/
|
|
23
|
+
export declare const ALPHA_CHANEL = "99";
|
|
24
|
+
/**
|
|
25
|
+
* @type {number}
|
|
26
|
+
* @desc #FFFFFF as decimal number
|
|
27
|
+
*/
|
|
28
|
+
export declare const WHITE_COLOR_AS_DECIMAL = 16777215;
|
|
29
|
+
export declare const AUTO = "auto";
|
|
30
|
+
export declare const ANIMATION_DURATION: {
|
|
31
|
+
NO: number;
|
|
32
|
+
SLOW: number;
|
|
33
|
+
FAST: number;
|
|
34
|
+
};
|
|
35
|
+
export declare const DEFAULT_CHART_NAME = "new_chart";
|
|
36
|
+
export declare const CUSTOM_LEGEND_PLUGIN_NAME = "htmlLegend";
|
|
37
|
+
export declare const DECIMAL_POINT_TOLERANCE = 9;
|
|
38
|
+
export declare const MAX_DECIMAL_DIFF: number;
|
|
39
|
+
export declare const GRADIENT_COLORS: ICommonGradientColor[];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ChartTypeRegistry, LegendItem, Plugin } from 'chart.js';
|
|
2
|
+
import { ICommonCustomLegend, UnusedParameter } from '../common.interface';
|
|
3
|
+
import { Position } from './enums';
|
|
4
|
+
export interface IChartGraph {
|
|
5
|
+
showMinorGridlines: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface IOptions {
|
|
8
|
+
title?: string | string[];
|
|
9
|
+
legend?: {
|
|
10
|
+
position: Position;
|
|
11
|
+
display?: boolean;
|
|
12
|
+
align?: string;
|
|
13
|
+
usePointStyle?: boolean;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
interface IStyling {
|
|
17
|
+
width?: string | number;
|
|
18
|
+
height?: string | number;
|
|
19
|
+
squareAspectRatio?: number | boolean;
|
|
20
|
+
maintainAspectRatio?: boolean;
|
|
21
|
+
staticChartHeight?: boolean;
|
|
22
|
+
performanceMode?: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface IAxis {
|
|
25
|
+
label?: string;
|
|
26
|
+
}
|
|
27
|
+
interface ILegend {
|
|
28
|
+
customLegend?: ICommonCustomLegend<any>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @param { graph } graph - graph data from chart options
|
|
32
|
+
* @param { legend } legend
|
|
33
|
+
* @return {[]}
|
|
34
|
+
*/
|
|
35
|
+
export declare const getPlugins: <T extends keyof ChartTypeRegistry>(graph: IChartGraph, legend: ILegend) => Plugin<T>[] | any;
|
|
36
|
+
/**
|
|
37
|
+
* @param {string[]} colors - color schema
|
|
38
|
+
* @return {string} - random color
|
|
39
|
+
*/
|
|
40
|
+
export declare const generateRandomColor: (colors: string[]) => string[];
|
|
41
|
+
/**
|
|
42
|
+
* @param {ICommonChartOptions} options - chart options object
|
|
43
|
+
* @return {{color: (string|undefined), display: boolean, text}|{}}
|
|
44
|
+
*/
|
|
45
|
+
export declare const getTitle: (options: IOptions) => {
|
|
46
|
+
display: boolean;
|
|
47
|
+
text: string | string[];
|
|
48
|
+
} | {
|
|
49
|
+
display?: undefined;
|
|
50
|
+
text?: undefined;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* @function isVertical
|
|
54
|
+
*/
|
|
55
|
+
export declare const isVertical: (direction: "vertical" | "horizontal") => direction is "vertical";
|
|
56
|
+
/**
|
|
57
|
+
* @param {'x'|'y'} axisType
|
|
58
|
+
* @param {number} i - index
|
|
59
|
+
* @return {'top'|'bottom'|'left'|'right'|*}
|
|
60
|
+
*/
|
|
61
|
+
export declare const getAxisPosition: (axisType: string, i: number) => Position;
|
|
62
|
+
/**
|
|
63
|
+
* @param {chartStyling} chartStyling
|
|
64
|
+
* @param {Object} styles - styles imported form .less file
|
|
65
|
+
* @return {string} - class name
|
|
66
|
+
*/
|
|
67
|
+
export declare const getClassName: (chartStyling: IStyling, styles: Record<string, string>) => string;
|
|
68
|
+
export declare const getLegend: (options: IOptions, clickHandler: (_: UnusedParameter, legendItem: LegendItem) => void) => {
|
|
69
|
+
position: any;
|
|
70
|
+
display: boolean | undefined;
|
|
71
|
+
align: "center" | "start" | "end";
|
|
72
|
+
labels: {
|
|
73
|
+
boxHeight: number;
|
|
74
|
+
boxWidth: number | undefined;
|
|
75
|
+
usePointStyle: boolean | undefined;
|
|
76
|
+
};
|
|
77
|
+
onClick: (_: UnusedParameter, legendItem: LegendItem) => void;
|
|
78
|
+
};
|
|
79
|
+
export declare const afterLabelCallback: (tooltipItem: Record<string, any>) => string;
|
|
80
|
+
export declare const getTooltipLabel: (tooltipItem: Record<string, any>, showLabelsInTooltips: boolean) => string;
|
|
81
|
+
export declare const sanitize: (str: string) => string;
|
|
82
|
+
export declare const getChartFileName: (axes?: IAxis[]) => string;
|
|
83
|
+
export declare const setDefaultTheme: () => void;
|
|
84
|
+
export declare const isNilOrEmpty: <T>(value: T | null | undefined) => boolean;
|
|
85
|
+
export declare const isEmptyString: (value: string) => value is "";
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from '../../../../node_modules/react';
|
|
2
|
+
interface ContainerProps {
|
|
3
|
+
style?: CSSProperties;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
margin?: boolean;
|
|
6
|
+
deprecatedMessage?: string;
|
|
7
|
+
warningMessage?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const Container: {
|
|
10
|
+
({ style, children, margin, deprecatedMessage, warningMessage, }: ContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
defaultProps: {
|
|
12
|
+
style: {};
|
|
13
|
+
margin: boolean;
|
|
14
|
+
deprecatedMessage: null;
|
|
15
|
+
warningMessage: null;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const customFormatNumber: (labelNumber: number, scientificNotation: boolean) => string;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export declare enum AxisType {
|
|
2
|
+
X = "x",
|
|
3
|
+
Y = "y"
|
|
4
|
+
}
|
|
5
|
+
export declare enum Position {
|
|
6
|
+
Bottom = "bottom",
|
|
7
|
+
Top = "top",
|
|
8
|
+
Left = "left",
|
|
9
|
+
Right = "right",
|
|
10
|
+
TopRight = "top-right",
|
|
11
|
+
TopLeft = "top-left",
|
|
12
|
+
BottomLeft = "bottom-left",
|
|
13
|
+
BottomRight = "bottom-right"
|
|
14
|
+
}
|
|
15
|
+
export declare enum ChartType {
|
|
16
|
+
Line = "line",
|
|
17
|
+
Bar = "bar"
|
|
18
|
+
}
|
|
19
|
+
export declare enum CursorStyle {
|
|
20
|
+
Pointer = "pointer",
|
|
21
|
+
Initial = "initial",
|
|
22
|
+
Grab = "grab",
|
|
23
|
+
Grabbing = "grabbing",
|
|
24
|
+
Crosshair = "crosshair",
|
|
25
|
+
Move = "move"
|
|
26
|
+
}
|
|
27
|
+
export declare enum ScaleType {
|
|
28
|
+
Category = "category",
|
|
29
|
+
Linear = "linear",
|
|
30
|
+
Logarithmic = "logarithmic"
|
|
31
|
+
}
|
|
32
|
+
export declare enum ChartDirection {
|
|
33
|
+
Vertical = "vertical"
|
|
34
|
+
}
|
|
35
|
+
export declare enum TooltipLabel {
|
|
36
|
+
Y = "yLabel",
|
|
37
|
+
X = "xLabel"
|
|
38
|
+
}
|
|
39
|
+
export declare enum AlignOptions {
|
|
40
|
+
End = "end",
|
|
41
|
+
Start = "start",
|
|
42
|
+
Center = "center",
|
|
43
|
+
Right = "right",
|
|
44
|
+
Left = "left"
|
|
45
|
+
}
|
|
46
|
+
export declare enum PointType {
|
|
47
|
+
Casing = "casing"
|
|
48
|
+
}
|
|
49
|
+
export declare enum AnnotationType {
|
|
50
|
+
Box = "box",
|
|
51
|
+
Ellipse = "ellipse",
|
|
52
|
+
Line = "line",
|
|
53
|
+
Text = "text"
|
|
54
|
+
}
|
|
55
|
+
export declare enum PointStyle {
|
|
56
|
+
Circle = "circle",
|
|
57
|
+
Square = "rect",
|
|
58
|
+
Diamond = "rectRot",
|
|
59
|
+
Triangle = "triangle"
|
|
60
|
+
}
|
|
61
|
+
export declare enum ChartHoverMode {
|
|
62
|
+
Nearest = "nearest"
|
|
63
|
+
}
|
|
64
|
+
export declare enum PanZoomMode {
|
|
65
|
+
X = "x",
|
|
66
|
+
Y = "y",
|
|
67
|
+
XY = "xy",
|
|
68
|
+
Z = "z"
|
|
69
|
+
}
|
|
70
|
+
export declare enum Key {
|
|
71
|
+
Shift = "Shift"
|
|
72
|
+
}
|
|
73
|
+
export declare enum Events {
|
|
74
|
+
Mousemove = "mousemove",
|
|
75
|
+
Mouseout = "mouseout",
|
|
76
|
+
Click = "click",
|
|
77
|
+
Touchstart = "touchstart",
|
|
78
|
+
Touchmove = "touchmove",
|
|
79
|
+
Dblclick = "dblclick"
|
|
80
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Chart } from 'chart.js';
|
|
2
|
+
import { AnnotationType } from '../plugins/annotation-dragger-plugin/enums';
|
|
3
|
+
import { Position } from './enums';
|
|
4
|
+
import { ICommonAnnotationElement, ICommonAnnotationsData, ICoordinates } from '../common.interface';
|
|
5
|
+
export interface IGetAnnotationsProps {
|
|
6
|
+
showAnnotations: boolean;
|
|
7
|
+
annotationsData: ICommonAnnotationsData[];
|
|
8
|
+
}
|
|
9
|
+
interface TChart extends Chart {
|
|
10
|
+
hoveredAnnotationId?: string | null;
|
|
11
|
+
}
|
|
12
|
+
declare const getAnnotation: ({ showAnnotations, annotationsData, }: IGetAnnotationsProps) => ICommonAnnotationElement[] | {
|
|
13
|
+
display: boolean | undefined;
|
|
14
|
+
annotationIndex: number;
|
|
15
|
+
id: string;
|
|
16
|
+
scaleID: "x" | "y";
|
|
17
|
+
label: {
|
|
18
|
+
content: string;
|
|
19
|
+
display: boolean;
|
|
20
|
+
font: {
|
|
21
|
+
weight: string;
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
backgroundColor: string;
|
|
25
|
+
content: string;
|
|
26
|
+
display: boolean;
|
|
27
|
+
position: Position;
|
|
28
|
+
color?: undefined;
|
|
29
|
+
font?: undefined;
|
|
30
|
+
borderWidth?: undefined;
|
|
31
|
+
padding?: undefined;
|
|
32
|
+
borderRadius?: undefined;
|
|
33
|
+
borderColor?: undefined;
|
|
34
|
+
} | {
|
|
35
|
+
backgroundColor: any;
|
|
36
|
+
content: string;
|
|
37
|
+
display: any;
|
|
38
|
+
position: any;
|
|
39
|
+
color: any;
|
|
40
|
+
font: any;
|
|
41
|
+
borderWidth: number;
|
|
42
|
+
padding: number;
|
|
43
|
+
borderRadius: number;
|
|
44
|
+
borderColor: any;
|
|
45
|
+
};
|
|
46
|
+
backgroundColor: string;
|
|
47
|
+
borderColor: string;
|
|
48
|
+
borderWidth: number;
|
|
49
|
+
borderDash: number[] | undefined;
|
|
50
|
+
type: AnnotationType;
|
|
51
|
+
adjustScaleRange: boolean;
|
|
52
|
+
enter: ({ element, }: {
|
|
53
|
+
element: ICommonAnnotationElement;
|
|
54
|
+
}, { chart, }: {
|
|
55
|
+
chart: TChart;
|
|
56
|
+
}) => void;
|
|
57
|
+
leave: ({ element, }: {
|
|
58
|
+
element: ICommonAnnotationElement;
|
|
59
|
+
}, { chart, }: {
|
|
60
|
+
chart: TChart;
|
|
61
|
+
}) => void;
|
|
62
|
+
onDragStart: () => (cord: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
63
|
+
onDrag: () => (cord: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
64
|
+
onDragEnd: () => (cord: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
65
|
+
pointStyle: string;
|
|
66
|
+
resizable: boolean;
|
|
67
|
+
displayDragCoordinates: boolean;
|
|
68
|
+
hideLegend?: boolean;
|
|
69
|
+
annotationAxis: "x" | "y";
|
|
70
|
+
rotation: number;
|
|
71
|
+
color: string;
|
|
72
|
+
endValue: number;
|
|
73
|
+
labelConfig?: Record<string, any>;
|
|
74
|
+
value: number;
|
|
75
|
+
xMin: number;
|
|
76
|
+
xMax: number;
|
|
77
|
+
yMin: number;
|
|
78
|
+
yMax: number;
|
|
79
|
+
xValue?: number;
|
|
80
|
+
yValue?: number;
|
|
81
|
+
radius?: number;
|
|
82
|
+
enableDrag?: boolean;
|
|
83
|
+
dragAxis?: import('../plugins/annotation-dragger-plugin/enums').DragAxis;
|
|
84
|
+
dragRange?: {
|
|
85
|
+
x?: [number, number];
|
|
86
|
+
y?: [number, number];
|
|
87
|
+
};
|
|
88
|
+
xScaleID?: string;
|
|
89
|
+
yScaleID?: string;
|
|
90
|
+
}[];
|
|
91
|
+
export default getAnnotation;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Chart, ChartConfiguration, Plugin } from 'chart.js';
|
|
2
|
+
/**
|
|
3
|
+
* Gets an example custom legend plugin for use in storybook.
|
|
4
|
+
* @param {string} customLegendContainerID - the id of the div container to put the generated legend in
|
|
5
|
+
*/
|
|
6
|
+
export declare const getCustomLegendPlugin: (customLegendContainerID: string) => {
|
|
7
|
+
afterUpdate(chart: Chart, _args: Plugin, _options: ChartConfiguration): void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ICommonOptions } from '../common.interface';
|
|
2
|
+
export interface IDraggableDataOptions {
|
|
3
|
+
dragX: boolean;
|
|
4
|
+
dragY: boolean;
|
|
5
|
+
round: boolean;
|
|
6
|
+
showTooltip: boolean;
|
|
7
|
+
onDragStart: () => void;
|
|
8
|
+
onDrag: () => void;
|
|
9
|
+
onDragEnd: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface IDraggableData {
|
|
12
|
+
dragData: IDraggableDataOptions;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @param {ICommonChartOptions} options - line chart options object
|
|
16
|
+
*/
|
|
17
|
+
declare const getDraggableData: (options: ICommonOptions) => IDraggableData | object;
|
|
18
|
+
export default getDraggableData;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TGeneratedLineChartDatasets } from '../../../line-chart/line-chart.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Estimates whether any of the data series has values that are all close together
|
|
4
|
+
* - checks only the first and last values in each series (i.e. assumes they are ordered)
|
|
5
|
+
* - uses an equality check with tolerance for decimal precision noise
|
|
6
|
+
* - this is just an inexpensive "guesstimate" (full min/max detection can be used afterwards)
|
|
7
|
+
*/
|
|
8
|
+
export declare const estimateDataSeriesHaveCloseValues: (generatedDatasets: TGeneratedLineChartDatasets) => boolean;
|