@gravity-ui/charts 0.6.0 → 0.6.1-beta.2
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 +2 -2
- package/dist/cjs/components/Axis/AxisY.d.ts +1 -0
- package/dist/cjs/components/Axis/AxisY.js +55 -13
- package/dist/cjs/components/ChartInner/index.js +3 -2
- package/dist/cjs/components/ChartInner/useChartInnerHandlers.js +4 -0
- package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +2 -2
- package/dist/cjs/components/Legend/index.js +1 -2
- package/dist/cjs/components/PlotTitle/index.js +1 -1
- package/dist/cjs/components/PlotTitle/styles.css +1 -1
- package/dist/cjs/components/Tooltip/ChartTooltipContent.d.ts +2 -2
- package/dist/cjs/components/Tooltip/DefaultContent.js +19 -3
- package/dist/cjs/components/Tooltip/index.js +2 -2
- package/dist/cjs/components/Tooltip/styles.css +11 -9
- package/dist/cjs/components/index.d.ts +10 -9
- package/dist/cjs/constants/index.d.ts +1 -0
- package/dist/cjs/constants/index.js +1 -0
- package/dist/cjs/hooks/useChartOptions/types.d.ts +11 -1
- package/dist/cjs/hooks/useChartOptions/x-axis.js +1 -0
- package/dist/cjs/hooks/useChartOptions/y-axis.js +9 -1
- package/dist/cjs/hooks/useSeries/prepare-area.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-bar-x.d.ts +2 -1
- package/dist/cjs/hooks/useSeries/prepare-bar-x.js +2 -1
- package/dist/cjs/hooks/useSeries/prepare-bar-y.d.ts +2 -1
- package/dist/cjs/hooks/useSeries/prepare-bar-y.js +3 -1
- package/dist/cjs/hooks/useSeries/prepare-line.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-pie.js +2 -2
- package/dist/cjs/hooks/useSeries/prepare-sankey.d.ts +11 -0
- package/dist/cjs/hooks/useSeries/prepare-sankey.js +38 -0
- package/dist/cjs/hooks/useSeries/prepareSeries.js +21 -2
- package/dist/cjs/hooks/useSeries/types.d.ts +12 -2
- package/dist/cjs/hooks/useSeries/utils.js +1 -1
- package/dist/cjs/hooks/useShapes/area/prepare-data.js +4 -0
- package/dist/cjs/hooks/useShapes/bar-x/index.js +16 -2
- package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +3 -1
- package/dist/cjs/hooks/useShapes/bar-x/types.d.ts +1 -0
- package/dist/cjs/hooks/useShapes/bar-y/index.js +16 -2
- package/dist/cjs/hooks/useShapes/bar-y/prepare-data.js +3 -1
- package/dist/cjs/hooks/useShapes/bar-y/types.d.ts +1 -0
- package/dist/cjs/hooks/useShapes/index.d.ts +2 -1
- package/dist/cjs/hooks/useShapes/index.js +19 -0
- package/dist/cjs/hooks/useShapes/line/index.js +2 -2
- package/dist/cjs/hooks/useShapes/line/prepare-data.js +1 -0
- package/dist/cjs/hooks/useShapes/pie/index.js +5 -4
- package/dist/cjs/hooks/useShapes/pie/prepare-data.js +168 -118
- package/dist/cjs/hooks/useShapes/pie/types.d.ts +2 -2
- package/dist/cjs/hooks/useShapes/sankey/index.d.ts +12 -0
- package/dist/cjs/hooks/useShapes/sankey/index.js +67 -0
- package/dist/cjs/hooks/useShapes/sankey/prepare-data.d.ts +7 -0
- package/dist/cjs/hooks/useShapes/sankey/prepare-data.js +72 -0
- package/dist/cjs/hooks/useShapes/sankey/types.d.ts +33 -0
- package/dist/cjs/hooks/useShapes/sankey/types.js +1 -0
- package/dist/cjs/hooks/useShapes/styles.css +2 -2
- package/dist/cjs/hooks/useShapes/treemap/prepare-data.js +1 -0
- package/dist/cjs/hooks/useShapes/utils.d.ts +7 -2
- package/dist/cjs/hooks/useShapes/utils.js +22 -17
- package/dist/cjs/hooks/useShapes/waterfall/index.js +1 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/types/chart/area.d.ts +6 -6
- package/dist/cjs/types/chart/axis.d.ts +32 -7
- package/dist/cjs/types/chart/bar-x.d.ts +9 -4
- package/dist/cjs/types/chart/bar-y.d.ts +10 -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 +6 -4
- package/dist/cjs/types/chart/sankey.d.ts +22 -0
- package/dist/cjs/types/chart/sankey.js +1 -0
- package/dist/cjs/types/chart/scatter.d.ts +4 -4
- package/dist/cjs/types/chart/series.d.ts +21 -10
- 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 +27 -21
- 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 +35 -4
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/utils/chart/get-closest-data.d.ts +2 -0
- package/dist/cjs/utils/chart/get-closest-data.js +39 -3
- package/dist/cjs/utils/chart/index.js +1 -1
- package/dist/cjs/utils/chart/series/index.d.ts +1 -0
- package/dist/cjs/utils/chart/series/index.js +1 -0
- package/dist/cjs/utils/chart/series/line.d.ts +2 -0
- package/dist/cjs/utils/chart/series/line.js +17 -0
- package/dist/esm/components/Axis/AxisY.d.ts +1 -0
- package/dist/esm/components/Axis/AxisY.js +55 -13
- package/dist/esm/components/ChartInner/index.js +3 -2
- package/dist/esm/components/ChartInner/useChartInnerHandlers.js +4 -0
- package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +2 -2
- package/dist/esm/components/Legend/index.js +1 -2
- package/dist/esm/components/PlotTitle/index.js +1 -1
- package/dist/esm/components/PlotTitle/styles.css +1 -1
- package/dist/esm/components/Tooltip/ChartTooltipContent.d.ts +2 -2
- package/dist/esm/components/Tooltip/DefaultContent.js +19 -3
- package/dist/esm/components/Tooltip/index.js +2 -2
- package/dist/esm/components/Tooltip/styles.css +11 -9
- package/dist/esm/components/index.d.ts +10 -9
- package/dist/esm/constants/index.d.ts +1 -0
- package/dist/esm/constants/index.js +1 -0
- package/dist/esm/hooks/useChartOptions/types.d.ts +11 -1
- package/dist/esm/hooks/useChartOptions/x-axis.js +1 -0
- package/dist/esm/hooks/useChartOptions/y-axis.js +9 -1
- package/dist/esm/hooks/useSeries/prepare-area.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-bar-x.d.ts +2 -1
- package/dist/esm/hooks/useSeries/prepare-bar-x.js +2 -1
- package/dist/esm/hooks/useSeries/prepare-bar-y.d.ts +2 -1
- package/dist/esm/hooks/useSeries/prepare-bar-y.js +3 -1
- package/dist/esm/hooks/useSeries/prepare-line.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-pie.js +2 -2
- package/dist/esm/hooks/useSeries/prepare-sankey.d.ts +11 -0
- package/dist/esm/hooks/useSeries/prepare-sankey.js +38 -0
- package/dist/esm/hooks/useSeries/prepareSeries.js +21 -2
- package/dist/esm/hooks/useSeries/types.d.ts +12 -2
- package/dist/esm/hooks/useSeries/utils.js +1 -1
- package/dist/esm/hooks/useShapes/area/prepare-data.js +4 -0
- package/dist/esm/hooks/useShapes/bar-x/index.js +16 -2
- package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +3 -1
- package/dist/esm/hooks/useShapes/bar-x/types.d.ts +1 -0
- package/dist/esm/hooks/useShapes/bar-y/index.js +16 -2
- package/dist/esm/hooks/useShapes/bar-y/prepare-data.js +3 -1
- package/dist/esm/hooks/useShapes/bar-y/types.d.ts +1 -0
- package/dist/esm/hooks/useShapes/index.d.ts +2 -1
- package/dist/esm/hooks/useShapes/index.js +19 -0
- package/dist/esm/hooks/useShapes/line/index.js +2 -2
- package/dist/esm/hooks/useShapes/line/prepare-data.js +1 -0
- package/dist/esm/hooks/useShapes/pie/index.js +5 -4
- package/dist/esm/hooks/useShapes/pie/prepare-data.js +168 -118
- package/dist/esm/hooks/useShapes/pie/types.d.ts +2 -2
- package/dist/esm/hooks/useShapes/sankey/index.d.ts +12 -0
- package/dist/esm/hooks/useShapes/sankey/index.js +67 -0
- package/dist/esm/hooks/useShapes/sankey/prepare-data.d.ts +7 -0
- package/dist/esm/hooks/useShapes/sankey/prepare-data.js +72 -0
- package/dist/esm/hooks/useShapes/sankey/types.d.ts +33 -0
- package/dist/esm/hooks/useShapes/sankey/types.js +1 -0
- package/dist/esm/hooks/useShapes/styles.css +2 -2
- package/dist/esm/hooks/useShapes/treemap/prepare-data.js +1 -0
- package/dist/esm/hooks/useShapes/utils.d.ts +7 -2
- package/dist/esm/hooks/useShapes/utils.js +22 -17
- package/dist/esm/hooks/useShapes/waterfall/index.js +1 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/types/chart/area.d.ts +6 -6
- package/dist/esm/types/chart/axis.d.ts +32 -7
- package/dist/esm/types/chart/bar-x.d.ts +9 -4
- package/dist/esm/types/chart/bar-y.d.ts +10 -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 +6 -4
- package/dist/esm/types/chart/sankey.d.ts +22 -0
- package/dist/esm/types/chart/sankey.js +1 -0
- package/dist/esm/types/chart/scatter.d.ts +4 -4
- package/dist/esm/types/chart/series.d.ts +21 -10
- 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 +27 -21
- 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 +35 -4
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/utils/chart/get-closest-data.d.ts +2 -0
- package/dist/esm/utils/chart/get-closest-data.js +39 -3
- package/dist/esm/utils/chart/index.js +1 -1
- package/dist/esm/utils/chart/series/index.d.ts +1 -0
- package/dist/esm/utils/chart/series/index.js +1 -0
- package/dist/esm/utils/chart/series/line.d.ts +2 -0
- package/dist/esm/utils/chart/series/line.js +17 -0
- package/package.json +7 -2
|
@@ -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,49 @@ 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 * from './chart/sankey';
|
|
29
|
+
export interface ChartData<T = MeaningfulAny> {
|
|
30
|
+
/**
|
|
31
|
+
* General options for the chart.
|
|
32
|
+
*/
|
|
29
33
|
chart?: ChartOptions;
|
|
34
|
+
/**
|
|
35
|
+
* The legend displays a labeled box for each data element in the chart.
|
|
36
|
+
* It shows a distinctive symbol paired with a name for every series.
|
|
37
|
+
*/
|
|
30
38
|
legend?: ChartLegend;
|
|
39
|
+
/**
|
|
40
|
+
* Represents the series data and series options.
|
|
41
|
+
*/
|
|
31
42
|
series: {
|
|
43
|
+
/**
|
|
44
|
+
* Contains data points to be plotted.
|
|
45
|
+
*/
|
|
32
46
|
data: ChartSeries<T>[];
|
|
47
|
+
/**
|
|
48
|
+
* Allows for customizing the appearance and behavior of the series.
|
|
49
|
+
*/
|
|
33
50
|
options?: ChartSeriesOptions;
|
|
34
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* The main title of the chart.
|
|
54
|
+
*/
|
|
35
55
|
title?: ChartTitle;
|
|
56
|
+
/**
|
|
57
|
+
* Options for the tooltip that appears when the user hovers over a series or point.
|
|
58
|
+
*/
|
|
36
59
|
tooltip?: ChartTooltip<T>;
|
|
60
|
+
/**
|
|
61
|
+
* Options for the the X axis.
|
|
62
|
+
*/
|
|
37
63
|
xAxis?: ChartXAxis;
|
|
64
|
+
/**
|
|
65
|
+
* Options for the the Y axis or multiple Y axes.
|
|
66
|
+
*/
|
|
38
67
|
yAxis?: ChartYAxis[];
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
68
|
+
/**
|
|
69
|
+
* Setting for displaying charts on different plots.
|
|
70
|
+
* It can be used to visualize related information on multiple charts.
|
|
71
|
+
*/
|
|
41
72
|
split?: ChartSplit;
|
|
42
|
-
}
|
|
73
|
+
}
|
package/dist/esm/types/index.js
CHANGED
|
@@ -35,7 +35,7 @@ function getSeriesType(shapeData) {
|
|
|
35
35
|
return get(shapeData, 'series.type') || get(shapeData, 'point.series.type');
|
|
36
36
|
}
|
|
37
37
|
export function getClosestPoints(args) {
|
|
38
|
-
const { position, shapesData } = args;
|
|
38
|
+
const { position, shapesData, boundsHeight, boundsWidth } = args;
|
|
39
39
|
const [pointerX, pointerY] = position;
|
|
40
40
|
const result = [];
|
|
41
41
|
const groups = groupBy(shapesData, getSeriesType);
|
|
@@ -135,13 +135,13 @@ export function getClosestPoints(args) {
|
|
|
135
135
|
case 'pie': {
|
|
136
136
|
const points = list.map((d) => d.segments).flat();
|
|
137
137
|
const closestPoint = points.find((p) => {
|
|
138
|
-
const { center
|
|
138
|
+
const { center } = p.data.pie;
|
|
139
139
|
const x = pointerX - center[0];
|
|
140
140
|
const y = pointerY - center[1];
|
|
141
141
|
let angle = Math.atan2(y, x) + 0.5 * Math.PI;
|
|
142
142
|
angle = angle < 0 ? Math.PI * 2 + angle : angle;
|
|
143
143
|
const polarRadius = Math.sqrt(x * x + y * y);
|
|
144
|
-
return angle >= p.startAngle && angle <= p.endAngle && polarRadius < radius;
|
|
144
|
+
return (angle >= p.startAngle && angle <= p.endAngle && polarRadius < p.data.radius);
|
|
145
145
|
});
|
|
146
146
|
if (closestPoint) {
|
|
147
147
|
result.push({
|
|
@@ -166,7 +166,43 @@ export function getClosestPoints(args) {
|
|
|
166
166
|
}
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
|
+
case 'sankey': {
|
|
170
|
+
const [data] = list;
|
|
171
|
+
const closestLink = data.links.find((d) => {
|
|
172
|
+
var _a;
|
|
173
|
+
return isInsidePath({
|
|
174
|
+
path: (_a = d.path) !== null && _a !== void 0 ? _a : '',
|
|
175
|
+
strokeWidth: d.strokeWidth,
|
|
176
|
+
point: [pointerX, pointerY],
|
|
177
|
+
width: boundsWidth,
|
|
178
|
+
height: boundsHeight,
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
if (closestLink) {
|
|
182
|
+
result.push({
|
|
183
|
+
data: closestLink.source,
|
|
184
|
+
target: closestLink.target,
|
|
185
|
+
series: data.series,
|
|
186
|
+
closest: true,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
169
191
|
}
|
|
170
192
|
});
|
|
171
193
|
return result;
|
|
172
194
|
}
|
|
195
|
+
function isInsidePath(args) {
|
|
196
|
+
const { path, point, width, height, strokeWidth } = args;
|
|
197
|
+
const canvas = document.createElement('canvas');
|
|
198
|
+
canvas.width = width;
|
|
199
|
+
canvas.height = height;
|
|
200
|
+
const ctx = canvas.getContext('2d');
|
|
201
|
+
if (ctx) {
|
|
202
|
+
ctx.lineWidth = strokeWidth;
|
|
203
|
+
const path2D = new Path2D(path);
|
|
204
|
+
ctx.stroke(path2D);
|
|
205
|
+
return ctx.isPointInPath(path2D, ...point) || ctx.isPointInStroke(path2D, ...point);
|
|
206
|
+
}
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
@@ -15,7 +15,7 @@ export * from './legend';
|
|
|
15
15
|
export * from './symbol';
|
|
16
16
|
export * from './series';
|
|
17
17
|
export * from './color';
|
|
18
|
-
const CHARTS_WITHOUT_AXIS = ['pie', 'treemap'];
|
|
18
|
+
const CHARTS_WITHOUT_AXIS = ['pie', 'treemap', 'sankey'];
|
|
19
19
|
export const CHART_SERIES_WITH_VOLUME_ON_Y_AXIS = [
|
|
20
20
|
'bar-x',
|
|
21
21
|
'area',
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function getLineDashArray(dashStyle, strokeWidth = 2) {
|
|
2
|
+
const value = dashStyle.toLowerCase();
|
|
3
|
+
const arrayValue = value
|
|
4
|
+
.replace('shortdashdotdot', '3,1,1,1,1,1,')
|
|
5
|
+
.replace('shortdashdot', '3,1,1,1')
|
|
6
|
+
.replace('shortdot', '1,1,')
|
|
7
|
+
.replace('shortdash', '3,1,')
|
|
8
|
+
.replace('longdash', '8,3,')
|
|
9
|
+
.replace(/dot/g, '1,3,')
|
|
10
|
+
.replace('dash', '4,3,')
|
|
11
|
+
.replace(/,$/, '')
|
|
12
|
+
.split(',')
|
|
13
|
+
.map((part) => {
|
|
14
|
+
return `${parseInt(part, 10) * strokeWidth}`;
|
|
15
|
+
});
|
|
16
|
+
return arrayValue.join(',').replace(/NaN/g, 'none');
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/charts",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1-beta.2",
|
|
4
4
|
"description": "React component used to render charts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -50,13 +50,17 @@
|
|
|
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",
|
|
57
60
|
"@gravity-ui/date-utils": "^2.5.4",
|
|
58
61
|
"@gravity-ui/i18n": "^1.6.0",
|
|
59
62
|
"d3": "^7.9.0",
|
|
63
|
+
"d3-sankey": "^0.12.3",
|
|
60
64
|
"lodash": "^4.17.21",
|
|
61
65
|
"tslib": "^2.6.2"
|
|
62
66
|
},
|
|
@@ -90,6 +94,7 @@
|
|
|
90
94
|
"@testing-library/react": "^16.0.0",
|
|
91
95
|
"@testing-library/user-event": "^14.5.2",
|
|
92
96
|
"@types/d3": "^7.4.3",
|
|
97
|
+
"@types/d3-sankey": "^0.12.4",
|
|
93
98
|
"@types/d3-selection": "^3.0.11",
|
|
94
99
|
"@types/jest": "^29.5.12",
|
|
95
100
|
"@types/lodash": "^4.17.12",
|