@gravity-ui/charts 0.6.1 → 0.8.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 +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/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 +5 -5
- package/dist/cjs/components/Tooltip/styles.css +2 -15
- 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/bar-x/index.js +16 -2
- package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +2 -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 +2 -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/pie/index.js +3 -3
- package/dist/cjs/hooks/useShapes/pie/prepare-data.js +37 -35
- package/dist/cjs/hooks/useShapes/pie/types.d.ts +1 -1
- 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/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/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 +6 -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/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 +5 -5
- package/dist/esm/components/Tooltip/styles.css +2 -15
- 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/bar-x/index.js +16 -2
- package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +2 -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 +2 -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/pie/index.js +3 -3
- package/dist/esm/hooks/useShapes/pie/prepare-data.js +37 -35
- package/dist/esm/hooks/useShapes/pie/types.d.ts +1 -1
- 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/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/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 +6 -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 +9 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { select } from 'd3';
|
|
1
|
+
import { path, select } from 'd3';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
3
|
import { getDataCategoryValue } from '../../utils';
|
|
4
4
|
export function getXValue(args) {
|
|
@@ -36,20 +36,25 @@ export function setActiveState(args) {
|
|
|
36
36
|
}
|
|
37
37
|
return datum;
|
|
38
38
|
}
|
|
39
|
-
export function
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
export function getRectPath(args) {
|
|
40
|
+
const { x, y, width, height, borderRadius = 0 } = args;
|
|
41
|
+
const borderRadiuses = typeof borderRadius === 'number' ? new Array(4).fill(borderRadius) : borderRadius;
|
|
42
|
+
const [borderRadiusTopLeft = 0, borderRadiusTopRight = 0, borderRadiusBottomRight = 0, borderRadiusBottomLeft = 0,] = borderRadiuses !== null && borderRadiuses !== void 0 ? borderRadiuses : [];
|
|
43
|
+
const p = path();
|
|
44
|
+
let startAngle = -Math.PI / 2;
|
|
45
|
+
const angle = Math.PI / 2;
|
|
46
|
+
p.moveTo(x + borderRadiusTopLeft, y);
|
|
47
|
+
p.lineTo(x + width - borderRadiusTopRight, y);
|
|
48
|
+
p.arc(x + width - borderRadiusTopRight, y + borderRadiusTopRight, borderRadiusTopRight, startAngle, startAngle + angle);
|
|
49
|
+
startAngle += angle;
|
|
50
|
+
p.lineTo(x + width, y + height - borderRadiusBottomRight);
|
|
51
|
+
p.arc(x + width - borderRadiusBottomRight, y + height - borderRadiusBottomRight, borderRadiusBottomRight, startAngle, startAngle + angle);
|
|
52
|
+
startAngle += angle;
|
|
53
|
+
p.lineTo(x + borderRadiusBottomLeft, y + height);
|
|
54
|
+
p.arc(x + borderRadiusBottomLeft, y + height - borderRadiusBottomLeft, borderRadiusBottomLeft, startAngle, startAngle + angle);
|
|
55
|
+
startAngle += angle;
|
|
56
|
+
p.lineTo(x, y + borderRadiusTopLeft);
|
|
57
|
+
p.arc(x + borderRadiusTopLeft, y + borderRadiusTopLeft, borderRadiusTopLeft, startAngle, startAngle + angle);
|
|
58
|
+
p.closePath();
|
|
59
|
+
return p;
|
|
55
60
|
}
|
|
@@ -2,9 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { color, line as lineGenerator, select } from 'd3';
|
|
3
3
|
import get from 'lodash/get';
|
|
4
4
|
import { DashStyle } from '../../../constants';
|
|
5
|
-
import { block, filterOverlappingLabels, getWaterfallPointColor } from '../../../utils';
|
|
5
|
+
import { block, filterOverlappingLabels, getLineDashArray, getWaterfallPointColor, } from '../../../utils';
|
|
6
6
|
import { HtmlLayer } from '../HtmlLayer';
|
|
7
|
-
import { getLineDashArray } from '../utils';
|
|
8
7
|
export { prepareWaterfallData } from './prepare-data';
|
|
9
8
|
export * from './types';
|
|
10
9
|
const b = block('d3-waterfall');
|
|
@@ -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 AreaSeriesData<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)
|
|
@@ -35,12 +35,12 @@ export type AreaSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
export type AreaMarkerSymbol = 'circle' | 'square';
|
|
40
|
-
export
|
|
40
|
+
export interface AreaMarkerOptions extends PointMarkerOptions {
|
|
41
41
|
symbol?: AreaMarkerSymbol;
|
|
42
|
-
}
|
|
43
|
-
export
|
|
42
|
+
}
|
|
43
|
+
export interface AreaSeries<T = MeaningfulAny> extends BaseSeries {
|
|
44
44
|
type: typeof SeriesType.Area;
|
|
45
45
|
data: AreaSeriesData<T>[];
|
|
46
46
|
/** The name of the series (used in legend, tooltip etc) */
|
|
@@ -73,4 +73,4 @@ export type AreaSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
73
73
|
marker?: AreaMarkerOptions;
|
|
74
74
|
/** Y-axis index (when using two axes) */
|
|
75
75
|
yAxis?: number;
|
|
76
|
-
}
|
|
76
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { DashStyle } from 'src/constants';
|
|
1
2
|
import type { FormatNumberOptions } from '../formatter';
|
|
2
3
|
import type { BaseTextStyle } from './base';
|
|
3
4
|
export type ChartAxisType = 'category' | 'datetime' | 'linear' | 'logarithmic';
|
|
4
5
|
export type ChartAxisTitleAlignment = 'left' | 'center' | 'right';
|
|
5
|
-
export
|
|
6
|
+
export interface ChartAxisLabels {
|
|
6
7
|
/** Enable or disable the axis labels. */
|
|
7
8
|
enabled?: boolean;
|
|
8
9
|
/** The label's pixel distance from the perimeter of the plot area.
|
|
@@ -27,8 +28,8 @@ export type ChartAxisLabels = {
|
|
|
27
28
|
* @default: 0
|
|
28
29
|
*/
|
|
29
30
|
rotation?: number;
|
|
30
|
-
}
|
|
31
|
-
export
|
|
31
|
+
}
|
|
32
|
+
export interface ChartAxis {
|
|
32
33
|
categories?: string[];
|
|
33
34
|
timestamps?: number[];
|
|
34
35
|
type?: ChartAxisType;
|
|
@@ -72,9 +73,31 @@ export type ChartAxis = {
|
|
|
72
73
|
* Defaults to 0.05 for Y axis and to 0.01 for X axis.
|
|
73
74
|
* */
|
|
74
75
|
maxPadding?: number;
|
|
75
|
-
}
|
|
76
|
-
export
|
|
77
|
-
|
|
76
|
+
}
|
|
77
|
+
export interface ChartXAxis extends ChartAxis {
|
|
78
|
+
}
|
|
79
|
+
export interface AxisPlotLine {
|
|
80
|
+
/** The position of the line in axis units. */
|
|
81
|
+
value?: number;
|
|
82
|
+
/** The color of the plot line (hex, rgba). */
|
|
83
|
+
color?: string;
|
|
84
|
+
/** Pixel width of the plot line.
|
|
85
|
+
*
|
|
86
|
+
* @default 1
|
|
87
|
+
* */
|
|
88
|
+
width?: number;
|
|
89
|
+
/** Option for line stroke style. */
|
|
90
|
+
dashStyle?: `${DashStyle}`;
|
|
91
|
+
/**
|
|
92
|
+
* Individual opacity for the line.
|
|
93
|
+
*
|
|
94
|
+
* @default 1
|
|
95
|
+
* */
|
|
96
|
+
opacity?: number;
|
|
97
|
+
/** Place the line behind or above the chart. */
|
|
98
|
+
layerPlacement?: 'before' | 'after';
|
|
99
|
+
}
|
|
100
|
+
export interface ChartYAxis extends ChartAxis {
|
|
78
101
|
/** Axis location.
|
|
79
102
|
* Possible values - 'left' and 'right'.
|
|
80
103
|
* */
|
|
@@ -82,4 +105,6 @@ export type ChartYAxis = ChartAxis & {
|
|
|
82
105
|
/** Property for splitting charts. Determines which area the axis is located in.
|
|
83
106
|
* */
|
|
84
107
|
plotIndex?: number;
|
|
85
|
-
|
|
108
|
+
/** An array of lines stretching across the plot area, marking a specific value */
|
|
109
|
+
plotLines?: AxisPlotLine[];
|
|
110
|
+
}
|
|
@@ -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 { ChartSeriesOptions } from './series';
|
|
6
|
-
export
|
|
6
|
+
export interface BarXSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
7
7
|
/**
|
|
8
8
|
* The `x` value of the bar. Depending on the context , it may represents:
|
|
9
9
|
* - numeric value (for `linear` x axis)
|
|
@@ -28,14 +28,19 @@ export type BarXSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
28
28
|
label?: string | number;
|
|
29
29
|
/** Individual opacity for the bar-x column. */
|
|
30
30
|
opacity?: number;
|
|
31
|
-
}
|
|
32
|
-
export
|
|
31
|
+
}
|
|
32
|
+
export interface BarXSeries<T = MeaningfulAny> extends BaseSeries {
|
|
33
33
|
type: typeof SeriesType.BarX;
|
|
34
34
|
data: BarXSeriesData<T>[];
|
|
35
35
|
/** The name of the series (used in legend, tooltip etc) */
|
|
36
36
|
name: string;
|
|
37
37
|
/** The main color of the series (hex, rgba) */
|
|
38
38
|
color?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The corner radius of the border surrounding each bar.
|
|
41
|
+
* @default 0
|
|
42
|
+
*/
|
|
43
|
+
borderRadius?: number;
|
|
39
44
|
/** Whether to stack the values of each series on top of each other.
|
|
40
45
|
* Possible values are undefined to disable, "normal" to stack by value or "percent"
|
|
41
46
|
*
|
|
@@ -64,4 +69,4 @@ export type BarXSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
64
69
|
};
|
|
65
70
|
/** Y-axis index (when using two axes) */
|
|
66
71
|
yAxis?: number;
|
|
67
|
-
}
|
|
72
|
+
}
|
|
@@ -2,8 +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
|
-
|
|
6
|
-
export type BarYSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
5
|
+
export interface BarYSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
7
6
|
/**
|
|
8
7
|
* The `x` value of the bar. Depending on the context , it may represents:
|
|
9
8
|
* - numeric value (for `linear` x axis)
|
|
@@ -22,14 +21,19 @@ export type BarYSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
22
21
|
label?: string | number;
|
|
23
22
|
/** Individual opacity for the bar. */
|
|
24
23
|
opacity?: number;
|
|
25
|
-
}
|
|
26
|
-
export
|
|
24
|
+
}
|
|
25
|
+
export interface BarYSeries<T = MeaningfulAny> extends BaseSeries {
|
|
27
26
|
type: typeof SeriesType.BarY;
|
|
28
27
|
data: BarYSeriesData<T>[];
|
|
29
28
|
/** The name of the series (used in legend, tooltip etc) */
|
|
30
29
|
name: string;
|
|
31
30
|
/** The main color of the series (hex, rgba) */
|
|
32
31
|
color?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The corner radius of the border surrounding each bar.
|
|
34
|
+
* @default 0
|
|
35
|
+
*/
|
|
36
|
+
borderRadius?: number;
|
|
33
37
|
/** Whether to stack the values of each series on top of each other.
|
|
34
38
|
* Possible values are undefined to disable, "normal" to stack by value or "percent"
|
|
35
39
|
*
|
|
@@ -44,7 +48,7 @@ export type BarYSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
44
48
|
* @default true
|
|
45
49
|
* */
|
|
46
50
|
grouping?: boolean;
|
|
47
|
-
dataLabels?:
|
|
51
|
+
dataLabels?: BaseSeries['dataLabels'] & {
|
|
48
52
|
/**
|
|
49
53
|
* Whether to align the data label inside or outside the box.
|
|
50
54
|
* For charts with a percentage stack, it is always true.
|
|
@@ -57,4 +61,4 @@ export type BarYSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
57
61
|
legend?: ChartLegend & {
|
|
58
62
|
symbol?: RectLegendSymbolOptions;
|
|
59
63
|
};
|
|
60
|
-
}
|
|
64
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MeaningfulAny } from '../misc';
|
|
2
|
-
export
|
|
2
|
+
export interface BaseSeries {
|
|
3
3
|
/** Initial visibility of the series */
|
|
4
4
|
visible?: boolean;
|
|
5
5
|
/**
|
|
@@ -30,8 +30,8 @@ export type BaseSeries = {
|
|
|
30
30
|
};
|
|
31
31
|
/** You can set the cursor to "pointer" if you have click events attached to the series, to signal to the user that the points and lines can be clicked. */
|
|
32
32
|
cursor?: string;
|
|
33
|
-
}
|
|
34
|
-
export
|
|
33
|
+
}
|
|
34
|
+
export interface BaseSeriesData<T = MeaningfulAny> {
|
|
35
35
|
/**
|
|
36
36
|
* A reserved subspace to store options and values for customized functionality
|
|
37
37
|
*
|
|
@@ -40,9 +40,9 @@ export type BaseSeriesData<T = MeaningfulAny> = {
|
|
|
40
40
|
custom?: T;
|
|
41
41
|
/** Individual color for the data chunk (point in scatter, segment in pie, bar etc) */
|
|
42
42
|
color?: string;
|
|
43
|
-
}
|
|
44
|
-
export
|
|
43
|
+
}
|
|
44
|
+
export interface BaseTextStyle {
|
|
45
45
|
fontSize: string;
|
|
46
46
|
fontWeight?: string;
|
|
47
47
|
fontColor?: string;
|
|
48
|
-
}
|
|
48
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { MeaningfulAny } from '../misc';
|
|
2
2
|
import type { ChartTooltipRendererArgs } from './tooltip';
|
|
3
|
-
export
|
|
3
|
+
export interface ChartMargin {
|
|
4
4
|
top: number;
|
|
5
5
|
right: number;
|
|
6
6
|
bottom: number;
|
|
7
7
|
left: number;
|
|
8
|
-
}
|
|
9
|
-
export
|
|
8
|
+
}
|
|
9
|
+
export interface ChartOptions {
|
|
10
10
|
margin?: Partial<ChartMargin>;
|
|
11
11
|
events?: {
|
|
12
12
|
click?: (data: {
|
|
@@ -15,4 +15,4 @@ export type ChartOptions = {
|
|
|
15
15
|
}, event: PointerEvent) => void;
|
|
16
16
|
pointermove?: (data: ChartTooltipRendererArgs | undefined, event: PointerEvent) => void;
|
|
17
17
|
};
|
|
18
|
-
}
|
|
18
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** The halo appearing around the hovered part of series(point in line-type series or slice in pie charts) */
|
|
2
|
-
export
|
|
2
|
+
export interface Halo {
|
|
3
3
|
/** Enable or disable the halo */
|
|
4
4
|
enabled?: boolean;
|
|
5
5
|
/** The opacity of halo */
|
|
6
6
|
opacity?: number;
|
|
7
7
|
/** The pixel size of the halo. Radius for point markers or width of the outside slice in pie charts. */
|
|
8
8
|
size?: number;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
@@ -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,12 @@ 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
|
+
/** The individual radius of the pie segment. The default value is series.radius */
|
|
18
|
+
radius?: string | number;
|
|
19
|
+
}
|
|
18
20
|
export type ConnectorShape = 'straight-line' | 'polyline';
|
|
19
21
|
export type ConnectorCurve = 'linear' | 'basic';
|
|
20
|
-
export
|
|
22
|
+
export interface PieSeries<T = MeaningfulAny> extends BaseSeries {
|
|
21
23
|
type: typeof SeriesType.Pie;
|
|
22
24
|
data: PieSeriesData<T>[];
|
|
23
25
|
/**
|
|
@@ -85,4 +87,4 @@ export type PieSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
85
87
|
innerRadius: number;
|
|
86
88
|
};
|
|
87
89
|
}) => BaseType;
|
|
88
|
-
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SeriesType } from '../../constants';
|
|
2
|
+
import type { MeaningfulAny } from '../misc';
|
|
3
|
+
import type { BaseSeries, BaseSeriesData } from './base';
|
|
4
|
+
import type { ChartLegend, RectLegendSymbolOptions } from './legend';
|
|
5
|
+
export interface SankeySeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
6
|
+
name: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
links: {
|
|
9
|
+
name: string;
|
|
10
|
+
value: number;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
export interface SankeySeries<T = MeaningfulAny> extends BaseSeries {
|
|
14
|
+
type: typeof SeriesType.Sankey;
|
|
15
|
+
/** The name of the series (used in legend, tooltip etc). */
|
|
16
|
+
name: string;
|
|
17
|
+
data: SankeySeriesData<T>[];
|
|
18
|
+
/** Individual series legend options. Has higher priority than legend options in widget data. */
|
|
19
|
+
legend?: ChartLegend & {
|
|
20
|
+
symbol?: RectLegendSymbolOptions;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
+
}
|
|
@@ -8,15 +8,16 @@ import type { Halo } from './halo';
|
|
|
8
8
|
import type { LineSeries, LineSeriesData } from './line';
|
|
9
9
|
import type { PointMarkerOptions } from './marker';
|
|
10
10
|
import type { PieSeries, PieSeriesData } from './pie';
|
|
11
|
+
import type { SankeySeries, SankeySeriesData } from './sankey';
|
|
11
12
|
import type { ScatterSeries, ScatterSeriesData } from './scatter';
|
|
12
13
|
import type { TreemapSeries, TreemapSeriesData } from './treemap';
|
|
13
14
|
import type { WaterfallSeries, WaterfallSeriesData } from './waterfall';
|
|
14
|
-
export type ChartSeries<T = MeaningfulAny> = ScatterSeries<T> | PieSeries<T> | BarXSeries<T> | BarYSeries<T> | LineSeries<T> | AreaSeries<T> | TreemapSeries<T> | WaterfallSeries<T>;
|
|
15
|
-
export type ChartSeriesData<T = MeaningfulAny> = ScatterSeriesData<T> | PieSeriesData<T> | BarXSeriesData<T> | BarYSeriesData<T> | LineSeriesData<T> | AreaSeriesData<T> | TreemapSeriesData<T> | WaterfallSeriesData<T>;
|
|
16
|
-
export
|
|
15
|
+
export type ChartSeries<T = MeaningfulAny> = ScatterSeries<T> | PieSeries<T> | BarXSeries<T> | BarYSeries<T> | LineSeries<T> | AreaSeries<T> | TreemapSeries<T> | WaterfallSeries<T> | SankeySeries<T>;
|
|
16
|
+
export type ChartSeriesData<T = MeaningfulAny> = ScatterSeriesData<T> | PieSeriesData<T> | BarXSeriesData<T> | BarYSeriesData<T> | LineSeriesData<T> | AreaSeriesData<T> | TreemapSeriesData<T> | WaterfallSeriesData<T> | SankeySeriesData<T>;
|
|
17
|
+
export interface DataLabelRendererData<T = MeaningfulAny> {
|
|
17
18
|
data: ChartSeriesData<T>;
|
|
18
|
-
}
|
|
19
|
-
export
|
|
19
|
+
}
|
|
20
|
+
export interface BasicHoverState {
|
|
20
21
|
/**
|
|
21
22
|
* Enable separate styles for the hovered series.
|
|
22
23
|
*
|
|
@@ -32,8 +33,8 @@ export type BasicHoverState = {
|
|
|
32
33
|
* @default 0.3
|
|
33
34
|
*/
|
|
34
35
|
brightness?: number;
|
|
35
|
-
}
|
|
36
|
-
export
|
|
36
|
+
}
|
|
37
|
+
export interface BasicInactiveState {
|
|
37
38
|
/**
|
|
38
39
|
* Enable separate styles for the inactive series.
|
|
39
40
|
*
|
|
@@ -46,8 +47,8 @@ export type BasicInactiveState = {
|
|
|
46
47
|
* @default 0.5
|
|
47
48
|
* */
|
|
48
49
|
opacity?: number;
|
|
49
|
-
}
|
|
50
|
-
export
|
|
50
|
+
}
|
|
51
|
+
export interface ChartSeriesOptions {
|
|
51
52
|
/** Individual data label for each point. */
|
|
52
53
|
dataLabels?: {
|
|
53
54
|
/** Enable or disable the data labels */
|
|
@@ -72,6 +73,11 @@ export type ChartSeriesOptions = {
|
|
|
72
73
|
* @default 0.2
|
|
73
74
|
*/
|
|
74
75
|
groupPadding?: number;
|
|
76
|
+
/**
|
|
77
|
+
* The corner radius of the border surrounding each bar.
|
|
78
|
+
* @default 0
|
|
79
|
+
*/
|
|
80
|
+
borderRadius?: number;
|
|
75
81
|
dataSorting?: {
|
|
76
82
|
/** Determines what data value should be used to sort by.
|
|
77
83
|
* Possible values are undefined to disable, "name" to sort by series name or "y"
|
|
@@ -108,6 +114,11 @@ export type ChartSeriesOptions = {
|
|
|
108
114
|
* @default 0.2
|
|
109
115
|
*/
|
|
110
116
|
groupPadding?: number;
|
|
117
|
+
/**
|
|
118
|
+
* The corner radius of the border surrounding each bar.
|
|
119
|
+
* @default 0
|
|
120
|
+
*/
|
|
121
|
+
borderRadius?: number;
|
|
111
122
|
dataSorting?: {
|
|
112
123
|
/** Determines what data value should be used to sort by.
|
|
113
124
|
* Possible values are undefined to disable, "name" to sort by series name or "x"
|
|
@@ -222,4 +233,4 @@ export type ChartSeriesOptions = {
|
|
|
222
233
|
inactive?: BasicInactiveState;
|
|
223
234
|
};
|
|
224
235
|
};
|
|
225
|
-
}
|
|
236
|
+
}
|
|
@@ -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
|
+
}
|