@oliasoft-open-source/charts-library 5.13.0 → 5.14.0-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/index.d.ts +15 -1217
- package/dist/index.js +453 -68
- package/dist/src/components/bar-chart/bar-chart-const.d.ts +2 -0
- package/dist/src/components/bar-chart/bar-chart-default-props.d.ts +3 -0
- package/dist/src/components/bar-chart/bar-chart.d.ts +3 -0
- package/dist/src/components/bar-chart/bar-chart.interface.d.ts +141 -0
- package/dist/src/components/bar-chart/utils/get-bar-chart-data-labels.d.ts +10 -0
- package/dist/src/components/bar-chart/utils/get-bar-chart-scales.d.ts +3 -0
- package/dist/src/components/bar-chart/utils/get-bar-chart-tooltips.d.ts +6 -0
- package/dist/src/components/bar-chart/utils/use-bar-chart-config.d.ts +13 -0
- package/dist/src/components/bar-chart/utils/use-bar-chart-options.d.ts +55 -0
- package/dist/src/components/common/common.interface.d.ts +275 -0
- package/dist/src/components/common/controls-portal.d.ts +7 -0
- package/dist/src/components/common/enums.d.ts +87 -0
- package/dist/src/components/common/helpers/add-transparency/add-transparency.d.ts +1 -0
- package/dist/src/components/common/helpers/callout-helpers/callout-helpers.d.ts +25 -0
- package/dist/src/components/common/helpers/chart-border-plugin.d.ts +16 -0
- package/dist/src/components/common/helpers/chart-consts.d.ts +39 -0
- package/dist/src/components/common/helpers/chart-utils.d.ts +86 -0
- package/dist/src/components/common/helpers/container.d.ts +18 -0
- package/dist/src/components/common/helpers/custom-format-number.d.ts +1 -0
- package/dist/src/components/common/helpers/download-pgn.d.ts +3 -0
- package/dist/src/components/common/helpers/get-chart-annotation.d.ts +139 -0
- package/dist/src/components/common/helpers/get-chart-from-ctx.d.ts +1 -0
- package/dist/src/components/common/helpers/get-custom-legend-plugin-example.d.ts +8 -0
- package/dist/src/components/common/helpers/get-draggableData.d.ts +18 -0
- package/dist/src/components/common/helpers/get-grouped-color-scheme/get-grouped-color-scheme.d.ts +1 -0
- package/dist/src/components/common/helpers/input-normalizers.d.ts +15 -0
- package/dist/src/components/common/helpers/range/estimate-data-series-have-close-values.d.ts +8 -0
- package/dist/src/components/common/helpers/range/range.d.ts +33 -0
- package/dist/src/components/common/helpers/text.d.ts +1 -0
- package/dist/src/components/common/helpers/to-annotation.d.ts +4 -0
- package/dist/src/components/common/hooks/use-generated-labels.d.ts +4 -0
- package/dist/src/components/common/hooks/use-legend-state.d.ts +28 -0
- package/dist/src/components/common/hooks/use-legend.d.ts +4 -0
- package/dist/src/components/common/hooks/use-update-annotations.d.ts +4 -0
- package/dist/src/components/common/legend-component/legend-dropzone.d.ts +3 -0
- package/dist/src/components/common/legend-component/legend-interface.d.ts +47 -0
- package/dist/src/components/common/legend-component/legend-item/LegendItemLine.d.ts +5 -0
- package/dist/src/components/common/legend-component/legend-item/legend-item.d.ts +3 -0
- package/dist/src/components/common/legend-component/legend-panel.d.ts +3 -0
- package/dist/src/components/common/legend-component/legend.d.ts +3 -0
- package/dist/src/components/common/legend-component/state/legend-action-types.d.ts +3 -0
- package/dist/src/components/common/legend-component/state/legend-context.d.ts +14 -0
- package/dist/src/components/common/legend-component/state/legend-state-reducer.d.ts +30 -0
- package/dist/src/components/common/legend-component/utils/create-style-object.d.ts +27 -0
- package/dist/src/components/common/legend-component/utils/get-generated-labels.d.ts +2 -0
- package/dist/src/components/common/plugins/annotation-dragger-plugin/annotation-dragger-plugin.d.ts +15 -0
- package/dist/src/components/common/plugins/annotation-dragger-plugin/annotation-position-storage.d.ts +7 -0
- package/dist/src/components/common/plugins/annotation-dragger-plugin/enums.d.ts +21 -0
- package/dist/src/components/common/plugins/annotation-dragger-plugin/event-helpers.d.ts +6 -0
- package/dist/src/components/common/plugins/annotation-dragger-plugin/helpers.d.ts +53 -0
- package/dist/src/components/common/plugins/annotation-dragger-plugin/point-annotation-label.d.ts +5 -0
- package/dist/src/components/common/plugins/ellipsis-annotation-plugin/compute-ellipse-geometry.d.ts +9 -0
- package/dist/src/components/common/plugins/ellipsis-annotation-plugin/ellipsis-annotation-plugin.d.ts +18 -0
- package/dist/src/components/common/plugins/gradient-background-plugin/enums.d.ts +10 -0
- package/dist/src/components/common/plugins/gradient-background-plugin/gradient-background-plugin.d.ts +2 -0
- package/dist/src/components/line-chart/constants/default-translations.d.ts +25 -0
- package/dist/src/components/line-chart/constants/line-chart-consts.d.ts +13 -0
- package/dist/src/components/line-chart/controls/axes-options/axes-options-interfaces.d.ts +57 -0
- package/dist/src/components/line-chart/controls/axes-options/axes-options.d.ts +6 -0
- package/dist/src/components/line-chart/controls/axes-options/axes-validation.d.ts +8 -0
- package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +19 -0
- package/dist/src/components/line-chart/controls/controls.d.ts +3 -0
- package/dist/src/components/line-chart/controls/drag-options-interfaces.d.ts +14 -0
- package/dist/src/components/line-chart/controls/drag-options.d.ts +23 -0
- package/dist/src/components/line-chart/controls/line-options.d.ts +19 -0
- package/dist/src/components/line-chart/hooks/use-chart-functions.d.ts +32 -0
- package/dist/src/components/line-chart/hooks/use-chart-options.d.ts +19 -0
- package/dist/src/components/line-chart/hooks/use-chart-plugins.d.ts +7 -0
- package/dist/src/components/line-chart/hooks/use-chart-state.d.ts +12 -0
- package/dist/src/components/line-chart/hooks/use-toggle-handler.d.ts +12 -0
- package/dist/src/components/line-chart/initialize/config.d.ts +12 -0
- package/dist/src/components/line-chart/initialize/initialize-line-chart.d.ts +12 -0
- package/dist/src/components/line-chart/line-chart-get-default-props.d.ts +3 -0
- package/dist/src/components/line-chart/line-chart.d.ts +3 -0
- package/dist/src/components/line-chart/line-chart.interface.d.ts +236 -0
- package/dist/src/components/line-chart/plugins/callout-plugin/callout-plugin.d.ts +11 -0
- package/dist/src/components/line-chart/plugins/callout-plugin/helpers.d.ts +42 -0
- package/dist/src/components/line-chart/plugins/chart-area-text-plugin.d.ts +17 -0
- package/dist/src/components/line-chart/plugins/line-chart.minor-gridlines-plugin.d.ts +8 -0
- package/dist/src/components/line-chart/plugins/line-markers-plugin/draw.d.ts +39 -0
- package/dist/src/components/line-chart/plugins/line-markers-plugin/line-markers-plugin.d.ts +10 -0
- package/dist/src/components/line-chart/plugins/line-markers-plugin/types.d.ts +109 -0
- package/dist/src/components/line-chart/plugins/line-markers-plugin/utils.d.ts +40 -0
- package/dist/src/components/line-chart/plugins/plugin-constants.d.ts +11 -0
- package/dist/src/components/line-chart/plugins/plugins.interface.d.ts +9 -0
- package/dist/src/components/line-chart/state/action-types.d.ts +12 -0
- package/dist/src/components/line-chart/state/helpers.d.ts +13 -0
- package/dist/src/components/line-chart/state/initial-state.d.ts +11 -0
- package/dist/src/components/line-chart/state/line-chart-reducer.d.ts +2 -0
- package/dist/src/components/line-chart/state/manage-state-in-local-storage.d.ts +15 -0
- package/dist/src/components/line-chart/state/state.interfaces.d.ts +26 -0
- package/dist/src/components/line-chart/utils/axis-formatting/axis-formatting.d.ts +2 -0
- package/dist/src/components/line-chart/utils/axis-scales/axis-scales.d.ts +18 -0
- package/dist/src/components/line-chart/utils/check-custom-option/check-custom-option.d.ts +12 -0
- package/dist/src/components/line-chart/utils/datalabels-alignment/datalabels-alignment.interface.d.ts +20 -0
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-condition.d.ts +8 -0
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-data.d.ts +11 -0
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-datalabels-position.d.ts +6 -0
- package/dist/src/components/line-chart/utils/enums.d.ts +4 -0
- package/dist/src/components/line-chart/utils/generate-line-chart-datasets.d.ts +8 -0
- package/dist/src/components/line-chart/utils/get-annotations-data.d.ts +1 -0
- package/dist/src/components/line-chart/utils/get-axes-data-from-metasets.d.ts +1 -0
- package/dist/src/components/line-chart/utils/get-axes-ranges-from-chart.d.ts +9 -0
- package/dist/src/components/line-chart/utils/get-axis-range-by-type.d.ts +10 -0
- package/dist/src/components/line-chart/utils/get-generated-labels.d.ts +2 -0
- package/dist/src/components/line-chart/utils/get-line-chart-data-labels.d.ts +16 -0
- package/dist/src/components/line-chart/utils/get-line-chart-scales.d.ts +589 -0
- package/dist/src/components/line-chart/utils/get-line-chart-tooltips.d.ts +30 -0
- package/dist/src/components/line-chart/utils/line-chart-utils.d.ts +24 -0
- package/dist/src/components/line-chart/utils/translations/get-translations.d.ts +8 -0
- package/dist/src/components/pie-chart/pie-chart-defalut-props.interface.d.ts +50 -0
- package/dist/src/components/pie-chart/pie-chart-get-default-props.d.ts +3 -0
- package/dist/src/components/pie-chart/pie-chart.d.ts +3 -0
- package/dist/src/components/pie-chart/pie-chart.interface.d.ts +58 -0
- package/dist/src/components/pie-chart/use-pie-chart-config.d.ts +42 -0
- package/dist/src/components/scatter-chart/hooks/use-scatter-chart-config.d.ts +239 -0
- package/dist/src/components/scatter-chart/scatter-chart-default-props.interface.d.ts +72 -0
- package/dist/src/components/scatter-chart/scatter-chart-get-default-props.d.ts +4 -0
- package/dist/src/components/scatter-chart/scatter-chart.d.ts +3 -0
- package/dist/src/components/scatter-chart/scatter-chart.interface.d.ts +111 -0
- package/dist/src/components/scatter-chart/utils/get-scales-config.d.ts +176 -0
- package/dist/src/components/scatter-chart/utils/get-tooltip-config.d.ts +21 -0
- package/package.json +9 -9
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { IBarChartProps, IBarDefaultProps, IBarOptionsInput } from './bar-chart.interface';
|
|
2
|
+
export declare const normalizeBarOptions: (options?: IBarOptionsInput) => IBarDefaultProps["options"];
|
|
3
|
+
export declare const getDefaultProps: (props: IBarChartProps) => IBarDefaultProps;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { ChartDataset } from 'chart.js';
|
|
2
|
+
import { DeepPartial, ICommonAdditionalAxesOptions, ICommonAnnotations, ICommonAnnotationsData, ICommonAxis, ICommonChartOptions, ICommonCustomLegend, ICommonData, ICommonDataset, ICommonDataValue, ICommonDragData, ICommonGraph, ICommonInteractions, ICommonLegend, ICommonOptions, ICommonScales, ICommonStyling, ICommonTooltip } from '../common/common.interface';
|
|
3
|
+
import { IChartGraph } from '../common/helpers/chart-utils';
|
|
4
|
+
import { ChartType } from '../common/enums';
|
|
5
|
+
export interface IBarStyling extends ICommonStyling {
|
|
6
|
+
squareAspectRatio?: boolean;
|
|
7
|
+
layoutPadding?: string | number | {
|
|
8
|
+
top: number;
|
|
9
|
+
bottom: number;
|
|
10
|
+
left: number;
|
|
11
|
+
right: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface IBarLegend extends ICommonLegend {
|
|
15
|
+
customLegend?: ICommonCustomLegend<any>;
|
|
16
|
+
}
|
|
17
|
+
export interface IBarAxes {
|
|
18
|
+
x: ICommonAxis<'top' | 'bottom'>[];
|
|
19
|
+
y: ICommonAxis<'left' | 'right'>[];
|
|
20
|
+
[key: string]: ICommonAxis[];
|
|
21
|
+
}
|
|
22
|
+
export interface IBarAdditionalAxesOptions extends ICommonAdditionalAxesOptions {
|
|
23
|
+
stackedX?: boolean;
|
|
24
|
+
stackedY?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface IBarOptions extends ICommonOptions {
|
|
27
|
+
direction?: 'vertical' | 'horizontal';
|
|
28
|
+
axes: IBarAxes;
|
|
29
|
+
scales?: ICommonScales;
|
|
30
|
+
additionalAxesOptions?: IBarAdditionalAxesOptions;
|
|
31
|
+
chartStyling: IBarStyling;
|
|
32
|
+
graph?: ICommonGraph;
|
|
33
|
+
annotations?: ICommonAnnotations;
|
|
34
|
+
legend?: IBarLegend;
|
|
35
|
+
dragData?: ICommonDragData;
|
|
36
|
+
}
|
|
37
|
+
export interface IBarChartDataset extends ICommonDataset {
|
|
38
|
+
isAnnotation?: boolean;
|
|
39
|
+
annotationIndex?: number;
|
|
40
|
+
borderSkipped?: boolean;
|
|
41
|
+
borderRadius?: number;
|
|
42
|
+
xAxisID?: string;
|
|
43
|
+
yAxisID?: string;
|
|
44
|
+
hidden?: boolean;
|
|
45
|
+
displayGroup?: string | number;
|
|
46
|
+
type?: ChartType.BAR;
|
|
47
|
+
}
|
|
48
|
+
export interface IBarChartBaseData {
|
|
49
|
+
labels: string[];
|
|
50
|
+
datasets: IBarChartDataset[];
|
|
51
|
+
}
|
|
52
|
+
export interface IBarChartData extends ICommonData {
|
|
53
|
+
testId?: string;
|
|
54
|
+
controlsPortalId?: string;
|
|
55
|
+
data: IBarChartBaseData;
|
|
56
|
+
options: IBarOptions;
|
|
57
|
+
}
|
|
58
|
+
type ILooseBarAxis = DeepPartial<ICommonAxis<string>> & {
|
|
59
|
+
[key: string]: unknown;
|
|
60
|
+
};
|
|
61
|
+
type ILooseBarAnnotation = DeepPartial<ICommonAnnotationsData> & {
|
|
62
|
+
[key: string]: unknown;
|
|
63
|
+
} & {
|
|
64
|
+
annotationAxis?: string;
|
|
65
|
+
type?: string;
|
|
66
|
+
value?: number | string | null;
|
|
67
|
+
};
|
|
68
|
+
export type IBarOptionsInput = Omit<DeepPartial<IBarOptions>, 'title' | 'direction' | 'axes' | 'legend' | 'chartStyling' | 'interactions' | 'annotations'> & {
|
|
69
|
+
[key: string]: unknown;
|
|
70
|
+
title?: unknown;
|
|
71
|
+
direction?: string;
|
|
72
|
+
axes?: {
|
|
73
|
+
x?: ILooseBarAxis[];
|
|
74
|
+
y?: ILooseBarAxis[];
|
|
75
|
+
[key: string]: ILooseBarAxis[] | undefined;
|
|
76
|
+
};
|
|
77
|
+
legend?: Omit<DeepPartial<IBarLegend>, 'position' | 'align'> & {
|
|
78
|
+
position?: string;
|
|
79
|
+
align?: string;
|
|
80
|
+
[key: string]: unknown;
|
|
81
|
+
};
|
|
82
|
+
chartStyling?: DeepPartial<IBarStyling> & {
|
|
83
|
+
hideControls?: boolean;
|
|
84
|
+
minHeight?: number | string;
|
|
85
|
+
[key: string]: unknown;
|
|
86
|
+
};
|
|
87
|
+
interactions?: DeepPartial<ICommonInteractions> & {
|
|
88
|
+
enableZoom?: boolean;
|
|
89
|
+
enablePan?: boolean;
|
|
90
|
+
[key: string]: unknown;
|
|
91
|
+
};
|
|
92
|
+
annotations?: (DeepPartial<ICommonAnnotations> & {
|
|
93
|
+
annotationsData?: ILooseBarAnnotation[];
|
|
94
|
+
}) | null;
|
|
95
|
+
};
|
|
96
|
+
export interface IBarChartDataInput extends Omit<IBarChartData, 'options' | 'data'> {
|
|
97
|
+
data?: Omit<DeepPartial<IBarChartData['data']>, 'datasets'> & {
|
|
98
|
+
datasets?: Array<DeepPartial<IBarChartDataset> | object | null>;
|
|
99
|
+
};
|
|
100
|
+
options?: IBarOptionsInput;
|
|
101
|
+
}
|
|
102
|
+
export interface IBarChartProps {
|
|
103
|
+
chart: IBarChartDataInput;
|
|
104
|
+
}
|
|
105
|
+
export interface IBarDefaultProps {
|
|
106
|
+
testId: string;
|
|
107
|
+
controlsPortalId: string;
|
|
108
|
+
data: IBarChartBaseData;
|
|
109
|
+
options: {
|
|
110
|
+
title?: string | string[];
|
|
111
|
+
direction: 'vertical' | 'horizontal';
|
|
112
|
+
axes: IBarAxes;
|
|
113
|
+
additionalAxesOptions: IBarAdditionalAxesOptions;
|
|
114
|
+
chartStyling: IBarStyling;
|
|
115
|
+
tooltip: ICommonTooltip;
|
|
116
|
+
graph: IChartGraph;
|
|
117
|
+
scales?: ICommonScales;
|
|
118
|
+
annotations: {
|
|
119
|
+
showAnnotations: boolean;
|
|
120
|
+
controlAnnotation: boolean;
|
|
121
|
+
annotationsData: ICommonAnnotationsData[];
|
|
122
|
+
};
|
|
123
|
+
legend: IBarLegend;
|
|
124
|
+
chartOptions: ICommonChartOptions;
|
|
125
|
+
interactions: ICommonInteractions;
|
|
126
|
+
dragData: ICommonDragData;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export interface IGenerateBarChartDataset extends ChartDataset<'bar', ICommonDataValue[]> {
|
|
130
|
+
borderColor: string;
|
|
131
|
+
backgroundColor: string | string[];
|
|
132
|
+
borderDash?: number[];
|
|
133
|
+
borderWidth?: number;
|
|
134
|
+
annotationType?: string;
|
|
135
|
+
hideLegend?: boolean;
|
|
136
|
+
displayGroup?: string | number;
|
|
137
|
+
isAnnotation?: boolean;
|
|
138
|
+
annotationIndex?: number;
|
|
139
|
+
}
|
|
140
|
+
export type TGenerateBarChartDatasets = IGenerateBarChartDataset[];
|
|
141
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IBarOptions } from '../bar-chart.interface.ts';
|
|
2
|
+
type ExtendedDisplayOptions = 'auto' | boolean;
|
|
3
|
+
export interface IExtendedDataLabelsOptions {
|
|
4
|
+
display: ExtendedDisplayOptions;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Returns the data labels configuration for a bar chart.
|
|
8
|
+
*/
|
|
9
|
+
declare const getBarChartDataLabels: (options: IBarOptions) => IExtendedDataLabelsOptions;
|
|
10
|
+
export default getBarChartDataLabels;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { ActiveElement, Chart, ChartEvent } from 'chart.js';
|
|
3
|
+
import { IBarDefaultProps, IBarOptions, TGenerateBarChartDatasets } from '../bar-chart.interface';
|
|
4
|
+
import { ICommonHoveredItems } from '../../common/common.interface';
|
|
5
|
+
export interface IGenerateBarChartDatasetsProps {
|
|
6
|
+
datasets: TGenerateBarChartDatasets;
|
|
7
|
+
options: IBarOptions;
|
|
8
|
+
}
|
|
9
|
+
export declare const useBarChartConfig: (_chartRef: RefObject<Chart>, chart: IBarDefaultProps) => {
|
|
10
|
+
generatedDatasets: TGenerateBarChartDatasets;
|
|
11
|
+
onClick: (_evt: ChartEvent, _elements: ActiveElement[], chartInstance: Chart) => void;
|
|
12
|
+
onHover: (evt: ChartEvent, hoveredItems: ICommonHoveredItems[]) => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { Chart } from 'chart.js';
|
|
3
|
+
import { AxisType, ChartHoverMode } from '../../common/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,275 @@
|
|
|
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 as DraggableAnnotationType, DragAxis } from './plugins/annotation-dragger-plugin/enums';
|
|
5
|
+
import { AlignOptions, Position } from './enums';
|
|
6
|
+
import { ILineMarkersAnnotation } from '../line-chart/plugins/line-markers-plugin/types';
|
|
7
|
+
export type TAxisPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
8
|
+
export type DeepPartial<T> = T extends (...args: unknown[]) => unknown ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? {
|
|
9
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
10
|
+
} : T;
|
|
11
|
+
export interface ICommonDataValue {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
label?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ICommonDataset {
|
|
17
|
+
label?: string;
|
|
18
|
+
borderColor?: string;
|
|
19
|
+
backgroundColor?: string | string[];
|
|
20
|
+
borderWidth?: number;
|
|
21
|
+
data: ICommonDataValue[];
|
|
22
|
+
hidden?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ICommonScales extends Partial<Record<string, LinearScaleOptions>> {
|
|
25
|
+
x: LinearScaleOptions;
|
|
26
|
+
y: LinearScaleOptions;
|
|
27
|
+
}
|
|
28
|
+
export interface ICommonAnnotationElement {
|
|
29
|
+
id?: string;
|
|
30
|
+
display: boolean;
|
|
31
|
+
annotationIndex: number;
|
|
32
|
+
label: {
|
|
33
|
+
options: LabelOptions;
|
|
34
|
+
content: string;
|
|
35
|
+
};
|
|
36
|
+
options: {
|
|
37
|
+
id?: string;
|
|
38
|
+
scaleID?: string;
|
|
39
|
+
borderColor?: string;
|
|
40
|
+
borderWidth?: number;
|
|
41
|
+
radius?: number;
|
|
42
|
+
label?: {
|
|
43
|
+
content?: string;
|
|
44
|
+
position?: string;
|
|
45
|
+
enabled?: boolean;
|
|
46
|
+
xAdjust?: number;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface ICoordinates {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
}
|
|
54
|
+
export interface ICalloutLabelConfig {
|
|
55
|
+
enabled?: boolean;
|
|
56
|
+
color?: string;
|
|
57
|
+
font?: string;
|
|
58
|
+
borderColor?: string;
|
|
59
|
+
strokeStyle?: string;
|
|
60
|
+
lineWidth?: number;
|
|
61
|
+
startOffset?: number;
|
|
62
|
+
endOffset?: number;
|
|
63
|
+
margin?: number;
|
|
64
|
+
xValue?: number;
|
|
65
|
+
yValue?: number;
|
|
66
|
+
xAdjust?: number;
|
|
67
|
+
yAdjust?: number;
|
|
68
|
+
onDragStart?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
69
|
+
onDrag?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
70
|
+
onDragEnd?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
71
|
+
}
|
|
72
|
+
export interface IAnnotationLabelConfig {
|
|
73
|
+
backgroundColor?: string;
|
|
74
|
+
display?: boolean;
|
|
75
|
+
position?: string;
|
|
76
|
+
color?: string;
|
|
77
|
+
font?: string;
|
|
78
|
+
borderColor?: string;
|
|
79
|
+
callout?: Record<string, unknown>;
|
|
80
|
+
[key: string]: unknown;
|
|
81
|
+
}
|
|
82
|
+
export interface ICommonAnnotationsData {
|
|
83
|
+
display?: boolean;
|
|
84
|
+
hideLegend?: boolean;
|
|
85
|
+
labelOffsetPx?: number;
|
|
86
|
+
id?: string;
|
|
87
|
+
adjustScaleRange?: boolean;
|
|
88
|
+
annotationAxis?: 'x' | 'y';
|
|
89
|
+
rotation?: number;
|
|
90
|
+
color?: string;
|
|
91
|
+
endValue?: number;
|
|
92
|
+
borderWidth?: number;
|
|
93
|
+
backgroundColor?: string;
|
|
94
|
+
label?: string;
|
|
95
|
+
labelConfig?: IAnnotationLabelConfig;
|
|
96
|
+
type?: DraggableAnnotationType;
|
|
97
|
+
value?: number;
|
|
98
|
+
xMin?: number;
|
|
99
|
+
xMax?: number;
|
|
100
|
+
yMin?: number;
|
|
101
|
+
yMax?: number;
|
|
102
|
+
xValue?: number;
|
|
103
|
+
yValue?: number;
|
|
104
|
+
radius?: number;
|
|
105
|
+
enableDrag?: boolean;
|
|
106
|
+
onDragStart?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
107
|
+
onDrag?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
108
|
+
onDragEnd?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
109
|
+
dragAxis?: DragAxis;
|
|
110
|
+
pointStyle?: string;
|
|
111
|
+
resizable?: boolean;
|
|
112
|
+
dragRange?: {
|
|
113
|
+
x?: [number, number];
|
|
114
|
+
y?: [number, number];
|
|
115
|
+
};
|
|
116
|
+
displayDragCoordinates?: boolean;
|
|
117
|
+
xScaleID?: string;
|
|
118
|
+
yScaleID?: string;
|
|
119
|
+
opacity?: number;
|
|
120
|
+
}
|
|
121
|
+
export interface ICommonGradientColor {
|
|
122
|
+
offset: number;
|
|
123
|
+
color: string;
|
|
124
|
+
}
|
|
125
|
+
export interface ICommonGradient {
|
|
126
|
+
display: boolean;
|
|
127
|
+
gradientColors?: ICommonGradientColor[];
|
|
128
|
+
direction?: GradientDirection;
|
|
129
|
+
}
|
|
130
|
+
export interface ICommonStyling {
|
|
131
|
+
width?: number | string;
|
|
132
|
+
height?: number | string;
|
|
133
|
+
maintainAspectRatio?: boolean;
|
|
134
|
+
staticChartHeight?: boolean;
|
|
135
|
+
performanceMode?: boolean;
|
|
136
|
+
gradient?: ICommonGradient;
|
|
137
|
+
}
|
|
138
|
+
export interface ICommonLegend {
|
|
139
|
+
display: boolean;
|
|
140
|
+
position?: Position;
|
|
141
|
+
align?: AlignOptions;
|
|
142
|
+
}
|
|
143
|
+
export interface ICommonTooltipCallbacks {
|
|
144
|
+
title?: () => void;
|
|
145
|
+
label?: () => void;
|
|
146
|
+
afterLabel?: () => void;
|
|
147
|
+
}
|
|
148
|
+
export interface ICommonTooltip {
|
|
149
|
+
tooltips?: boolean;
|
|
150
|
+
showLabelsInTooltips?: boolean;
|
|
151
|
+
scientificNotation?: boolean;
|
|
152
|
+
callbacks?: ICommonTooltipCallbacks;
|
|
153
|
+
}
|
|
154
|
+
export interface ICommonAdditionalAxesOptions {
|
|
155
|
+
chartScaleType?: 'linear' | 'logarithmic';
|
|
156
|
+
reverse?: boolean;
|
|
157
|
+
beginAtZero?: boolean;
|
|
158
|
+
stepSize?: number;
|
|
159
|
+
stacked?: boolean;
|
|
160
|
+
suggestedMin?: number;
|
|
161
|
+
suggestedMax?: number;
|
|
162
|
+
min?: number;
|
|
163
|
+
max?: number;
|
|
164
|
+
}
|
|
165
|
+
export interface ICommonAnnotation {
|
|
166
|
+
showLabel?: boolean;
|
|
167
|
+
text?: string | string[];
|
|
168
|
+
position?: string;
|
|
169
|
+
fontSize?: number;
|
|
170
|
+
xOffset?: number;
|
|
171
|
+
yOffset?: number;
|
|
172
|
+
maxWidth?: number;
|
|
173
|
+
lineHeight?: number;
|
|
174
|
+
}
|
|
175
|
+
export interface ICommonAnnotations {
|
|
176
|
+
showAnnotations?: boolean;
|
|
177
|
+
controlAnnotation?: boolean;
|
|
178
|
+
enableDragAnnotation?: boolean;
|
|
179
|
+
enableCalloutAnnotation?: boolean;
|
|
180
|
+
lineMarkersAnnotation?: ILineMarkersAnnotation;
|
|
181
|
+
annotationsData?: ICommonAnnotationsData[];
|
|
182
|
+
labelAnnotation?: ICommonAnnotation;
|
|
183
|
+
}
|
|
184
|
+
export interface ICommonGraph {
|
|
185
|
+
lineTension?: number;
|
|
186
|
+
spanGaps?: boolean;
|
|
187
|
+
showDataLabels?: boolean;
|
|
188
|
+
showMinorGridlines?: boolean;
|
|
189
|
+
}
|
|
190
|
+
export interface ICommonInteractions {
|
|
191
|
+
onLegendClick?: (text: string, hidden: boolean) => void;
|
|
192
|
+
onHover?: (event?: ChartEvent, datasetIndex?: number, index?: number, generatedDataset?: any[]) => void;
|
|
193
|
+
onUnhover?: (event?: ChartEvent, datasetIndex?: number, index?: number, generatedDataset?: any[]) => void;
|
|
194
|
+
}
|
|
195
|
+
export interface ICommonCustomLegend<T extends keyof ChartTypeRegistry> {
|
|
196
|
+
customLegendPlugin: Plugin<T> | null;
|
|
197
|
+
customLegendContainerID: string;
|
|
198
|
+
}
|
|
199
|
+
export interface ICommonChartOptions {
|
|
200
|
+
enableZoom?: boolean;
|
|
201
|
+
enablePan?: boolean;
|
|
202
|
+
}
|
|
203
|
+
export interface ICommonDragData {
|
|
204
|
+
enableDragData?: boolean;
|
|
205
|
+
showTooltip?: boolean;
|
|
206
|
+
roundPoints?: boolean;
|
|
207
|
+
dragX?: boolean;
|
|
208
|
+
dragY?: boolean;
|
|
209
|
+
onDragStart?: () => void;
|
|
210
|
+
onDrag?: () => void;
|
|
211
|
+
onDragEnd?: () => void;
|
|
212
|
+
}
|
|
213
|
+
export interface ICommonOptions {
|
|
214
|
+
title?: string | string[];
|
|
215
|
+
chartStyling?: ICommonStyling;
|
|
216
|
+
tooltip?: ICommonTooltip;
|
|
217
|
+
legend?: ICommonLegend;
|
|
218
|
+
chartOptions?: ICommonChartOptions;
|
|
219
|
+
interactions?: ICommonInteractions;
|
|
220
|
+
dragData?: ICommonDragData;
|
|
221
|
+
annotations?: ICommonAnnotations;
|
|
222
|
+
plugins?: {
|
|
223
|
+
lineMarkersPlugin?: {
|
|
224
|
+
enabled?: boolean;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
export interface ICommonData {
|
|
229
|
+
testId?: string;
|
|
230
|
+
data?: {
|
|
231
|
+
labels?: string[];
|
|
232
|
+
datasets?: ICommonDataset[];
|
|
233
|
+
};
|
|
234
|
+
options: ICommonOptions;
|
|
235
|
+
}
|
|
236
|
+
export interface ICommonHoveredItems {
|
|
237
|
+
index: number;
|
|
238
|
+
datasetIndex: number;
|
|
239
|
+
}
|
|
240
|
+
export interface ICommonChartPlugins {
|
|
241
|
+
legend: {
|
|
242
|
+
position: TAxisPosition;
|
|
243
|
+
};
|
|
244
|
+
title: {
|
|
245
|
+
display: boolean;
|
|
246
|
+
text: string;
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
export interface ICommonAxis<PositionType = string> {
|
|
250
|
+
label?: string;
|
|
251
|
+
position?: PositionType;
|
|
252
|
+
color?: string | string[];
|
|
253
|
+
unit?: string;
|
|
254
|
+
gridLines?: boolean;
|
|
255
|
+
stepSize?: number;
|
|
256
|
+
}
|
|
257
|
+
export interface IChartGeneratedLabel {
|
|
258
|
+
text: string;
|
|
259
|
+
fillStyle: string;
|
|
260
|
+
strokeStyle: string;
|
|
261
|
+
index: number;
|
|
262
|
+
}
|
|
263
|
+
export interface IChartLegendItemFilter {
|
|
264
|
+
index: number;
|
|
265
|
+
datasetIndex: number;
|
|
266
|
+
hidden: boolean;
|
|
267
|
+
}
|
|
268
|
+
export interface IChartDataLabelsOptions {
|
|
269
|
+
display?: 'auto' | boolean;
|
|
270
|
+
align?: 'center';
|
|
271
|
+
anchor?: 'center';
|
|
272
|
+
formatter?: (_value: unknown, context: unknown) => unknown;
|
|
273
|
+
}
|
|
274
|
+
export type UnusedParameter = unknown;
|
|
275
|
+
export type TPrimitive = string | number | boolean | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactElement } from '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,87 @@
|
|
|
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
|
+
PIE = "pie",
|
|
19
|
+
DOUGHNUT = "doughnut",
|
|
20
|
+
SCATTER = "scatter"
|
|
21
|
+
}
|
|
22
|
+
export declare enum CursorStyle {
|
|
23
|
+
Pointer = "pointer",
|
|
24
|
+
Initial = "initial",
|
|
25
|
+
Grab = "grab",
|
|
26
|
+
Grabbing = "grabbing",
|
|
27
|
+
Crosshair = "crosshair",
|
|
28
|
+
Move = "move"
|
|
29
|
+
}
|
|
30
|
+
export declare enum ScaleType {
|
|
31
|
+
Category = "category",
|
|
32
|
+
Linear = "linear",
|
|
33
|
+
Logarithmic = "logarithmic"
|
|
34
|
+
}
|
|
35
|
+
export declare enum ChartDirection {
|
|
36
|
+
VERTICAL = "vertical",
|
|
37
|
+
HORIZONTAL = "horizontal"
|
|
38
|
+
}
|
|
39
|
+
export declare enum TooltipLabel {
|
|
40
|
+
Y = "yLabel",
|
|
41
|
+
X = "xLabel"
|
|
42
|
+
}
|
|
43
|
+
export declare enum AlignOptions {
|
|
44
|
+
End = "end",
|
|
45
|
+
Start = "start",
|
|
46
|
+
Center = "center",
|
|
47
|
+
Right = "right",
|
|
48
|
+
Left = "left"
|
|
49
|
+
}
|
|
50
|
+
export declare enum PointType {
|
|
51
|
+
Casing = "casing"
|
|
52
|
+
}
|
|
53
|
+
export declare enum AnnotationType {
|
|
54
|
+
Box = "box",
|
|
55
|
+
Ellipse = "ellipse",
|
|
56
|
+
Line = "line",
|
|
57
|
+
Text = "text",
|
|
58
|
+
Label = "label"
|
|
59
|
+
}
|
|
60
|
+
export declare enum PointStyle {
|
|
61
|
+
Circle = "circle",
|
|
62
|
+
Square = "rect",
|
|
63
|
+
Diamond = "rectRot",
|
|
64
|
+
Triangle = "triangle"
|
|
65
|
+
}
|
|
66
|
+
export declare enum ChartHoverMode {
|
|
67
|
+
Nearest = "nearest"
|
|
68
|
+
}
|
|
69
|
+
export declare enum PanZoomMode {
|
|
70
|
+
X = "x",
|
|
71
|
+
Y = "y",
|
|
72
|
+
XY = "xy",
|
|
73
|
+
Z = "z"
|
|
74
|
+
}
|
|
75
|
+
export declare enum Key {
|
|
76
|
+
Shift = "Shift"
|
|
77
|
+
}
|
|
78
|
+
export declare enum Events {
|
|
79
|
+
Mousemove = "mousemove",
|
|
80
|
+
Mouseout = "mouseout",
|
|
81
|
+
Click = "click",
|
|
82
|
+
Touchstart = "touchstart",
|
|
83
|
+
Touchmove = "touchmove",
|
|
84
|
+
Dblclick = "dblclick"
|
|
85
|
+
}
|
|
86
|
+
export { AnnotationType as DraggableAnnotationType, DragAxis, } from './plugins/annotation-dragger-plugin/enums';
|
|
87
|
+
export { GradientDirection } from './plugins/gradient-background-plugin/enums';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function addTransparency(input: string, alpha: number, out?: 'rgb' | 'hex'): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ICommonAnnotationsData } from '../../common.interface';
|
|
2
|
+
export interface ICalloutCfg extends Record<string, unknown> {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
onlyWhenOverlapping?: boolean;
|
|
5
|
+
margin?: number;
|
|
6
|
+
gapPx?: number;
|
|
7
|
+
minConnectorLengthPx?: number;
|
|
8
|
+
xAdjust?: number;
|
|
9
|
+
yAdjust?: number;
|
|
10
|
+
xValue?: number;
|
|
11
|
+
yValue?: number;
|
|
12
|
+
font?: string | {
|
|
13
|
+
size?: number | string;
|
|
14
|
+
};
|
|
15
|
+
padding?: number | {
|
|
16
|
+
top?: number;
|
|
17
|
+
right?: number;
|
|
18
|
+
bottom?: number;
|
|
19
|
+
left?: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare const isCalloutOverlapping: (ctx: any, refAnnotation: ICommonAnnotationsData, index: number) => boolean;
|
|
23
|
+
export declare const resolveCalloutXValue: (ctx: any, refAnnotation: ICommonAnnotationsData, calloutCfg: ICalloutCfg, index: number) => number | undefined;
|
|
24
|
+
export declare const resolveCalloutYValue: (ctx: any, refAnnotation: ICommonAnnotationsData, calloutCfg: ICalloutCfg, index: number) => number | undefined;
|
|
25
|
+
export declare const isCalloutAnchorInChartArea: (ctx: any, refAnnotation: ICommonAnnotationsData, margin?: number) => boolean;
|
|
@@ -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 {};
|