@oliasoft-open-source/charts-library 4.1.4 → 4.1.6-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 +262 -279
- package/dist/index.js.map +1 -1
- package/dist/src/components/bar-chart/bar-chart.interface.d.ts +1 -1
- package/dist/src/components/common/common.interface.d.ts +1 -0
- package/dist/src/components/common/helpers/chart-utils.d.ts +1 -6
- package/dist/src/components/common/helpers/get-chart-annotation.d.ts +3 -4
- package/dist/src/components/common/hooks/use-legend-state.d.ts +1 -8
- package/dist/src/components/common/legend-component/state/legend-action-types.d.ts +1 -3
- package/dist/src/components/common/legend-component/state/legend-state-reducer.d.ts +13 -16
- package/dist/src/components/line-chart/hooks/use-chart-options.d.ts +16 -0
- package/dist/src/components/line-chart/line-chart.interface.d.ts +2 -2
- package/dist/src/components/line-chart/line-chart.stories.d.ts +2 -0
- package/dist/src/components/line-chart/state/action-types.d.ts +0 -1
- package/dist/src/components/pie-chart/pie-chart.interface.d.ts +1 -1
- package/package.json +5 -4
|
@@ -83,7 +83,7 @@ export interface IGenerateBarChartDataset extends ChartDataset<'bar', ICommonDat
|
|
|
83
83
|
borderWidth?: number;
|
|
84
84
|
annotationType?: string;
|
|
85
85
|
hideLegend?: boolean;
|
|
86
|
-
displayGroup?:
|
|
86
|
+
displayGroup?: string | number;
|
|
87
87
|
isAnnotation?: boolean;
|
|
88
88
|
annotationIndex?: number;
|
|
89
89
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChartTypeRegistry, LegendItem, Plugin } from 'chart.js';
|
|
2
|
-
import {
|
|
2
|
+
import { ICommonCustomLegend, UnusedParameter } from '../common.interface';
|
|
3
3
|
import { Position } from './enums';
|
|
4
4
|
export interface IChartGraph {
|
|
5
5
|
showMinorGridlines: boolean;
|
|
@@ -38,11 +38,6 @@ export declare const getPlugins: <T extends keyof ChartTypeRegistry>(graph: ICha
|
|
|
38
38
|
* @return {string} - random color
|
|
39
39
|
*/
|
|
40
40
|
export declare const generateRandomColor: (colors: string[]) => string[];
|
|
41
|
-
/**
|
|
42
|
-
* @param {annotationsData[]} annotationsData
|
|
43
|
-
* @return {number[]|*[]}
|
|
44
|
-
*/
|
|
45
|
-
export declare const setAnnotations: (annotationsData: ICommonAnnotationsData[]) => number[];
|
|
46
41
|
/**
|
|
47
42
|
* @param {ICommonChartOptions} options - chart options object
|
|
48
43
|
* @return {{color: (string|undefined), display: boolean, text}|{}}
|
|
@@ -4,10 +4,9 @@ import { ICommonAnnotationElement, ICommonAnnotationsData } from '../common.inte
|
|
|
4
4
|
export interface IGetAnnotationsProps {
|
|
5
5
|
showAnnotations: boolean;
|
|
6
6
|
annotationsData: ICommonAnnotationsData[];
|
|
7
|
-
visibleAnnotationsIndexes: number[];
|
|
8
7
|
}
|
|
9
|
-
declare const getAnnotation: ({ showAnnotations, annotationsData,
|
|
10
|
-
display: boolean;
|
|
8
|
+
declare const getAnnotation: ({ showAnnotations, annotationsData, }: IGetAnnotationsProps) => ICommonAnnotationElement[] | {
|
|
9
|
+
display: boolean | undefined;
|
|
11
10
|
annotationIndex: number;
|
|
12
11
|
id: string;
|
|
13
12
|
scaleID: "x" | "y";
|
|
@@ -50,5 +49,5 @@ declare const getAnnotation: ({ showAnnotations, annotationsData, visibleAnnotat
|
|
|
50
49
|
xMax: number;
|
|
51
50
|
yMin: number;
|
|
52
51
|
yMax: number;
|
|
53
|
-
}
|
|
52
|
+
}[];
|
|
54
53
|
export default getAnnotation;
|
|
@@ -5,17 +5,12 @@ export interface IUseLegendStateProps {
|
|
|
5
5
|
chartRef: RefObject<Chart>;
|
|
6
6
|
options: any;
|
|
7
7
|
}
|
|
8
|
-
export type THiddenState = {
|
|
9
|
-
label: string;
|
|
10
|
-
hidden: boolean;
|
|
11
|
-
datasetIndex: number;
|
|
12
|
-
};
|
|
13
8
|
/**
|
|
14
9
|
* Custom hook to manage legend state.
|
|
15
10
|
*/
|
|
16
11
|
export declare const useLegendState: ({ chartRef, options }: IUseLegendStateProps) => {
|
|
17
12
|
legendClick: (_: UnusedParameter, legendItem: LegendItem) => void;
|
|
18
|
-
|
|
13
|
+
annotation: import("../common.interface").ICommonAnnotationElement[];
|
|
19
14
|
legend: {
|
|
20
15
|
position: any;
|
|
21
16
|
display: boolean | undefined;
|
|
@@ -30,6 +25,4 @@ export declare const useLegendState: ({ chartRef, options }: IUseLegendStateProp
|
|
|
30
25
|
customLegendPlugin: {
|
|
31
26
|
htmlLegend: any;
|
|
32
27
|
};
|
|
33
|
-
upsertHiddenState: ({ label, datasetIndex, hidden }: THiddenState) => void;
|
|
34
|
-
visibleAnnotationsIndexes: number[];
|
|
35
28
|
};
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const CLEAR_NON_EXISTENT_DATASETS = "CLEAR_NON_EXISTENT_DATASETS";
|
|
3
|
-
export declare const TOGGLE_ANNOTATION_VISIBILITY = "TOGGLE_ANNOTATION_VISIBILITY";
|
|
1
|
+
export declare const TOGGLE_DS_VISIBILITY = "TOGGLE_DS_VISIBILITY";
|
|
4
2
|
export declare const RESET_STATE = "RESET_STATE";
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Chart } from 'chart.js';
|
|
2
|
+
import { TLegendDataset, TLegendDatasets } from '../legend-interface';
|
|
3
|
+
import { RESET_STATE, TOGGLE_DS_VISIBILITY } from './legend-action-types';
|
|
2
4
|
import { ICommonAnnotationElement } from '../../common.interface';
|
|
3
|
-
import { THiddenState } from '../../hooks/use-legend-state';
|
|
4
5
|
export interface ILegendState {
|
|
5
|
-
hiddenStates: THiddenState[];
|
|
6
6
|
annotation: ICommonAnnotationElement[];
|
|
7
|
-
visibleAnnotationsIndexes: number[];
|
|
8
7
|
}
|
|
9
8
|
export type TLegendAction = {
|
|
10
|
-
type: typeof
|
|
9
|
+
type: typeof TOGGLE_DS_VISIBILITY;
|
|
11
10
|
payload: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
chartInstance: Chart;
|
|
12
|
+
dsConfig: {
|
|
13
|
+
datasetIndex: number;
|
|
14
|
+
dataset: TLegendDataset;
|
|
15
|
+
datasets: TLegendDatasets;
|
|
16
|
+
};
|
|
17
|
+
annotationConfig: {
|
|
18
|
+
annotationIndex: number;
|
|
19
|
+
};
|
|
15
20
|
};
|
|
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
21
|
} | {
|
|
25
22
|
type: typeof RESET_STATE;
|
|
26
23
|
payload: ILegendState;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Dispatch, RefObject } from 'react';
|
|
2
|
+
import { Chart } from 'chart.js';
|
|
3
|
+
import { IState } from '../state/state.interfaces';
|
|
4
|
+
import { ILineChartOptions, TGeneratedLineChartDatasets } from '../line-chart.interface';
|
|
5
|
+
interface IUseChartOptions {
|
|
6
|
+
chartRef: RefObject<Chart>;
|
|
7
|
+
state: IState;
|
|
8
|
+
options: ILineChartOptions;
|
|
9
|
+
dispatch: Dispatch<any>;
|
|
10
|
+
generatedDatasets: TGeneratedLineChartDatasets;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Custom hook to generate chart options.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useChartOptions: ({ chartRef, state, options, dispatch, generatedDatasets, }: IUseChartOptions) => any;
|
|
16
|
+
export {};
|
|
@@ -97,7 +97,7 @@ export interface ILineChartDataset extends ICommonDataset {
|
|
|
97
97
|
xAxisID?: string;
|
|
98
98
|
yAxisID?: string;
|
|
99
99
|
formation?: boolean;
|
|
100
|
-
displayGroup?:
|
|
100
|
+
displayGroup?: string | number;
|
|
101
101
|
pointStyle?: string;
|
|
102
102
|
}
|
|
103
103
|
export interface ILineChartData extends ICommonData {
|
|
@@ -136,7 +136,7 @@ export interface IGeneratedLineChartDataset {
|
|
|
136
136
|
annotationBorderColor?: string;
|
|
137
137
|
annotationBorderDash?: number[];
|
|
138
138
|
annotationBorderWidth?: number;
|
|
139
|
-
displayGroup?:
|
|
139
|
+
displayGroup?: string | number;
|
|
140
140
|
hideLegend?: boolean;
|
|
141
141
|
pointStyle?: string;
|
|
142
142
|
xAxisID?: string;
|
|
@@ -1199,6 +1199,8 @@ export namespace TestCustomLinePointsLogic {
|
|
|
1199
1199
|
export { args_43 as args };
|
|
1200
1200
|
}
|
|
1201
1201
|
export function ManageAnnotationExternally(): import("react/jsx-runtime").JSX.Element;
|
|
1202
|
+
export function FilterAnnotationWhenLegendClick(): import("react/jsx-runtime").JSX.Element;
|
|
1203
|
+
export function GroupedDS(): import("react/jsx-runtime").JSX.Element;
|
|
1202
1204
|
import { LineChart } from './line-chart';
|
|
1203
1205
|
declare namespace basicChart { }
|
|
1204
1206
|
declare const customLegendContainerID: "custom-legend-container";
|
|
@@ -3,7 +3,6 @@ export declare const TOGGLE_PAN = "TOGGLE_PAN";
|
|
|
3
3
|
export declare const TOGGLE_POINTS = "TOGGLE_POINTS";
|
|
4
4
|
export declare const TOGGLE_LINE = "TOGGLE_LINE";
|
|
5
5
|
export declare const TOGGLE_LEGEND = "TOGGLE_LEGEND";
|
|
6
|
-
export declare const TOGGLE_ANNOTATION = "TOGGLE_ANNOTATION";
|
|
7
6
|
export declare const TOGGLE_TABLE = "TOGGLE_TABLE";
|
|
8
7
|
export declare const SAVE_INITIAL_AXES_RANGES = "SAVE_INITIAL_AXES_RANGES";
|
|
9
8
|
export declare const RESET_AXES_RANGES = "RESET_AXES_RANGES";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oliasoft-open-source/charts-library",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.6-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": {
|
|
@@ -75,10 +75,11 @@
|
|
|
75
75
|
"ajv-errors": "^3.0.0",
|
|
76
76
|
"ajv-keywords": "^5.1.0",
|
|
77
77
|
"classnames": "^2.3.2",
|
|
78
|
-
"eslint": "^8.
|
|
78
|
+
"eslint": "^8.55.0",
|
|
79
79
|
"eslint-config-airbnb": "^19.0.4",
|
|
80
80
|
"eslint-config-prettier": "^9.0.0",
|
|
81
81
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
82
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
82
83
|
"eslint-plugin-import": "^2.26.0",
|
|
83
84
|
"eslint-plugin-jsx-a11y": "^6.6.1",
|
|
84
85
|
"eslint-plugin-react": "^7.31.1",
|
|
@@ -110,8 +111,8 @@
|
|
|
110
111
|
"@oliasoft-open-source/units": "^3.4.2",
|
|
111
112
|
"classnames": "^2.3.2",
|
|
112
113
|
"immer": "^10.0.2",
|
|
114
|
+
"lodash": "^4.17.21",
|
|
113
115
|
"react": "^17",
|
|
114
|
-
"react-dom": "^17"
|
|
115
|
-
"lodash": "^4.17.21"
|
|
116
|
+
"react-dom": "^17"
|
|
116
117
|
}
|
|
117
118
|
}
|