@oliasoft-open-source/charts-library 3.6.9-beta-5 → 3.6.9-beta-7

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.
@@ -1,4 +1,4 @@
1
- interface IAnnotationData {
1
+ export interface IAnnotationData {
2
2
  annotationAxis?: string;
3
3
  color?: string;
4
4
  type?: string;
@@ -0,0 +1,281 @@
1
+ import { Dispatch, RefObject } from 'react';
2
+ import { Chart } from 'chart.js';
3
+ import { IState } from '../state/state.interfaces';
4
+ import { ILineChartDataset, ILineChartOptions } from '../line-chart.interface';
5
+ import { ChartHoverMode, Events, PanZoomMode, PointStyle } from '../../common/helpers/enums';
6
+ interface IUseChartOptions {
7
+ chartRef: RefObject<Chart>;
8
+ state: IState;
9
+ options: ILineChartOptions;
10
+ dispatch: Dispatch<any>;
11
+ generatedDatasets: ILineChartDataset[];
12
+ }
13
+ /**
14
+ * Custom hook to generate chart options.
15
+ */
16
+ export declare const useChartOptions: ({ chartRef, state, options, dispatch, generatedDatasets, }: IUseChartOptions) => {
17
+ layout: {
18
+ padding: string | number | {
19
+ top: number;
20
+ bottom: number;
21
+ left: number;
22
+ right: number;
23
+ } | undefined;
24
+ };
25
+ onHover: (evt: import("chart.js").ChartEvent, hoveredItems: import("../../common/common.interface").ICommonHoveredItems[]) => void;
26
+ maintainAspectRatio: boolean | undefined;
27
+ aspectRatio: number;
28
+ animation: boolean | {
29
+ duration: number;
30
+ onComplete: (() => void) | undefined;
31
+ };
32
+ hover: {
33
+ mode: ChartHoverMode;
34
+ intersect: boolean;
35
+ };
36
+ elements: {
37
+ line: {
38
+ pointStyle: PointStyle;
39
+ showLine: boolean;
40
+ };
41
+ };
42
+ scales: any;
43
+ plugins: {
44
+ datalabels: {
45
+ display: string;
46
+ align: (context: any) => import("../../common/helpers/enums").AlignOptions.End | import("../../common/helpers/enums").AlignOptions.Start | import("../../common/helpers/enums").AlignOptions.Right | import("../../common/helpers/enums").AlignOptions.Left;
47
+ formatter: (_value: any, context: import("chart.js").TooltipItem<any>) => any;
48
+ } | {
49
+ display: boolean;
50
+ align?: undefined;
51
+ formatter?: undefined;
52
+ };
53
+ annotation: {
54
+ annotations: import("../../common/helpers/get-chart-annotation").IAnnotationData | undefined;
55
+ };
56
+ zoom: {
57
+ pan: {
58
+ enabled: boolean;
59
+ mode: PanZoomMode;
60
+ onPanComplete(): void;
61
+ };
62
+ zoom: {
63
+ mode: PanZoomMode;
64
+ drag: {
65
+ enabled: boolean;
66
+ threshold: number;
67
+ backgroundColor: string;
68
+ borderColor: string;
69
+ borderWidth: number;
70
+ };
71
+ onZoomComplete(): void;
72
+ };
73
+ };
74
+ tooltip: {
75
+ enabled: boolean;
76
+ mode: ChartHoverMode;
77
+ intersect: boolean;
78
+ padding: number;
79
+ usePointStyle: boolean;
80
+ boxWidth: number;
81
+ boxHeight: number;
82
+ boxPadding: number;
83
+ callbacks: {
84
+ title: (tooltipItem: any, _data: any) => string;
85
+ label: (tooltipItem: any) => string;
86
+ afterLabel: (tooltipItem: Record<string, any>) => string;
87
+ };
88
+ };
89
+ legend: {
90
+ display: boolean;
91
+ position: import("../../common/helpers/enums").Position;
92
+ align: string | undefined;
93
+ labels: {
94
+ boxHeight: number;
95
+ boxWidth: number | undefined;
96
+ usePointStyle: boolean | undefined;
97
+ };
98
+ onClick: (_e: any, legendItem: any) => void;
99
+ };
100
+ customLegendPlugin: {
101
+ htmlLegend: {
102
+ containerID: string;
103
+ } | null | undefined;
104
+ };
105
+ chartAreaBorder: {
106
+ borderColor: string;
107
+ };
108
+ chartAreaText: {
109
+ showLabel: boolean | undefined;
110
+ text: string | string[] | undefined;
111
+ position: string | undefined;
112
+ fontSize: number | undefined;
113
+ xOffset: number | undefined;
114
+ yOffset: number | undefined;
115
+ maxWidth: number | undefined;
116
+ lineHeight: number | undefined;
117
+ };
118
+ } | {
119
+ dragData: {
120
+ dragX: boolean | undefined;
121
+ dragY: boolean | undefined;
122
+ round: boolean | undefined;
123
+ showTooltip: boolean | undefined;
124
+ onDragStart: () => void;
125
+ onDrag: () => void;
126
+ onDragEnd: () => void;
127
+ };
128
+ datalabels: {
129
+ display: string;
130
+ align: (context: any) => import("../../common/helpers/enums").AlignOptions.End | import("../../common/helpers/enums").AlignOptions.Start | import("../../common/helpers/enums").AlignOptions.Right | import("../../common/helpers/enums").AlignOptions.Left;
131
+ formatter: (_value: any, context: import("chart.js").TooltipItem<any>) => any;
132
+ } | {
133
+ display: boolean;
134
+ align?: undefined;
135
+ formatter?: undefined;
136
+ };
137
+ annotation: {
138
+ annotations: import("../../common/helpers/get-chart-annotation").IAnnotationData | undefined;
139
+ };
140
+ zoom: {
141
+ pan: {
142
+ enabled: boolean;
143
+ mode: PanZoomMode;
144
+ onPanComplete(): void;
145
+ };
146
+ zoom: {
147
+ mode: PanZoomMode;
148
+ drag: {
149
+ enabled: boolean;
150
+ threshold: number;
151
+ backgroundColor: string;
152
+ borderColor: string;
153
+ borderWidth: number;
154
+ };
155
+ onZoomComplete(): void;
156
+ };
157
+ };
158
+ tooltip: {
159
+ enabled: boolean;
160
+ mode: ChartHoverMode;
161
+ intersect: boolean;
162
+ padding: number;
163
+ usePointStyle: boolean;
164
+ boxWidth: number;
165
+ boxHeight: number;
166
+ boxPadding: number;
167
+ callbacks: {
168
+ title: (tooltipItem: any, _data: any) => string;
169
+ label: (tooltipItem: any) => string;
170
+ afterLabel: (tooltipItem: Record<string, any>) => string;
171
+ };
172
+ };
173
+ legend: {
174
+ display: boolean;
175
+ position: import("../../common/helpers/enums").Position;
176
+ align: string | undefined;
177
+ labels: {
178
+ boxHeight: number;
179
+ boxWidth: number | undefined;
180
+ usePointStyle: boolean | undefined;
181
+ };
182
+ onClick: (_e: any, legendItem: any) => void;
183
+ };
184
+ customLegendPlugin: {
185
+ htmlLegend: {
186
+ containerID: string;
187
+ } | null | undefined;
188
+ };
189
+ chartAreaBorder: {
190
+ borderColor: string;
191
+ };
192
+ chartAreaText: {
193
+ showLabel: boolean | undefined;
194
+ text: string | string[] | undefined;
195
+ position: string | undefined;
196
+ fontSize: number | undefined;
197
+ xOffset: number | undefined;
198
+ yOffset: number | undefined;
199
+ maxWidth: number | undefined;
200
+ lineHeight: number | undefined;
201
+ };
202
+ } | {
203
+ dragData?: undefined;
204
+ datalabels: {
205
+ display: string;
206
+ align: (context: any) => import("../../common/helpers/enums").AlignOptions.End | import("../../common/helpers/enums").AlignOptions.Start | import("../../common/helpers/enums").AlignOptions.Right | import("../../common/helpers/enums").AlignOptions.Left;
207
+ formatter: (_value: any, context: import("chart.js").TooltipItem<any>) => any;
208
+ } | {
209
+ display: boolean;
210
+ align?: undefined;
211
+ formatter?: undefined;
212
+ };
213
+ annotation: {
214
+ annotations: import("../../common/helpers/get-chart-annotation").IAnnotationData | undefined;
215
+ };
216
+ zoom: {
217
+ pan: {
218
+ enabled: boolean;
219
+ mode: PanZoomMode;
220
+ onPanComplete(): void;
221
+ };
222
+ zoom: {
223
+ mode: PanZoomMode;
224
+ drag: {
225
+ enabled: boolean;
226
+ threshold: number;
227
+ backgroundColor: string;
228
+ borderColor: string;
229
+ borderWidth: number;
230
+ };
231
+ onZoomComplete(): void;
232
+ };
233
+ };
234
+ tooltip: {
235
+ enabled: boolean;
236
+ mode: ChartHoverMode;
237
+ intersect: boolean;
238
+ padding: number;
239
+ usePointStyle: boolean;
240
+ boxWidth: number;
241
+ boxHeight: number;
242
+ boxPadding: number;
243
+ callbacks: {
244
+ title: (tooltipItem: any, _data: any) => string;
245
+ label: (tooltipItem: any) => string;
246
+ afterLabel: (tooltipItem: Record<string, any>) => string;
247
+ };
248
+ };
249
+ legend: {
250
+ display: boolean;
251
+ position: import("../../common/helpers/enums").Position;
252
+ align: string | undefined;
253
+ labels: {
254
+ boxHeight: number;
255
+ boxWidth: number | undefined;
256
+ usePointStyle: boolean | undefined;
257
+ };
258
+ onClick: (_e: any, legendItem: any) => void;
259
+ };
260
+ customLegendPlugin: {
261
+ htmlLegend: {
262
+ containerID: string;
263
+ } | null | undefined;
264
+ };
265
+ chartAreaBorder: {
266
+ borderColor: string;
267
+ };
268
+ chartAreaText: {
269
+ showLabel: boolean | undefined;
270
+ text: string | string[] | undefined;
271
+ position: string | undefined;
272
+ fontSize: number | undefined;
273
+ xOffset: number | undefined;
274
+ yOffset: number | undefined;
275
+ maxWidth: number | undefined;
276
+ lineHeight: number | undefined;
277
+ };
278
+ };
279
+ events: Events[];
280
+ };
281
+ export {};
package/index.js ADDED
@@ -0,0 +1,14 @@
1
+ /*
2
+ Components
3
+ */
4
+
5
+ import ScatterChart from './src/components/scatter-chart/scatter-chart';
6
+
7
+ export { LineChart } from './src/components/line-chart/line-chart';
8
+ export { initializeLineChart } from './src/components/line-chart/initialize/initialize-line-chart';
9
+
10
+ export { PieChart } from './src/components/pie-chart/pie-chart';
11
+
12
+ export { BarChart } from './src/components/bar-chart/bar-chart';
13
+
14
+ export { ScatterChart };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "3.6.9-beta-5",
3
+ "version": "3.6.9-beta-7",
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
  "bugs": {
@@ -12,15 +12,15 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "Oliasoft AS and contributors",
15
- "main": "./dist/index.js",
15
+ "main": "index.js",
16
16
  "module": "./dist/index.js",
17
17
  "types": "./dist/index.d.ts",
18
18
  "files": [
19
19
  "dist"
20
20
  ],
21
21
  "scripts": {
22
- "build:package": "vite build --config vite.config.mjs",
23
- "build": "yarn build:package && storybook build --quiet --output-dir ./public",
22
+ "build:package": "tsc && vite build",
23
+ "build": "yarn build:package && storybook build --quiet --output-dir ./public/storybook",
24
24
  "dev:storybook": "storybook dev -p 6006",
25
25
  "lint:check": "eslint \"**/*.{js,jsx,ts,tsx}\"",
26
26
  "lint:fix": "eslint --fix \"**/*.{js,jsx,ts,tsx}\"",
@@ -73,6 +73,7 @@
73
73
  "eslint-config-airbnb": "^19.0.4",
74
74
  "eslint-config-prettier": "^9.0.0",
75
75
  "eslint-import-resolver-alias": "^1.1.2",
76
+ "eslint-import-resolver-typescript": "^3.6.1",
76
77
  "eslint-plugin-import": "^2.26.0",
77
78
  "eslint-plugin-jsx-a11y": "^6.6.1",
78
79
  "eslint-plugin-react": "^7.31.1",
@@ -90,11 +91,9 @@
90
91
  "prettier": "3.0.3",
91
92
  "react": "^18.2.0",
92
93
  "react-dom": "^18.2.0",
93
- "rollup-plugin-peer-deps-external": "^2.2.4",
94
94
  "storybook": "^7.0.18",
95
95
  "storybook-dark-mode": "^3.0.0",
96
96
  "vite": "^4.3.9",
97
- "vite-plugin-css-injected-by-js": "^3.1.1",
98
97
  "vite-plugin-dts": "3.6.0",
99
98
  "vite-tsconfig-paths": "^4.2.0",
100
99
  "vitest": "^0.34.6"
@@ -107,5 +106,8 @@
107
106
  "lodash": "^4.17.21",
108
107
  "react": "^17",
109
108
  "react-dom": "^17"
109
+ },
110
+ "resolutions": {
111
+ "jackspeak": "2.1.1"
110
112
  }
111
113
  }