@gravity-ui/charts 1.24.1 → 1.25.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/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +1 -1
- package/dist/cjs/components/ChartInner/useChartInnerProps.js +0 -1
- package/dist/cjs/components/Legend/index.js +11 -11
- package/dist/cjs/hooks/useAxis/index.js +0 -1
- package/dist/cjs/hooks/useAxis/x-axis.d.ts +1 -3
- package/dist/cjs/hooks/useAxis/x-axis.js +3 -4
- package/dist/cjs/hooks/useAxisScales/index.d.ts +1 -3
- package/dist/cjs/hooks/useAxisScales/index.js +25 -45
- package/dist/cjs/hooks/useRangeSlider/index.js +0 -1
- package/dist/cjs/hooks/useSeries/index.js +8 -8
- package/dist/cjs/hooks/useSeries/prepare-area.js +7 -5
- package/dist/cjs/hooks/useSeries/prepare-bar-x.js +8 -6
- package/dist/cjs/hooks/useSeries/prepare-bar-y.d.ts +2 -0
- package/dist/cjs/hooks/useSeries/prepare-bar-y.js +7 -5
- package/dist/cjs/hooks/useSeries/prepare-funnel.js +14 -10
- package/dist/cjs/hooks/useSeries/prepare-heatmap.js +9 -7
- package/dist/cjs/hooks/useSeries/prepare-legend.js +6 -4
- package/dist/cjs/hooks/useSeries/prepare-line.js +6 -4
- package/dist/cjs/hooks/useSeries/prepare-pie.js +10 -6
- package/dist/cjs/hooks/useSeries/prepare-radar.js +7 -5
- package/dist/cjs/hooks/useSeries/prepare-sankey.js +3 -1
- package/dist/cjs/hooks/useSeries/prepare-scatter.js +4 -1
- package/dist/cjs/hooks/useSeries/prepare-treemap.js +4 -2
- package/dist/cjs/hooks/useSeries/prepare-waterfall.js +13 -8
- package/dist/cjs/hooks/useSeries/types.d.ts +5 -0
- package/dist/cjs/hooks/useSeries/utils.d.ts +7 -3
- package/dist/cjs/hooks/useSeries/utils.js +2 -2
- package/dist/cjs/hooks/useShapes/area/prepare-data.js +4 -1
- package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +24 -46
- package/dist/cjs/hooks/useShapes/bar-y/prepare-data.js +0 -3
- package/dist/cjs/hooks/useShapes/line/prepare-data.js +1 -1
- package/dist/cjs/hooks/useShapes/waterfall/prepare-data.js +4 -1
- package/dist/cjs/hooks/utils/bar-x.d.ts +3 -2
- package/dist/cjs/hooks/utils/bar-x.js +8 -6
- package/dist/cjs/hooks/utils/bar-y.d.ts +0 -1
- package/dist/cjs/hooks/utils/bar-y.js +3 -3
- package/dist/cjs/types/chart/area.d.ts +3 -3
- package/dist/cjs/types/chart/axis.d.ts +1 -0
- package/dist/cjs/types/chart/bar-x.d.ts +3 -3
- package/dist/cjs/types/chart/bar-y.d.ts +3 -3
- package/dist/cjs/types/chart/base.d.ts +9 -0
- package/dist/cjs/types/chart/funnel.d.ts +10 -6
- package/dist/cjs/types/chart/heatmap.d.ts +3 -3
- package/dist/cjs/types/chart/legend.d.ts +11 -9
- package/dist/cjs/types/chart/line.d.ts +3 -3
- package/dist/cjs/types/chart/pie.d.ts +10 -6
- package/dist/cjs/types/chart/radar.d.ts +3 -3
- package/dist/cjs/types/chart/sankey.d.ts +3 -3
- package/dist/cjs/types/chart/scatter.d.ts +3 -3
- package/dist/cjs/types/chart/treemap.d.ts +3 -3
- package/dist/cjs/types/chart/waterfall.d.ts +2 -2
- package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +1 -1
- package/dist/esm/components/ChartInner/useChartInnerProps.js +0 -1
- package/dist/esm/components/Legend/index.js +11 -11
- package/dist/esm/hooks/useAxis/index.js +0 -1
- package/dist/esm/hooks/useAxis/x-axis.d.ts +1 -3
- package/dist/esm/hooks/useAxis/x-axis.js +3 -4
- package/dist/esm/hooks/useAxisScales/index.d.ts +1 -3
- package/dist/esm/hooks/useAxisScales/index.js +25 -45
- package/dist/esm/hooks/useRangeSlider/index.js +0 -1
- package/dist/esm/hooks/useSeries/index.js +8 -8
- package/dist/esm/hooks/useSeries/prepare-area.js +7 -5
- package/dist/esm/hooks/useSeries/prepare-bar-x.js +8 -6
- package/dist/esm/hooks/useSeries/prepare-bar-y.d.ts +2 -0
- package/dist/esm/hooks/useSeries/prepare-bar-y.js +7 -5
- package/dist/esm/hooks/useSeries/prepare-funnel.js +14 -10
- package/dist/esm/hooks/useSeries/prepare-heatmap.js +9 -7
- package/dist/esm/hooks/useSeries/prepare-legend.js +6 -4
- package/dist/esm/hooks/useSeries/prepare-line.js +6 -4
- package/dist/esm/hooks/useSeries/prepare-pie.js +10 -6
- package/dist/esm/hooks/useSeries/prepare-radar.js +7 -5
- package/dist/esm/hooks/useSeries/prepare-sankey.js +3 -1
- package/dist/esm/hooks/useSeries/prepare-scatter.js +4 -1
- package/dist/esm/hooks/useSeries/prepare-treemap.js +4 -2
- package/dist/esm/hooks/useSeries/prepare-waterfall.js +13 -8
- package/dist/esm/hooks/useSeries/types.d.ts +5 -0
- package/dist/esm/hooks/useSeries/utils.d.ts +7 -3
- package/dist/esm/hooks/useSeries/utils.js +2 -2
- package/dist/esm/hooks/useShapes/area/prepare-data.js +4 -1
- package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +24 -46
- package/dist/esm/hooks/useShapes/bar-y/prepare-data.js +0 -3
- package/dist/esm/hooks/useShapes/line/prepare-data.js +1 -1
- package/dist/esm/hooks/useShapes/waterfall/prepare-data.js +4 -1
- package/dist/esm/hooks/utils/bar-x.d.ts +3 -2
- package/dist/esm/hooks/utils/bar-x.js +8 -6
- package/dist/esm/hooks/utils/bar-y.d.ts +0 -1
- package/dist/esm/hooks/utils/bar-y.js +3 -3
- package/dist/esm/types/chart/area.d.ts +3 -3
- package/dist/esm/types/chart/axis.d.ts +1 -0
- package/dist/esm/types/chart/bar-x.d.ts +3 -3
- package/dist/esm/types/chart/bar-y.d.ts +3 -3
- package/dist/esm/types/chart/base.d.ts +9 -0
- package/dist/esm/types/chart/funnel.d.ts +10 -6
- package/dist/esm/types/chart/heatmap.d.ts +3 -3
- package/dist/esm/types/chart/legend.d.ts +11 -9
- package/dist/esm/types/chart/line.d.ts +3 -3
- package/dist/esm/types/chart/pie.d.ts +10 -6
- package/dist/esm/types/chart/radar.d.ts +3 -3
- package/dist/esm/types/chart/sankey.d.ts +3 -3
- package/dist/esm/types/chart/scatter.d.ts +3 -3
- package/dist/esm/types/chart/treemap.d.ts +3 -3
- package/dist/esm/types/chart/waterfall.d.ts +2 -2
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ const useVisibleSeries = ({ preparedSeries, activeLegendItems, }) => {
|
|
|
9
9
|
return React.useMemo(() => {
|
|
10
10
|
return preparedSeries.map((singleSeries) => {
|
|
11
11
|
if (singleSeries.legend.enabled) {
|
|
12
|
-
return Object.assign(Object.assign({}, singleSeries), { visible: activeLegendItems.includes(singleSeries.
|
|
12
|
+
return Object.assign(Object.assign({}, singleSeries), { visible: activeLegendItems.includes(singleSeries.legend.groupId) });
|
|
13
13
|
}
|
|
14
14
|
return singleSeries;
|
|
15
15
|
});
|
|
@@ -61,15 +61,15 @@ export const useSeries = (args) => {
|
|
|
61
61
|
}, [seriesData, seriesOptions, preparedLegend, colors]);
|
|
62
62
|
const prevOriginalSeriesData = usePrevious(originalSeriesData);
|
|
63
63
|
const chartSeries = useVisibleSeries({ preparedSeries, activeLegendItems });
|
|
64
|
-
const handleLegendItemClick = React.useCallback(({
|
|
64
|
+
const handleLegendItemClick = React.useCallback(({ id, metaKey }) => {
|
|
65
65
|
const allItems = getAllLegendItems(preparedSeries);
|
|
66
|
-
const onlyItemSelected = activeLegendItems.length === 1 && activeLegendItems.includes(
|
|
66
|
+
const onlyItemSelected = activeLegendItems.length === 1 && activeLegendItems.includes(id);
|
|
67
67
|
let nextActiveLegendItems;
|
|
68
|
-
if (metaKey && activeLegendItems.includes(
|
|
69
|
-
nextActiveLegendItems = activeLegendItems.filter((item) => item !==
|
|
68
|
+
if (metaKey && activeLegendItems.includes(id)) {
|
|
69
|
+
nextActiveLegendItems = activeLegendItems.filter((item) => item !== id);
|
|
70
70
|
}
|
|
71
|
-
else if (metaKey && !activeLegendItems.includes(
|
|
72
|
-
nextActiveLegendItems = activeLegendItems.concat(
|
|
71
|
+
else if (metaKey && !activeLegendItems.includes(id)) {
|
|
72
|
+
nextActiveLegendItems = activeLegendItems.concat(id);
|
|
73
73
|
}
|
|
74
74
|
else if (onlyItemSelected && allItems.length === 1) {
|
|
75
75
|
nextActiveLegendItems = [];
|
|
@@ -78,7 +78,7 @@ export const useSeries = (args) => {
|
|
|
78
78
|
nextActiveLegendItems = allItems;
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
|
-
nextActiveLegendItems = [
|
|
81
|
+
nextActiveLegendItems = [id];
|
|
82
82
|
}
|
|
83
83
|
setActiveLegendItems(nextActiveLegendItems);
|
|
84
84
|
}, [preparedSeries, activeLegendItems]);
|
|
@@ -32,7 +32,6 @@ function prepareSeriesData(series) {
|
|
|
32
32
|
case 'zero':
|
|
33
33
|
return data.map((p) => { var _a; return (Object.assign(Object.assign({}, p), { y: (_a = p.y) !== null && _a !== void 0 ? _a : 0 })); });
|
|
34
34
|
case 'connect':
|
|
35
|
-
return data.filter((p) => p.y !== null);
|
|
36
35
|
case 'skip':
|
|
37
36
|
default:
|
|
38
37
|
return data;
|
|
@@ -43,7 +42,7 @@ export function prepareArea(args) {
|
|
|
43
42
|
const defaultAreaWidth = get(seriesOptions, 'area.lineWidth', DEFAULT_LINE_WIDTH);
|
|
44
43
|
const defaultOpacity = get(seriesOptions, 'area.opacity', 0.75);
|
|
45
44
|
return seriesList.map((series) => {
|
|
46
|
-
var _a, _b, _c;
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
47
46
|
const id = getUniqId();
|
|
48
47
|
const name = series.name || '';
|
|
49
48
|
const color = series.color || colorScale(name);
|
|
@@ -58,23 +57,26 @@ export function prepareArea(args) {
|
|
|
58
57
|
legend: {
|
|
59
58
|
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
60
59
|
symbol: prepareLegendSymbol(series),
|
|
60
|
+
groupId: (_b = (_a = series.legend) === null || _a === void 0 ? void 0 : _a.groupId) !== null && _b !== void 0 ? _b : getUniqId(),
|
|
61
|
+
itemText: (_d = (_c = series.legend) === null || _c === void 0 ? void 0 : _c.itemText) !== null && _d !== void 0 ? _d : name,
|
|
61
62
|
},
|
|
62
63
|
data: prepareSeriesData(series),
|
|
63
64
|
stacking: series.stacking,
|
|
64
65
|
stackId: getSeriesStackId(series),
|
|
65
66
|
dataLabels: {
|
|
66
|
-
enabled: ((
|
|
67
|
-
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (
|
|
67
|
+
enabled: ((_e = series.dataLabels) === null || _e === void 0 ? void 0 : _e.enabled) || false,
|
|
68
|
+
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_f = series.dataLabels) === null || _f === void 0 ? void 0 : _f.style),
|
|
68
69
|
padding: get(series, 'dataLabels.padding', DEFAULT_DATALABELS_PADDING),
|
|
69
70
|
allowOverlap: get(series, 'dataLabels.allowOverlap', false),
|
|
70
71
|
html: get(series, 'dataLabels.html', false),
|
|
71
|
-
format: (
|
|
72
|
+
format: (_g = series.dataLabels) === null || _g === void 0 ? void 0 : _g.format,
|
|
72
73
|
},
|
|
73
74
|
marker: prepareMarker(series, seriesOptions),
|
|
74
75
|
cursor: get(series, 'cursor', null),
|
|
75
76
|
yAxis: get(series, 'yAxis', 0),
|
|
76
77
|
tooltip: series.tooltip,
|
|
77
78
|
rangeSlider: Object.assign({}, seriesRangeSliderOptionsDefaults, series.rangeSlider),
|
|
79
|
+
nullMode: series.nullMode,
|
|
78
80
|
};
|
|
79
81
|
return prepared;
|
|
80
82
|
}, []);
|
|
@@ -12,13 +12,13 @@ function prepareSeriesData(series) {
|
|
|
12
12
|
return data.map((p) => { var _a; return (Object.assign(Object.assign({}, p), { y: (_a = p.y) !== null && _a !== void 0 ? _a : 0 })); });
|
|
13
13
|
case 'skip':
|
|
14
14
|
default:
|
|
15
|
-
return data
|
|
15
|
+
return data;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
export function prepareBarXSeries(args) {
|
|
19
19
|
const { colorScale, series: seriesList, seriesOptions, legend } = args;
|
|
20
20
|
return seriesList.map((series) => {
|
|
21
|
-
var _a, _b, _c, _d;
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
22
22
|
const name = series.name || '';
|
|
23
23
|
const color = series.color || colorScale(name);
|
|
24
24
|
const dataLabelsInside = series.stacking === 'percent' ? true : get(series, 'dataLabels.inside', false);
|
|
@@ -31,18 +31,20 @@ export function prepareBarXSeries(args) {
|
|
|
31
31
|
legend: {
|
|
32
32
|
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
33
33
|
symbol: prepareLegendSymbol(series),
|
|
34
|
+
groupId: (_b = (_a = series.legend) === null || _a === void 0 ? void 0 : _a.groupId) !== null && _b !== void 0 ? _b : getUniqId(),
|
|
35
|
+
itemText: (_d = (_c = series.legend) === null || _c === void 0 ? void 0 : _c.itemText) !== null && _d !== void 0 ? _d : name,
|
|
34
36
|
},
|
|
35
37
|
data: prepareSeriesData(series),
|
|
36
38
|
stacking: series.stacking,
|
|
37
39
|
stackId: getSeriesStackId(series),
|
|
38
40
|
dataLabels: {
|
|
39
|
-
enabled: ((
|
|
41
|
+
enabled: ((_e = series.dataLabels) === null || _e === void 0 ? void 0 : _e.enabled) || false,
|
|
40
42
|
inside: dataLabelsInside,
|
|
41
|
-
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (
|
|
42
|
-
allowOverlap: ((
|
|
43
|
+
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_f = series.dataLabels) === null || _f === void 0 ? void 0 : _f.style),
|
|
44
|
+
allowOverlap: ((_g = series.dataLabels) === null || _g === void 0 ? void 0 : _g.allowOverlap) || false,
|
|
43
45
|
padding: get(series, 'dataLabels.padding', DEFAULT_DATALABELS_PADDING),
|
|
44
46
|
html: get(series, 'dataLabels.html', false),
|
|
45
|
-
format: (
|
|
47
|
+
format: (_h = series.dataLabels) === null || _h === void 0 ? void 0 : _h.format,
|
|
46
48
|
},
|
|
47
49
|
cursor: get(series, 'cursor', null),
|
|
48
50
|
yAxis: get(series, 'yAxis', 0),
|
|
@@ -13,7 +13,7 @@ function prepareSeriesData(series) {
|
|
|
13
13
|
return data.map((p) => { var _a; return (Object.assign(Object.assign({}, p), { x: (_a = p.x) !== null && _a !== void 0 ? _a : 0 })); });
|
|
14
14
|
case 'skip':
|
|
15
15
|
default:
|
|
16
|
-
return data
|
|
16
|
+
return data;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
async function prepareDataLabels(series) {
|
|
@@ -46,7 +46,7 @@ async function prepareDataLabels(series) {
|
|
|
46
46
|
export function prepareBarYSeries(args) {
|
|
47
47
|
const { colorScale, series: seriesList, seriesOptions, legend } = args;
|
|
48
48
|
return Promise.all(seriesList.map(async (series) => {
|
|
49
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
49
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
50
50
|
const name = series.name || '';
|
|
51
51
|
const color = series.color || colorScale(name);
|
|
52
52
|
return {
|
|
@@ -58,15 +58,17 @@ export function prepareBarYSeries(args) {
|
|
|
58
58
|
legend: {
|
|
59
59
|
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
60
60
|
symbol: prepareLegendSymbol(series),
|
|
61
|
+
groupId: (_b = (_a = series.legend) === null || _a === void 0 ? void 0 : _a.groupId) !== null && _b !== void 0 ? _b : getUniqId(),
|
|
62
|
+
itemText: (_d = (_c = series.legend) === null || _c === void 0 ? void 0 : _c.itemText) !== null && _d !== void 0 ? _d : name,
|
|
61
63
|
},
|
|
62
64
|
data: prepareSeriesData(series),
|
|
63
65
|
stacking: series.stacking,
|
|
64
66
|
stackId: getSeriesStackId(series),
|
|
65
67
|
dataLabels: await prepareDataLabels(series),
|
|
66
68
|
cursor: get(series, 'cursor', null),
|
|
67
|
-
borderRadius: (
|
|
68
|
-
borderWidth: (
|
|
69
|
-
borderColor: (
|
|
69
|
+
borderRadius: (_g = (_e = series.borderRadius) !== null && _e !== void 0 ? _e : (_f = seriesOptions === null || seriesOptions === void 0 ? void 0 : seriesOptions['bar-y']) === null || _f === void 0 ? void 0 : _f.borderRadius) !== null && _g !== void 0 ? _g : 0,
|
|
70
|
+
borderWidth: (_k = (_h = series.borderWidth) !== null && _h !== void 0 ? _h : (_j = seriesOptions === null || seriesOptions === void 0 ? void 0 : seriesOptions['bar-y']) === null || _j === void 0 ? void 0 : _j.borderWidth) !== null && _k !== void 0 ? _k : 0,
|
|
71
|
+
borderColor: (_o = (_l = series.borderColor) !== null && _l !== void 0 ? _l : (_m = seriesOptions === null || seriesOptions === void 0 ? void 0 : seriesOptions['bar-y']) === null || _m === void 0 ? void 0 : _m.borderColor) !== null && _o !== void 0 ? _o : 'var(--gcharts-shape-border-color)',
|
|
70
72
|
tooltip: series.tooltip,
|
|
71
73
|
};
|
|
72
74
|
}));
|
|
@@ -10,7 +10,7 @@ export function prepareFunnelSeries(args) {
|
|
|
10
10
|
const colorScale = scaleOrdinal(dataNames, colors);
|
|
11
11
|
const isConnectorsEnabled = (_b = (_a = series.connectors) === null || _a === void 0 ? void 0 : _a.enabled) !== null && _b !== void 0 ? _b : true;
|
|
12
12
|
const preparedSeries = series.data.map((dataItem) => {
|
|
13
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
14
14
|
const id = getUniqId();
|
|
15
15
|
const color = dataItem.color || colorScale(dataItem.name);
|
|
16
16
|
const result = {
|
|
@@ -28,20 +28,24 @@ export function prepareFunnelSeries(args) {
|
|
|
28
28
|
id,
|
|
29
29
|
color,
|
|
30
30
|
legend: {
|
|
31
|
-
enabled:
|
|
32
|
-
symbol:
|
|
31
|
+
enabled: (_h = (_f = (_e = dataItem.legend) === null || _e === void 0 ? void 0 : _e.enabled) !== null && _f !== void 0 ? _f : (_g = series.legend) === null || _g === void 0 ? void 0 : _g.enabled) !== null && _h !== void 0 ? _h : legend.enabled,
|
|
32
|
+
symbol: ((_j = dataItem.legend) === null || _j === void 0 ? void 0 : _j.symbol)
|
|
33
|
+
? prepareLegendSymbol(dataItem)
|
|
34
|
+
: prepareLegendSymbol(series),
|
|
35
|
+
groupId: (_l = (_k = dataItem.legend) === null || _k === void 0 ? void 0 : _k.groupId) !== null && _l !== void 0 ? _l : getUniqId(),
|
|
36
|
+
itemText: (_o = (_m = dataItem.legend) === null || _m === void 0 ? void 0 : _m.itemText) !== null && _o !== void 0 ? _o : dataItem.name,
|
|
33
37
|
},
|
|
34
38
|
cursor: get(series, 'cursor', null),
|
|
35
39
|
tooltip: series.tooltip,
|
|
36
40
|
connectors: {
|
|
37
41
|
enabled: isConnectorsEnabled,
|
|
38
|
-
height: isConnectorsEnabled ? ((
|
|
39
|
-
lineDashStyle: (
|
|
40
|
-
lineOpacity: (
|
|
41
|
-
lineColor: (
|
|
42
|
-
areaColor: (
|
|
43
|
-
areaOpacity: (
|
|
44
|
-
lineWidth: (
|
|
42
|
+
height: isConnectorsEnabled ? ((_q = (_p = series.connectors) === null || _p === void 0 ? void 0 : _p.height) !== null && _q !== void 0 ? _q : '25%') : 0,
|
|
43
|
+
lineDashStyle: (_s = (_r = series.connectors) === null || _r === void 0 ? void 0 : _r.lineDashStyle) !== null && _s !== void 0 ? _s : 'Dash',
|
|
44
|
+
lineOpacity: (_u = (_t = series.connectors) === null || _t === void 0 ? void 0 : _t.lineOpacity) !== null && _u !== void 0 ? _u : 1,
|
|
45
|
+
lineColor: (_w = (_v = series.connectors) === null || _v === void 0 ? void 0 : _v.lineColor) !== null && _w !== void 0 ? _w : 'var(--g-color-line-generic-active)',
|
|
46
|
+
areaColor: (_y = (_x = series.connectors) === null || _x === void 0 ? void 0 : _x.areaColor) !== null && _y !== void 0 ? _y : color,
|
|
47
|
+
areaOpacity: (_0 = (_z = series.connectors) === null || _z === void 0 ? void 0 : _z.areaOpacity) !== null && _0 !== void 0 ? _0 : 0.25,
|
|
48
|
+
lineWidth: (_2 = (_1 = series.connectors) === null || _1 === void 0 ? void 0 : _1.lineWidth) !== null && _2 !== void 0 ? _2 : 1,
|
|
45
49
|
},
|
|
46
50
|
};
|
|
47
51
|
return result;
|
|
@@ -18,7 +18,7 @@ function prepareSeriesData(series) {
|
|
|
18
18
|
export function prepareHeatmapSeries(args) {
|
|
19
19
|
const { colorScale, series: seriesList, seriesOptions, legend } = args;
|
|
20
20
|
return seriesList.map((series) => {
|
|
21
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
22
22
|
const name = series.name || '';
|
|
23
23
|
const color = series.color || colorScale(name);
|
|
24
24
|
return {
|
|
@@ -30,20 +30,22 @@ export function prepareHeatmapSeries(args) {
|
|
|
30
30
|
legend: {
|
|
31
31
|
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
32
32
|
symbol: prepareLegendSymbol(series),
|
|
33
|
+
groupId: (_b = (_a = series.legend) === null || _a === void 0 ? void 0 : _a.groupId) !== null && _b !== void 0 ? _b : getUniqId(),
|
|
34
|
+
itemText: (_d = (_c = series.legend) === null || _c === void 0 ? void 0 : _c.itemText) !== null && _d !== void 0 ? _d : name,
|
|
33
35
|
},
|
|
34
36
|
data: prepareSeriesData(series),
|
|
35
37
|
dataLabels: {
|
|
36
|
-
enabled: ((
|
|
37
|
-
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (
|
|
38
|
+
enabled: ((_e = series.dataLabels) === null || _e === void 0 ? void 0 : _e.enabled) || false,
|
|
39
|
+
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_f = series.dataLabels) === null || _f === void 0 ? void 0 : _f.style),
|
|
38
40
|
padding: get(series, 'dataLabels.padding', DEFAULT_DATALABELS_PADDING),
|
|
39
|
-
html: (
|
|
40
|
-
format: (
|
|
41
|
+
html: (_h = (_g = series.dataLabels) === null || _g === void 0 ? void 0 : _g.html) !== null && _h !== void 0 ? _h : false,
|
|
42
|
+
format: (_j = series.dataLabels) === null || _j === void 0 ? void 0 : _j.format,
|
|
41
43
|
},
|
|
42
44
|
cursor: get(series, 'cursor', null),
|
|
43
45
|
yAxis: get(series, 'yAxis', 0),
|
|
44
46
|
tooltip: series.tooltip,
|
|
45
|
-
borderColor: (
|
|
46
|
-
borderWidth: (
|
|
47
|
+
borderColor: (_m = (_k = series.borderColor) !== null && _k !== void 0 ? _k : (_l = seriesOptions === null || seriesOptions === void 0 ? void 0 : seriesOptions.heatmap) === null || _l === void 0 ? void 0 : _l.borderColor) !== null && _m !== void 0 ? _m : 'var(--gcharts-shape-border-color)',
|
|
48
|
+
borderWidth: (_q = (_o = series.borderWidth) !== null && _o !== void 0 ? _o : (_p = seriesOptions === null || seriesOptions === void 0 ? void 0 : seriesOptions.heatmap) === null || _p === void 0 ? void 0 : _p.borderWidth) !== null && _q !== void 0 ? _q : 0,
|
|
47
49
|
};
|
|
48
50
|
}, []);
|
|
49
51
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { select } from 'd3';
|
|
2
|
+
import { groupBy } from 'lodash';
|
|
2
3
|
import clone from 'lodash/clone';
|
|
3
4
|
import get from 'lodash/get';
|
|
4
5
|
import merge from 'lodash/merge';
|
|
@@ -75,10 +76,11 @@ export async function getPreparedLegend(args) {
|
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
78
|
function getFlattenLegendItems(series, preparedLegend) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
const grouped = groupBy(series, (s) => s.legend.groupId);
|
|
80
|
+
return Object.values(grouped).reduce((acc, items) => {
|
|
81
|
+
const s = items.find((item) => item.legend.enabled);
|
|
82
|
+
if (s) {
|
|
83
|
+
acc.push(Object.assign(Object.assign({}, s), { id: s.legend.groupId, name: s.legend.itemText, height: preparedLegend.lineHeight, symbol: s.legend.symbol }));
|
|
82
84
|
}
|
|
83
85
|
return acc;
|
|
84
86
|
}, []);
|
|
@@ -60,7 +60,7 @@ export function prepareLineSeries(args) {
|
|
|
60
60
|
const defaultLineWidth = get(seriesOptions, 'line.lineWidth', DEFAULT_LINE_WIDTH);
|
|
61
61
|
const defaultDashStyle = get(seriesOptions, 'line.dashStyle', DEFAULT_DASH_STYLE);
|
|
62
62
|
return seriesList.map((series) => {
|
|
63
|
-
var _a, _b, _c;
|
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
64
64
|
const id = getUniqId();
|
|
65
65
|
const name = series.name || '';
|
|
66
66
|
const color = series.color || colorScale(name);
|
|
@@ -75,15 +75,17 @@ export function prepareLineSeries(args) {
|
|
|
75
75
|
legend: {
|
|
76
76
|
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
77
77
|
symbol: prepareLineLegendSymbol(series, seriesOptions),
|
|
78
|
+
groupId: (_b = (_a = series.legend) === null || _a === void 0 ? void 0 : _a.groupId) !== null && _b !== void 0 ? _b : getUniqId(),
|
|
79
|
+
itemText: (_d = (_c = series.legend) === null || _c === void 0 ? void 0 : _c.itemText) !== null && _d !== void 0 ? _d : name,
|
|
78
80
|
},
|
|
79
81
|
data: prepareSeriesData(series),
|
|
80
82
|
dataLabels: {
|
|
81
|
-
enabled: ((
|
|
82
|
-
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (
|
|
83
|
+
enabled: ((_e = series.dataLabels) === null || _e === void 0 ? void 0 : _e.enabled) || false,
|
|
84
|
+
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_f = series.dataLabels) === null || _f === void 0 ? void 0 : _f.style),
|
|
83
85
|
padding: get(series, 'dataLabels.padding', DEFAULT_DATALABELS_PADDING),
|
|
84
86
|
allowOverlap: get(series, 'dataLabels.allowOverlap', false),
|
|
85
87
|
html: get(series, 'dataLabels.html', false),
|
|
86
|
-
format: (
|
|
88
|
+
format: (_g = series.dataLabels) === null || _g === void 0 ? void 0 : _g.format,
|
|
87
89
|
},
|
|
88
90
|
marker: prepareMarker(series, seriesOptions),
|
|
89
91
|
dashStyle: dashStyle,
|
|
@@ -24,7 +24,7 @@ export function preparePieSeries(args) {
|
|
|
24
24
|
const stackId = getUniqId();
|
|
25
25
|
const seriesHoverState = get(seriesOptions, 'pie.states.hover');
|
|
26
26
|
const preparedSeries = preparedData.map((dataItem) => {
|
|
27
|
-
var _a, _b, _c, _d, _e, _f;
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
28
28
|
const id = getUniqId();
|
|
29
29
|
const result = {
|
|
30
30
|
type: 'pie',
|
|
@@ -48,14 +48,18 @@ export function preparePieSeries(args) {
|
|
|
48
48
|
id,
|
|
49
49
|
color: dataItem.color || colorScale(dataItem.name),
|
|
50
50
|
legend: {
|
|
51
|
-
enabled:
|
|
52
|
-
symbol:
|
|
51
|
+
enabled: (_f = (_d = (_c = dataItem.legend) === null || _c === void 0 ? void 0 : _c.enabled) !== null && _d !== void 0 ? _d : (_e = series.legend) === null || _e === void 0 ? void 0 : _e.enabled) !== null && _f !== void 0 ? _f : legend.enabled,
|
|
52
|
+
symbol: ((_g = dataItem.legend) === null || _g === void 0 ? void 0 : _g.symbol)
|
|
53
|
+
? prepareLegendSymbol(dataItem)
|
|
54
|
+
: prepareLegendSymbol(series),
|
|
55
|
+
groupId: (_j = (_h = dataItem.legend) === null || _h === void 0 ? void 0 : _h.groupId) !== null && _j !== void 0 ? _j : getUniqId(),
|
|
56
|
+
itemText: (_l = (_k = dataItem.legend) === null || _k === void 0 ? void 0 : _k.itemText) !== null && _l !== void 0 ? _l : dataItem.name,
|
|
53
57
|
},
|
|
54
58
|
center: series.center || ['50%', '50%'],
|
|
55
59
|
borderColor: series.borderColor || '',
|
|
56
|
-
borderRadius: (
|
|
57
|
-
borderWidth: (
|
|
58
|
-
radius: (
|
|
60
|
+
borderRadius: (_m = series.borderRadius) !== null && _m !== void 0 ? _m : 0,
|
|
61
|
+
borderWidth: (_o = series.borderWidth) !== null && _o !== void 0 ? _o : 1,
|
|
62
|
+
radius: (_q = (_p = dataItem.radius) !== null && _p !== void 0 ? _p : series.radius) !== null && _q !== void 0 ? _q : '100%',
|
|
59
63
|
innerRadius: series.innerRadius || 0,
|
|
60
64
|
minRadius: series.minRadius,
|
|
61
65
|
stackId,
|
|
@@ -30,7 +30,7 @@ export function prepareRadarSeries(args) {
|
|
|
30
30
|
const colorScale = scaleOrdinal(radarSeries.map((s, index) => { var _a; return (_a = s.name) !== null && _a !== void 0 ? _a : `Series ${index + 1}`; }), colors);
|
|
31
31
|
const categories = (_b = (_a = radarSeries.find((s) => s.categories)) === null || _a === void 0 ? void 0 : _a.categories) !== null && _b !== void 0 ? _b : [];
|
|
32
32
|
return radarSeries.map((series, index) => {
|
|
33
|
-
var _a, _b, _c, _d, _e, _f;
|
|
33
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
34
34
|
const name = (_a = series.name) !== null && _a !== void 0 ? _a : `Series ${index + 1}`;
|
|
35
35
|
const color = (_b = series.color) !== null && _b !== void 0 ? _b : colorScale(name);
|
|
36
36
|
const preparedSeries = {
|
|
@@ -44,17 +44,19 @@ export function prepareRadarSeries(args) {
|
|
|
44
44
|
legend: {
|
|
45
45
|
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
46
46
|
symbol: prepareLegendSymbol(series),
|
|
47
|
+
groupId: (_d = (_c = series.legend) === null || _c === void 0 ? void 0 : _c.groupId) !== null && _d !== void 0 ? _d : getUniqId(),
|
|
48
|
+
itemText: (_f = (_e = series.legend) === null || _e === void 0 ? void 0 : _e.itemText) !== null && _f !== void 0 ? _f : name,
|
|
47
49
|
},
|
|
48
50
|
borderColor: series.borderColor || color,
|
|
49
|
-
borderWidth: (
|
|
50
|
-
fillOpacity: (
|
|
51
|
+
borderWidth: (_g = series.borderWidth) !== null && _g !== void 0 ? _g : 1,
|
|
52
|
+
fillOpacity: (_h = series.fillOpacity) !== null && _h !== void 0 ? _h : 0.25,
|
|
51
53
|
dataLabels: {
|
|
52
54
|
enabled: get(series, 'dataLabels.enabled', true),
|
|
53
|
-
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (
|
|
55
|
+
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_j = series.dataLabels) === null || _j === void 0 ? void 0 : _j.style),
|
|
54
56
|
padding: get(series, 'dataLabels.padding', DEFAULT_DATALABELS_PADDING),
|
|
55
57
|
allowOverlap: get(series, 'dataLabels.allowOverlap', false),
|
|
56
58
|
html: get(series, 'dataLabels.html', false),
|
|
57
|
-
format: (
|
|
59
|
+
format: (_k = series.dataLabels) === null || _k === void 0 ? void 0 : _k.format,
|
|
58
60
|
},
|
|
59
61
|
cursor: get(series, 'cursor', null),
|
|
60
62
|
marker: prepareMarker(series, seriesOptions),
|
|
@@ -5,7 +5,7 @@ import { prepareLegendSymbol } from './utils';
|
|
|
5
5
|
export function prepareSankeySeries(args) {
|
|
6
6
|
const { colorScale, legend, series } = args;
|
|
7
7
|
return series.map((s) => {
|
|
8
|
-
var _a, _b;
|
|
8
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9
9
|
const id = getUniqId();
|
|
10
10
|
const name = s.name || '';
|
|
11
11
|
const color = colorScale(name);
|
|
@@ -31,6 +31,8 @@ export function prepareSankeySeries(args) {
|
|
|
31
31
|
legend: {
|
|
32
32
|
enabled: get(s, 'legend.enabled', legend.enabled),
|
|
33
33
|
symbol: prepareLegendSymbol(s),
|
|
34
|
+
groupId: (_d = (_c = s.legend) === null || _c === void 0 ? void 0 : _c.groupId) !== null && _d !== void 0 ? _d : getUniqId(),
|
|
35
|
+
itemText: (_f = (_e = s.legend) === null || _e === void 0 ? void 0 : _e.itemText) !== null && _f !== void 0 ? _f : name,
|
|
34
36
|
},
|
|
35
37
|
cursor: get(s, 'cursor', null),
|
|
36
38
|
tooltip: s.tooltip,
|
|
@@ -39,6 +39,7 @@ function prepareSeriesData(series) {
|
|
|
39
39
|
export function prepareScatterSeries(args) {
|
|
40
40
|
const { colorScale, series, seriesOptions, legend } = args;
|
|
41
41
|
return series.map((s, index) => {
|
|
42
|
+
var _a, _b, _c, _d, _e, _f;
|
|
42
43
|
const id = getUniqId();
|
|
43
44
|
const name = 'name' in s && s.name ? s.name : '';
|
|
44
45
|
const symbolType = s.symbolType || getSymbolType(index);
|
|
@@ -49,8 +50,10 @@ export function prepareScatterSeries(args) {
|
|
|
49
50
|
color: get(s, 'color', colorScale(name)),
|
|
50
51
|
visible: get(s, 'visible', true),
|
|
51
52
|
legend: {
|
|
52
|
-
enabled:
|
|
53
|
+
enabled: (_b = (_a = s.legend) === null || _a === void 0 ? void 0 : _a.enabled) !== null && _b !== void 0 ? _b : legend.enabled,
|
|
53
54
|
symbol: prepareLegendSymbol(s, symbolType),
|
|
55
|
+
groupId: (_d = (_c = s.legend) === null || _c === void 0 ? void 0 : _c.groupId) !== null && _d !== void 0 ? _d : getUniqId(),
|
|
56
|
+
itemText: (_f = (_e = s.legend) === null || _e === void 0 ? void 0 : _e.itemText) !== null && _f !== void 0 ? _f : name,
|
|
54
57
|
},
|
|
55
58
|
data: prepareSeriesData(s),
|
|
56
59
|
marker: prepareMarker(s, seriesOptions, index),
|
|
@@ -6,7 +6,7 @@ import { prepareLegendSymbol } from './utils';
|
|
|
6
6
|
export function prepareTreemap(args) {
|
|
7
7
|
const { colorScale, legend, series } = args;
|
|
8
8
|
return series.map((s) => {
|
|
9
|
-
var _a, _b, _c;
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
10
10
|
const id = getUniqId();
|
|
11
11
|
const name = s.name || '';
|
|
12
12
|
const color = s.color || colorScale(name);
|
|
@@ -29,8 +29,10 @@ export function prepareTreemap(args) {
|
|
|
29
29
|
legend: {
|
|
30
30
|
enabled: get(s, 'legend.enabled', legend.enabled),
|
|
31
31
|
symbol: prepareLegendSymbol(s),
|
|
32
|
+
groupId: (_d = (_c = s.legend) === null || _c === void 0 ? void 0 : _c.groupId) !== null && _d !== void 0 ? _d : getUniqId(),
|
|
33
|
+
itemText: (_f = (_e = s.legend) === null || _e === void 0 ? void 0 : _e.itemText) !== null && _f !== void 0 ? _f : name,
|
|
32
34
|
},
|
|
33
|
-
levels: (
|
|
35
|
+
levels: (_g = s.levels) !== null && _g !== void 0 ? _g : [],
|
|
34
36
|
layoutAlgorithm: get(s, 'layoutAlgorithm', LayoutAlgorithm.Binary),
|
|
35
37
|
cursor: get(s, 'cursor', null),
|
|
36
38
|
sorting: Object.assign({ enabled: false, direction: 'desc' }, s.sorting),
|
|
@@ -19,7 +19,7 @@ function prepareSeriesData(series) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
export function prepareWaterfallSeries(args) {
|
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
23
23
|
const { colorScale, series: seriesList, legend, colors } = args;
|
|
24
24
|
const [, negativeColor, positiveColor] = colors;
|
|
25
25
|
const series = seriesList[0];
|
|
@@ -29,10 +29,6 @@ export function prepareWaterfallSeries(args) {
|
|
|
29
29
|
type: series.type,
|
|
30
30
|
name: series.name,
|
|
31
31
|
visible: get(series, 'visible', true),
|
|
32
|
-
legend: {
|
|
33
|
-
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
34
|
-
symbol: prepareLegendSymbol(series),
|
|
35
|
-
},
|
|
36
32
|
dataLabels: {
|
|
37
33
|
enabled: ((_a = series.dataLabels) === null || _a === void 0 ? void 0 : _a.enabled) || true,
|
|
38
34
|
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_b = series.dataLabels) === null || _b === void 0 ? void 0 : _b.style),
|
|
@@ -41,13 +37,22 @@ export function prepareWaterfallSeries(args) {
|
|
|
41
37
|
html: get(series, 'dataLabels.html', false),
|
|
42
38
|
format: (_d = series.dataLabels) === null || _d === void 0 ? void 0 : _d.format,
|
|
43
39
|
},
|
|
40
|
+
legend: {
|
|
41
|
+
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
42
|
+
symbol: prepareLegendSymbol(series),
|
|
43
|
+
groupId: '',
|
|
44
|
+
itemText: '',
|
|
45
|
+
},
|
|
44
46
|
cursor: get(series, 'cursor', null),
|
|
45
47
|
data: [],
|
|
46
48
|
tooltip: series.tooltip,
|
|
47
49
|
};
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
50
|
+
const positiveName = (_g = (_f = (_e = series.legend) === null || _e === void 0 ? void 0 : _e.itemText) === null || _f === void 0 ? void 0 : _f.positive) !== null && _g !== void 0 ? _g : `${series.name} ↑`;
|
|
51
|
+
const positive = Object.assign(Object.assign({}, common), { name: positiveName, legend: Object.assign(Object.assign({}, common.legend), { groupId: getUniqId(), itemText: (_k = (_j = (_h = series.legend) === null || _h === void 0 ? void 0 : _h.itemText) === null || _j === void 0 ? void 0 : _j.positive) !== null && _k !== void 0 ? _k : positiveName }), id: getUniqId(), color: series.positiveColor || positiveColor, data: [] });
|
|
52
|
+
const negativeName = (_o = (_m = (_l = series.legend) === null || _l === void 0 ? void 0 : _l.itemText) === null || _m === void 0 ? void 0 : _m.negative) !== null && _o !== void 0 ? _o : `${series.name} ↓`;
|
|
53
|
+
const negative = Object.assign(Object.assign({}, common), { name: negativeName, legend: Object.assign(Object.assign({}, common.legend), { groupId: getUniqId(), itemText: (_r = (_q = (_p = series.legend) === null || _p === void 0 ? void 0 : _p.itemText) === null || _q === void 0 ? void 0 : _q.negative) !== null && _r !== void 0 ? _r : negativeName }), id: getUniqId(), color: series.negativeColor || negativeColor, data: [] });
|
|
54
|
+
const totalsName = (_u = (_t = (_s = series.legend) === null || _s === void 0 ? void 0 : _s.itemText) === null || _t === void 0 ? void 0 : _t.totals) !== null && _u !== void 0 ? _u : series.name;
|
|
55
|
+
const totals = Object.assign(Object.assign({}, common), { name: totalsName, legend: Object.assign(Object.assign({}, common.legend), { groupId: getUniqId(), itemText: (_x = (_w = (_v = series.legend) === null || _v === void 0 ? void 0 : _v.itemText) === null || _w === void 0 ? void 0 : _w.totals) !== null && _x !== void 0 ? _x : totalsName }), id: getUniqId(), data: [] });
|
|
51
56
|
const preparedData = prepareSeriesData(series);
|
|
52
57
|
preparedData.forEach((d, index) => {
|
|
53
58
|
var _a;
|
|
@@ -35,10 +35,12 @@ export type PreparedLegend = Required<Omit<ChartLegend, 'title' | 'colorScale'>>
|
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
export type OnLegendItemClick = (data: {
|
|
38
|
+
id: string;
|
|
38
39
|
name: string;
|
|
39
40
|
metaKey: boolean;
|
|
40
41
|
}) => void;
|
|
41
42
|
export type LegendItem = {
|
|
43
|
+
id: string;
|
|
42
44
|
color: string;
|
|
43
45
|
height: number;
|
|
44
46
|
name: string;
|
|
@@ -72,6 +74,8 @@ type BasePreparedSeries = {
|
|
|
72
74
|
id: string;
|
|
73
75
|
visible: boolean;
|
|
74
76
|
legend: {
|
|
77
|
+
groupId: string;
|
|
78
|
+
itemText: string;
|
|
75
79
|
enabled: boolean;
|
|
76
80
|
symbol: PreparedLegendSymbol;
|
|
77
81
|
};
|
|
@@ -228,6 +232,7 @@ export type PreparedAreaSeries = {
|
|
|
228
232
|
stackId: string;
|
|
229
233
|
lineWidth: number;
|
|
230
234
|
opacity: number;
|
|
235
|
+
nullMode: AreaSeries['nullMode'];
|
|
231
236
|
dataLabels: {
|
|
232
237
|
enabled: boolean;
|
|
233
238
|
style: BaseTextStyle;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { SymbolType } from '../../constants';
|
|
2
|
-
import type {
|
|
3
|
-
import type { PreparedLegendSymbol, PreparedSeries, StackedSeries } from './types';
|
|
2
|
+
import type { RectLegendSymbolOptions } from '../../types';
|
|
3
|
+
import type { PathLegendSymbol, PreparedLegendSymbol, PreparedSeries, StackedSeries } from './types';
|
|
4
4
|
export declare const getActiveLegendItems: (series: PreparedSeries[]) => string[];
|
|
5
5
|
export declare const getAllLegendItems: (series: PreparedSeries[]) => string[];
|
|
6
|
-
export declare function prepareLegendSymbol(series:
|
|
6
|
+
export declare function prepareLegendSymbol(series: {
|
|
7
|
+
legend?: {
|
|
8
|
+
symbol?: RectLegendSymbolOptions | PathLegendSymbol;
|
|
9
|
+
};
|
|
10
|
+
}, symbolType?: `${SymbolType}`): PreparedLegendSymbol;
|
|
7
11
|
export declare function getSeriesStackId(series: StackedSeries): string;
|
|
@@ -5,13 +5,13 @@ import { DEFAULT_LEGEND_SYMBOL_PADDING, DEFAULT_LEGEND_SYMBOL_SIZE } from './con
|
|
|
5
5
|
export const getActiveLegendItems = (series) => {
|
|
6
6
|
return series.reduce((acc, s) => {
|
|
7
7
|
if (s.legend.enabled && s.visible) {
|
|
8
|
-
acc.push(s.
|
|
8
|
+
acc.push(s.legend.groupId);
|
|
9
9
|
}
|
|
10
10
|
return acc;
|
|
11
11
|
}, []);
|
|
12
12
|
};
|
|
13
13
|
export const getAllLegendItems = (series) => {
|
|
14
|
-
return series.map((s) => s.
|
|
14
|
+
return series.map((s) => s.legend.groupId);
|
|
15
15
|
};
|
|
16
16
|
export function prepareLegendSymbol(series, symbolType) {
|
|
17
17
|
var _a;
|
|
@@ -76,7 +76,7 @@ export const prepareAreaData = async (args) => {
|
|
|
76
76
|
var _a, _b;
|
|
77
77
|
const { series, xAxis, xScale, yAxis, yScale, boundsHeight: plotHeight, split, isOutsideBounds, } = args;
|
|
78
78
|
const [_xMin, xRangeMax] = xScale.range();
|
|
79
|
-
const xMax = xRangeMax
|
|
79
|
+
const xMax = xRangeMax;
|
|
80
80
|
const result = [];
|
|
81
81
|
const dataByPlots = Array.from(group(series, (s) => {
|
|
82
82
|
const yAxisIndex = s.yAxis;
|
|
@@ -133,6 +133,9 @@ export const prepareAreaData = async (args) => {
|
|
|
133
133
|
if (yPointValue !== null) {
|
|
134
134
|
accumulatedYValues.set(x, yMin - yPointValue);
|
|
135
135
|
}
|
|
136
|
+
if (s.nullMode === 'connect' && yPointValue === null) {
|
|
137
|
+
return pointsAcc;
|
|
138
|
+
}
|
|
136
139
|
pointsAcc.push({
|
|
137
140
|
y0: yAxisTop + yMin - accumulatedYValue,
|
|
138
141
|
x: xValue,
|