@oliasoft-open-source/charts-library 4.7.0-beta-5 → 4.7.0-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.
@@ -178,7 +178,7 @@ export namespace CustomLegend {
178
178
  export namespace legend {
179
179
  namespace customLegend {
180
180
  export const customLegendPlugin: {
181
- afterUpdate(chart: import("chart.js").Chart<keyof import("chart.js").ChartTypeRegistry, (number | import("chart.js").Point | [number, number] | import("chart.js").BubbleDataPoint | null)[], unknown>, _args: import("chart.js").Plugin<keyof import("chart.js").ChartTypeRegistry, import("../../../node_modules/chart.js/dist/types/basic").AnyObject>, _options: import("chart.js").ChartConfiguration<keyof import("chart.js").ChartTypeRegistry, (number | import("chart.js").Point | [number, number] | import("chart.js").BubbleDataPoint | null)[], unknown>): void;
181
+ afterUpdate(chart: import("chart.js").Chart<keyof import("chart.js").ChartTypeRegistry, (number | [number, number] | import("chart.js").Point | import("chart.js").BubbleDataPoint | null)[], unknown>, _args: import("chart.js").Plugin<keyof import("chart.js").ChartTypeRegistry, import("../../../node_modules/chart.js/dist/types/basic").AnyObject>, _options: import("chart.js").ChartConfiguration<keyof import("chart.js").ChartTypeRegistry, (number | [number, number] | import("chart.js").Point | import("chart.js").BubbleDataPoint | null)[], unknown>): void;
182
182
  };
183
183
  export { customLegendContainerID };
184
184
  }
@@ -7,7 +7,7 @@ export interface IUseBarChartOptionsProps {
7
7
  chartRef: MutableRefObject<Chart | null>;
8
8
  }
9
9
  export declare const useBarChartOptions: ({ chart, chartRef, }: IUseBarChartOptionsProps) => {
10
- onClick: (_evt: import("chart.js").ChartEvent, _elements: import("chart.js").ActiveElement[], chartInstance: Chart<keyof import("chart.js").ChartTypeRegistry, (number | import("chart.js").Point | [number, number] | import("chart.js").BubbleDataPoint | null)[], unknown>) => void;
10
+ onClick: (_evt: import("chart.js").ChartEvent, _elements: import("chart.js").ActiveElement[], chartInstance: Chart<keyof import("chart.js").ChartTypeRegistry, (number | [number, number] | import("chart.js").Point | import("chart.js").BubbleDataPoint | null)[], unknown>) => void;
11
11
  onHover: (evt: import("chart.js").ChartEvent, hoveredItems: import("../../common/common.interface").ICommonHoveredItems[]) => void;
12
12
  indexAxis: AxisType;
13
13
  maintainAspectRatio: boolean | undefined;
@@ -1,7 +1,7 @@
1
1
  import { ChartEvent, ChartTypeRegistry, LinearScaleOptions, Plugin } from 'chart.js';
2
2
  import { LabelOptions } from 'chartjs-plugin-annotation';
3
3
  import { GradientDirection } from '../common/plugins/gradient-background-plugin/enums';
4
- import { DragAxis } from '../common/plugins/annotation-dragger-plugin/enums';
4
+ import { AnnotationType, DragAxis } from '../common/plugins/annotation-dragger-plugin/enums';
5
5
  import { AlignOptions, Position } from './helpers/enums';
6
6
  export type TAxisPosition = 'top' | 'bottom' | 'left' | 'right';
7
7
  export interface ICommonDataValue {
@@ -55,7 +55,7 @@ export interface ICommonAnnotationsData {
55
55
  endValue: number;
56
56
  label: string;
57
57
  labelConfig?: Record<string, any>;
58
- type: string;
58
+ type: AnnotationType;
59
59
  value: number;
60
60
  xMin: number;
61
61
  xMax: number;
@@ -69,6 +69,12 @@ export interface ICommonAnnotationsData {
69
69
  onDrag?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
70
70
  onDragEnd?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
71
71
  dragAxis?: DragAxis;
72
+ pointStyle?: string;
73
+ resizable?: boolean;
74
+ dragRange?: {
75
+ x?: [number, number];
76
+ y?: [number, number];
77
+ };
72
78
  }
73
79
  export interface ICommonGradientColor {
74
80
  offset: number;
@@ -53,7 +53,10 @@ export declare enum AnnotationType {
53
53
  Text = "text"
54
54
  }
55
55
  export declare enum PointStyle {
56
- Circle = "circle"
56
+ Circle = "circle",
57
+ Square = "rect",
58
+ Diamond = "rectRot",
59
+ Triangle = "triangle"
57
60
  }
58
61
  export declare enum ChartHoverMode {
59
62
  Nearest = "nearest"
@@ -1,4 +1,5 @@
1
1
  import { Chart } from 'chart.js';
2
+ import { AnnotationType } from '../../common/plugins/annotation-dragger-plugin/enums';
2
3
  import { Position } from './enums';
3
4
  import { ICommonAnnotationElement, ICommonAnnotationsData, ICoordinates } from '../common.interface';
4
5
  export interface IGetAnnotationsProps {
@@ -46,7 +47,7 @@ declare const getAnnotation: ({ showAnnotations, annotationsData, }: IGetAnnotat
46
47
  borderColor: string;
47
48
  borderWidth: number;
48
49
  borderDash: number[] | undefined;
49
- type: string;
50
+ type: AnnotationType;
50
51
  adjustScaleRange: boolean;
51
52
  enter: ({ element, }: {
52
53
  element: ICommonAnnotationElement;
@@ -61,6 +62,8 @@ declare const getAnnotation: ({ showAnnotations, annotationsData, }: IGetAnnotat
61
62
  onDragStart: () => (cord: ICoordinates, annotation: ICommonAnnotationsData) => void;
62
63
  onDrag: () => (cord: ICoordinates, annotation: ICommonAnnotationsData) => void;
63
64
  onDragEnd: () => (cord: ICoordinates, annotation: ICommonAnnotationsData) => void;
65
+ pointStyle: string;
66
+ resizable: boolean;
64
67
  hideLegend?: boolean | undefined;
65
68
  annotationAxis: "x" | "y";
66
69
  color: string;
@@ -76,5 +79,9 @@ declare const getAnnotation: ({ showAnnotations, annotationsData, }: IGetAnnotat
76
79
  radius?: number | undefined;
77
80
  enableDrag?: boolean | undefined;
78
81
  dragAxis?: import('../../common/plugins/annotation-dragger-plugin/enums').DragAxis | undefined;
82
+ dragRange?: {
83
+ x?: [number, number] | undefined;
84
+ y?: [number, number] | undefined;
85
+ } | undefined;
79
86
  }[];
80
87
  export default getAnnotation;
@@ -1,5 +1,7 @@
1
+ import { Chart } from 'chart.js';
1
2
  import { ICommonAnnotationsData } from '../../../common/common.interface';
2
3
  import { IScales } from '../../../common/plugins/annotation-dragger-plugin/annotation-dragger-plugin';
4
+ import { AnnotationType, DragAxis } from './enums';
3
5
  export declare const getMousePosition: (event: MouseEvent, canvas: HTMLCanvasElement) => {
4
6
  x: number;
5
7
  y: number;
@@ -20,3 +22,29 @@ export declare const calculateAnnotationMetricsInValuesInPixels: (annotation: IC
20
22
  width: number | undefined;
21
23
  height: number | undefined;
22
24
  };
25
+ export interface IIsWithinChartAreaProps {
26
+ x?: number;
27
+ y?: number;
28
+ chartArea: {
29
+ left: number;
30
+ right: number;
31
+ top: number;
32
+ bottom: number;
33
+ };
34
+ scales: IScales;
35
+ metrics: {
36
+ width?: number;
37
+ height?: number;
38
+ };
39
+ resizable?: boolean;
40
+ dragRange?: {
41
+ x?: [number, number];
42
+ y?: [number, number];
43
+ } | null;
44
+ annotationType: AnnotationType;
45
+ }
46
+ export declare const isWithinChartArea: ({ x, y, chartArea, scales, metrics, resizable, dragRange, annotationType, }: IIsWithinChartAreaProps) => boolean;
47
+ export declare const updateAnnotationPositionWithinBounds: (axis: DragAxis, newPosition: number, activeAnnotation: ICommonAnnotationsData, chart: Chart, scales: IScales, metrics?: {
48
+ width?: number;
49
+ height?: number;
50
+ }) => void;
@@ -1,30 +1,23 @@
1
+ import { IMenuSection } from '@oliasoft-open-source/react-ui-library';
1
2
  import { IDragOptions } from './drag-options-interfaces';
2
3
  export declare function getDragOptions({ onTogglePan, onToggleZoom, panEnabled, zoomEnabled, enableDragPoints, enableDragAnnotation, isDragDataAllowed, isDragAnnotationAllowed, onToggleDragAnnotation, onToggleDragPoints, onDisableDragOptions, translations: { dragToZoom, doubleClickToReset, dragToPan, dragToMovePoints, dragDisabled, dragToMoveAnnotation, }, }: IDragOptions): ({
3
- buttonLabel: string;
4
4
  label: string;
5
+ description: string;
5
6
  icon: import("react/jsx-runtime").JSX.Element;
6
7
  selected: boolean;
7
8
  type: string;
8
9
  onClick: () => void;
9
- disabled?: undefined;
10
10
  } | {
11
11
  label: string;
12
12
  icon: import("react/jsx-runtime").JSX.Element;
13
13
  selected: boolean | undefined;
14
14
  type: string;
15
15
  onClick: () => void;
16
- buttonLabel?: undefined;
17
- disabled?: undefined;
18
- } | {
19
- label: import("react/jsx-runtime").JSX.Element;
20
- type: string;
21
- disabled: boolean;
22
- buttonLabel?: undefined;
23
- icon?: undefined;
24
- selected?: undefined;
25
- onClick?: undefined;
16
+ description?: undefined;
26
17
  })[];
27
18
  /**
28
19
  * @param {import('./drag-options-interfaces').IDragOptions} obj
29
20
  */
30
- export declare const DragOptions: ({ onTogglePan, onToggleZoom, panEnabled, zoomEnabled, enableDragPoints, enableDragAnnotation, isDragDataAllowed, isDragAnnotationAllowed, onToggleDragAnnotation, onToggleDragPoints, onDisableDragOptions, translations: { dragToZoom, doubleClickToReset, dragToPan, dragToMovePoints, dragDisabled, dragToMoveAnnotation, }, }: IDragOptions) => import("react/jsx-runtime").JSX.Element;
21
+ export declare const DragOptions: ({ options }: {
22
+ options: IMenuSection[];
23
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,4 @@
1
+ import { IMenuSection } from '@oliasoft-open-source/react-ui-library';
1
2
  interface ILineOptions {
2
3
  lineEnabled: boolean;
3
4
  onToggleLine: () => void;
@@ -12,5 +13,7 @@ export declare function getLineOptions({ lineEnabled, onToggleLine, onTogglePoin
12
13
  selected: boolean;
13
14
  onClick: () => void;
14
15
  }[];
15
- export declare const LineOptions: ({ lineEnabled, onToggleLine, onTogglePoints, pointsEnabled, translations, }: ILineOptions) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const LineOptions: ({ options }: {
17
+ options: IMenuSection[];
18
+ }) => import("react/jsx-runtime").JSX.Element;
16
19
  export {};
@@ -679,7 +679,7 @@ export namespace CustomLegend {
679
679
  export namespace legend_4 {
680
680
  namespace customLegend {
681
681
  export const customLegendPlugin: {
682
- afterUpdate(chart: import("chart.js").Chart<keyof import("chart.js").ChartTypeRegistry, (number | import("chart.js").Point | [number, number] | import("chart.js").BubbleDataPoint | null)[], unknown>, _args: import("chart.js").Plugin<keyof import("chart.js").ChartTypeRegistry, import("../../../node_modules/chart.js/dist/types/basic").AnyObject>, _options: import("chart.js").ChartConfiguration<keyof import("chart.js").ChartTypeRegistry, (number | import("chart.js").Point | [number, number] | import("chart.js").BubbleDataPoint | null)[], unknown>): void;
682
+ afterUpdate(chart: import("chart.js").Chart<keyof import("chart.js").ChartTypeRegistry, (number | [number, number] | import("chart.js").Point | import("chart.js").BubbleDataPoint | null)[], unknown>, _args: import("chart.js").Plugin<keyof import("chart.js").ChartTypeRegistry, import("../../../node_modules/chart.js/dist/types/basic").AnyObject>, _options: import("chart.js").ChartConfiguration<keyof import("chart.js").ChartTypeRegistry, (number | [number, number] | import("chart.js").Point | import("chart.js").BubbleDataPoint | null)[], unknown>): void;
683
683
  };
684
684
  export { customLegendContainerID };
685
685
  }
@@ -1261,6 +1261,9 @@ export namespace DragAnnotations {
1261
1261
  radius?: undefined;
1262
1262
  labelConfig?: undefined;
1263
1263
  dragAxis?: undefined;
1264
+ dragRange?: undefined;
1265
+ pointStyle?: undefined;
1266
+ resizable?: undefined;
1264
1267
  } | {
1265
1268
  enableDrag: boolean;
1266
1269
  type: string;
@@ -1280,6 +1283,9 @@ export namespace DragAnnotations {
1280
1283
  radius?: undefined;
1281
1284
  labelConfig?: undefined;
1282
1285
  dragAxis?: undefined;
1286
+ dragRange?: undefined;
1287
+ pointStyle?: undefined;
1288
+ resizable?: undefined;
1283
1289
  } | {
1284
1290
  enableDrag: boolean;
1285
1291
  type: string;
@@ -1299,6 +1305,9 @@ export namespace DragAnnotations {
1299
1305
  radius?: undefined;
1300
1306
  labelConfig?: undefined;
1301
1307
  dragAxis?: undefined;
1308
+ dragRange?: undefined;
1309
+ pointStyle?: undefined;
1310
+ resizable?: undefined;
1302
1311
  } | {
1303
1312
  type: string;
1304
1313
  enableDrag: boolean;
@@ -1321,6 +1330,9 @@ export namespace DragAnnotations {
1321
1330
  yMin?: undefined;
1322
1331
  yMax?: undefined;
1323
1332
  dragAxis?: undefined;
1333
+ dragRange?: undefined;
1334
+ pointStyle?: undefined;
1335
+ resizable?: undefined;
1324
1336
  } | {
1325
1337
  enableDrag: boolean;
1326
1338
  dragAxis: string;
@@ -1340,6 +1352,56 @@ export namespace DragAnnotations {
1340
1352
  yValue?: undefined;
1341
1353
  radius?: undefined;
1342
1354
  labelConfig?: undefined;
1355
+ dragRange?: undefined;
1356
+ pointStyle?: undefined;
1357
+ resizable?: undefined;
1358
+ } | {
1359
+ type: string;
1360
+ enableDrag: boolean;
1361
+ dragAxis: string;
1362
+ xValue: number;
1363
+ yValue: number;
1364
+ radius: number;
1365
+ color: string;
1366
+ label: string;
1367
+ dragRange: {
1368
+ x: number[];
1369
+ y: number[];
1370
+ };
1371
+ annotationAxis?: undefined;
1372
+ value?: undefined;
1373
+ xMin?: undefined;
1374
+ xMax?: undefined;
1375
+ yMin?: undefined;
1376
+ yMax?: undefined;
1377
+ onDragStart?: undefined;
1378
+ onDrag?: undefined;
1379
+ onDragEnd?: undefined;
1380
+ labelConfig?: undefined;
1381
+ pointStyle?: undefined;
1382
+ resizable?: undefined;
1383
+ } | {
1384
+ type: string;
1385
+ enableDrag: boolean;
1386
+ pointStyle: string;
1387
+ dragAxis: string;
1388
+ xValue: number;
1389
+ yValue: number;
1390
+ radius: number;
1391
+ color: string;
1392
+ label: string;
1393
+ annotationAxis?: undefined;
1394
+ value?: undefined;
1395
+ xMin?: undefined;
1396
+ xMax?: undefined;
1397
+ yMin?: undefined;
1398
+ yMax?: undefined;
1399
+ onDragStart?: undefined;
1400
+ onDrag?: undefined;
1401
+ onDragEnd?: undefined;
1402
+ labelConfig?: undefined;
1403
+ dragRange?: undefined;
1404
+ resizable?: undefined;
1343
1405
  } | {
1344
1406
  type: string;
1345
1407
  enableDrag: boolean;
@@ -1359,6 +1421,56 @@ export namespace DragAnnotations {
1359
1421
  onDrag?: undefined;
1360
1422
  onDragEnd?: undefined;
1361
1423
  labelConfig?: undefined;
1424
+ dragRange?: undefined;
1425
+ pointStyle?: undefined;
1426
+ resizable?: undefined;
1427
+ } | {
1428
+ enableDrag: boolean;
1429
+ resizable: boolean;
1430
+ type: string;
1431
+ xMin: number;
1432
+ xMax: number;
1433
+ yMin: number;
1434
+ yMax: number;
1435
+ color: string;
1436
+ label: string;
1437
+ annotationAxis?: undefined;
1438
+ value?: undefined;
1439
+ onDragStart?: undefined;
1440
+ onDrag?: undefined;
1441
+ onDragEnd?: undefined;
1442
+ xValue?: undefined;
1443
+ yValue?: undefined;
1444
+ radius?: undefined;
1445
+ labelConfig?: undefined;
1446
+ dragAxis?: undefined;
1447
+ dragRange?: undefined;
1448
+ pointStyle?: undefined;
1449
+ } | {
1450
+ enableDrag: boolean;
1451
+ dragAxis: string;
1452
+ dragRange: {
1453
+ x: number[];
1454
+ y?: undefined;
1455
+ };
1456
+ type: string;
1457
+ xMin: number;
1458
+ xMax: number;
1459
+ yMin: number;
1460
+ yMax: number;
1461
+ color: string;
1462
+ label: string;
1463
+ annotationAxis?: undefined;
1464
+ value?: undefined;
1465
+ onDragStart?: undefined;
1466
+ onDrag?: undefined;
1467
+ onDragEnd?: undefined;
1468
+ xValue?: undefined;
1469
+ yValue?: undefined;
1470
+ radius?: undefined;
1471
+ labelConfig?: undefined;
1472
+ pointStyle?: undefined;
1473
+ resizable?: undefined;
1362
1474
  })[];
1363
1475
  export { annotationsData_5 as annotationsData };
1364
1476
  }
@@ -0,0 +1,28 @@
1
+ declare namespace _default {
2
+ export const title: string;
3
+ export { LineChart as component };
4
+ export namespace args {
5
+ export { basicChart as chart };
6
+ }
7
+ }
8
+ export default _default;
9
+ export function TestLegendDropzoneResizing(): import("react/jsx-runtime").JSX.Element;
10
+ import { LineChart } from './line-chart';
11
+ declare namespace basicChart {
12
+ namespace data {
13
+ const datasets: {
14
+ label: string;
15
+ data: {
16
+ x: number;
17
+ y: number;
18
+ }[];
19
+ }[];
20
+ }
21
+ namespace options {
22
+ const title_1: string;
23
+ export { title_1 as title };
24
+ export namespace chartStyling {
25
+ const height: string;
26
+ }
27
+ }
28
+ }
@@ -9,7 +9,7 @@ import { UnusedParameter } from '../../common/common.interface';
9
9
  */
10
10
  declare const getLineChartDataLabels: (options: ILineChartOptions) => {
11
11
  display: string;
12
- align: (context: import("./datalabels-alignment/datalabels-alignment.interface").IAlignmentContext) => import("../../common/helpers/enums").AlignOptions.End | import("../../common/helpers/enums").AlignOptions.Start | import("../../common/helpers/enums").AlignOptions.Right | import("../../common/helpers/enums").AlignOptions.Left;
12
+ align: (context: import("./datalabels-alignment/datalabels-alignment.interface").IAlignmentContext) => import("../../../..").AlignOptions.End | import("../../../..").AlignOptions.Start | import("../../../..").AlignOptions.Right | import("../../../..").AlignOptions.Left;
13
13
  formatter: (_: UnusedParameter, context: TooltipItem<any>) => any;
14
14
  } | {
15
15
  display: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "4.7.0-beta-5",
3
+ "version": "4.7.0-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
  "resolutions": {
@@ -44,10 +44,10 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@fontsource/noto-sans": "^5.0.18",
47
- "chart.js": "^4.2.1",
48
- "chartjs-plugin-annotation": "^3.0.1",
49
- "chartjs-plugin-datalabels": "^2.1.0",
50
- "chartjs-plugin-dragdata": "^2.2.5",
47
+ "chart.js": "^4.4.6",
48
+ "chartjs-plugin-annotation": "^3.1.0",
49
+ "chartjs-plugin-datalabels": "^2.2.0",
50
+ "chartjs-plugin-dragdata": "2.2.5",
51
51
  "chartjs-plugin-zoom": "^2.0.1",
52
52
  "fast-deep-equal": "^3.1.3",
53
53
  "html-to-image": "^1.11.11",
@@ -59,8 +59,8 @@
59
59
  "react-use": "^17.4.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@oliasoft-open-source/react-ui-library": "^4.10.4",
63
- "@oliasoft-open-source/units": "^3.14.0",
62
+ "@oliasoft-open-source/react-ui-library": "^4.16.0",
63
+ "@oliasoft-open-source/units": "^4.2.1",
64
64
  "@storybook/addon-actions": "^7.0.18",
65
65
  "@storybook/addon-docs": "^7.0.18",
66
66
  "@storybook/addon-mdx-gfm": "^7.0.23",
@@ -101,16 +101,16 @@
101
101
  "rollup-plugin-peer-deps-external": "^2.2.4",
102
102
  "storybook": "^7.0.18",
103
103
  "storybook-dark-mode": "^3.0.0",
104
- "vite": "^4.3.9",
104
+ "vite": "^5.4.11",
105
105
  "vite-plugin-css-injected-by-js": "^3.1.1",
106
106
  "vite-plugin-dts": "3.6.0",
107
107
  "vite-plugin-svgr": "^4.2.0",
108
108
  "vite-tsconfig-paths": "^4.2.0",
109
- "vitest": "^0.34.6"
109
+ "vitest": "^2.1.4"
110
110
  },
111
111
  "peerDependencies": {
112
- "@oliasoft-open-source/react-ui-library": "^4.10.4",
113
- "@oliasoft-open-source/units": "^3.14.0",
112
+ "@oliasoft-open-source/react-ui-library": "^4.16.0",
113
+ "@oliasoft-open-source/units": "^4.2.1",
114
114
  "ajv": "^8.12.0",
115
115
  "ajv-errors": "^3.0.0",
116
116
  "ajv-keywords": "^5.1.0",