@oliasoft-open-source/charts-library 5.13.0 → 5.14.0-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +11 -12
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defaultTranslations } from '../../constants/default-translations';
|
|
2
|
+
/**
|
|
3
|
+
* Merges custom getTranslations with the default getTranslations.
|
|
4
|
+
* If a custom translation is provided for a key, it will override the default one.
|
|
5
|
+
* @param {object} translations - Custom getTranslations.
|
|
6
|
+
* @returns {object} - The resulting getTranslations object, containing both default and custom getTranslations.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getTranslations: (translations?: Partial<Record<keyof typeof defaultTranslations, string>>) => {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ChartEvent } from 'chart.js';
|
|
2
|
+
import { ICommonTooltip } from '../common/common.interface';
|
|
3
|
+
import { AlignOptions, Position } from '../common/enums';
|
|
4
|
+
import { IPieChartDataset, IPieOptions } from './pie-chart.interface';
|
|
5
|
+
export interface IDefaultChartStyling {
|
|
6
|
+
width?: number | string;
|
|
7
|
+
height?: number | string;
|
|
8
|
+
maintainAspectRatio: boolean;
|
|
9
|
+
staticChartHeight: boolean;
|
|
10
|
+
performanceMode: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface IDefaultPieGraph {
|
|
13
|
+
showDataLabels: boolean;
|
|
14
|
+
stacked: boolean;
|
|
15
|
+
cutout: number | string;
|
|
16
|
+
}
|
|
17
|
+
interface IDefaultPieLegend {
|
|
18
|
+
display: boolean;
|
|
19
|
+
useDataset: boolean;
|
|
20
|
+
position: Position;
|
|
21
|
+
align: AlignOptions;
|
|
22
|
+
}
|
|
23
|
+
interface IDefaultChartOptions {
|
|
24
|
+
enableZoom: boolean;
|
|
25
|
+
enablePan: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface IDefaultInteractions {
|
|
28
|
+
onLegendClick?: (text: string, hidden: boolean) => void;
|
|
29
|
+
onHover?: (event?: ChartEvent, datasetIndex?: number, index?: number, generatedDataset?: IPieChartDataset[]) => void;
|
|
30
|
+
onUnhover?: (event?: ChartEvent, datasetIndex?: number, index?: number, generatedDataset?: IPieChartDataset[]) => void;
|
|
31
|
+
}
|
|
32
|
+
interface IDefaultChartData {
|
|
33
|
+
labels: string[];
|
|
34
|
+
datasets: IPieChartDataset[];
|
|
35
|
+
}
|
|
36
|
+
interface IDefaultPieOptions extends IPieOptions {
|
|
37
|
+
title: string | string[];
|
|
38
|
+
chartStyling: IDefaultChartStyling;
|
|
39
|
+
tooltip: ICommonTooltip;
|
|
40
|
+
graph: IDefaultPieGraph;
|
|
41
|
+
legend: IDefaultPieLegend;
|
|
42
|
+
chartOptions: IDefaultChartOptions;
|
|
43
|
+
interactions: IDefaultInteractions;
|
|
44
|
+
}
|
|
45
|
+
export interface IPieChartDefaultProps {
|
|
46
|
+
testId: string | null;
|
|
47
|
+
data: IDefaultChartData;
|
|
48
|
+
options: IDefaultPieOptions;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { IChartDataLabelsOptions, IChartGeneratedLabel, IChartLegendItemFilter, ICommonData, ICommonDataValue, ICommonDataset, ICommonLegend, ICommonOptions } from '../common/common.interface';
|
|
2
|
+
export interface IPieLegend extends ICommonLegend {
|
|
3
|
+
useDataset?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface IPieGraph {
|
|
6
|
+
showDataLabels?: boolean;
|
|
7
|
+
stacked?: boolean;
|
|
8
|
+
cutout?: number | string;
|
|
9
|
+
}
|
|
10
|
+
export interface IPieOptions extends ICommonOptions {
|
|
11
|
+
graph?: IPieGraph;
|
|
12
|
+
legend?: IPieLegend;
|
|
13
|
+
axes?: unknown;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface IPieDataValue extends ICommonDataValue {
|
|
17
|
+
label: string;
|
|
18
|
+
borderWidth: string | number;
|
|
19
|
+
value: number;
|
|
20
|
+
backgroundColor?: string | string[];
|
|
21
|
+
borderColor?: string;
|
|
22
|
+
labels: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface IPieChartDataset extends ICommonDataset {
|
|
25
|
+
data: IPieDataValue[];
|
|
26
|
+
hideLegend?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface IPieData {
|
|
29
|
+
labels?: string[];
|
|
30
|
+
datasets?: IPieChartDataset[];
|
|
31
|
+
xUnit?: string;
|
|
32
|
+
yUnit?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface IPieChartData extends ICommonData {
|
|
35
|
+
data: IPieData;
|
|
36
|
+
options: IPieOptions;
|
|
37
|
+
}
|
|
38
|
+
export interface IPieChartProps {
|
|
39
|
+
chart: IPieChartData;
|
|
40
|
+
testId?: string | null;
|
|
41
|
+
}
|
|
42
|
+
export type IPieGeneratedLabel = IChartGeneratedLabel;
|
|
43
|
+
export type IPieLegendItemFilter = IChartLegendItemFilter;
|
|
44
|
+
export type IPiesDataLabelsOptions = IChartDataLabelsOptions;
|
|
45
|
+
export interface IGeneratedPieChartDataset {
|
|
46
|
+
label: string;
|
|
47
|
+
backgroundColor: string[];
|
|
48
|
+
borderColor: string;
|
|
49
|
+
borderWidth: number;
|
|
50
|
+
borderDash: number[];
|
|
51
|
+
annotationType?: string;
|
|
52
|
+
data: IPieDataValue[];
|
|
53
|
+
hideLegend?: boolean;
|
|
54
|
+
displayGroup?: string | number;
|
|
55
|
+
isAnnotation?: boolean;
|
|
56
|
+
annotationIndex?: number;
|
|
57
|
+
}
|
|
58
|
+
export type TGeneratedPieChartDatasets = IGeneratedPieChartDataset[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ActiveElement, Chart, Chart as ChartJS, ChartEvent, LegendItem, Plugin, TooltipItem } from 'chart.js';
|
|
2
|
+
import { IGeneratedPieChartDataset, IPieDataValue, IPiesDataLabelsOptions } from './pie-chart.interface';
|
|
3
|
+
import { IPieChartDefaultProps } from './pie-chart-defalut-props.interface';
|
|
4
|
+
import { UnusedParameter } from '../common/common.interface';
|
|
5
|
+
interface ILegendPlugin extends Plugin {
|
|
6
|
+
chart?: Chart;
|
|
7
|
+
}
|
|
8
|
+
export declare const usePieChartConfig: (chart: IPieChartDefaultProps) => {
|
|
9
|
+
generatedDatasets: IGeneratedPieChartDataset[] | {
|
|
10
|
+
borderWidth: number;
|
|
11
|
+
borderColor: string;
|
|
12
|
+
backgroundColor: string | string[];
|
|
13
|
+
data: IPieDataValue[];
|
|
14
|
+
hideLegend?: boolean;
|
|
15
|
+
label?: string;
|
|
16
|
+
hidden?: boolean;
|
|
17
|
+
}[];
|
|
18
|
+
getTitle: () => {
|
|
19
|
+
display: boolean;
|
|
20
|
+
text: string | string[];
|
|
21
|
+
} | {
|
|
22
|
+
display?: undefined;
|
|
23
|
+
text?: undefined;
|
|
24
|
+
};
|
|
25
|
+
legendClick: (_: UnusedParameter, legendItem?: LegendItem, legend?: ILegendPlugin) => void;
|
|
26
|
+
onClick: (_evt: ChartEvent, _elements: ActiveElement[], chartInstance: ChartJS) => void;
|
|
27
|
+
onHover: (evt: ChartEvent, hoveredItems: ActiveElement[]) => void;
|
|
28
|
+
getDatalabels: () => IPiesDataLabelsOptions;
|
|
29
|
+
getLegend: () => object;
|
|
30
|
+
getToolTips: () => {
|
|
31
|
+
callbacks: {
|
|
32
|
+
title: (tooltipItem: TooltipItem<any>[]) => string;
|
|
33
|
+
label: (tooltipItem: TooltipItem<any>) => string;
|
|
34
|
+
};
|
|
35
|
+
padding: number;
|
|
36
|
+
boxWidth: number;
|
|
37
|
+
boxHeight: number;
|
|
38
|
+
boxPadding: number;
|
|
39
|
+
usePointStyle: boolean;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { ActiveElement, AnimationSpec, Chart, ChartEvent } from 'chart.js';
|
|
2
|
+
import { IScatterChartDefaultProps } from '../scatter-chart-default-props.interface';
|
|
3
|
+
import { MutableRefObject } from 'react';
|
|
4
|
+
import { ICommonHoveredItems } from '../../common/common.interface';
|
|
5
|
+
import { TGeneratedScatterChartDatasets } from '../scatter-chart.interface';
|
|
6
|
+
export declare const useScatterChartConfig: (chart: IScatterChartDefaultProps, chartRef: MutableRefObject<Chart | null>) => {
|
|
7
|
+
generatedDatasets: TGeneratedScatterChartDatasets;
|
|
8
|
+
scatterOptions: {
|
|
9
|
+
interactions: {
|
|
10
|
+
onLegendClick: (_: import('../../common/common.interface').UnusedParameter, legendItem: import('chart.js').LegendItem) => void;
|
|
11
|
+
onHover: (evt: ChartEvent, hoveredItems: ICommonHoveredItems[]) => void;
|
|
12
|
+
};
|
|
13
|
+
scales: {
|
|
14
|
+
x: {
|
|
15
|
+
type: "linear";
|
|
16
|
+
position: import('chart.js').CartesianScaleOptions["position"];
|
|
17
|
+
beginAtZero: boolean | undefined;
|
|
18
|
+
reverse: boolean | undefined;
|
|
19
|
+
suggestedMax: number | undefined;
|
|
20
|
+
suggestedMin: number | undefined;
|
|
21
|
+
min: number | undefined;
|
|
22
|
+
max: number | undefined;
|
|
23
|
+
title: {
|
|
24
|
+
font: {
|
|
25
|
+
size: number;
|
|
26
|
+
} | {
|
|
27
|
+
family?: string | undefined;
|
|
28
|
+
size: number;
|
|
29
|
+
style?: "initial" | "normal" | "italic" | "oblique" | "inherit" | undefined;
|
|
30
|
+
weight?: number | "bold" | "normal" | "lighter" | "bolder" | null | undefined;
|
|
31
|
+
lineHeight?: string | number | undefined;
|
|
32
|
+
} | {
|
|
33
|
+
size: number;
|
|
34
|
+
} | {
|
|
35
|
+
family?: import('chart.js').Scriptable<string | undefined, import('chart.js').ScriptableCartesianScaleContext>;
|
|
36
|
+
size: number | ((ctx: import('chart.js').ScriptableCartesianScaleContext, options: import('node_modules/chart.js/dist/types/basic').AnyObject) => number | undefined);
|
|
37
|
+
style?: import('chart.js').Scriptable<"initial" | "normal" | "italic" | "oblique" | "inherit" | undefined, import('chart.js').ScriptableCartesianScaleContext>;
|
|
38
|
+
weight?: import('chart.js').Scriptable<number | "bold" | "normal" | "lighter" | "bolder" | null | undefined, import('chart.js').ScriptableCartesianScaleContext>;
|
|
39
|
+
lineHeight?: import('chart.js').Scriptable<string | number | undefined, import('chart.js').ScriptableCartesianScaleContext>;
|
|
40
|
+
};
|
|
41
|
+
display: boolean;
|
|
42
|
+
align?: import('chart.js').Align | undefined;
|
|
43
|
+
text: string | string[] | undefined;
|
|
44
|
+
color?: import('chart.js').Color | undefined;
|
|
45
|
+
padding: number | {
|
|
46
|
+
top: number;
|
|
47
|
+
bottom: number;
|
|
48
|
+
y: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
ticks: {
|
|
52
|
+
font: {
|
|
53
|
+
size: number;
|
|
54
|
+
} | {
|
|
55
|
+
family?: string | undefined;
|
|
56
|
+
size: number;
|
|
57
|
+
style?: "initial" | "normal" | "italic" | "oblique" | "inherit" | undefined;
|
|
58
|
+
weight?: number | "bold" | "normal" | "lighter" | "bolder" | null | undefined;
|
|
59
|
+
lineHeight?: string | number | undefined;
|
|
60
|
+
} | {
|
|
61
|
+
size: number;
|
|
62
|
+
} | {
|
|
63
|
+
family?: import('chart.js').Scriptable<string | undefined, import('chart.js').ScriptableScaleContext>;
|
|
64
|
+
size: number | ((ctx: import('chart.js').ScriptableScaleContext, options: import('node_modules/chart.js/dist/types/basic').AnyObject) => number | undefined);
|
|
65
|
+
style?: import('chart.js').Scriptable<"initial" | "normal" | "italic" | "oblique" | "inherit" | undefined, import('chart.js').ScriptableScaleContext>;
|
|
66
|
+
weight?: import('chart.js').Scriptable<number | "bold" | "normal" | "lighter" | "bolder" | null | undefined, import('chart.js').ScriptableScaleContext>;
|
|
67
|
+
lineHeight?: import('chart.js').Scriptable<string | number | undefined, import('chart.js').ScriptableScaleContext>;
|
|
68
|
+
};
|
|
69
|
+
backdropColor?: import('chart.js').Scriptable<import('chart.js').Color, import('chart.js').ScriptableScaleContext> | undefined;
|
|
70
|
+
backdropPadding?: number | import('chart.js').ChartArea | undefined;
|
|
71
|
+
callback?: ((this: import('chart.js').Scale, tickValue: number | string, index: number, ticks: import('chart.js').Tick[]) => string | string[] | number | number[] | null | undefined) | undefined;
|
|
72
|
+
display?: boolean | undefined;
|
|
73
|
+
color?: import('chart.js').ScriptableAndArray<import('chart.js').Color, import('chart.js').ScriptableScaleContext> | undefined;
|
|
74
|
+
padding?: number | undefined;
|
|
75
|
+
showLabelBackdrop?: import('chart.js').Scriptable<boolean, import('chart.js').ScriptableScaleContext> | undefined;
|
|
76
|
+
textStrokeColor?: import('chart.js').Scriptable<import('chart.js').Color, import('chart.js').ScriptableScaleContext> | undefined;
|
|
77
|
+
textStrokeWidth?: import('chart.js').Scriptable<number, import('chart.js').ScriptableScaleContext> | undefined;
|
|
78
|
+
z?: number | undefined;
|
|
79
|
+
major?: {
|
|
80
|
+
enabled: boolean;
|
|
81
|
+
} | undefined;
|
|
82
|
+
sampleSize?: number | undefined;
|
|
83
|
+
align?: import('chart.js').Align | "inner" | undefined;
|
|
84
|
+
autoSkip?: boolean | undefined;
|
|
85
|
+
autoSkipPadding?: number | undefined;
|
|
86
|
+
crossAlign?: "center" | "near" | "far" | undefined;
|
|
87
|
+
includeBounds: boolean;
|
|
88
|
+
labelOffset?: number | undefined;
|
|
89
|
+
minRotation?: number | undefined;
|
|
90
|
+
maxRotation?: number | undefined;
|
|
91
|
+
mirror?: boolean | undefined;
|
|
92
|
+
maxTicksLimit?: number | undefined;
|
|
93
|
+
format?: Intl.NumberFormatOptions | undefined;
|
|
94
|
+
precision?: number | undefined;
|
|
95
|
+
stepSize: number | undefined;
|
|
96
|
+
count?: number | undefined;
|
|
97
|
+
};
|
|
98
|
+
grid: {};
|
|
99
|
+
};
|
|
100
|
+
y: {
|
|
101
|
+
type: "linear";
|
|
102
|
+
position: import('chart.js').CartesianScaleOptions["position"];
|
|
103
|
+
beginAtZero: boolean | undefined;
|
|
104
|
+
reverse: boolean | undefined;
|
|
105
|
+
suggestedMax: number | undefined;
|
|
106
|
+
suggestedMin: number | undefined;
|
|
107
|
+
min: number | undefined;
|
|
108
|
+
max: number | undefined;
|
|
109
|
+
title: {
|
|
110
|
+
font: {
|
|
111
|
+
size: number;
|
|
112
|
+
} | {
|
|
113
|
+
family?: string | undefined;
|
|
114
|
+
size: number;
|
|
115
|
+
style?: "initial" | "normal" | "italic" | "oblique" | "inherit" | undefined;
|
|
116
|
+
weight?: number | "bold" | "normal" | "lighter" | "bolder" | null | undefined;
|
|
117
|
+
lineHeight?: string | number | undefined;
|
|
118
|
+
} | {
|
|
119
|
+
size: number;
|
|
120
|
+
} | {
|
|
121
|
+
family?: import('chart.js').Scriptable<string | undefined, import('chart.js').ScriptableCartesianScaleContext>;
|
|
122
|
+
size: number | ((ctx: import('chart.js').ScriptableCartesianScaleContext, options: import('node_modules/chart.js/dist/types/basic').AnyObject) => number | undefined);
|
|
123
|
+
style?: import('chart.js').Scriptable<"initial" | "normal" | "italic" | "oblique" | "inherit" | undefined, import('chart.js').ScriptableCartesianScaleContext>;
|
|
124
|
+
weight?: import('chart.js').Scriptable<number | "bold" | "normal" | "lighter" | "bolder" | null | undefined, import('chart.js').ScriptableCartesianScaleContext>;
|
|
125
|
+
lineHeight?: import('chart.js').Scriptable<string | number | undefined, import('chart.js').ScriptableCartesianScaleContext>;
|
|
126
|
+
};
|
|
127
|
+
display: boolean;
|
|
128
|
+
align?: import('chart.js').Align | undefined;
|
|
129
|
+
text: string | string[] | undefined;
|
|
130
|
+
color?: import('chart.js').Color | undefined;
|
|
131
|
+
padding: number | {
|
|
132
|
+
top: number;
|
|
133
|
+
bottom: number;
|
|
134
|
+
y: number;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
ticks: {
|
|
138
|
+
font: {
|
|
139
|
+
size: number;
|
|
140
|
+
} | {
|
|
141
|
+
family?: string | undefined;
|
|
142
|
+
size: number;
|
|
143
|
+
style?: "initial" | "normal" | "italic" | "oblique" | "inherit" | undefined;
|
|
144
|
+
weight?: number | "bold" | "normal" | "lighter" | "bolder" | null | undefined;
|
|
145
|
+
lineHeight?: string | number | undefined;
|
|
146
|
+
} | {
|
|
147
|
+
size: number;
|
|
148
|
+
} | {
|
|
149
|
+
family?: import('chart.js').Scriptable<string | undefined, import('chart.js').ScriptableScaleContext>;
|
|
150
|
+
size: number | ((ctx: import('chart.js').ScriptableScaleContext, options: import('node_modules/chart.js/dist/types/basic').AnyObject) => number | undefined);
|
|
151
|
+
style?: import('chart.js').Scriptable<"initial" | "normal" | "italic" | "oblique" | "inherit" | undefined, import('chart.js').ScriptableScaleContext>;
|
|
152
|
+
weight?: import('chart.js').Scriptable<number | "bold" | "normal" | "lighter" | "bolder" | null | undefined, import('chart.js').ScriptableScaleContext>;
|
|
153
|
+
lineHeight?: import('chart.js').Scriptable<string | number | undefined, import('chart.js').ScriptableScaleContext>;
|
|
154
|
+
};
|
|
155
|
+
backdropColor?: import('chart.js').Scriptable<import('chart.js').Color, import('chart.js').ScriptableScaleContext> | undefined;
|
|
156
|
+
backdropPadding?: number | import('chart.js').ChartArea | undefined;
|
|
157
|
+
callback?: ((this: import('chart.js').Scale, tickValue: number | string, index: number, ticks: import('chart.js').Tick[]) => string | string[] | number | number[] | null | undefined) | undefined;
|
|
158
|
+
display?: boolean | undefined;
|
|
159
|
+
color?: import('chart.js').ScriptableAndArray<import('chart.js').Color, import('chart.js').ScriptableScaleContext> | undefined;
|
|
160
|
+
padding?: number | undefined;
|
|
161
|
+
showLabelBackdrop?: import('chart.js').Scriptable<boolean, import('chart.js').ScriptableScaleContext> | undefined;
|
|
162
|
+
textStrokeColor?: import('chart.js').Scriptable<import('chart.js').Color, import('chart.js').ScriptableScaleContext> | undefined;
|
|
163
|
+
textStrokeWidth?: import('chart.js').Scriptable<number, import('chart.js').ScriptableScaleContext> | undefined;
|
|
164
|
+
z?: number | undefined;
|
|
165
|
+
major?: {
|
|
166
|
+
enabled: boolean;
|
|
167
|
+
} | undefined;
|
|
168
|
+
sampleSize?: number | undefined;
|
|
169
|
+
align?: import('chart.js').Align | "inner" | undefined;
|
|
170
|
+
autoSkip?: boolean | undefined;
|
|
171
|
+
autoSkipPadding?: number | undefined;
|
|
172
|
+
crossAlign?: "center" | "near" | "far" | undefined;
|
|
173
|
+
includeBounds: boolean;
|
|
174
|
+
labelOffset?: number | undefined;
|
|
175
|
+
minRotation?: number | undefined;
|
|
176
|
+
maxRotation?: number | undefined;
|
|
177
|
+
mirror?: boolean | undefined;
|
|
178
|
+
maxTicksLimit?: number | undefined;
|
|
179
|
+
format?: Intl.NumberFormatOptions | undefined;
|
|
180
|
+
precision?: number | undefined;
|
|
181
|
+
stepSize: number | undefined;
|
|
182
|
+
count?: number | undefined;
|
|
183
|
+
};
|
|
184
|
+
grid: {};
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
animation: Partial<AnimationSpec<"scatter">>;
|
|
188
|
+
plugins: {
|
|
189
|
+
legend: {
|
|
190
|
+
display: boolean;
|
|
191
|
+
events: never[];
|
|
192
|
+
position: any;
|
|
193
|
+
align: "center" | "start" | "end";
|
|
194
|
+
labels: {
|
|
195
|
+
boxHeight: number;
|
|
196
|
+
boxWidth: number | undefined;
|
|
197
|
+
usePointStyle: boolean | undefined;
|
|
198
|
+
};
|
|
199
|
+
onClick: (_: import('../../common/common.interface').UnusedParameter, legendItem: import('chart.js').LegendItem) => void;
|
|
200
|
+
};
|
|
201
|
+
customLegendPlugin: {
|
|
202
|
+
htmlLegend: any;
|
|
203
|
+
};
|
|
204
|
+
title: {
|
|
205
|
+
display: boolean;
|
|
206
|
+
text: string | string[];
|
|
207
|
+
} | {
|
|
208
|
+
display?: undefined;
|
|
209
|
+
text?: undefined;
|
|
210
|
+
};
|
|
211
|
+
annotation: {
|
|
212
|
+
annotations: {};
|
|
213
|
+
};
|
|
214
|
+
chartAreaBorder: {
|
|
215
|
+
borderColor: string;
|
|
216
|
+
};
|
|
217
|
+
datalabels: {
|
|
218
|
+
display: boolean;
|
|
219
|
+
};
|
|
220
|
+
tooltip: {
|
|
221
|
+
enabled: boolean;
|
|
222
|
+
callbacks: {
|
|
223
|
+
title: (tooltipItems: import('chart.js').TooltipItem<"scatter">[]) => string | undefined;
|
|
224
|
+
label: (tooltipItems: import('../utils/get-tooltip-config').IScatterTooltipItem) => string;
|
|
225
|
+
};
|
|
226
|
+
backgroundColor: string;
|
|
227
|
+
displayColors: boolean;
|
|
228
|
+
padding: number;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
width?: number | string;
|
|
232
|
+
height?: number | string;
|
|
233
|
+
maintainAspectRatio: boolean;
|
|
234
|
+
staticChartHeight: boolean;
|
|
235
|
+
performanceMode: boolean;
|
|
236
|
+
onClick: (_evt: ChartEvent, _elements: ActiveElement[], chartInstance: Chart) => void;
|
|
237
|
+
onHover: (evt: ChartEvent, hoveredItems: ICommonHoveredItems[]) => void;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ChartEvent } from 'chart.js';
|
|
2
|
+
import { ICommonAdditionalAxesOptions, ICommonAnnotations, ICommonCustomLegend, ICommonLegend, ICommonScales } from '../common/common.interface';
|
|
3
|
+
import { ChartDirection } from '../common/enums';
|
|
4
|
+
import { IScatterAxes, IScatterChartDataset } from './scatter-chart.interface';
|
|
5
|
+
export interface IDefaultChartStyling {
|
|
6
|
+
width?: number | string;
|
|
7
|
+
height?: number | string;
|
|
8
|
+
maintainAspectRatio: boolean;
|
|
9
|
+
staticChartHeight: boolean;
|
|
10
|
+
performanceMode: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface IDefaultTooltip {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
tooltips: boolean;
|
|
15
|
+
showLabelsInTooltips: boolean;
|
|
16
|
+
backgroundColor: string;
|
|
17
|
+
displayColors: boolean;
|
|
18
|
+
scientificNotation: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface IDefaultScatterGraph {
|
|
21
|
+
showMinorGridlines: boolean;
|
|
22
|
+
showDataLabels: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface IDefaultScatterLegend extends ICommonLegend {
|
|
25
|
+
customLegend?: ICommonCustomLegend<any>;
|
|
26
|
+
}
|
|
27
|
+
interface IDefaultChartOptions {
|
|
28
|
+
enableZoom: boolean;
|
|
29
|
+
enablePan: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface IDefaultInteractions {
|
|
32
|
+
onLegendClick?: (text: string, hidden: boolean) => void;
|
|
33
|
+
onHover?: (event?: ChartEvent, datasetIndex?: number, index?: number, generatedDataset?: IScatterChartDataset[]) => void;
|
|
34
|
+
onUnhover?: (event?: ChartEvent, datasetIndex?: number, index?: number, generatedDataset?: IScatterChartDataset[]) => void;
|
|
35
|
+
onAnimationComplete?: () => void;
|
|
36
|
+
}
|
|
37
|
+
interface IDefaultChartData {
|
|
38
|
+
labels: string[];
|
|
39
|
+
datasets: IScatterChartDataset[];
|
|
40
|
+
}
|
|
41
|
+
export interface IDefaultScatterOptions {
|
|
42
|
+
title: string | string[];
|
|
43
|
+
chartStyling: IDefaultChartStyling;
|
|
44
|
+
tooltip: IDefaultTooltip;
|
|
45
|
+
graph: IDefaultScatterGraph;
|
|
46
|
+
axes: IScatterAxes;
|
|
47
|
+
scales?: ICommonScales;
|
|
48
|
+
additionalAxesOptions: ICommonAdditionalAxesOptions;
|
|
49
|
+
legend: IDefaultScatterLegend;
|
|
50
|
+
chartOptions: IDefaultChartOptions;
|
|
51
|
+
interactions: IDefaultInteractions;
|
|
52
|
+
annotations?: ICommonAnnotations;
|
|
53
|
+
direction: ChartDirection;
|
|
54
|
+
}
|
|
55
|
+
export interface IScatterChartDefaultProps {
|
|
56
|
+
testId: string | null;
|
|
57
|
+
data: IDefaultChartData;
|
|
58
|
+
options: {
|
|
59
|
+
title: string | string[];
|
|
60
|
+
chartStyling: IDefaultChartStyling;
|
|
61
|
+
tooltip: IDefaultTooltip;
|
|
62
|
+
graph: IDefaultScatterGraph;
|
|
63
|
+
axes: IScatterAxes;
|
|
64
|
+
additionalAxesOptions: ICommonAdditionalAxesOptions;
|
|
65
|
+
legend: IDefaultScatterLegend;
|
|
66
|
+
chartOptions: IDefaultChartOptions;
|
|
67
|
+
interactions: IDefaultInteractions;
|
|
68
|
+
annotations?: ICommonAnnotations;
|
|
69
|
+
direction: ChartDirection;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IScatterChartDefaultProps } from './scatter-chart-default-props.interface';
|
|
2
|
+
import { IScatterChartProps, IScatterOptionsInput } from './scatter-chart.interface';
|
|
3
|
+
export declare const normalizeScatterOptions: (options?: IScatterOptionsInput) => IScatterChartDefaultProps["options"];
|
|
4
|
+
export declare const getDefaultProps: (props: IScatterChartProps) => IScatterChartDefaultProps;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { DeepPartial, IChartDataLabelsOptions, IChartGeneratedLabel, IChartLegendItemFilter, ICommonAdditionalAxesOptions, ICommonAnnotations, ICommonAnnotationsData, ICommonAxis, ICommonData, ICommonDataValue, ICommonDataset, ICommonLegend, ICommonOptions, ICommonScales } from '../common/common.interface';
|
|
2
|
+
import { ChartDirection } from '../common/enums.ts';
|
|
3
|
+
export interface IScatterLegend extends ICommonLegend {
|
|
4
|
+
useDataset?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface IScatterGraph {
|
|
7
|
+
showMinorGridlines?: boolean;
|
|
8
|
+
showDataLabels?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface IScatterTooltip {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
tooltips?: boolean;
|
|
13
|
+
showLabelsInTooltips: boolean;
|
|
14
|
+
backgroundColor?: string;
|
|
15
|
+
displayColors?: boolean;
|
|
16
|
+
scientificNotation?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface IScatterAxes {
|
|
19
|
+
x: ICommonAxis<'top' | 'bottom'>[];
|
|
20
|
+
y: ICommonAxis<'left' | 'right'>[];
|
|
21
|
+
[key: string]: ICommonAxis[];
|
|
22
|
+
}
|
|
23
|
+
export interface IScatterOptions extends ICommonOptions {
|
|
24
|
+
graph?: IScatterGraph;
|
|
25
|
+
legend?: IScatterLegend;
|
|
26
|
+
axes?: IScatterAxes;
|
|
27
|
+
scales?: ICommonScales;
|
|
28
|
+
additionalAxesOptions?: ICommonAdditionalAxesOptions;
|
|
29
|
+
direction?: ChartDirection;
|
|
30
|
+
}
|
|
31
|
+
export interface IScatterDataValue extends ICommonDataValue {
|
|
32
|
+
label?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface IScatterChartDataset extends ICommonDataset {
|
|
35
|
+
data: IScatterDataValue[];
|
|
36
|
+
hideLegend?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface IScatterData {
|
|
39
|
+
labels?: string[];
|
|
40
|
+
datasets?: IScatterChartDataset[];
|
|
41
|
+
xUnit?: string;
|
|
42
|
+
yUnit?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface IScatterChartData extends ICommonData {
|
|
45
|
+
data: IScatterData;
|
|
46
|
+
options: IScatterOptions;
|
|
47
|
+
}
|
|
48
|
+
type ILooseScatterAxis = DeepPartial<ICommonAxis<string>> & {
|
|
49
|
+
[key: string]: unknown;
|
|
50
|
+
};
|
|
51
|
+
type ILooseScatterAnnotation = DeepPartial<ICommonAnnotationsData> & {
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
} & {
|
|
54
|
+
annotationAxis?: string;
|
|
55
|
+
type?: string;
|
|
56
|
+
value?: number | string | null;
|
|
57
|
+
};
|
|
58
|
+
export type IScatterOptionsInput = Omit<DeepPartial<IScatterOptions>, 'title' | 'direction' | 'axes' | 'legend' | 'chartStyling' | 'interactions' | 'annotations'> & {
|
|
59
|
+
[key: string]: unknown;
|
|
60
|
+
title?: unknown;
|
|
61
|
+
direction?: string;
|
|
62
|
+
axes?: {
|
|
63
|
+
x?: ILooseScatterAxis[];
|
|
64
|
+
y?: ILooseScatterAxis[];
|
|
65
|
+
[key: string]: ILooseScatterAxis[] | undefined;
|
|
66
|
+
};
|
|
67
|
+
legend?: Omit<DeepPartial<IScatterLegend>, 'position' | 'align'> & {
|
|
68
|
+
position?: string;
|
|
69
|
+
align?: string;
|
|
70
|
+
[key: string]: unknown;
|
|
71
|
+
};
|
|
72
|
+
chartStyling?: {
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
};
|
|
75
|
+
interactions?: DeepPartial<ICommonOptions['interactions']> & {
|
|
76
|
+
enableZoom?: boolean;
|
|
77
|
+
enablePan?: boolean;
|
|
78
|
+
[key: string]: unknown;
|
|
79
|
+
};
|
|
80
|
+
annotations?: (DeepPartial<ICommonAnnotations> & {
|
|
81
|
+
annotationsData?: ILooseScatterAnnotation[];
|
|
82
|
+
}) | null;
|
|
83
|
+
};
|
|
84
|
+
export interface IScatterChartDataInput extends Omit<IScatterChartData, 'data' | 'options'> {
|
|
85
|
+
data?: Omit<DeepPartial<IScatterChartData['data']>, 'datasets'> & {
|
|
86
|
+
datasets?: Array<DeepPartial<IScatterChartDataset> | object | null>;
|
|
87
|
+
};
|
|
88
|
+
options?: IScatterOptionsInput;
|
|
89
|
+
}
|
|
90
|
+
export interface IScatterChartProps {
|
|
91
|
+
chart: IScatterChartDataInput;
|
|
92
|
+
testId?: string | null;
|
|
93
|
+
}
|
|
94
|
+
export type IScatterGeneratedLabel = IChartGeneratedLabel;
|
|
95
|
+
export type IScatterLegendItemFilter = IChartLegendItemFilter;
|
|
96
|
+
export type IScatterDataLabelsOptions = IChartDataLabelsOptions;
|
|
97
|
+
export interface IGeneratedScatterChartDataset {
|
|
98
|
+
label: string;
|
|
99
|
+
backgroundColor: string[];
|
|
100
|
+
borderColor: string;
|
|
101
|
+
borderWidth: number;
|
|
102
|
+
borderDash: number[];
|
|
103
|
+
annotationType?: string;
|
|
104
|
+
data: IScatterDataValue[];
|
|
105
|
+
hideLegend?: boolean;
|
|
106
|
+
displayGroup?: string | number;
|
|
107
|
+
isAnnotation?: boolean;
|
|
108
|
+
annotationIndex?: number;
|
|
109
|
+
}
|
|
110
|
+
export type TGeneratedScatterChartDatasets = IGeneratedScatterChartDataset[];
|
|
111
|
+
export {};
|