@gravity-ui/chartkit 4.14.0 → 4.16.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/build/constants/index.d.ts +1 -0
- package/build/constants/index.js +1 -0
- package/build/constants/widget-data.d.ts +34 -0
- package/build/constants/widget-data.js +37 -0
- package/build/plugins/d3/examples/ExampleWrapper.d.ts +7 -0
- package/build/plugins/d3/examples/ExampleWrapper.js +5 -0
- package/build/plugins/d3/examples/area/Basic.js +3 -4
- package/build/plugins/d3/examples/area/StackedArea.js +3 -4
- package/build/plugins/d3/examples/bar-x/Basic.js +8 -4
- package/build/plugins/d3/examples/bar-x/DataLabels.js +4 -2
- package/build/plugins/d3/examples/bar-x/GroupedColumns.js +4 -2
- package/build/plugins/d3/examples/bar-x/StackedColumns.js +4 -2
- package/build/plugins/d3/examples/bar-y/Basic.js +4 -2
- package/build/plugins/d3/examples/bar-y/GroupedColumns.js +4 -2
- package/build/plugins/d3/examples/bar-y/StackedColumns.js +4 -2
- package/build/plugins/d3/examples/combined/LineAndBarX.js +5 -3
- package/build/plugins/d3/examples/line/Basic.js +4 -2
- package/build/plugins/d3/examples/line/DataLabels.js +4 -2
- package/build/plugins/d3/examples/line/LineWithMarkers.js +4 -2
- package/build/plugins/d3/examples/line/Shapes.d.ts +2 -0
- package/build/plugins/d3/examples/line/Shapes.js +93 -0
- package/build/plugins/d3/examples/pie/Basic.js +4 -2
- package/build/plugins/d3/examples/pie/Donut.js +4 -2
- package/build/plugins/d3/examples/scatter/Basic.js +4 -2
- package/build/plugins/d3/renderer/components/Legend.js +23 -1
- package/build/plugins/d3/renderer/components/styles.css +4 -0
- package/build/plugins/d3/renderer/hooks/useSeries/constants.d.ts +2 -3
- package/build/plugins/d3/renderer/hooks/useSeries/constants.js +1 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-line-series.d.ts +2 -0
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-line-series.js +11 -0
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.d.ts +2 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.js +11 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.js +8 -5
- package/build/plugins/d3/renderer/hooks/useSeries/types.d.ts +23 -12
- package/build/plugins/d3/renderer/hooks/useSeries/utils.d.ts +2 -1
- package/build/plugins/d3/renderer/hooks/useSeries/utils.js +5 -6
- package/build/plugins/d3/renderer/hooks/useShapes/area/index.js +5 -62
- package/build/plugins/d3/renderer/hooks/useShapes/line/index.js +9 -65
- package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.js +5 -2
- package/build/plugins/d3/renderer/hooks/useShapes/line/types.d.ts +3 -0
- package/build/plugins/d3/renderer/hooks/useShapes/marker.d.ts +12 -0
- package/build/plugins/d3/renderer/hooks/useShapes/marker.js +70 -0
- package/build/plugins/d3/renderer/hooks/useShapes/pie/index.d.ts +3 -2
- package/build/plugins/d3/renderer/hooks/useShapes/pie/index.js +28 -0
- package/build/plugins/d3/renderer/hooks/useShapes/pie/prepare-data.js +9 -3
- package/build/plugins/d3/renderer/hooks/useShapes/pie/types.d.ts +5 -0
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.js +16 -9
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.d.ts +1 -0
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.js +3 -0
- package/build/plugins/d3/renderer/hooks/useShapes/utils.d.ts +2 -0
- package/build/plugins/d3/renderer/hooks/useShapes/utils.js +17 -0
- package/build/plugins/d3/renderer/utils/index.d.ts +1 -0
- package/build/plugins/d3/renderer/utils/index.js +1 -0
- package/build/plugins/d3/renderer/utils/symbol.d.ts +5 -0
- package/build/plugins/d3/renderer/utils/symbol.js +36 -0
- package/build/plugins/d3/renderer/validation/index.js +2 -8
- package/build/plugins/highcharts/renderer/helpers/config/config.js +0 -3
- package/build/types/widget-data/area.d.ts +2 -1
- package/build/types/widget-data/bar-x.d.ts +2 -1
- package/build/types/widget-data/bar-y.d.ts +2 -1
- package/build/types/widget-data/halo.d.ts +9 -0
- package/build/types/widget-data/halo.js +1 -0
- package/build/types/widget-data/index.d.ts +1 -0
- package/build/types/widget-data/index.js +1 -0
- package/build/types/widget-data/legend.d.ts +8 -0
- package/build/types/widget-data/line.d.ts +6 -1
- package/build/types/widget-data/marker.d.ts +0 -8
- package/build/types/widget-data/pie.d.ts +2 -1
- package/build/types/widget-data/scatter.d.ts +3 -2
- package/build/types/widget-data/series.d.ts +19 -4
- package/package.json +8 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
|
-
import { color, pointer, select } from 'd3';
|
|
3
|
+
import { symbol, color, pointer, select } from 'd3';
|
|
4
4
|
import { block } from '../../../../../../utils/cn';
|
|
5
|
-
import { extractD3DataFromNode, isNodeContainsD3Data } from '../../../utils';
|
|
5
|
+
import { extractD3DataFromNode, isNodeContainsD3Data, getSymbol } from '../../../utils';
|
|
6
6
|
import { shapeKey } from '../utils';
|
|
7
|
+
import { SymbolType } from '../../../../../../constants';
|
|
7
8
|
export { prepareScatterData } from './prepare-data';
|
|
8
9
|
const b = block('d3-scatter');
|
|
9
|
-
const DEFAULT_SCATTER_POINT_RADIUS = 4;
|
|
10
10
|
const EMPTY_SELECTION = null;
|
|
11
11
|
const isNodeContainsScatterData = (node) => {
|
|
12
12
|
return isNodeContainsD3Data(node);
|
|
@@ -22,13 +22,20 @@ export function ScatterSeriesShape(props) {
|
|
|
22
22
|
const hoverOptions = get(seriesOptions, 'scatter.states.hover');
|
|
23
23
|
const inactiveOptions = get(seriesOptions, 'scatter.states.inactive');
|
|
24
24
|
const selection = svgElement
|
|
25
|
-
.selectAll(
|
|
25
|
+
.selectAll('path')
|
|
26
26
|
.data(preparedData, shapeKey)
|
|
27
|
-
.join((enter) => enter.append('
|
|
28
|
-
.attr('
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
.join((enter) => enter.append('path').attr('class', b('point')), (update) => update, (exit) => exit.remove())
|
|
28
|
+
.attr('d', (d) => {
|
|
29
|
+
const symbolType = d.series.symbolType || SymbolType.Circle;
|
|
30
|
+
const scatterSymbol = getSymbol(symbolType);
|
|
31
|
+
// D3 takes size as square pixels, so we need to make square pixels size by multiplying
|
|
32
|
+
// https://d3js.org/d3-shape/symbol#symbol
|
|
33
|
+
return symbol(scatterSymbol, d.size * d.size)();
|
|
34
|
+
})
|
|
35
|
+
.attr('transform', (d) => {
|
|
36
|
+
return 'translate(' + d.cx + ',' + d.cy + ')';
|
|
37
|
+
})
|
|
38
|
+
.attr('fill', (d) => d.data.color || d.series.color || '');
|
|
32
39
|
svgElement
|
|
33
40
|
.on('mousemove', (e) => {
|
|
34
41
|
const point = e.target;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getXValue, getYValue } from '../utils';
|
|
2
|
+
const DEFAULT_SCATTER_POINT_SIZE = 7;
|
|
2
3
|
const getFilteredLinearScatterData = (data) => {
|
|
3
4
|
return data.filter((d) => typeof d.x === 'number' && typeof d.y === 'number');
|
|
4
5
|
};
|
|
@@ -9,6 +10,7 @@ export const prepareScatterData = (args) => {
|
|
|
9
10
|
? s.data
|
|
10
11
|
: getFilteredLinearScatterData(s.data);
|
|
11
12
|
filteredData.forEach((d) => {
|
|
13
|
+
const size = d.radius ? d.radius * 2 : DEFAULT_SCATTER_POINT_SIZE;
|
|
12
14
|
acc.push({
|
|
13
15
|
data: d,
|
|
14
16
|
series: s,
|
|
@@ -17,6 +19,7 @@ export const prepareScatterData = (args) => {
|
|
|
17
19
|
hovered: false,
|
|
18
20
|
active: true,
|
|
19
21
|
id: acc.length - 1,
|
|
22
|
+
size,
|
|
20
23
|
});
|
|
21
24
|
});
|
|
22
25
|
return acc;
|
|
@@ -2,6 +2,7 @@ import type { BaseType } from 'd3';
|
|
|
2
2
|
import type { BasicInactiveState } from '../../../../../types';
|
|
3
3
|
import type { ChartScale } from '../useAxisScales';
|
|
4
4
|
import type { PreparedAxis } from '../useChartOptions/types';
|
|
5
|
+
import { DashStyle } from '../../../../../constants';
|
|
5
6
|
export declare function getXValue(args: {
|
|
6
7
|
point: {
|
|
7
8
|
x?: number | string;
|
|
@@ -25,3 +26,4 @@ export declare function setActiveState<T extends {
|
|
|
25
26
|
state: BasicInactiveState | undefined;
|
|
26
27
|
active: boolean;
|
|
27
28
|
}): T;
|
|
29
|
+
export declare const getLineDashArray: (dashStyle: DashStyle, strokeWidth?: number) => string;
|
|
@@ -34,3 +34,20 @@ export function setActiveState(args) {
|
|
|
34
34
|
}
|
|
35
35
|
return datum;
|
|
36
36
|
}
|
|
37
|
+
export const getLineDashArray = (dashStyle, strokeWidth = 2) => {
|
|
38
|
+
const value = dashStyle.toLowerCase();
|
|
39
|
+
const arrayValue = value
|
|
40
|
+
.replace('shortdashdotdot', '3,1,1,1,1,1,')
|
|
41
|
+
.replace('shortdashdot', '3,1,1,1')
|
|
42
|
+
.replace('shortdot', '1,1,')
|
|
43
|
+
.replace('shortdash', '3,1,')
|
|
44
|
+
.replace('longdash', '8,3,')
|
|
45
|
+
.replace(/dot/g, '1,3,')
|
|
46
|
+
.replace('dash', '4,3,')
|
|
47
|
+
.replace(/,$/, '')
|
|
48
|
+
.split(',')
|
|
49
|
+
.map((part) => {
|
|
50
|
+
return `${parseInt(part, 10) * strokeWidth}`;
|
|
51
|
+
});
|
|
52
|
+
return arrayValue.join(',').replace(/NaN/g, 'none');
|
|
53
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { symbolDiamond2, symbolCircle, symbolSquare, symbolTriangle2 } from 'd3';
|
|
2
|
+
import { SymbolType } from '../../../../constants';
|
|
3
|
+
export const getSymbolType = (index) => {
|
|
4
|
+
const scatterStyles = Object.values(SymbolType);
|
|
5
|
+
return scatterStyles[index % scatterStyles.length];
|
|
6
|
+
};
|
|
7
|
+
// This is an inverted triangle
|
|
8
|
+
// Based on https://github.com/d3/d3-shape/blob/main/src/symbol/triangle2.js
|
|
9
|
+
const sqrt3 = Math.sqrt(3);
|
|
10
|
+
const triangleDown = {
|
|
11
|
+
draw: (context, size) => {
|
|
12
|
+
const s = Math.sqrt(size) * 0.6824;
|
|
13
|
+
const t = s / 2;
|
|
14
|
+
const u = (s * sqrt3) / 2;
|
|
15
|
+
context.moveTo(0, s);
|
|
16
|
+
context.lineTo(u, -t);
|
|
17
|
+
context.lineTo(-u, -t);
|
|
18
|
+
context.closePath();
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export const getSymbol = (symbolType) => {
|
|
22
|
+
switch (symbolType) {
|
|
23
|
+
case SymbolType.Diamond:
|
|
24
|
+
return symbolDiamond2;
|
|
25
|
+
case SymbolType.Circle:
|
|
26
|
+
return symbolCircle;
|
|
27
|
+
case SymbolType.Square:
|
|
28
|
+
return symbolSquare;
|
|
29
|
+
case SymbolType.Triangle:
|
|
30
|
+
return symbolTriangle2;
|
|
31
|
+
case SymbolType.TriangleDown:
|
|
32
|
+
return triangleDown;
|
|
33
|
+
default:
|
|
34
|
+
return symbolCircle;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
2
|
import isEmpty from 'lodash/isEmpty';
|
|
3
|
+
import { SeriesType } from '../../../../constants';
|
|
3
4
|
import { ChartKitError, CHARTKIT_ERROR_CODE } from '../../../../libs';
|
|
4
5
|
import { i18n } from '../../../../i18n';
|
|
5
6
|
import { DEFAULT_AXIS_TYPE } from '../constants';
|
|
6
|
-
const AVAILABLE_SERIES_TYPES =
|
|
7
|
-
'area',
|
|
8
|
-
'bar-x',
|
|
9
|
-
'bar-y',
|
|
10
|
-
'line',
|
|
11
|
-
'pie',
|
|
12
|
-
'scatter',
|
|
13
|
-
];
|
|
7
|
+
const AVAILABLE_SERIES_TYPES = Object.values(SeriesType);
|
|
14
8
|
const validateXYSeries = (args) => {
|
|
15
9
|
const { series, xAxis, yAxis } = args;
|
|
16
10
|
const xType = get(xAxis, 'type', DEFAULT_AXIS_TYPE);
|
|
@@ -1155,9 +1155,6 @@ export function prepareConfig(data, options, isMobile, holidays) {
|
|
|
1155
1155
|
var _a;
|
|
1156
1156
|
if (chartType === 'column' || chartType === 'bar') {
|
|
1157
1157
|
this.series.forEach((seriesItem) => {
|
|
1158
|
-
if (!seriesItem.legendItem) {
|
|
1159
|
-
return;
|
|
1160
|
-
}
|
|
1161
1158
|
const color = seriesItem.color;
|
|
1162
1159
|
// The update method updates all series, and therefore,
|
|
1163
1160
|
// after working out the handleLegendItemMouseOverAndOut,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SeriesType } from '../../constants';
|
|
1
2
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
2
3
|
import type { ChartKitWidgetLegend, RectLegendSymbolOptions } from './legend';
|
|
3
4
|
import type { PointMarkerOptions } from './marker';
|
|
@@ -24,7 +25,7 @@ export type AreaMarkerOptions = PointMarkerOptions & {
|
|
|
24
25
|
symbol?: AreaMarkerSymbol;
|
|
25
26
|
};
|
|
26
27
|
export type AreaSeries<T = any> = BaseSeries & {
|
|
27
|
-
type:
|
|
28
|
+
type: typeof SeriesType.Area;
|
|
28
29
|
data: AreaSeriesData<T>[];
|
|
29
30
|
/** The name of the series (used in legend, tooltip etc) */
|
|
30
31
|
name: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SeriesType } from '../../constants';
|
|
1
2
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
2
3
|
import type { ChartKitWidgetSeriesOptions } from './series';
|
|
3
4
|
import { ChartKitWidgetLegend, RectLegendSymbolOptions } from './legend';
|
|
@@ -26,7 +27,7 @@ export type BarXSeriesData<T = any> = BaseSeriesData<T> & {
|
|
|
26
27
|
label?: string | number;
|
|
27
28
|
};
|
|
28
29
|
export type BarXSeries<T = any> = BaseSeries & {
|
|
29
|
-
type:
|
|
30
|
+
type: typeof SeriesType.BarX;
|
|
30
31
|
data: BarXSeriesData<T>[];
|
|
31
32
|
/** The name of the series (used in legend, tooltip etc) */
|
|
32
33
|
name: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SeriesType } from '../../constants';
|
|
1
2
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
2
3
|
import type { ChartKitWidgetSeriesOptions } from './series';
|
|
3
4
|
import { ChartKitWidgetLegend, RectLegendSymbolOptions } from './legend';
|
|
@@ -20,7 +21,7 @@ export type BarYSeriesData<T = any> = BaseSeriesData<T> & {
|
|
|
20
21
|
label?: string | number;
|
|
21
22
|
};
|
|
22
23
|
export type BarYSeries<T = any> = BaseSeries & {
|
|
23
|
-
type:
|
|
24
|
+
type: typeof SeriesType.BarY;
|
|
24
25
|
data: BarYSeriesData<T>[];
|
|
25
26
|
/** The name of the series (used in legend, tooltip etc) */
|
|
26
27
|
name: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The halo appearing around the hovered part of series(point in line-type series or slice in pie charts) */
|
|
2
|
+
export type Halo = {
|
|
3
|
+
/** Enable or disable the halo */
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
/** The opacity of halo */
|
|
6
|
+
opacity?: number;
|
|
7
|
+
/** The pixel size of the halo. Radius for point markers or width of the outside slice in pie charts. */
|
|
8
|
+
size?: number;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -58,3 +58,11 @@ export type PathLegendSymbolOptions = BaseLegendSymbol & {
|
|
|
58
58
|
* */
|
|
59
59
|
width?: number;
|
|
60
60
|
};
|
|
61
|
+
export type SymbolLegendSymbolOptions = BaseLegendSymbol & {
|
|
62
|
+
/**
|
|
63
|
+
* The pixel width of the symbol for series types that use a symbol in the legend
|
|
64
|
+
*
|
|
65
|
+
* @default 8
|
|
66
|
+
* */
|
|
67
|
+
width?: number;
|
|
68
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
2
2
|
import type { ChartKitWidgetLegend, RectLegendSymbolOptions } from './legend';
|
|
3
3
|
import type { PointMarkerOptions } from './marker';
|
|
4
|
+
import { DashStyle, LineCap, SeriesType } from '../../constants';
|
|
4
5
|
export type LineSeriesData<T = any> = BaseSeriesData<T> & {
|
|
5
6
|
/**
|
|
6
7
|
* The `x` value of the point. Depending on the context , it may represents:
|
|
@@ -24,7 +25,7 @@ export type LineMarkerOptions = PointMarkerOptions & {
|
|
|
24
25
|
symbol?: LineMarkerSymbol;
|
|
25
26
|
};
|
|
26
27
|
export type LineSeries<T = any> = BaseSeries & {
|
|
27
|
-
type:
|
|
28
|
+
type: typeof SeriesType.Line;
|
|
28
29
|
data: LineSeriesData<T>[];
|
|
29
30
|
/** The name of the series (used in legend, tooltip etc) */
|
|
30
31
|
name: string;
|
|
@@ -41,4 +42,8 @@ export type LineSeries<T = any> = BaseSeries & {
|
|
|
41
42
|
};
|
|
42
43
|
/** Options for the point markers of line series */
|
|
43
44
|
marker?: LineMarkerOptions;
|
|
45
|
+
/** Option for line stroke style */
|
|
46
|
+
dashStyle?: `${DashStyle}`;
|
|
47
|
+
/** Option for line cap style */
|
|
48
|
+
linecap?: `${LineCap}`;
|
|
44
49
|
};
|
|
@@ -8,11 +8,3 @@ export type PointMarkerOptions = {
|
|
|
8
8
|
/** The width of the point marker's border */
|
|
9
9
|
borderWidth?: number;
|
|
10
10
|
};
|
|
11
|
-
export type PointMarkerHalo = {
|
|
12
|
-
/** Enable or disable the halo appearing around the point */
|
|
13
|
-
enabled?: boolean;
|
|
14
|
-
/** The Opacity of the point halo */
|
|
15
|
-
opacity?: number;
|
|
16
|
-
/** The radius of the point halo */
|
|
17
|
-
radius?: number;
|
|
18
|
-
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SeriesType } from '../../constants';
|
|
1
2
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
2
3
|
import { ChartKitWidgetLegend, RectLegendSymbolOptions } from './legend';
|
|
3
4
|
export type PieSeriesData<T = any> = BaseSeriesData<T> & {
|
|
@@ -13,7 +14,7 @@ export type PieSeriesData<T = any> = BaseSeriesData<T> & {
|
|
|
13
14
|
export type ConnectorShape = 'straight-line' | 'polyline';
|
|
14
15
|
export type ConnectorCurve = 'linear' | 'basic';
|
|
15
16
|
export type PieSeries<T = any> = BaseSeries & {
|
|
16
|
-
type:
|
|
17
|
+
type: typeof SeriesType.Pie;
|
|
17
18
|
data: PieSeriesData<T>[];
|
|
18
19
|
/**
|
|
19
20
|
* The color of the border surrounding each segment.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SeriesType, SymbolType } from '../../constants';
|
|
1
2
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
2
3
|
import type { ChartKitWidgetLegend, RectLegendSymbolOptions } from './legend';
|
|
3
4
|
export type ScatterSeriesData<T = any> = BaseSeriesData<T> & {
|
|
@@ -24,14 +25,14 @@ export type ScatterSeriesData<T = any> = BaseSeriesData<T> & {
|
|
|
24
25
|
radius?: number;
|
|
25
26
|
};
|
|
26
27
|
export type ScatterSeries<T = any> = BaseSeries & {
|
|
27
|
-
type:
|
|
28
|
+
type: typeof SeriesType.Scatter;
|
|
28
29
|
data: ScatterSeriesData<T>[];
|
|
29
30
|
/** The name of the series (used in legend, tooltip etc) */
|
|
30
31
|
name: string;
|
|
31
32
|
/** The main color of the series (hex, rgba) */
|
|
32
33
|
color?: string;
|
|
33
34
|
/** A predefined shape or symbol for the dot */
|
|
34
|
-
|
|
35
|
+
symbolType?: `${SymbolType}`;
|
|
35
36
|
/** Individual series legend options. Has higher priority than legend options in widget data */
|
|
36
37
|
legend?: ChartKitWidgetLegend & {
|
|
37
38
|
symbol?: RectLegendSymbolOptions;
|
|
@@ -4,8 +4,10 @@ import type { ScatterSeries, ScatterSeriesData } from './scatter';
|
|
|
4
4
|
import type { BarXSeries, BarXSeriesData } from './bar-x';
|
|
5
5
|
import type { LineSeries, LineSeriesData, LineMarkerOptions } from './line';
|
|
6
6
|
import type { BarYSeries, BarYSeriesData } from './bar-y';
|
|
7
|
-
import type { PointMarkerOptions
|
|
7
|
+
import type { PointMarkerOptions } from './marker';
|
|
8
8
|
import type { AreaSeries, AreaSeriesData } from './area';
|
|
9
|
+
import type { Halo } from './halo';
|
|
10
|
+
import { DashStyle, LineCap } from '../../constants';
|
|
9
11
|
export type ChartKitWidgetSeries<T = any> = ScatterSeries<T> | PieSeries<T> | BarXSeries<T> | BarYSeries<T> | LineSeries<T> | AreaSeries<T>;
|
|
10
12
|
export type ChartKitWidgetSeriesData<T = any> = ScatterSeriesData<T> | PieSeriesData<T> | BarXSeriesData<T> | BarYSeriesData<T> | LineSeriesData<T> | AreaSeriesData<T>;
|
|
11
13
|
export type DataLabelRendererData<T = any> = {
|
|
@@ -125,7 +127,10 @@ export type ChartKitWidgetSeriesOptions = {
|
|
|
125
127
|
pie?: {
|
|
126
128
|
/** Options for the series states that provide additional styling information to the series. */
|
|
127
129
|
states?: {
|
|
128
|
-
hover?: BasicHoverState
|
|
130
|
+
hover?: BasicHoverState & {
|
|
131
|
+
/** Options for the halo appearing outside the hovered slice */
|
|
132
|
+
halo?: Halo;
|
|
133
|
+
};
|
|
129
134
|
inactive?: BasicInactiveState;
|
|
130
135
|
};
|
|
131
136
|
};
|
|
@@ -147,13 +152,23 @@ export type ChartKitWidgetSeriesOptions = {
|
|
|
147
152
|
hover?: BasicHoverState & {
|
|
148
153
|
marker?: PointMarkerOptions & {
|
|
149
154
|
/** Options for the halo appearing around the hovered point */
|
|
150
|
-
halo?:
|
|
155
|
+
halo?: Halo;
|
|
151
156
|
};
|
|
152
157
|
};
|
|
153
158
|
inactive?: BasicInactiveState;
|
|
154
159
|
};
|
|
155
160
|
/** Options for the point markers of line series */
|
|
156
161
|
marker?: LineMarkerOptions;
|
|
162
|
+
/** Options for line style
|
|
163
|
+
*
|
|
164
|
+
* @default 'Solid'
|
|
165
|
+
* */
|
|
166
|
+
dashStyle?: `${DashStyle}`;
|
|
167
|
+
/** Options for line cap style
|
|
168
|
+
*
|
|
169
|
+
* @default 'round' when dashStyle is not 'solid', 'none' when dashStyle is not 'solid'
|
|
170
|
+
* */
|
|
171
|
+
linecap?: `${LineCap}`;
|
|
157
172
|
};
|
|
158
173
|
area?: {
|
|
159
174
|
/** Pixel width of the graph line.
|
|
@@ -166,7 +181,7 @@ export type ChartKitWidgetSeriesOptions = {
|
|
|
166
181
|
hover?: BasicHoverState & {
|
|
167
182
|
marker?: PointMarkerOptions & {
|
|
168
183
|
/** Options for the halo appearing around the hovered point */
|
|
169
|
-
halo?:
|
|
184
|
+
halo?: Halo;
|
|
170
185
|
};
|
|
171
186
|
};
|
|
172
187
|
inactive?: BasicInactiveState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/chartkit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.16.0",
|
|
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,7 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@bem-react/classname": "^1.6.0",
|
|
50
50
|
"@gravity-ui/date-utils": "^1.4.1",
|
|
51
|
-
"@gravity-ui/yagr": "^4.1.
|
|
51
|
+
"@gravity-ui/yagr": "^4.1.1",
|
|
52
52
|
"afterframe": "^1.0.2",
|
|
53
53
|
"d3": "^7.8.5",
|
|
54
54
|
"lodash": "^4.17.21",
|
|
@@ -120,6 +120,12 @@
|
|
|
120
120
|
"lint:prettier": "prettier --check --loglevel=error '**/*.{js,jsx,ts,tsx,scss}'",
|
|
121
121
|
"lint": "run-p lint:*",
|
|
122
122
|
"typecheck": "tsc --noEmit",
|
|
123
|
+
"docs:deps": "cd ./documentation && npm ci",
|
|
124
|
+
"docs:start": "cd ./documentation && npm run start",
|
|
125
|
+
"docs:start:ru": "cd ./documentation && npm run start:ru",
|
|
126
|
+
"docs:build": "cd ./documentation && npm run build",
|
|
127
|
+
"docs:serve": "cd ./documentation && npm run serve",
|
|
128
|
+
"docs:deploy": "cd ./documentation && npm run deploy",
|
|
123
129
|
"prepublishOnly": "npm run build"
|
|
124
130
|
},
|
|
125
131
|
"husky": {
|