@gravity-ui/charts 0.6.0 → 0.7.0
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/README.md +1 -1
- package/dist/cjs/components/Tooltip/ChartTooltipContent.d.ts +2 -2
- package/dist/cjs/components/Tooltip/index.js +6 -6
- package/dist/cjs/components/Tooltip/styles.css +7 -18
- package/dist/cjs/components/index.d.ts +10 -9
- package/dist/cjs/hooks/useSeries/prepare-area.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-line.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/area/prepare-data.js +4 -0
- package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +1 -0
- package/dist/cjs/hooks/useShapes/bar-y/prepare-data.js +1 -0
- package/dist/cjs/hooks/useShapes/line/prepare-data.js +1 -0
- package/dist/cjs/hooks/useShapes/pie/index.js +2 -1
- package/dist/cjs/hooks/useShapes/pie/prepare-data.js +159 -111
- package/dist/cjs/hooks/useShapes/pie/types.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/treemap/prepare-data.js +1 -0
- package/dist/cjs/types/chart/area.d.ts +6 -6
- package/dist/cjs/types/chart/axis.d.ts +8 -7
- package/dist/cjs/types/chart/bar-x.d.ts +4 -4
- package/dist/cjs/types/chart/bar-y.d.ts +5 -6
- package/dist/cjs/types/chart/base.d.ts +6 -6
- package/dist/cjs/types/chart/chart.d.ts +4 -4
- package/dist/cjs/types/chart/halo.d.ts +2 -2
- package/dist/cjs/types/chart/legend.d.ts +10 -10
- package/dist/cjs/types/chart/line.d.ts +4 -4
- package/dist/cjs/types/chart/marker.d.ts +2 -2
- package/dist/cjs/types/chart/pie.d.ts +4 -4
- package/dist/cjs/types/chart/scatter.d.ts +4 -4
- package/dist/cjs/types/chart/series.d.ts +8 -8
- package/dist/cjs/types/chart/split.d.ts +4 -4
- package/dist/cjs/types/chart/title.d.ts +2 -2
- package/dist/cjs/types/chart/tooltip.d.ts +20 -20
- package/dist/cjs/types/chart/treemap.d.ts +4 -4
- package/dist/cjs/types/chart/waterfall.d.ts +4 -4
- package/dist/cjs/types/chart-ui.d.ts +10 -6
- package/dist/cjs/types/formatter.d.ts +4 -4
- package/dist/cjs/types/index.d.ts +34 -4
- package/dist/esm/components/Tooltip/ChartTooltipContent.d.ts +2 -2
- package/dist/esm/components/Tooltip/index.js +6 -6
- package/dist/esm/components/Tooltip/styles.css +7 -18
- package/dist/esm/components/index.d.ts +10 -9
- package/dist/esm/hooks/useSeries/prepare-area.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-line.d.ts +1 -1
- package/dist/esm/hooks/useShapes/area/prepare-data.js +4 -0
- package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +1 -0
- package/dist/esm/hooks/useShapes/bar-y/prepare-data.js +1 -0
- package/dist/esm/hooks/useShapes/line/prepare-data.js +1 -0
- package/dist/esm/hooks/useShapes/pie/index.js +2 -1
- package/dist/esm/hooks/useShapes/pie/prepare-data.js +159 -111
- package/dist/esm/hooks/useShapes/pie/types.d.ts +1 -1
- package/dist/esm/hooks/useShapes/treemap/prepare-data.js +1 -0
- package/dist/esm/types/chart/area.d.ts +6 -6
- package/dist/esm/types/chart/axis.d.ts +8 -7
- package/dist/esm/types/chart/bar-x.d.ts +4 -4
- package/dist/esm/types/chart/bar-y.d.ts +5 -6
- package/dist/esm/types/chart/base.d.ts +6 -6
- package/dist/esm/types/chart/chart.d.ts +4 -4
- package/dist/esm/types/chart/halo.d.ts +2 -2
- package/dist/esm/types/chart/legend.d.ts +10 -10
- package/dist/esm/types/chart/line.d.ts +4 -4
- package/dist/esm/types/chart/marker.d.ts +2 -2
- package/dist/esm/types/chart/pie.d.ts +4 -4
- package/dist/esm/types/chart/scatter.d.ts +4 -4
- package/dist/esm/types/chart/series.d.ts +8 -8
- package/dist/esm/types/chart/split.d.ts +4 -4
- package/dist/esm/types/chart/title.d.ts +2 -2
- package/dist/esm/types/chart/tooltip.d.ts +20 -20
- package/dist/esm/types/chart/treemap.d.ts +4 -4
- package/dist/esm/types/chart/waterfall.d.ts +4 -4
- package/dist/esm/types/chart-ui.d.ts +10 -6
- package/dist/esm/types/formatter.d.ts +4 -4
- package/dist/esm/types/index.d.ts +34 -4
- package/package.json +7 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseTextStyle } from './base';
|
|
2
|
-
export
|
|
2
|
+
export interface ChartLegend {
|
|
3
3
|
enabled?: boolean;
|
|
4
4
|
/**
|
|
5
5
|
* Different types for different color schemes.
|
|
@@ -47,16 +47,16 @@ export type ChartLegend = {
|
|
|
47
47
|
domain?: number[];
|
|
48
48
|
};
|
|
49
49
|
width?: number;
|
|
50
|
-
}
|
|
51
|
-
export
|
|
50
|
+
}
|
|
51
|
+
export interface BaseLegendSymbol {
|
|
52
52
|
/**
|
|
53
53
|
* The pixel padding between the legend item symbol and the legend item text.
|
|
54
54
|
*
|
|
55
55
|
* @default 5
|
|
56
56
|
* */
|
|
57
57
|
padding?: number;
|
|
58
|
-
}
|
|
59
|
-
export
|
|
58
|
+
}
|
|
59
|
+
export interface RectLegendSymbolOptions extends BaseLegendSymbol {
|
|
60
60
|
/**
|
|
61
61
|
* The pixel width of the symbol for series types that use a rectangle in the legend
|
|
62
62
|
*
|
|
@@ -75,20 +75,20 @@ export type RectLegendSymbolOptions = BaseLegendSymbol & {
|
|
|
75
75
|
* Defaults to half the symbolHeight, effectively creating a circle.
|
|
76
76
|
*/
|
|
77
77
|
radius?: number;
|
|
78
|
-
}
|
|
79
|
-
export
|
|
78
|
+
}
|
|
79
|
+
export interface PathLegendSymbolOptions extends BaseLegendSymbol {
|
|
80
80
|
/**
|
|
81
81
|
* The pixel width of the symbol for series types that use a path in the legend
|
|
82
82
|
*
|
|
83
83
|
* @default 16
|
|
84
84
|
* */
|
|
85
85
|
width?: number;
|
|
86
|
-
}
|
|
87
|
-
export
|
|
86
|
+
}
|
|
87
|
+
export interface SymbolLegendSymbolOptions extends BaseLegendSymbol {
|
|
88
88
|
/**
|
|
89
89
|
* The pixel width of the symbol for series types that use a symbol in the legend
|
|
90
90
|
*
|
|
91
91
|
* @default 8
|
|
92
92
|
* */
|
|
93
93
|
width?: number;
|
|
94
|
-
}
|
|
94
|
+
}
|
|
@@ -3,7 +3,7 @@ import type { MeaningfulAny } from '../misc';
|
|
|
3
3
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
4
4
|
import type { ChartLegend, RectLegendSymbolOptions } from './legend';
|
|
5
5
|
import type { PointMarkerOptions } from './marker';
|
|
6
|
-
export
|
|
6
|
+
export interface LineSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
7
7
|
/**
|
|
8
8
|
* The `x` value of the point. Depending on the context , it may represents:
|
|
9
9
|
* - numeric value (for `linear` x axis)
|
|
@@ -27,8 +27,8 @@ export type LineSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
}
|
|
31
|
-
export
|
|
30
|
+
}
|
|
31
|
+
export interface LineSeries<T = MeaningfulAny> extends BaseSeries {
|
|
32
32
|
type: typeof SeriesType.Line;
|
|
33
33
|
data: LineSeriesData<T>[];
|
|
34
34
|
/** The name of the series (used in legend, tooltip etc) */
|
|
@@ -54,4 +54,4 @@ export type LineSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
54
54
|
opacity?: number;
|
|
55
55
|
/** Y-axis index (when using two axes) */
|
|
56
56
|
yAxis?: number;
|
|
57
|
-
}
|
|
57
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SymbolType } from '../../constants';
|
|
2
|
-
export
|
|
2
|
+
export interface PointMarkerOptions {
|
|
3
3
|
/** Enable or disable the point marker */
|
|
4
4
|
enabled?: boolean;
|
|
5
5
|
/** The radius of the point marker */
|
|
@@ -9,4 +9,4 @@ export type PointMarkerOptions = {
|
|
|
9
9
|
/** The width of the point marker's border */
|
|
10
10
|
borderWidth?: number;
|
|
11
11
|
symbol?: `${SymbolType}`;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
@@ -3,7 +3,7 @@ import type { SeriesType } from '../../constants';
|
|
|
3
3
|
import type { MeaningfulAny } from '../misc';
|
|
4
4
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
5
5
|
import type { ChartLegend, RectLegendSymbolOptions } from './legend';
|
|
6
|
-
export
|
|
6
|
+
export interface PieSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
7
7
|
/** The value of the pie segment. */
|
|
8
8
|
value: number;
|
|
9
9
|
/** The name of the pie segment (used in legend, tooltip etc). */
|
|
@@ -14,10 +14,10 @@ export type PieSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
14
14
|
label?: string;
|
|
15
15
|
/** Individual opacity for the pie segment. */
|
|
16
16
|
opacity?: number;
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
export type ConnectorShape = 'straight-line' | 'polyline';
|
|
19
19
|
export type ConnectorCurve = 'linear' | 'basic';
|
|
20
|
-
export
|
|
20
|
+
export interface PieSeries<T = MeaningfulAny> extends BaseSeries {
|
|
21
21
|
type: typeof SeriesType.Pie;
|
|
22
22
|
data: PieSeriesData<T>[];
|
|
23
23
|
/**
|
|
@@ -85,4 +85,4 @@ export type PieSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
85
85
|
innerRadius: number;
|
|
86
86
|
};
|
|
87
87
|
}) => BaseType;
|
|
88
|
-
}
|
|
88
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { SeriesType, SymbolType } from '../../constants';
|
|
|
2
2
|
import type { MeaningfulAny } from '../misc';
|
|
3
3
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
4
4
|
import type { ChartLegend, RectLegendSymbolOptions } from './legend';
|
|
5
|
-
export
|
|
5
|
+
export interface ScatterSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
6
6
|
/**
|
|
7
7
|
* The `x` value of the point. Depending on the context , it may represents:
|
|
8
8
|
* - numeric value (for `linear` x axis)
|
|
@@ -27,8 +27,8 @@ export type ScatterSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
27
27
|
radius?: number;
|
|
28
28
|
/** Individual opacity for the point. */
|
|
29
29
|
opacity?: number;
|
|
30
|
-
}
|
|
31
|
-
export
|
|
30
|
+
}
|
|
31
|
+
export interface ScatterSeries<T = MeaningfulAny> extends BaseSeries {
|
|
32
32
|
type: typeof SeriesType.Scatter;
|
|
33
33
|
data: ScatterSeriesData<T>[];
|
|
34
34
|
/** The name of the series (used in legend, tooltip etc) */
|
|
@@ -43,4 +43,4 @@ export type ScatterSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
43
43
|
};
|
|
44
44
|
/** Y-axis index (when using two axes) */
|
|
45
45
|
yAxis?: number;
|
|
46
|
-
}
|
|
46
|
+
}
|
|
@@ -13,10 +13,10 @@ import type { TreemapSeries, TreemapSeriesData } from './treemap';
|
|
|
13
13
|
import type { WaterfallSeries, WaterfallSeriesData } from './waterfall';
|
|
14
14
|
export type ChartSeries<T = MeaningfulAny> = ScatterSeries<T> | PieSeries<T> | BarXSeries<T> | BarYSeries<T> | LineSeries<T> | AreaSeries<T> | TreemapSeries<T> | WaterfallSeries<T>;
|
|
15
15
|
export type ChartSeriesData<T = MeaningfulAny> = ScatterSeriesData<T> | PieSeriesData<T> | BarXSeriesData<T> | BarYSeriesData<T> | LineSeriesData<T> | AreaSeriesData<T> | TreemapSeriesData<T> | WaterfallSeriesData<T>;
|
|
16
|
-
export
|
|
16
|
+
export interface DataLabelRendererData<T = MeaningfulAny> {
|
|
17
17
|
data: ChartSeriesData<T>;
|
|
18
|
-
}
|
|
19
|
-
export
|
|
18
|
+
}
|
|
19
|
+
export interface BasicHoverState {
|
|
20
20
|
/**
|
|
21
21
|
* Enable separate styles for the hovered series.
|
|
22
22
|
*
|
|
@@ -32,8 +32,8 @@ export type BasicHoverState = {
|
|
|
32
32
|
* @default 0.3
|
|
33
33
|
*/
|
|
34
34
|
brightness?: number;
|
|
35
|
-
}
|
|
36
|
-
export
|
|
35
|
+
}
|
|
36
|
+
export interface BasicInactiveState {
|
|
37
37
|
/**
|
|
38
38
|
* Enable separate styles for the inactive series.
|
|
39
39
|
*
|
|
@@ -46,8 +46,8 @@ export type BasicInactiveState = {
|
|
|
46
46
|
* @default 0.5
|
|
47
47
|
* */
|
|
48
48
|
opacity?: number;
|
|
49
|
-
}
|
|
50
|
-
export
|
|
49
|
+
}
|
|
50
|
+
export interface ChartSeriesOptions {
|
|
51
51
|
/** Individual data label for each point. */
|
|
52
52
|
dataLabels?: {
|
|
53
53
|
/** Enable or disable the data labels */
|
|
@@ -222,4 +222,4 @@ export type ChartSeriesOptions = {
|
|
|
222
222
|
inactive?: BasicInactiveState;
|
|
223
223
|
};
|
|
224
224
|
};
|
|
225
|
-
}
|
|
225
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { BaseTextStyle } from './base';
|
|
2
|
-
export
|
|
2
|
+
export interface SplitPlotOptions {
|
|
3
3
|
title?: {
|
|
4
4
|
text: string;
|
|
5
5
|
style?: Partial<BaseTextStyle>;
|
|
6
6
|
};
|
|
7
|
-
}
|
|
8
|
-
export
|
|
7
|
+
}
|
|
8
|
+
export interface ChartSplit {
|
|
9
9
|
enable: boolean;
|
|
10
10
|
layout?: 'vertical';
|
|
11
11
|
gap?: string | number;
|
|
12
12
|
plots?: SplitPlotOptions[];
|
|
13
|
-
}
|
|
13
|
+
}
|
|
@@ -8,63 +8,63 @@ import type { PieSeries, PieSeriesData } from './pie';
|
|
|
8
8
|
import type { ScatterSeries, ScatterSeriesData } from './scatter';
|
|
9
9
|
import type { TreemapSeries, TreemapSeriesData } from './treemap';
|
|
10
10
|
import type { WaterfallSeries, WaterfallSeriesData } from './waterfall';
|
|
11
|
-
export
|
|
11
|
+
export interface TooltipDataChunkBarX<T = MeaningfulAny> {
|
|
12
12
|
data: BarXSeriesData<T>;
|
|
13
13
|
series: BarXSeries<T>;
|
|
14
|
-
}
|
|
15
|
-
export
|
|
14
|
+
}
|
|
15
|
+
export interface TooltipDataChunkBarY<T = MeaningfulAny> {
|
|
16
16
|
data: BarYSeriesData<T>;
|
|
17
17
|
series: BarYSeries<T>;
|
|
18
|
-
}
|
|
19
|
-
export
|
|
18
|
+
}
|
|
19
|
+
export interface TooltipDataChunkPie<T = MeaningfulAny> {
|
|
20
20
|
data: PieSeriesData<T>;
|
|
21
21
|
series: {
|
|
22
22
|
type: PieSeries['type'];
|
|
23
23
|
id: string;
|
|
24
24
|
name: string;
|
|
25
25
|
};
|
|
26
|
-
}
|
|
27
|
-
export
|
|
26
|
+
}
|
|
27
|
+
export interface TooltipDataChunkScatter<T = MeaningfulAny> {
|
|
28
28
|
data: ScatterSeriesData<T>;
|
|
29
29
|
series: {
|
|
30
30
|
type: ScatterSeries['type'];
|
|
31
31
|
id: string;
|
|
32
32
|
name: string;
|
|
33
33
|
};
|
|
34
|
-
}
|
|
35
|
-
export
|
|
34
|
+
}
|
|
35
|
+
export interface TooltipDataChunkLine<T = MeaningfulAny> {
|
|
36
36
|
data: LineSeriesData<T>;
|
|
37
37
|
series: {
|
|
38
38
|
type: LineSeries['type'];
|
|
39
39
|
id: string;
|
|
40
40
|
name: string;
|
|
41
41
|
};
|
|
42
|
-
}
|
|
43
|
-
export
|
|
42
|
+
}
|
|
43
|
+
export interface TooltipDataChunkArea<T = MeaningfulAny> {
|
|
44
44
|
data: AreaSeriesData<T>;
|
|
45
45
|
series: {
|
|
46
46
|
type: AreaSeries['type'];
|
|
47
47
|
id: string;
|
|
48
48
|
name: string;
|
|
49
49
|
};
|
|
50
|
-
}
|
|
51
|
-
export
|
|
50
|
+
}
|
|
51
|
+
export interface TooltipDataChunkTreemap<T = MeaningfulAny> {
|
|
52
52
|
data: TreemapSeriesData<T>;
|
|
53
53
|
series: TreemapSeries<T>;
|
|
54
|
-
}
|
|
55
|
-
export
|
|
54
|
+
}
|
|
55
|
+
export interface TooltipDataChunkWaterfall<T = MeaningfulAny> {
|
|
56
56
|
data: WaterfallSeriesData<T>;
|
|
57
57
|
series: WaterfallSeries<T>;
|
|
58
|
-
}
|
|
58
|
+
}
|
|
59
59
|
export type TooltipDataChunk<T = MeaningfulAny> = (TooltipDataChunkBarX<T> | TooltipDataChunkBarY<T> | TooltipDataChunkPie<T> | TooltipDataChunkScatter<T> | TooltipDataChunkLine<T> | TooltipDataChunkArea<T> | TooltipDataChunkTreemap<T> | TooltipDataChunkWaterfall<T>) & {
|
|
60
60
|
closest?: boolean;
|
|
61
61
|
};
|
|
62
|
-
export
|
|
62
|
+
export interface ChartTooltipRendererArgs<T = MeaningfulAny> {
|
|
63
63
|
hovered: TooltipDataChunk<T>[];
|
|
64
64
|
xAxis?: ChartXAxis;
|
|
65
65
|
yAxis?: ChartYAxis;
|
|
66
|
-
}
|
|
67
|
-
export
|
|
66
|
+
}
|
|
67
|
+
export interface ChartTooltip<T = MeaningfulAny> {
|
|
68
68
|
enabled?: boolean;
|
|
69
69
|
/** Specifies the renderer for the tooltip. If returned null default tooltip renderer will be used. */
|
|
70
70
|
renderer?: (args: ChartTooltipRendererArgs<T>) => React.ReactElement | null;
|
|
@@ -72,4 +72,4 @@ export type ChartTooltip<T = MeaningfulAny> = {
|
|
|
72
72
|
enabled?: boolean;
|
|
73
73
|
modifierKey?: 'altKey' | 'metaKey';
|
|
74
74
|
};
|
|
75
|
-
}
|
|
75
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { LayoutAlgorithm, SeriesType } from '../../constants';
|
|
|
2
2
|
import type { MeaningfulAny } from '../misc';
|
|
3
3
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
4
4
|
import type { ChartLegend, RectLegendSymbolOptions } from './legend';
|
|
5
|
-
export
|
|
5
|
+
export interface TreemapSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
6
6
|
/** The name of the node (used in legend, tooltip etc). */
|
|
7
7
|
name: string | string[];
|
|
8
8
|
/** The value of the node. All nodes should have this property except nodes that have children. */
|
|
@@ -14,8 +14,8 @@ export type TreemapSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
14
14
|
* If no nodes has a matching id, or this option is undefined, then the parent will be set to the root.
|
|
15
15
|
*/
|
|
16
16
|
parentId?: string;
|
|
17
|
-
}
|
|
18
|
-
export
|
|
17
|
+
}
|
|
18
|
+
export interface TreemapSeries<T = MeaningfulAny> extends BaseSeries {
|
|
19
19
|
type: typeof SeriesType.Treemap;
|
|
20
20
|
data: TreemapSeriesData<T>[];
|
|
21
21
|
/** The name of the series (used in legend, tooltip etc). */
|
|
@@ -43,4 +43,4 @@ export type TreemapSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
43
43
|
/** Horizontal alignment of the data label inside the tile. */
|
|
44
44
|
align?: 'left' | 'center' | 'right';
|
|
45
45
|
};
|
|
46
|
-
}
|
|
46
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { SeriesType } from '../../constants';
|
|
|
2
2
|
import type { MeaningfulAny } from '../misc';
|
|
3
3
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
4
4
|
import type { ChartLegend, RectLegendSymbolOptions } from './legend';
|
|
5
|
-
export
|
|
5
|
+
export interface WaterfallSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
6
6
|
/**
|
|
7
7
|
* The `x` value. Depending on the context , it may represents:
|
|
8
8
|
* - numeric value (for `linear` x axis)
|
|
@@ -21,8 +21,8 @@ export type WaterfallSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
21
21
|
opacity?: number;
|
|
22
22
|
/** When this property is true, the point display the total sum across the entire series. */
|
|
23
23
|
total?: boolean;
|
|
24
|
-
}
|
|
25
|
-
export
|
|
24
|
+
}
|
|
25
|
+
export interface WaterfallSeries<T = MeaningfulAny> extends BaseSeries {
|
|
26
26
|
type: typeof SeriesType.Waterfall;
|
|
27
27
|
data: WaterfallSeriesData<T>[];
|
|
28
28
|
/** The name of the series (used in legend, tooltip etc). */
|
|
@@ -37,4 +37,4 @@ export type WaterfallSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
37
37
|
legend?: ChartLegend & {
|
|
38
38
|
symbol?: RectLegendSymbolOptions;
|
|
39
39
|
};
|
|
40
|
-
}
|
|
40
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseTextStyle } from './chart/base';
|
|
2
|
-
export
|
|
2
|
+
export interface LabelData {
|
|
3
3
|
text: string;
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
@@ -13,12 +13,16 @@ export type LabelData = {
|
|
|
13
13
|
id: string;
|
|
14
14
|
};
|
|
15
15
|
active?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export
|
|
16
|
+
}
|
|
17
|
+
export interface HtmlItem {
|
|
18
18
|
x: number;
|
|
19
19
|
y: number;
|
|
20
20
|
content: string;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
size: {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface ShapeDataWithHtmlItems {
|
|
23
27
|
htmlElements: HtmlItem[];
|
|
24
|
-
}
|
|
28
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface FormatOptions {
|
|
2
2
|
precision?: number | 'auto';
|
|
3
3
|
unitRate?: number;
|
|
4
4
|
showRankDelimiter?: boolean;
|
|
5
5
|
lang?: string;
|
|
6
6
|
labelMode?: string;
|
|
7
|
-
}
|
|
8
|
-
export
|
|
7
|
+
}
|
|
8
|
+
export interface FormatNumberOptions extends FormatOptions {
|
|
9
9
|
format?: 'number' | 'percent';
|
|
10
10
|
multiplier?: number;
|
|
11
11
|
prefix?: string;
|
|
12
12
|
postfix?: string;
|
|
13
13
|
unit?: 'auto' | 'k' | 'm' | 'b' | 't' | null;
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -25,18 +25,48 @@ export * from './chart/tooltip';
|
|
|
25
25
|
export * from './chart/halo';
|
|
26
26
|
export * from './chart/treemap';
|
|
27
27
|
export * from './chart/waterfall';
|
|
28
|
-
export
|
|
28
|
+
export interface ChartData<T = MeaningfulAny> {
|
|
29
|
+
/**
|
|
30
|
+
* General options for the chart.
|
|
31
|
+
*/
|
|
29
32
|
chart?: ChartOptions;
|
|
33
|
+
/**
|
|
34
|
+
* The legend displays a labeled box for each data element in the chart.
|
|
35
|
+
* It shows a distinctive symbol paired with a name for every series.
|
|
36
|
+
*/
|
|
30
37
|
legend?: ChartLegend;
|
|
38
|
+
/**
|
|
39
|
+
* Represents the series data and series options.
|
|
40
|
+
*/
|
|
31
41
|
series: {
|
|
42
|
+
/**
|
|
43
|
+
* Contains data points to be plotted.
|
|
44
|
+
*/
|
|
32
45
|
data: ChartSeries<T>[];
|
|
46
|
+
/**
|
|
47
|
+
* Allows for customizing the appearance and behavior of the series.
|
|
48
|
+
*/
|
|
33
49
|
options?: ChartSeriesOptions;
|
|
34
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* The main title of the chart.
|
|
53
|
+
*/
|
|
35
54
|
title?: ChartTitle;
|
|
55
|
+
/**
|
|
56
|
+
* Options for the tooltip that appears when the user hovers over a series or point.
|
|
57
|
+
*/
|
|
36
58
|
tooltip?: ChartTooltip<T>;
|
|
59
|
+
/**
|
|
60
|
+
* Options for the the X axis.
|
|
61
|
+
*/
|
|
37
62
|
xAxis?: ChartXAxis;
|
|
63
|
+
/**
|
|
64
|
+
* Options for the the Y axis or multiple Y axes.
|
|
65
|
+
*/
|
|
38
66
|
yAxis?: ChartYAxis[];
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
67
|
+
/**
|
|
68
|
+
* Setting for displaying charts on different plots.
|
|
69
|
+
* It can be used to visualize related information on multiple charts.
|
|
70
|
+
*/
|
|
41
71
|
split?: ChartSplit;
|
|
42
|
-
}
|
|
72
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/charts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "React component used to render charts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -50,7 +50,10 @@
|
|
|
50
50
|
"build": "gulp",
|
|
51
51
|
"start": "storybook dev -p 7007",
|
|
52
52
|
"build-storybook": "storybook build -c .storybook -o storybook-static",
|
|
53
|
-
"prepublishOnly": "npm run build"
|
|
53
|
+
"prepublishOnly": "npm run build",
|
|
54
|
+
"docs:deps": "cd ./docs && npm ci",
|
|
55
|
+
"docs:dev": "cd ./docs && npm run docs:dev",
|
|
56
|
+
"docs:build": "cd ./docs && npm run docs:build"
|
|
54
57
|
},
|
|
55
58
|
"dependencies": {
|
|
56
59
|
"@bem-react/classname": "^1.6.0",
|
|
@@ -70,7 +73,7 @@
|
|
|
70
73
|
"@gravity-ui/prettier-config": "^1.1.0",
|
|
71
74
|
"@gravity-ui/stylelint-config": "^4.0.1",
|
|
72
75
|
"@gravity-ui/tsconfig": "^1.0.0",
|
|
73
|
-
"@gravity-ui/uikit": "^
|
|
76
|
+
"@gravity-ui/uikit": "^7.4.0",
|
|
74
77
|
"@storybook/addon-a11y": "^8.2.9",
|
|
75
78
|
"@storybook/addon-actions": "^8.2.9",
|
|
76
79
|
"@storybook/addon-essentials": "^8.2.9",
|
|
@@ -122,7 +125,7 @@
|
|
|
122
125
|
"typescript": "^5.5.4"
|
|
123
126
|
},
|
|
124
127
|
"peerDependencies": {
|
|
125
|
-
"@gravity-ui/uikit": "^
|
|
128
|
+
"@gravity-ui/uikit": "^7.0.0",
|
|
126
129
|
"react": ">=17.0.0",
|
|
127
130
|
"react-dom": ">=17.0.0"
|
|
128
131
|
},
|