@oliasoft-open-source/charts-library 4.0.4 → 4.1.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.js +961 -866
- package/dist/index.js.map +1 -1
- package/dist/src/components/bar-chart/bar-chart.d.ts +2 -2
- package/dist/src/components/bar-chart/bar-chart.interface.d.ts +16 -2
- package/dist/src/components/bar-chart/utils/use-bar-chart-config.d.ts +7 -18
- package/dist/src/components/common/common.interface.d.ts +21 -0
- package/dist/src/components/common/enums.d.ts +5 -0
- package/dist/src/components/common/helpers/chart-utils.d.ts +1 -1
- package/dist/src/components/common/helpers/download-pgn.d.ts +4 -0
- package/dist/src/components/common/helpers/get-chart-annotation.d.ts +52 -20
- 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/{line-chart → common}/hooks/use-legend-state.d.ts +6 -12
- package/dist/src/components/common/hooks/use-legend.d.ts +5 -0
- package/dist/src/components/common/legend-component/legend-interface.d.ts +46 -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.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 +12 -0
- package/dist/src/components/common/legend-component/state/legend-state-reducer.d.ts +26 -0
- package/dist/src/components/{line-chart/legend → common/legend-component/utils}/create-style-object.d.ts +3 -2
- package/dist/src/components/common/legend-component/utils/get-generated-labels.d.ts +2 -0
- package/dist/src/components/line-chart/line-chart.d.ts +2 -2
- package/dist/src/components/line-chart/line-chart.interface.d.ts +2 -0
- package/dist/src/components/pie-chart/pie-chart.d.ts +2 -7
- package/dist/src/components/pie-chart/pie-chart.interface.d.ts +7 -0
- package/dist/src/components/pie-chart/use-pie-chart-config.d.ts +2 -2
- package/package.json +3 -3
- package/dist/src/components/line-chart/hooks/use-generated-labels.d.ts +0 -4
- package/dist/src/components/line-chart/legend/legend-constants.d.ts +0 -1
- package/dist/src/components/line-chart/legend/legend-interface.d.ts +0 -39
- package/dist/src/components/line-chart/legend/legend-item.d.ts +0 -3
- package/dist/src/components/line-chart/legend/legend.d.ts +0 -3
- /package/dist/src/components/{line-chart/legend → common/legend-component}/legend-dropzone.d.ts +0 -0
- /package/dist/src/components/{line-chart/legend → common/legend-component}/legend-panel.d.ts +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IBarChartProps } from './bar-chart.interface';
|
|
2
|
-
declare const
|
|
3
|
-
export { BarChart };
|
|
2
|
+
declare const BarChartWithLegend: (props: IBarChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export { BarChartWithLegend as BarChart };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChartDataset } from 'chart.js';
|
|
2
|
+
import { ICommonAdditionalAxesOptions, ICommonAnnotations, ICommonAnnotationsData, ICommonAxis, ICommonChartOptions, ICommonCustomLegend, ICommonData, ICommonDataset, ICommonDataValue, ICommonDragData, ICommonGraph, ICommonInteractions, ICommonLegend, ICommonOptions, ICommonScales, ICommonStyling, ICommonTooltip } from '../common/common.interface';
|
|
2
3
|
import { IChartGraph } from '../common/helpers/chart-utils';
|
|
4
|
+
import { ChartType } from '../common/helpers/enums';
|
|
3
5
|
export interface IBarStyling extends ICommonStyling {
|
|
4
6
|
squareAspectRatio?: boolean;
|
|
5
7
|
layoutPadding?: string | number | {
|
|
@@ -37,7 +39,7 @@ export interface IBarChartDataset extends ICommonDataset {
|
|
|
37
39
|
yAxisID?: string;
|
|
38
40
|
hidden?: boolean;
|
|
39
41
|
displayGroup?: string | number;
|
|
40
|
-
type?:
|
|
42
|
+
type?: ChartType.Bar;
|
|
41
43
|
}
|
|
42
44
|
export interface IBarChartBaseData {
|
|
43
45
|
labels: string[];
|
|
@@ -74,3 +76,15 @@ export interface IBarDefaultProps {
|
|
|
74
76
|
dragData: ICommonDragData;
|
|
75
77
|
};
|
|
76
78
|
}
|
|
79
|
+
export interface IGenerateBarChartDataset extends ChartDataset<'bar', ICommonDataValue[]> {
|
|
80
|
+
borderColor: string;
|
|
81
|
+
backgroundColor: string | string[];
|
|
82
|
+
borderDash?: number[];
|
|
83
|
+
borderWidth?: number;
|
|
84
|
+
annotationType?: string;
|
|
85
|
+
hideLegend?: boolean;
|
|
86
|
+
displayGroup?: boolean;
|
|
87
|
+
isAnnotation?: boolean;
|
|
88
|
+
annotationIndex?: number;
|
|
89
|
+
}
|
|
90
|
+
export type TGenerateBarChartDatasets = IGenerateBarChartDataset[];
|
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ActiveElement, Chart,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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
5
|
export interface IGenerateBarChartDatasetsProps {
|
|
6
|
-
datasets:
|
|
6
|
+
datasets: TGenerateBarChartDatasets;
|
|
7
7
|
options: IBarOptions;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
borderColor: string | string[];
|
|
12
|
-
backgroundColor: string | string[];
|
|
13
|
-
}
|
|
14
|
-
export interface IUseBarChartConfigProps {
|
|
15
|
-
chart: IBarDefaultProps;
|
|
16
|
-
chartRef: MutableRefObject<Chart | null>;
|
|
17
|
-
}
|
|
18
|
-
export declare const useBarChartConfig: ({ chart, chartRef, }: IUseBarChartConfigProps) => {
|
|
19
|
-
generatedDatasets: IGenerateBarChartDatasets[];
|
|
20
|
-
legendClick: (_e: ChartEvent, legendItem: LegendItem) => void;
|
|
9
|
+
export declare const useBarChartConfig: (chartRef: RefObject<Chart>, chart: IBarDefaultProps) => {
|
|
10
|
+
generatedDatasets: TGenerateBarChartDatasets;
|
|
21
11
|
onClick: (_evt: ChartEvent, _elements: ActiveElement[], chartInstance: Chart) => void;
|
|
22
12
|
onHover: (evt: ChartEvent, hoveredItems: ICommonHoveredItems[]) => void;
|
|
23
|
-
visibleAnnotationsIndexes: number[];
|
|
24
13
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChartEvent, ChartTypeRegistry, LinearScaleOptions, Plugin } from 'chart.js';
|
|
2
|
+
import { LabelOptions } from 'chartjs-plugin-annotation';
|
|
2
3
|
import { AlignOptions, Position } from './helpers/enums';
|
|
3
4
|
export type TAxisPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
4
5
|
export interface ICommonDataValue {
|
|
@@ -17,7 +18,26 @@ export interface ICommonScales extends Partial<Record<string, LinearScaleOptions
|
|
|
17
18
|
x: LinearScaleOptions;
|
|
18
19
|
y: LinearScaleOptions;
|
|
19
20
|
}
|
|
21
|
+
export interface ICommonAnnotationElement {
|
|
22
|
+
display: boolean;
|
|
23
|
+
annotationIndex: number;
|
|
24
|
+
label: {
|
|
25
|
+
options: LabelOptions;
|
|
26
|
+
};
|
|
27
|
+
options: {
|
|
28
|
+
scaleID?: string;
|
|
29
|
+
borderColor?: string;
|
|
30
|
+
borderWidth?: number;
|
|
31
|
+
label?: {
|
|
32
|
+
content?: string;
|
|
33
|
+
position?: string;
|
|
34
|
+
enabled?: boolean;
|
|
35
|
+
xAdjust?: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
|
20
39
|
export interface ICommonAnnotationsData {
|
|
40
|
+
display?: boolean;
|
|
21
41
|
adjustScaleRange: boolean;
|
|
22
42
|
annotationAxis: 'x' | 'y';
|
|
23
43
|
color: string;
|
|
@@ -110,6 +130,7 @@ export interface ICommonOptions {
|
|
|
110
130
|
chartOptions?: ICommonChartOptions;
|
|
111
131
|
interactions?: ICommonInteractions;
|
|
112
132
|
dragData?: ICommonDragData;
|
|
133
|
+
annotations?: ICommonAnnotations;
|
|
113
134
|
}
|
|
114
135
|
export interface ICommonData {
|
|
115
136
|
testId?: string;
|
|
@@ -83,7 +83,7 @@ export declare const getLegend: (options: IOptions, clickHandler: (_: UnusedPara
|
|
|
83
83
|
};
|
|
84
84
|
export declare const afterLabelCallback: (tooltipItem: Record<string, any>) => string;
|
|
85
85
|
export declare const getTooltipLabel: (tooltipItem: Record<string, any>, showLabelsInTooltips: boolean) => string;
|
|
86
|
-
export declare const getChartFileName: (axes
|
|
86
|
+
export declare const getChartFileName: (axes?: IAxis[]) => string;
|
|
87
87
|
export declare const setDefaultTheme: () => void;
|
|
88
88
|
export declare const isNilOrEmpty: <T>(value: T | null | undefined) => boolean;
|
|
89
89
|
export {};
|
|
@@ -1,22 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Chart } from 'chart.js';
|
|
2
|
+
import { Position } from './enums';
|
|
3
|
+
import { ICommonAnnotationElement, ICommonAnnotationsData } from '../common.interface';
|
|
4
|
+
export interface IGetAnnotationsProps {
|
|
5
|
+
showAnnotations: boolean;
|
|
6
|
+
annotationsData: ICommonAnnotationsData[];
|
|
7
|
+
visibleAnnotationsIndexes: number[];
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
declare const getAnnotation: ({ showAnnotations, annotationsData, visibleAnnotationsIndexes, }: IGetAnnotationsProps) => ICommonAnnotationElement[] | ({
|
|
10
|
+
display: boolean;
|
|
11
|
+
annotationIndex: number;
|
|
12
|
+
id: string;
|
|
13
|
+
scaleID: "x" | "y";
|
|
14
|
+
label: {
|
|
15
|
+
backgroundColor: string;
|
|
16
|
+
content: string;
|
|
17
|
+
display: boolean;
|
|
18
|
+
position: Position;
|
|
19
|
+
font?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
content: string;
|
|
22
|
+
display: boolean;
|
|
23
|
+
font: {
|
|
24
|
+
weight: string;
|
|
25
|
+
};
|
|
26
|
+
backgroundColor?: undefined;
|
|
27
|
+
position?: undefined;
|
|
28
|
+
};
|
|
29
|
+
backgroundColor: string;
|
|
30
|
+
borderColor: string;
|
|
31
|
+
borderWidth: number;
|
|
32
|
+
borderDash: number[];
|
|
33
|
+
type: string;
|
|
34
|
+
adjustScaleRange: boolean;
|
|
35
|
+
enter: ({ element, }: {
|
|
36
|
+
element: ICommonAnnotationElement;
|
|
37
|
+
}, { chart, }: {
|
|
38
|
+
chart: Chart;
|
|
39
|
+
}) => void;
|
|
40
|
+
leave: ({ element, }: {
|
|
41
|
+
element: ICommonAnnotationElement;
|
|
42
|
+
}, { chart, }: {
|
|
43
|
+
chart: Chart;
|
|
44
|
+
}) => void;
|
|
45
|
+
annotationAxis: "x" | "y";
|
|
46
|
+
color: string;
|
|
47
|
+
endValue: number;
|
|
48
|
+
value: number;
|
|
49
|
+
xMin: number;
|
|
50
|
+
xMax: number;
|
|
51
|
+
yMin: number;
|
|
52
|
+
yMax: number;
|
|
53
|
+
} | undefined)[];
|
|
22
54
|
export default getAnnotation;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
2
|
import { Chart, LegendItem } from 'chart.js';
|
|
3
|
-
import { UnusedParameter } from '
|
|
4
|
-
import { ILineChartOptions } from '../line-chart.interface';
|
|
5
|
-
import { IState } from '../state/state.interfaces';
|
|
3
|
+
import { UnusedParameter } from '../common.interface';
|
|
6
4
|
export interface IUseLegendStateProps {
|
|
7
5
|
chartRef: RefObject<Chart>;
|
|
8
|
-
options:
|
|
9
|
-
state: IState;
|
|
10
|
-
dispatch: Dispatch<any>;
|
|
6
|
+
options: any;
|
|
11
7
|
}
|
|
12
8
|
export type THiddenState = {
|
|
13
9
|
label: string;
|
|
@@ -17,7 +13,7 @@ export type THiddenState = {
|
|
|
17
13
|
/**
|
|
18
14
|
* Custom hook to manage legend state.
|
|
19
15
|
*/
|
|
20
|
-
export declare const useLegendState: ({ chartRef, options
|
|
16
|
+
export declare const useLegendState: ({ chartRef, options }: IUseLegendStateProps) => {
|
|
21
17
|
legendClick: (_: UnusedParameter, legendItem: LegendItem) => void;
|
|
22
18
|
hiddenStates: THiddenState[];
|
|
23
19
|
legend: {
|
|
@@ -32,10 +28,8 @@ export declare const useLegendState: ({ chartRef, options, state, dispatch, }: I
|
|
|
32
28
|
onClick: (_: any, legendItem: LegendItem) => void;
|
|
33
29
|
};
|
|
34
30
|
customLegendPlugin: {
|
|
35
|
-
htmlLegend:
|
|
36
|
-
containerID: string;
|
|
37
|
-
} | null | undefined;
|
|
31
|
+
htmlLegend: any;
|
|
38
32
|
};
|
|
39
33
|
upsertHiddenState: ({ label, datasetIndex, hidden }: THiddenState) => void;
|
|
40
|
-
|
|
34
|
+
visibleAnnotationsIndexes: number[];
|
|
41
35
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { MouseEventHandler, RefObject } from 'react';
|
|
2
|
+
import { Chart, ChartArea } from 'chart.js';
|
|
3
|
+
import { Position } from '../helpers/enums';
|
|
4
|
+
import { IGeneratedLineChartDataset, ILineChartOptions, TGeneratedLineChartDatasets } from '../../line-chart/line-chart.interface';
|
|
5
|
+
import { IBarOptions, IGenerateBarChartDataset, TGenerateBarChartDatasets } from '../../bar-chart/bar-chart.interface';
|
|
6
|
+
import { IGeneratedPieChartDataset, IPieOptions, TGeneratedPieChartDatasets } from '../../pie-chart/pie-chart.interface';
|
|
7
|
+
import { ChartType } from '../enums';
|
|
8
|
+
export interface ILegendDropZone {
|
|
9
|
+
position: Position;
|
|
10
|
+
onDrop: () => void;
|
|
11
|
+
placeholderSize?: {
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface ILegendDropZones {
|
|
17
|
+
chartArea?: ChartArea;
|
|
18
|
+
setLegendPosition: (position: Position) => void;
|
|
19
|
+
isDragging: boolean;
|
|
20
|
+
placeholderSize?: {
|
|
21
|
+
width?: number;
|
|
22
|
+
height?: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export type TLegendDataset = IGeneratedLineChartDataset | IGenerateBarChartDataset | IGeneratedPieChartDataset;
|
|
26
|
+
export type TLegendDatasets = TGeneratedLineChartDatasets | TGenerateBarChartDatasets | TGeneratedPieChartDatasets;
|
|
27
|
+
export type TChartsOption = ILineChartOptions | IBarOptions | IPieOptions;
|
|
28
|
+
export interface ILegendItem {
|
|
29
|
+
hidden: boolean;
|
|
30
|
+
dataset: TLegendDataset;
|
|
31
|
+
handleClick: MouseEventHandler<HTMLDivElement>;
|
|
32
|
+
chartType: ChartType;
|
|
33
|
+
}
|
|
34
|
+
export interface ILegendConfig {
|
|
35
|
+
options: TChartsOption;
|
|
36
|
+
generatedDatasets: TLegendDatasets;
|
|
37
|
+
chartType: ChartType;
|
|
38
|
+
}
|
|
39
|
+
export interface ILegend {
|
|
40
|
+
chartRef: RefObject<Chart>;
|
|
41
|
+
legendConfig: ILegendConfig;
|
|
42
|
+
}
|
|
43
|
+
export interface ILegendPanel extends ILegend {
|
|
44
|
+
legendPosition: Position;
|
|
45
|
+
isDragging: boolean;
|
|
46
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IGeneratedLineChartDataset } from '../../../line-chart/line-chart.interface';
|
|
2
|
+
export interface ILineLegendItemProp {
|
|
3
|
+
dataset: IGeneratedLineChartDataset;
|
|
4
|
+
}
|
|
5
|
+
export declare const LegendItemLine: ({ dataset }: Record<string, any>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ILegendState } from './legend-state-reducer';
|
|
3
|
+
import { TChartsOption } from '../legend-interface';
|
|
4
|
+
export declare const LegendContext: React.Context<{
|
|
5
|
+
state: ILegendState;
|
|
6
|
+
dispatch: React.Dispatch<any>;
|
|
7
|
+
} | undefined>;
|
|
8
|
+
export interface ILegendProviderProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
options: TChartsOption;
|
|
11
|
+
}
|
|
12
|
+
export declare const LegendProvider: ({ children, options }: ILegendProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CLEAR_NON_EXISTENT_DATASETS, TOGGLE_ANNOTATION_VISIBILITY, UPSERT_HIDDEN_STATE } from './legend-action-types';
|
|
2
|
+
import { ICommonAnnotationElement } from '../../common.interface';
|
|
3
|
+
import { THiddenState } from '../../hooks/use-legend-state';
|
|
4
|
+
export interface ILegendState {
|
|
5
|
+
hiddenStates: THiddenState[];
|
|
6
|
+
annotation: ICommonAnnotationElement[];
|
|
7
|
+
visibleAnnotationsIndexes: number[];
|
|
8
|
+
}
|
|
9
|
+
export type TLegendAction = {
|
|
10
|
+
type: typeof UPSERT_HIDDEN_STATE;
|
|
11
|
+
payload: {
|
|
12
|
+
label: string;
|
|
13
|
+
hidden: boolean;
|
|
14
|
+
datasetIndex: number;
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
type: typeof CLEAR_NON_EXISTENT_DATASETS;
|
|
18
|
+
payload: Array<{
|
|
19
|
+
label: string;
|
|
20
|
+
}>;
|
|
21
|
+
} | {
|
|
22
|
+
type: typeof TOGGLE_ANNOTATION_VISIBILITY;
|
|
23
|
+
payload: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const legendInitialState: ILegendState;
|
|
26
|
+
export declare const legendReducer: (state: ILegendState, action: TLegendAction) => ILegendState;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Position } from '../../
|
|
1
|
+
import { Position } from '../../helpers/enums';
|
|
2
|
+
export declare const LEGEND_MARGIN = 4;
|
|
2
3
|
interface IChartArea {
|
|
3
4
|
top: number;
|
|
4
5
|
left: number;
|
|
@@ -22,5 +23,5 @@ interface ILegendStyle {
|
|
|
22
23
|
/**
|
|
23
24
|
* Creates a style object for positioning and sizing the legend panel based on the chart dimensions and legend position.
|
|
24
25
|
*/
|
|
25
|
-
export declare const createLegendStyle: (legendPosition: Position, chart: IChart) => ILegendStyle;
|
|
26
|
+
export declare const createLegendStyle: (legendPosition: Position, chart: IChart | null) => ILegendStyle;
|
|
26
27
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ILineChartProps } from './line-chart.interface';
|
|
2
|
-
declare const
|
|
3
|
-
export { LineChart };
|
|
2
|
+
declare const LineChartWithLegend: (props: ILineChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export { LineChartWithLegend as LineChart };
|
|
@@ -13,6 +13,7 @@ export interface ILineChartGraph {
|
|
|
13
13
|
}
|
|
14
14
|
export interface ILineChartTooltip extends ICommonTooltip {
|
|
15
15
|
hideSimulationName: boolean;
|
|
16
|
+
scientificNotation: boolean;
|
|
16
17
|
}
|
|
17
18
|
export interface ILineChartRange {
|
|
18
19
|
min: number;
|
|
@@ -137,6 +138,7 @@ export interface IGeneratedLineChartDataset {
|
|
|
137
138
|
annotationBorderWidth?: number;
|
|
138
139
|
displayGroup?: boolean;
|
|
139
140
|
hideLegend?: boolean;
|
|
141
|
+
pointStyle?: string;
|
|
140
142
|
xAxisID?: string;
|
|
141
143
|
yAxisID?: string;
|
|
142
144
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { IPieChartProps } from './pie-chart.interface';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @param {props: IPieChartProps} IPieChartProps
|
|
5
|
-
* ./pie-chart.interface
|
|
6
|
-
*/
|
|
7
|
-
declare const PieChart: (props: IPieChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export { PieChart };
|
|
2
|
+
declare const PieChartWithLegend: (props: IPieChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export { PieChartWithLegend as PieChart };
|
|
@@ -59,5 +59,12 @@ export interface IGeneratedPieChartDataset {
|
|
|
59
59
|
backgroundColor: string[];
|
|
60
60
|
borderColor: string[];
|
|
61
61
|
borderWidth: number;
|
|
62
|
+
borderDash: number[];
|
|
63
|
+
annotationType?: string;
|
|
62
64
|
data: IPieDataValue[];
|
|
65
|
+
hideLegend?: boolean;
|
|
66
|
+
displayGroup?: boolean;
|
|
67
|
+
isAnnotation?: boolean;
|
|
68
|
+
annotationIndex?: number;
|
|
63
69
|
}
|
|
70
|
+
export type TGeneratedPieChartDatasets = IGeneratedPieChartDataset[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ActiveElement, Chart, Chart as ChartJS, ChartEvent, LegendItem, Plugin, TooltipItem } from 'chart.js';
|
|
2
|
-
import {
|
|
2
|
+
import { IPieDataValue, IPiesDataLabelsOptions } from './pie-chart.interface';
|
|
3
3
|
import { IPieChartDefaultProps } from './pie-chart-defalut-props.interface';
|
|
4
4
|
import { UnusedParameter } from '../common/common.interface';
|
|
5
5
|
interface ILegendPlugin extends Plugin {
|
|
6
6
|
chart?: Chart;
|
|
7
7
|
}
|
|
8
8
|
export declare const usePieChartConfig: (chart: IPieChartDefaultProps) => {
|
|
9
|
-
generatedDatasets:
|
|
9
|
+
generatedDatasets: {
|
|
10
10
|
borderWidth: number;
|
|
11
11
|
borderColor: string | string[];
|
|
12
12
|
backgroundColor: string | string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oliasoft-open-source/charts-library",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0-beta-1",
|
|
4
4
|
"description": "React Chart Library (based on Chart.js and react-chart-js-2)",
|
|
5
5
|
"homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
|
|
6
6
|
"resolutions": {
|
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
"@oliasoft-open-source/units": "^3.4.2",
|
|
111
111
|
"classnames": "^2.3.2",
|
|
112
112
|
"immer": "^10.0.2",
|
|
113
|
+
"lodash": "^4.17.21",
|
|
113
114
|
"react": "^17",
|
|
114
|
-
"react-dom": "^17"
|
|
115
|
-
"lodash": "^4.17.21"
|
|
115
|
+
"react-dom": "^17"
|
|
116
116
|
}
|
|
117
117
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const LEGEND_MARGIN = 4;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Dispatch, MouseEventHandler, RefObject } from 'react';
|
|
2
|
-
import { Chart, ChartArea } from 'chart.js';
|
|
3
|
-
import { IState } from '../state/state.interfaces';
|
|
4
|
-
import { ILineChartDataset, ILineChartOptions, TGeneratedLineChartDatasets } from '../line-chart.interface';
|
|
5
|
-
import { Position } from '../../common/helpers/enums';
|
|
6
|
-
export interface ILegendDropZone {
|
|
7
|
-
position: Position;
|
|
8
|
-
onDrop: () => void;
|
|
9
|
-
placeholderSize?: {
|
|
10
|
-
width?: number;
|
|
11
|
-
height?: number;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export interface ILegendDropZones {
|
|
15
|
-
chartArea: ChartArea;
|
|
16
|
-
setLegendPosition: (position: Position) => void;
|
|
17
|
-
isDragging: boolean;
|
|
18
|
-
placeholderSize?: {
|
|
19
|
-
width?: number;
|
|
20
|
-
height?: number;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export interface ILegendItem {
|
|
24
|
-
hidden: boolean;
|
|
25
|
-
dataset: ILineChartDataset;
|
|
26
|
-
handleClick: MouseEventHandler<HTMLDivElement>;
|
|
27
|
-
}
|
|
28
|
-
export interface ILegend {
|
|
29
|
-
chartRef: RefObject<Chart>;
|
|
30
|
-
state: IState;
|
|
31
|
-
options: ILineChartOptions;
|
|
32
|
-
dispatch: Dispatch<any>;
|
|
33
|
-
generatedDatasets: TGeneratedLineChartDatasets;
|
|
34
|
-
translations?: Record<string, string>;
|
|
35
|
-
}
|
|
36
|
-
export interface ILegendPanel extends ILegend {
|
|
37
|
-
legendPosition: Position;
|
|
38
|
-
isDragging: boolean;
|
|
39
|
-
}
|
/package/dist/src/components/{line-chart/legend → common/legend-component}/legend-dropzone.d.ts
RENAMED
|
File without changes
|
/package/dist/src/components/{line-chart/legend → common/legend-component}/legend-panel.d.ts
RENAMED
|
File without changes
|