@gravity-ui/chartkit 4.8.0 → 4.9.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/build/components/ChartKit.d.ts +1 -1
- package/build/components/ChartKit.js +1 -1
- package/build/components/Loader/Loader.d.ts +5 -2
- package/build/components/Loader/Loader.js +8 -1
- package/build/plugins/d3/examples/bar-x/GroupedColumns.js +4 -2
- package/build/plugins/d3/examples/bar-y/Basic.d.ts +2 -0
- package/build/plugins/d3/examples/bar-y/Basic.js +43 -0
- package/build/plugins/d3/examples/bar-y/GroupedColumns.d.ts +2 -0
- package/build/plugins/d3/examples/bar-y/GroupedColumns.js +48 -0
- package/build/plugins/d3/examples/bar-y/StackedColumns.d.ts +2 -0
- package/build/plugins/d3/examples/bar-y/StackedColumns.js +47 -0
- package/build/plugins/d3/examples/combined/LineAndBarX.d.ts +2 -0
- package/build/plugins/d3/examples/combined/LineAndBarX.js +61 -0
- package/build/plugins/d3/examples/line/Basic.d.ts +2 -0
- package/build/plugins/d3/examples/line/Basic.js +66 -0
- package/build/plugins/d3/examples/nintendoGames.d.ts +40 -10
- package/build/plugins/d3/examples/nintendoGames.js +2416 -2189
- package/build/plugins/d3/renderer/D3Widget.d.ts +1 -1
- package/build/plugins/d3/renderer/D3Widget.js +27 -11
- package/build/plugins/d3/renderer/components/Chart.d.ts +0 -2
- package/build/plugins/d3/renderer/components/Chart.js +4 -6
- package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.d.ts +2 -2
- package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.js +42 -35
- package/build/plugins/d3/renderer/components/Tooltip/TooltipTriggerArea.d.ts +0 -2
- package/build/plugins/d3/renderer/components/Tooltip/TooltipTriggerArea.js +118 -48
- package/build/plugins/d3/renderer/components/Tooltip/index.d.ts +1 -0
- package/build/plugins/d3/renderer/components/Tooltip/index.js +5 -4
- package/build/plugins/d3/renderer/components/styles.css +1 -0
- package/build/plugins/d3/renderer/constants/defaults/series-options.d.ts +9 -2
- package/build/plugins/d3/renderer/constants/defaults/series-options.js +27 -0
- package/build/plugins/d3/renderer/hooks/useAxisScales/index.js +15 -1
- package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.js +3 -3
- package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.js +3 -3
- package/build/plugins/d3/renderer/hooks/useSeries/constants.d.ts +3 -0
- package/build/plugins/d3/renderer/hooks/useSeries/constants.js +5 -0
- package/build/plugins/d3/renderer/hooks/useSeries/index.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useSeries/index.js +2 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-x.d.ts +10 -0
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-x.js +38 -0
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-y.d.ts +10 -0
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-y.js +50 -0
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-line-series.d.ts +11 -0
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-line-series.js +32 -0
- package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.d.ts +2 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.js +21 -60
- package/build/plugins/d3/renderer/hooks/useSeries/types.d.ts +24 -2
- package/build/plugins/d3/renderer/hooks/useSeries/utils.d.ts +3 -1
- package/build/plugins/d3/renderer/hooks/useSeries/utils.js +13 -0
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/prepare-data.js +4 -6
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/index.d.ts +11 -0
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/index.js +87 -0
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/prepare-data.d.ts +12 -0
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/prepare-data.js +114 -0
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/types.d.ts +10 -0
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/types.js +1 -0
- package/build/plugins/d3/renderer/hooks/useShapes/constants.d.ts +3 -0
- package/build/plugins/d3/renderer/hooks/useShapes/constants.js +3 -0
- package/build/plugins/d3/renderer/hooks/useShapes/index.d.ts +4 -4
- package/build/plugins/d3/renderer/hooks/useShapes/index.js +35 -5
- package/build/plugins/d3/renderer/hooks/useShapes/line/index.d.ts +11 -0
- package/build/plugins/d3/renderer/hooks/useShapes/line/index.js +98 -0
- package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.d.ts +11 -0
- package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.js +21 -0
- package/build/plugins/d3/renderer/hooks/useShapes/line/types.d.ts +16 -0
- package/build/plugins/d3/renderer/hooks/useShapes/line/types.js +1 -0
- package/build/plugins/d3/renderer/hooks/useShapes/pie.d.ts +0 -2
- package/build/plugins/d3/renderer/hooks/useShapes/pie.js +3 -3
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.d.ts +0 -2
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.js +6 -6
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.js +3 -34
- package/build/plugins/d3/renderer/hooks/useShapes/styles.css +6 -0
- package/build/plugins/d3/renderer/hooks/useShapes/utils.d.ts +17 -0
- package/build/plugins/d3/renderer/hooks/useShapes/utils.js +25 -0
- package/build/plugins/d3/renderer/utils/axis-generators/bottom.js +3 -3
- package/build/plugins/d3/renderer/utils/text.d.ts +5 -7
- package/build/plugins/d3/renderer/utils/text.js +4 -15
- package/build/plugins/highcharts/renderer/HighchartsWidget.d.ts +1 -1
- package/build/plugins/indicator/renderer/IndicatorWidget.d.ts +1 -1
- package/build/plugins/yagr/renderer/YagrWidget.d.ts +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/widget-data/bar-y.d.ts +55 -0
- package/build/types/widget-data/bar-y.js +1 -0
- package/build/types/widget-data/base.d.ts +4 -0
- package/build/types/widget-data/index.d.ts +2 -0
- package/build/types/widget-data/index.js +2 -0
- package/build/types/widget-data/line.d.ts +37 -0
- package/build/types/widget-data/line.js +1 -0
- package/build/types/widget-data/series.d.ts +53 -3
- package/build/types/widget-data/tooltip.d.ts +15 -1
- package/build/utils/index.d.ts +1 -1
- package/build/utils/index.js +1 -1
- package/build/utils/performance.d.ts +3 -0
- package/build/utils/performance.js +8 -0
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseSeries, BaseSeriesData } from './base';
|
|
2
|
+
import { ChartKitWidgetLegend, RectLegendSymbolOptions } from './legend';
|
|
3
|
+
export type LineSeriesData<T = any> = BaseSeriesData<T> & {
|
|
4
|
+
/**
|
|
5
|
+
* The `x` value of the point. Depending on the context , it may represents:
|
|
6
|
+
* - numeric value (for `linear` x axis)
|
|
7
|
+
* - timestamp value (for `datetime` x axis)
|
|
8
|
+
* - x axis category value (for `category` x axis). If the type is a string, then it is a category value itself. If the type is a number, then it is the index of an element in the array of categories described in `xAxis.categories`
|
|
9
|
+
*/
|
|
10
|
+
x?: string | number;
|
|
11
|
+
/**
|
|
12
|
+
* The `y` value of the point. Depending on the context , it may represents:
|
|
13
|
+
* - numeric value (for `linear` y axis)
|
|
14
|
+
* - timestamp value (for `datetime` y axis)
|
|
15
|
+
* - y axis category value (for `category` y axis). If the type is a string, then it is a category value itself. If the type is a number, then it is the index of an element in the array of categories described in `yAxis[0].categories`
|
|
16
|
+
*/
|
|
17
|
+
y?: string | number;
|
|
18
|
+
/** Data label value of the point. If not specified, the y value is used. */
|
|
19
|
+
label?: string | number;
|
|
20
|
+
};
|
|
21
|
+
export type LineSeries<T = any> = BaseSeries & {
|
|
22
|
+
type: 'line';
|
|
23
|
+
data: LineSeriesData<T>[];
|
|
24
|
+
/** The name of the series (used in legend, tooltip etc) */
|
|
25
|
+
name: string;
|
|
26
|
+
/** The main color of the series (hex, rgba) */
|
|
27
|
+
color?: string;
|
|
28
|
+
/** Pixel width of the graph line.
|
|
29
|
+
*
|
|
30
|
+
* @default 1
|
|
31
|
+
* */
|
|
32
|
+
lineWidth?: number;
|
|
33
|
+
/** Individual series legend options. Has higher priority than legend options in widget data */
|
|
34
|
+
legend?: ChartKitWidgetLegend & {
|
|
35
|
+
symbol?: RectLegendSymbolOptions;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { PieSeries, PieSeriesData } from './pie';
|
|
2
3
|
import type { ScatterSeries, ScatterSeriesData } from './scatter';
|
|
3
4
|
import type { BarXSeries, BarXSeriesData } from './bar-x';
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
export type
|
|
5
|
+
import type { LineSeries, LineSeriesData } from './line';
|
|
6
|
+
import type { BarYSeries, BarYSeriesData } from './bar-y';
|
|
7
|
+
export type ChartKitWidgetSeries<T = any> = ScatterSeries<T> | PieSeries<T> | BarXSeries<T> | BarYSeries<T> | LineSeries<T>;
|
|
8
|
+
export type ChartKitWidgetSeriesData<T = any> = ScatterSeriesData<T> | PieSeriesData<T> | BarXSeriesData<T> | BarYSeriesData<T> | LineSeriesData<T>;
|
|
7
9
|
export type DataLabelRendererData<T = any> = {
|
|
8
10
|
data: ChartKitWidgetSeriesData<T>;
|
|
9
11
|
};
|
|
@@ -82,6 +84,42 @@ export type ChartKitWidgetSeriesOptions = {
|
|
|
82
84
|
inactive?: BasicInactiveState;
|
|
83
85
|
};
|
|
84
86
|
};
|
|
87
|
+
'bar-y'?: {
|
|
88
|
+
/** The maximum allowed pixel width for a column.
|
|
89
|
+
* This prevents the columns from becoming too wide when there is a small number of points in the chart.
|
|
90
|
+
*
|
|
91
|
+
* @default 50
|
|
92
|
+
*/
|
|
93
|
+
barMaxWidth?: number;
|
|
94
|
+
/** Padding between each column or bar, in x axis units.
|
|
95
|
+
*
|
|
96
|
+
* @default 0.1
|
|
97
|
+
* */
|
|
98
|
+
barPadding?: number;
|
|
99
|
+
/** Padding between each value groups, in x axis units
|
|
100
|
+
*
|
|
101
|
+
* @default 0.2
|
|
102
|
+
*/
|
|
103
|
+
groupPadding?: number;
|
|
104
|
+
dataSorting?: {
|
|
105
|
+
/** Determines what data value should be used to sort by.
|
|
106
|
+
* Possible values are undefined to disable, "name" to sort by series name or "x"
|
|
107
|
+
*
|
|
108
|
+
* @default undefined
|
|
109
|
+
* */
|
|
110
|
+
key?: 'name' | 'x' | undefined;
|
|
111
|
+
/** Sorting direction.
|
|
112
|
+
*
|
|
113
|
+
* @default 'asc'
|
|
114
|
+
* */
|
|
115
|
+
direction?: 'asc' | 'desc';
|
|
116
|
+
};
|
|
117
|
+
/** Options for the series states that provide additional styling information to the series. */
|
|
118
|
+
states?: {
|
|
119
|
+
hover?: BasicHoverState;
|
|
120
|
+
inactive?: BasicInactiveState;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
85
123
|
pie?: {
|
|
86
124
|
/** Options for the series states that provide additional styling information to the series. */
|
|
87
125
|
states?: {
|
|
@@ -96,5 +134,17 @@ export type ChartKitWidgetSeriesOptions = {
|
|
|
96
134
|
inactive?: BasicInactiveState;
|
|
97
135
|
};
|
|
98
136
|
};
|
|
137
|
+
line?: {
|
|
138
|
+
/** Pixel width of the graph line.
|
|
139
|
+
*
|
|
140
|
+
* @default 1
|
|
141
|
+
* */
|
|
142
|
+
lineWidth?: number;
|
|
143
|
+
/** Options for the series states that provide additional styling information to the series. */
|
|
144
|
+
states?: {
|
|
145
|
+
hover?: BasicHoverState;
|
|
146
|
+
inactive?: BasicInactiveState;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
99
149
|
};
|
|
100
150
|
export {};
|
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
import type { BarXSeries, BarXSeriesData } from './bar-x';
|
|
3
3
|
import type { PieSeries, PieSeriesData } from './pie';
|
|
4
4
|
import type { ScatterSeries, ScatterSeriesData } from './scatter';
|
|
5
|
+
import type { LineSeries, LineSeriesData } from './line';
|
|
6
|
+
import type { BarYSeries, BarYSeriesData } from './bar-y';
|
|
5
7
|
export type TooltipDataChunkBarX<T = any> = {
|
|
6
8
|
data: BarXSeriesData<T>;
|
|
7
9
|
series: BarXSeries<T>;
|
|
8
10
|
};
|
|
11
|
+
export type TooltipDataChunkBarY<T = any> = {
|
|
12
|
+
data: BarYSeriesData<T>;
|
|
13
|
+
series: BarYSeries<T>;
|
|
14
|
+
};
|
|
9
15
|
export type TooltipDataChunkPie<T = any> = {
|
|
10
16
|
data: PieSeriesData<T>;
|
|
11
17
|
series: Omit<PieSeries<T>, 'data'>;
|
|
@@ -14,7 +20,15 @@ export type TooltipDataChunkScatter<T = any> = {
|
|
|
14
20
|
data: ScatterSeriesData<T>;
|
|
15
21
|
series: ScatterSeries<T>;
|
|
16
22
|
};
|
|
17
|
-
export type
|
|
23
|
+
export type TooltipDataChunkLine<T = any> = {
|
|
24
|
+
data: LineSeriesData<T>;
|
|
25
|
+
series: {
|
|
26
|
+
type: LineSeries['type'];
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export type TooltipDataChunk<T = any> = TooltipDataChunkBarX<T> | TooltipDataChunkBarY<T> | TooltipDataChunkPie<T> | TooltipDataChunkScatter<T> | TooltipDataChunkLine<T>;
|
|
18
32
|
export type ChartKitWidgetTooltip<T = any> = {
|
|
19
33
|
enabled?: boolean;
|
|
20
34
|
/** Specifies the renderer for the tooltip. If returned null default tooltip renderer will be used. */
|
package/build/utils/index.d.ts
CHANGED
package/build/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/chartkit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.1",
|
|
4
4
|
"description": "React component used to render charts based on any sources you need",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "git@github.com:gravity-ui/ChartKit.git",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@bem-react/classname": "^1.6.0",
|
|
50
50
|
"@gravity-ui/date-utils": "^1.4.1",
|
|
51
|
-
"@gravity-ui/yagr": "^3.11.
|
|
51
|
+
"@gravity-ui/yagr": "^3.11.1",
|
|
52
|
+
"afterframe": "^1.0.2",
|
|
52
53
|
"d3": "^7.8.5",
|
|
53
54
|
"lodash": "^4.17.21",
|
|
54
55
|
"react-split-pane": "^0.1.92"
|