@gravity-ui/charts 1.51.7 → 1.52.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/useChartInnerHandlers.d.ts +3 -2
- package/dist/cjs/components/ChartInner/useChartInnerHandlers.js +1 -3
- package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +3 -2
- package/dist/cjs/components/ChartInner/useDefaultState.d.ts +3 -2
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/core/series/plugin.d.ts +47 -2
- package/dist/cjs/core/series/types.d.ts +4 -0
- package/dist/cjs/core/shapes/area/prepare-data.js +29 -19
- package/dist/cjs/core/shapes/area/renderer.d.ts +0 -5
- package/dist/cjs/core/shapes/area/renderer.js +0 -75
- package/dist/cjs/core/shapes/area/types.d.ts +2 -8
- package/dist/cjs/core/shapes/bar-x/prepare-data.js +18 -7
- package/dist/cjs/core/shapes/bar-x/renderer.d.ts +0 -1
- package/dist/cjs/core/shapes/bar-x/renderer.js +0 -18
- package/dist/cjs/core/shapes/bar-x/types.d.ts +2 -1
- package/dist/cjs/core/shapes/bar-y/get-tooltip-data.js +4 -2
- package/dist/cjs/core/shapes/bar-y/prepare-data.js +8 -2
- package/dist/cjs/core/shapes/funnel/prepare-data.js +121 -68
- package/dist/cjs/core/shapes/heatmap/prepare-data.js +11 -2
- package/dist/cjs/core/shapes/line/prepare-data.js +27 -17
- package/dist/cjs/core/shapes/line/renderer.d.ts +0 -5
- package/dist/cjs/core/shapes/line/renderer.js +0 -75
- package/dist/cjs/core/shapes/line/types.d.ts +2 -8
- package/dist/cjs/core/shapes/marker.d.ts +30 -0
- package/dist/cjs/core/shapes/marker.js +68 -0
- package/dist/cjs/core/shapes/pie/prepare-data.js +24 -9
- package/dist/cjs/core/shapes/radar/prepare-data.js +3 -0
- package/dist/cjs/core/shapes/sankey/prepare-data.js +10 -1
- package/dist/cjs/core/shapes/scatter/prepare-data.js +8 -1
- package/dist/cjs/core/shapes/scatter/renderer.js +3 -2
- package/dist/cjs/core/shapes/scatter/types.d.ts +1 -1
- package/dist/cjs/core/shapes/treemap/prepare-data.js +9 -1
- package/dist/cjs/core/shapes/types.d.ts +35 -0
- package/dist/cjs/core/shapes/waterfall/prepare-data.js +5 -2
- package/dist/cjs/core/shapes/x-range/prepare-data.js +7 -2
- package/dist/cjs/core/types/chart/base.d.ts +22 -2
- package/dist/cjs/core/types/chart/funnel.d.ts +25 -1
- package/dist/cjs/core/types/chart/tooltip.d.ts +6 -1
- package/dist/cjs/core/utils/data-labels.d.ts +34 -0
- package/dist/cjs/core/utils/data-labels.js +26 -0
- package/dist/cjs/core/utils/get-closest-data.d.ts +2 -2
- package/dist/cjs/core/utils/get-closest-data.js +14 -34
- package/dist/cjs/core/utils/tooltip-helpers.d.ts +16 -0
- package/dist/cjs/core/utils/tooltip-helpers.js +12 -0
- package/dist/cjs/hooks/useShapes/AnnotationLayer.d.ts +9 -0
- package/dist/cjs/hooks/useShapes/AnnotationLayer.js +17 -0
- package/dist/cjs/hooks/useShapes/HoverMarkerLayer.d.ts +10 -0
- package/dist/cjs/hooks/useShapes/HoverMarkerLayer.js +22 -0
- package/dist/cjs/hooks/useShapes/MarkerLayer.d.ts +7 -0
- package/dist/cjs/hooks/useShapes/MarkerLayer.js +12 -0
- package/dist/cjs/hooks/useShapes/SeriesShapes.d.ts +18 -0
- package/dist/cjs/hooks/useShapes/SeriesShapes.js +32 -0
- package/dist/cjs/hooks/useShapes/index.d.ts +5 -18
- package/dist/cjs/hooks/useShapes/index.js +39 -229
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/plugins/area/index.js +42 -0
- package/dist/cjs/plugins/bar-x/index.js +42 -0
- package/dist/cjs/plugins/bar-y/index.js +26 -0
- package/dist/cjs/plugins/funnel/index.js +18 -0
- package/dist/cjs/plugins/funnel/prepare.js +17 -12
- package/dist/cjs/plugins/heatmap/index.js +23 -0
- package/dist/cjs/plugins/line/index.js +28 -0
- package/dist/cjs/plugins/pie/index.js +18 -0
- package/dist/cjs/plugins/radar/index.js +18 -0
- package/dist/cjs/plugins/sankey/index.js +18 -0
- package/dist/cjs/plugins/scatter/index.js +26 -0
- package/dist/cjs/plugins/treemap/index.js +18 -0
- package/dist/cjs/plugins/waterfall/index.js +39 -0
- package/dist/cjs/plugins/x-range/index.js +25 -0
- package/dist/cjs/setup-jsdom.d.ts +0 -1
- package/dist/cjs/setup-jsdom.js +1 -1
- package/dist/esm/components/ChartInner/useChartInnerHandlers.d.ts +3 -2
- package/dist/esm/components/ChartInner/useChartInnerHandlers.js +1 -3
- package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +3 -2
- package/dist/esm/components/ChartInner/useDefaultState.d.ts +3 -2
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/core/series/plugin.d.ts +47 -2
- package/dist/esm/core/series/types.d.ts +4 -0
- package/dist/esm/core/shapes/area/prepare-data.js +29 -19
- package/dist/esm/core/shapes/area/renderer.d.ts +0 -5
- package/dist/esm/core/shapes/area/renderer.js +0 -75
- package/dist/esm/core/shapes/area/types.d.ts +2 -8
- package/dist/esm/core/shapes/bar-x/prepare-data.js +18 -7
- package/dist/esm/core/shapes/bar-x/renderer.d.ts +0 -1
- package/dist/esm/core/shapes/bar-x/renderer.js +0 -18
- package/dist/esm/core/shapes/bar-x/types.d.ts +2 -1
- package/dist/esm/core/shapes/bar-y/get-tooltip-data.js +4 -2
- package/dist/esm/core/shapes/bar-y/prepare-data.js +8 -2
- package/dist/esm/core/shapes/funnel/prepare-data.js +121 -68
- package/dist/esm/core/shapes/heatmap/prepare-data.js +11 -2
- package/dist/esm/core/shapes/line/prepare-data.js +27 -17
- package/dist/esm/core/shapes/line/renderer.d.ts +0 -5
- package/dist/esm/core/shapes/line/renderer.js +0 -75
- package/dist/esm/core/shapes/line/types.d.ts +2 -8
- package/dist/esm/core/shapes/marker.d.ts +30 -0
- package/dist/esm/core/shapes/marker.js +68 -0
- package/dist/esm/core/shapes/pie/prepare-data.js +24 -9
- package/dist/esm/core/shapes/radar/prepare-data.js +3 -0
- package/dist/esm/core/shapes/sankey/prepare-data.js +10 -1
- package/dist/esm/core/shapes/scatter/prepare-data.js +8 -1
- package/dist/esm/core/shapes/scatter/renderer.js +3 -2
- package/dist/esm/core/shapes/scatter/types.d.ts +1 -1
- package/dist/esm/core/shapes/treemap/prepare-data.js +9 -1
- package/dist/esm/core/shapes/types.d.ts +35 -0
- package/dist/esm/core/shapes/waterfall/prepare-data.js +5 -2
- package/dist/esm/core/shapes/x-range/prepare-data.js +7 -2
- package/dist/esm/core/types/chart/base.d.ts +22 -2
- package/dist/esm/core/types/chart/funnel.d.ts +25 -1
- package/dist/esm/core/types/chart/tooltip.d.ts +6 -1
- package/dist/esm/core/utils/data-labels.d.ts +34 -0
- package/dist/esm/core/utils/data-labels.js +26 -0
- package/dist/esm/core/utils/get-closest-data.d.ts +2 -2
- package/dist/esm/core/utils/get-closest-data.js +14 -34
- package/dist/esm/core/utils/tooltip-helpers.d.ts +16 -0
- package/dist/esm/core/utils/tooltip-helpers.js +12 -0
- package/dist/esm/hooks/useShapes/AnnotationLayer.d.ts +9 -0
- package/dist/esm/hooks/useShapes/AnnotationLayer.js +17 -0
- package/dist/esm/hooks/useShapes/HoverMarkerLayer.d.ts +10 -0
- package/dist/esm/hooks/useShapes/HoverMarkerLayer.js +22 -0
- package/dist/esm/hooks/useShapes/MarkerLayer.d.ts +7 -0
- package/dist/esm/hooks/useShapes/MarkerLayer.js +12 -0
- package/dist/esm/hooks/useShapes/SeriesShapes.d.ts +18 -0
- package/dist/esm/hooks/useShapes/SeriesShapes.js +32 -0
- package/dist/esm/hooks/useShapes/index.d.ts +5 -18
- package/dist/esm/hooks/useShapes/index.js +39 -229
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/plugins/area/index.js +42 -0
- package/dist/esm/plugins/bar-x/index.js +42 -0
- package/dist/esm/plugins/bar-y/index.js +26 -0
- package/dist/esm/plugins/funnel/index.js +18 -0
- package/dist/esm/plugins/funnel/prepare.js +17 -12
- package/dist/esm/plugins/heatmap/index.js +23 -0
- package/dist/esm/plugins/line/index.js +28 -0
- package/dist/esm/plugins/pie/index.js +18 -0
- package/dist/esm/plugins/radar/index.js +18 -0
- package/dist/esm/plugins/sankey/index.js +18 -0
- package/dist/esm/plugins/scatter/index.js +26 -0
- package/dist/esm/plugins/treemap/index.js +18 -0
- package/dist/esm/plugins/waterfall/index.js +39 -0
- package/dist/esm/plugins/x-range/index.js +25 -0
- package/dist/esm/setup-jsdom.d.ts +0 -1
- package/dist/esm/setup-jsdom.js +1 -1
- package/package.json +2 -3
- package/dist/cjs/hooks/useShapes/area/index.d.ts +0 -15
- package/dist/cjs/hooks/useShapes/area/index.js +0 -52
- package/dist/cjs/hooks/useShapes/bar-x/index.d.ts +0 -16
- package/dist/cjs/hooks/useShapes/bar-x/index.js +0 -45
- package/dist/cjs/hooks/useShapes/bar-y/index.d.ts +0 -13
- package/dist/cjs/hooks/useShapes/bar-y/index.js +0 -19
- package/dist/cjs/hooks/useShapes/funnel/index.d.ts +0 -13
- package/dist/cjs/hooks/useShapes/funnel/index.js +0 -21
- package/dist/cjs/hooks/useShapes/heatmap/index.d.ts +0 -13
- package/dist/cjs/hooks/useShapes/heatmap/index.js +0 -20
- package/dist/cjs/hooks/useShapes/line/index.d.ts +0 -15
- package/dist/cjs/hooks/useShapes/line/index.js +0 -38
- package/dist/cjs/hooks/useShapes/pie/index.d.ts +0 -12
- package/dist/cjs/hooks/useShapes/pie/index.js +0 -20
- package/dist/cjs/hooks/useShapes/radar/index.d.ts +0 -12
- package/dist/cjs/hooks/useShapes/radar/index.js +0 -19
- package/dist/cjs/hooks/useShapes/sankey/index.d.ts +0 -12
- package/dist/cjs/hooks/useShapes/sankey/index.js +0 -18
- package/dist/cjs/hooks/useShapes/scatter/index.d.ts +0 -13
- package/dist/cjs/hooks/useShapes/scatter/index.js +0 -22
- package/dist/cjs/hooks/useShapes/treemap/index.d.ts +0 -12
- package/dist/cjs/hooks/useShapes/treemap/index.js +0 -18
- package/dist/cjs/hooks/useShapes/waterfall/index.d.ts +0 -14
- package/dist/cjs/hooks/useShapes/waterfall/index.js +0 -31
- package/dist/cjs/hooks/useShapes/x-range/index.d.ts +0 -14
- package/dist/cjs/hooks/useShapes/x-range/index.js +0 -20
- package/dist/esm/hooks/useShapes/area/index.d.ts +0 -15
- package/dist/esm/hooks/useShapes/area/index.js +0 -52
- package/dist/esm/hooks/useShapes/bar-x/index.d.ts +0 -16
- package/dist/esm/hooks/useShapes/bar-x/index.js +0 -45
- package/dist/esm/hooks/useShapes/bar-y/index.d.ts +0 -13
- package/dist/esm/hooks/useShapes/bar-y/index.js +0 -19
- package/dist/esm/hooks/useShapes/funnel/index.d.ts +0 -13
- package/dist/esm/hooks/useShapes/funnel/index.js +0 -21
- package/dist/esm/hooks/useShapes/heatmap/index.d.ts +0 -13
- package/dist/esm/hooks/useShapes/heatmap/index.js +0 -20
- package/dist/esm/hooks/useShapes/line/index.d.ts +0 -15
- package/dist/esm/hooks/useShapes/line/index.js +0 -38
- package/dist/esm/hooks/useShapes/pie/index.d.ts +0 -12
- package/dist/esm/hooks/useShapes/pie/index.js +0 -20
- package/dist/esm/hooks/useShapes/radar/index.d.ts +0 -12
- package/dist/esm/hooks/useShapes/radar/index.js +0 -19
- package/dist/esm/hooks/useShapes/sankey/index.d.ts +0 -12
- package/dist/esm/hooks/useShapes/sankey/index.js +0 -18
- package/dist/esm/hooks/useShapes/scatter/index.d.ts +0 -13
- package/dist/esm/hooks/useShapes/scatter/index.js +0 -22
- package/dist/esm/hooks/useShapes/treemap/index.d.ts +0 -12
- package/dist/esm/hooks/useShapes/treemap/index.js +0 -18
- package/dist/esm/hooks/useShapes/waterfall/index.d.ts +0 -14
- package/dist/esm/hooks/useShapes/waterfall/index.js +0 -31
- package/dist/esm/hooks/useShapes/x-range/index.d.ts +0 -14
- package/dist/esm/hooks/useShapes/x-range/index.js +0 -20
|
@@ -1,35 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { group } from 'd3-array';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { prepareLineData } from '../../core/shapes/line/prepare-data';
|
|
6
|
-
import { preparePieData } from '../../core/shapes/pie/prepare-data';
|
|
7
|
-
import { prepareRadarData } from '../../core/shapes/radar/prepare-data';
|
|
8
|
-
import { prepareSankeyData } from '../../core/shapes/sankey/prepare-data';
|
|
9
|
-
import { prepareTreemapData } from '../../core/shapes/treemap/prepare-data';
|
|
3
|
+
import { getSeriesPlugin } from '../../core/series/seriesRegistry';
|
|
4
|
+
import { getSeriesClipPathId } from '../../core/shapes/utils';
|
|
10
5
|
import { getOnlyVisibleSeries } from '../../core/utils';
|
|
11
|
-
import {
|
|
12
|
-
import { AreaSeriesShapes } from './area';
|
|
13
|
-
import { BarXSeriesShapes, prepareBarXData } from './bar-x';
|
|
14
|
-
import { BarYSeriesShapes, prepareBarYData } from './bar-y';
|
|
15
|
-
import { FunnelSeriesShapes, prepareFunnelData } from './funnel';
|
|
16
|
-
import { HeatmapSeriesShapes, prepareHeatmapData } from './heatmap';
|
|
17
|
-
import { LineSeriesShapes } from './line';
|
|
18
|
-
import { PieSeriesShapes } from './pie';
|
|
19
|
-
import { RadarSeriesShapes } from './radar';
|
|
20
|
-
import { SankeySeriesShape } from './sankey';
|
|
21
|
-
import { ScatterSeriesShape, prepareScatterData } from './scatter';
|
|
22
|
-
import { TreemapSeriesShape } from './treemap';
|
|
23
|
-
import { getSeriesClipPathId } from './utils';
|
|
24
|
-
import { WaterfallSeriesShapes, prepareWaterfallData } from './waterfall';
|
|
25
|
-
import { XRangeSeriesShapes, prepareXRangeData } from './x-range';
|
|
6
|
+
import { SeriesShapes } from './SeriesShapes';
|
|
26
7
|
import './styles.css';
|
|
27
8
|
function IS_OUTSIDE_BOUNDS() {
|
|
28
9
|
return false;
|
|
29
10
|
}
|
|
30
|
-
function
|
|
31
|
-
var _a;
|
|
32
|
-
|
|
11
|
+
function resolveClipPathId(args) {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const { plugin, clipPathId, clipPathBySeriesType, yAxis, zoomState } = args;
|
|
14
|
+
if (plugin.type === 'line') {
|
|
15
|
+
return getSeriesClipPathId({ clipPathId, yAxis, zoomState });
|
|
16
|
+
}
|
|
17
|
+
const useClip = (_b = (_a = clipPathBySeriesType === null || clipPathBySeriesType === void 0 ? void 0 : clipPathBySeriesType[plugin.type]) !== null && _a !== void 0 ? _a : plugin.useClipPath) !== null && _b !== void 0 ? _b : true;
|
|
18
|
+
return useClip ? clipPathId : undefined;
|
|
33
19
|
}
|
|
34
20
|
export async function getShapes(args) {
|
|
35
21
|
const { boundsWidth, boundsHeight, clipPathId, clipPathBySeriesType, dispatcher, htmlLayout, isOutsideBounds = IS_OUTSIDE_BOUNDS, isRangeSlider, series, seriesOptions, split, xAxis, xScale, yAxis, yScale, zoomState, } = args;
|
|
@@ -45,212 +31,36 @@ export async function getShapes(args) {
|
|
|
45
31
|
const layers = [];
|
|
46
32
|
const groupedSeriesItems = Array.from(groupedSeries);
|
|
47
33
|
for (let index = groupedSeriesItems.length - 1; index >= 0; index--) {
|
|
48
|
-
const
|
|
49
|
-
const [groupId, chartSeries] = item;
|
|
34
|
+
const [groupKey, chartSeries] = groupedSeriesItems[index];
|
|
50
35
|
const seriesType = chartSeries[0].type;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
case SERIES_TYPE.BarY: {
|
|
72
|
-
if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
|
|
73
|
-
const preparedData = await prepareBarYData({
|
|
74
|
-
boundsHeight,
|
|
75
|
-
boundsWidth,
|
|
76
|
-
series: chartSeries,
|
|
77
|
-
seriesOptions,
|
|
78
|
-
xAxis,
|
|
79
|
-
xScale,
|
|
80
|
-
yAxis,
|
|
81
|
-
yScale,
|
|
82
|
-
});
|
|
83
|
-
shapes[index] = (React.createElement(BarYSeriesShapes, { key: SERIES_TYPE.BarY, dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
|
|
84
|
-
shapesData.splice(index, 0, ...preparedData.shapes);
|
|
85
|
-
}
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
case SERIES_TYPE.Waterfall: {
|
|
89
|
-
if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
|
|
90
|
-
const preparedData = await prepareWaterfallData({
|
|
91
|
-
series: chartSeries,
|
|
92
|
-
seriesOptions,
|
|
93
|
-
xAxis,
|
|
94
|
-
xScale,
|
|
95
|
-
yAxis,
|
|
96
|
-
yScale,
|
|
97
|
-
});
|
|
98
|
-
shapes[index] = (React.createElement(WaterfallSeriesShapes, { key: SERIES_TYPE.Waterfall, dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
|
|
99
|
-
shapesData.splice(index, 0, ...preparedData);
|
|
100
|
-
}
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
case SERIES_TYPE.Line: {
|
|
104
|
-
if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
|
|
105
|
-
const preparedData = await prepareLineData({
|
|
106
|
-
series: chartSeries,
|
|
107
|
-
seriesOptions,
|
|
108
|
-
xAxis,
|
|
109
|
-
xScale,
|
|
110
|
-
yAxis,
|
|
111
|
-
yScale,
|
|
112
|
-
split,
|
|
113
|
-
isOutsideBounds,
|
|
114
|
-
isRangeSlider,
|
|
115
|
-
otherLayers: layers,
|
|
116
|
-
});
|
|
117
|
-
const resultClipPathId = getSeriesClipPathId({
|
|
118
|
-
clipPathId,
|
|
119
|
-
yAxis,
|
|
120
|
-
zoomState,
|
|
121
|
-
});
|
|
122
|
-
shapes[index] = (React.createElement(LineSeriesShapes, { key: groupId, boundsHeight: boundsHeight, boundsWidth: boundsWidth, dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: resultClipPathId }));
|
|
123
|
-
shapesData.splice(index, 0, ...preparedData);
|
|
124
|
-
layers.push(...preparedData);
|
|
125
|
-
}
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
case SERIES_TYPE.Area: {
|
|
129
|
-
if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
|
|
130
|
-
const preparedData = await prepareAreaData({
|
|
131
|
-
series: chartSeries,
|
|
132
|
-
seriesOptions,
|
|
133
|
-
xAxis,
|
|
134
|
-
xScale,
|
|
135
|
-
yAxis,
|
|
136
|
-
yScale,
|
|
137
|
-
split,
|
|
138
|
-
isOutsideBounds,
|
|
139
|
-
isRangeSlider,
|
|
140
|
-
});
|
|
141
|
-
shapes[index] = (React.createElement(AreaSeriesShapes, { key: SERIES_TYPE.Area, boundsHeight: boundsHeight, boundsWidth: boundsWidth, dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
|
|
142
|
-
shapesData.splice(index, 0, ...preparedData);
|
|
143
|
-
layers.push(...preparedData);
|
|
144
|
-
}
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
case SERIES_TYPE.Scatter: {
|
|
148
|
-
if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
|
|
149
|
-
const scatterShapeData = await prepareScatterData({
|
|
150
|
-
series: chartSeries,
|
|
151
|
-
xAxis,
|
|
152
|
-
xScale,
|
|
153
|
-
yAxis,
|
|
154
|
-
yScale,
|
|
155
|
-
split,
|
|
156
|
-
isOutsideBounds,
|
|
157
|
-
isRangeSlider,
|
|
158
|
-
});
|
|
159
|
-
shapes[index] = (React.createElement(ScatterSeriesShape, { key: SERIES_TYPE.Scatter, clipPathId: shouldUseClipPathId(SERIES_TYPE.Scatter, clipPathBySeriesType)
|
|
160
|
-
? clipPathId
|
|
161
|
-
: undefined, dispatcher: dispatcher, preparedData: scatterShapeData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
|
|
162
|
-
shapesData.splice(index, 0, ...scatterShapeData.markers);
|
|
163
|
-
}
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
case SERIES_TYPE.Pie: {
|
|
167
|
-
const preparedData = await preparePieData({
|
|
168
|
-
series: chartSeries,
|
|
169
|
-
boundsWidth,
|
|
170
|
-
boundsHeight,
|
|
171
|
-
});
|
|
172
|
-
shapes[index] = (React.createElement(PieSeriesShapes, { key: SERIES_TYPE.Pie, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
|
|
173
|
-
shapesData.splice(index, 0, ...preparedData);
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
case SERIES_TYPE.Treemap: {
|
|
177
|
-
const preparedData = await prepareTreemapData({
|
|
178
|
-
// We should have exactly one series with "treemap" type
|
|
179
|
-
// Otherwise data validation should emit an error
|
|
180
|
-
series: chartSeries[0],
|
|
181
|
-
width: boundsWidth,
|
|
182
|
-
height: boundsHeight,
|
|
183
|
-
});
|
|
184
|
-
shapes[index] = (React.createElement(TreemapSeriesShape, { key: SERIES_TYPE.Treemap, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
|
|
185
|
-
shapesData.splice(index, 0, preparedData);
|
|
186
|
-
break;
|
|
187
|
-
}
|
|
188
|
-
case SERIES_TYPE.Sankey: {
|
|
189
|
-
const preparedData = prepareSankeyData({
|
|
190
|
-
series: chartSeries[0],
|
|
191
|
-
width: boundsWidth,
|
|
192
|
-
height: boundsHeight,
|
|
193
|
-
});
|
|
194
|
-
shapes[index] = (React.createElement(SankeySeriesShape, { key: SERIES_TYPE.Sankey, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
|
|
195
|
-
shapesData.splice(index, 0, preparedData);
|
|
196
|
-
break;
|
|
197
|
-
}
|
|
198
|
-
case SERIES_TYPE.Radar: {
|
|
199
|
-
const preparedData = await prepareRadarData({
|
|
200
|
-
series: chartSeries,
|
|
201
|
-
boundsWidth,
|
|
202
|
-
boundsHeight,
|
|
203
|
-
});
|
|
204
|
-
shapes[index] = (React.createElement(RadarSeriesShapes, { key: SERIES_TYPE.Radar, dispatcher: dispatcher, series: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
|
|
205
|
-
shapesData.splice(index, 0, ...preparedData);
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
208
|
-
case SERIES_TYPE.Heatmap: {
|
|
209
|
-
if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale[0])) {
|
|
210
|
-
const preparedData = await prepareHeatmapData({
|
|
211
|
-
series: chartSeries[0],
|
|
212
|
-
xAxis,
|
|
213
|
-
xScale,
|
|
214
|
-
yAxis: yAxis[0],
|
|
215
|
-
yScale: yScale[0],
|
|
216
|
-
});
|
|
217
|
-
shapes[index] = (React.createElement(HeatmapSeriesShapes, { key: SERIES_TYPE.Heatmap, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
|
|
218
|
-
shapesData.splice(index, 0, preparedData);
|
|
219
|
-
}
|
|
220
|
-
break;
|
|
221
|
-
}
|
|
222
|
-
case SERIES_TYPE.Funnel: {
|
|
223
|
-
const preparedData = await prepareFunnelData({
|
|
224
|
-
series: chartSeries,
|
|
225
|
-
boundsWidth,
|
|
226
|
-
boundsHeight,
|
|
227
|
-
});
|
|
228
|
-
shapes[index] = (React.createElement(FunnelSeriesShapes, { key: SERIES_TYPE.Funnel, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
|
|
229
|
-
shapesData.splice(index, 0, preparedData);
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
case SERIES_TYPE.XRange: {
|
|
233
|
-
if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
|
|
234
|
-
const preparedData = await prepareXRangeData({
|
|
235
|
-
series: chartSeries,
|
|
236
|
-
xAxis,
|
|
237
|
-
xScale,
|
|
238
|
-
yAxis,
|
|
239
|
-
yScale,
|
|
240
|
-
boundsWidth,
|
|
241
|
-
isRangeSlider,
|
|
242
|
-
});
|
|
243
|
-
shapes[index] = (React.createElement(XRangeSeriesShapes, { key: SERIES_TYPE.XRange, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout, clipPathId: clipPathId }));
|
|
244
|
-
shapesData.splice(index, 0, ...preparedData);
|
|
245
|
-
}
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
default: {
|
|
249
|
-
throw new ChartError({
|
|
250
|
-
message: `The display method is not defined for a series with type "${seriesType}"`,
|
|
251
|
-
});
|
|
252
|
-
}
|
|
36
|
+
const plugin = getSeriesPlugin(seriesType);
|
|
37
|
+
const { renderData, tooltipItems } = await plugin.prepareShapeData({
|
|
38
|
+
series: chartSeries,
|
|
39
|
+
boundsWidth,
|
|
40
|
+
boundsHeight,
|
|
41
|
+
seriesOptions,
|
|
42
|
+
xAxis,
|
|
43
|
+
yAxis,
|
|
44
|
+
xScale,
|
|
45
|
+
yScale,
|
|
46
|
+
split,
|
|
47
|
+
isOutsideBounds,
|
|
48
|
+
isRangeSlider,
|
|
49
|
+
otherLayers: layers,
|
|
50
|
+
});
|
|
51
|
+
if (renderData.length === 0) {
|
|
52
|
+
continue;
|
|
253
53
|
}
|
|
54
|
+
const resolvedClipPathId = resolveClipPathId({
|
|
55
|
+
plugin,
|
|
56
|
+
clipPathId,
|
|
57
|
+
clipPathBySeriesType,
|
|
58
|
+
yAxis,
|
|
59
|
+
zoomState,
|
|
60
|
+
});
|
|
61
|
+
shapes[index] = (React.createElement(SeriesShapes, { key: groupKey, plugin: plugin, preparedData: renderData, boundsWidth: boundsWidth, boundsHeight: boundsHeight, clipPathId: resolvedClipPathId, seriesOptions: seriesOptions, dispatcher: dispatcher, htmlLayout: htmlLayout, namespace: `hover-markers-${groupKey}` }));
|
|
62
|
+
shapesData.splice(index, 0, ...tooltipItems);
|
|
63
|
+
layers.push(...renderData);
|
|
254
64
|
}
|
|
255
65
|
return { shapes, shapesData };
|
|
256
66
|
}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/area/get-tooltip-data';
|
|
2
|
+
import { prepareAreaData } from '../../core/shapes/area/prepare-data';
|
|
3
|
+
import { renderArea } from '../../core/shapes/area/renderer';
|
|
4
|
+
import { filterOverlappingLabels } from '../../core/utils';
|
|
1
5
|
import { prepareArea } from './prepare';
|
|
6
|
+
async function prepareShapeData(args) {
|
|
7
|
+
const { series, seriesOptions, xAxis, xScale, yAxis, yScale, split, isOutsideBounds, isRangeSlider, } = args;
|
|
8
|
+
if (!xAxis || !xScale || !(yScale === null || yScale === void 0 ? void 0 : yScale.length) || !split) {
|
|
9
|
+
return { renderData: [], tooltipItems: [] };
|
|
10
|
+
}
|
|
11
|
+
const data = await prepareAreaData({
|
|
12
|
+
series: series,
|
|
13
|
+
seriesOptions,
|
|
14
|
+
xAxis,
|
|
15
|
+
xScale,
|
|
16
|
+
yAxis: yAxis !== null && yAxis !== void 0 ? yAxis : [],
|
|
17
|
+
yScale,
|
|
18
|
+
split,
|
|
19
|
+
isOutsideBounds: isOutsideBounds !== null && isOutsideBounds !== void 0 ? isOutsideBounds : (() => false),
|
|
20
|
+
isRangeSlider,
|
|
21
|
+
});
|
|
22
|
+
const allowOverlap = data.some((d) => d.series.dataLabels.allowOverlap);
|
|
23
|
+
if (!allowOverlap) {
|
|
24
|
+
const filtered = filterOverlappingLabels(data.flatMap((d) => d.htmlLabels));
|
|
25
|
+
const [first, ...rest] = data;
|
|
26
|
+
if (first) {
|
|
27
|
+
const filteredData = [
|
|
28
|
+
Object.assign(Object.assign({}, first), { htmlLabels: filtered }),
|
|
29
|
+
...rest.map((d) => (Object.assign(Object.assign({}, d), { htmlLabels: [] }))),
|
|
30
|
+
];
|
|
31
|
+
return { renderData: filteredData, tooltipItems: filteredData };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { renderData: data, tooltipItems: data };
|
|
35
|
+
}
|
|
36
|
+
function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
|
|
37
|
+
const data = preparedData;
|
|
38
|
+
const allowOverlap = data.some((d) => d.series.dataLabels.allowOverlap);
|
|
39
|
+
return renderArea({ plot }, data, seriesOptions, allowOverlap, dispatcher);
|
|
40
|
+
}
|
|
2
41
|
export const areaPlugin = {
|
|
3
42
|
type: 'area',
|
|
4
43
|
prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareArea({ series: series, seriesOptions, legend, colorScale }),
|
|
44
|
+
prepareShapeData,
|
|
45
|
+
renderShapes,
|
|
46
|
+
getTooltipData: getTooltipData,
|
|
5
47
|
};
|
|
@@ -1,5 +1,47 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/bar-x/get-tooltip-data';
|
|
2
|
+
import { prepareBarXData } from '../../core/shapes/bar-x/prepare-data';
|
|
3
|
+
import { renderBarX } from '../../core/shapes/bar-x/renderer';
|
|
4
|
+
import { filterOverlappingLabels } from '../../core/utils';
|
|
1
5
|
import { prepareBarXSeries } from './prepare';
|
|
6
|
+
async function prepareShapeData(args) {
|
|
7
|
+
const { series, seriesOptions, xAxis, xScale, yAxis, yScale, boundsHeight, split, isRangeSlider, } = args;
|
|
8
|
+
if (!xAxis || !xScale || !(yScale === null || yScale === void 0 ? void 0 : yScale.length) || !split) {
|
|
9
|
+
return { renderData: [], tooltipItems: [] };
|
|
10
|
+
}
|
|
11
|
+
const data = await prepareBarXData({
|
|
12
|
+
series: series,
|
|
13
|
+
seriesOptions,
|
|
14
|
+
xAxis,
|
|
15
|
+
xScale,
|
|
16
|
+
yAxis: yAxis !== null && yAxis !== void 0 ? yAxis : [],
|
|
17
|
+
yScale,
|
|
18
|
+
boundsHeight,
|
|
19
|
+
split,
|
|
20
|
+
isRangeSlider,
|
|
21
|
+
});
|
|
22
|
+
const allowOverlap = data.some((d) => d.series.dataLabels.allowOverlap);
|
|
23
|
+
if (!allowOverlap) {
|
|
24
|
+
const filtered = filterOverlappingLabels(data.flatMap((d) => d.htmlLabels));
|
|
25
|
+
const [first, ...rest] = data;
|
|
26
|
+
if (first) {
|
|
27
|
+
const filteredData = [
|
|
28
|
+
Object.assign(Object.assign({}, first), { htmlLabels: filtered }),
|
|
29
|
+
...rest.map((d) => (Object.assign(Object.assign({}, d), { htmlLabels: [] }))),
|
|
30
|
+
];
|
|
31
|
+
return { renderData: filteredData, tooltipItems: filteredData };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { renderData: data, tooltipItems: data };
|
|
35
|
+
}
|
|
36
|
+
function renderShapes({ plot, preparedData, seriesOptions, boundsWidth, boundsHeight, dispatcher, }) {
|
|
37
|
+
const data = preparedData;
|
|
38
|
+
const allowOverlap = data.some((d) => d.series.dataLabels.allowOverlap);
|
|
39
|
+
return renderBarX({ plot, boundsWidth, boundsHeight }, data, seriesOptions, allowOverlap, dispatcher);
|
|
40
|
+
}
|
|
2
41
|
export const barXPlugin = {
|
|
3
42
|
type: 'bar-x',
|
|
4
43
|
prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareBarXSeries({ series: series, seriesOptions, legend, colorScale }),
|
|
44
|
+
prepareShapeData,
|
|
45
|
+
renderShapes,
|
|
46
|
+
getTooltipData: getTooltipData,
|
|
5
47
|
};
|
|
@@ -1,5 +1,31 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/bar-y/get-tooltip-data';
|
|
2
|
+
import { prepareBarYData } from '../../core/shapes/bar-y/prepare-data';
|
|
3
|
+
import { renderBarY } from '../../core/shapes/bar-y/renderer';
|
|
1
4
|
import { prepareBarYSeries } from './prepare';
|
|
5
|
+
async function prepareShapeData(args) {
|
|
6
|
+
const { series, seriesOptions, xAxis, xScale, yAxis, yScale, boundsHeight, boundsWidth } = args;
|
|
7
|
+
if (!xAxis || !xScale || !(yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
|
|
8
|
+
return { renderData: [], tooltipItems: [] };
|
|
9
|
+
}
|
|
10
|
+
const data = await prepareBarYData({
|
|
11
|
+
boundsHeight,
|
|
12
|
+
boundsWidth,
|
|
13
|
+
series: series,
|
|
14
|
+
seriesOptions,
|
|
15
|
+
xAxis,
|
|
16
|
+
xScale,
|
|
17
|
+
yAxis: yAxis !== null && yAxis !== void 0 ? yAxis : [],
|
|
18
|
+
yScale,
|
|
19
|
+
});
|
|
20
|
+
return { renderData: [data], tooltipItems: data.shapes };
|
|
21
|
+
}
|
|
22
|
+
function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
|
|
23
|
+
return renderBarY({ plot }, preparedData[0], seriesOptions, dispatcher);
|
|
24
|
+
}
|
|
2
25
|
export const barYPlugin = {
|
|
3
26
|
type: 'bar-y',
|
|
4
27
|
prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareBarYSeries({ series: series, seriesOptions, legend, colorScale }),
|
|
28
|
+
prepareShapeData,
|
|
29
|
+
renderShapes,
|
|
30
|
+
getTooltipData: getTooltipData,
|
|
5
31
|
};
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/funnel/get-tooltip-data';
|
|
2
|
+
import { prepareFunnelData } from '../../core/shapes/funnel/prepare-data';
|
|
3
|
+
import { renderFunnel } from '../../core/shapes/funnel/renderer';
|
|
1
4
|
import { prepareFunnelSeries } from './prepare';
|
|
5
|
+
async function prepareShapeData({ series, boundsWidth, boundsHeight, }) {
|
|
6
|
+
const data = await prepareFunnelData({
|
|
7
|
+
series: series,
|
|
8
|
+
boundsWidth,
|
|
9
|
+
boundsHeight,
|
|
10
|
+
});
|
|
11
|
+
return { renderData: [data], tooltipItems: [data] };
|
|
12
|
+
}
|
|
13
|
+
function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
|
|
14
|
+
return renderFunnel({ plot }, preparedData[0], seriesOptions, dispatcher);
|
|
15
|
+
}
|
|
2
16
|
export const funnelPlugin = {
|
|
3
17
|
type: 'funnel',
|
|
18
|
+
useClipPath: false,
|
|
4
19
|
prepareSeries: ({ series, seriesOptions, legend, colors }) => prepareFunnelSeries({ series: series, seriesOptions, legend, colors }),
|
|
20
|
+
prepareShapeData,
|
|
21
|
+
renderShapes,
|
|
22
|
+
getTooltipData: getTooltipData,
|
|
5
23
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { scaleOrdinal } from 'd3-scale';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
3
|
import { DEFAULT_DATALABELS_STYLE } from '../../core/constants';
|
|
4
|
+
import { DEFAULT_DATALABELS_PADDING } from '../../core/series/constants';
|
|
4
5
|
import { prepareLegendSymbol } from '../../core/series/utils';
|
|
5
6
|
import { getUniqId } from '../../core/utils';
|
|
6
7
|
export function prepareFunnelSeries(args) {
|
|
@@ -16,7 +17,7 @@ export function prepareFunnelSeries(args) {
|
|
|
16
17
|
// For rectangle: enable by default.
|
|
17
18
|
const isConnectorsEnabled = (_d = (_c = series.connectors) === null || _c === void 0 ? void 0 : _c.enabled) !== null && _d !== void 0 ? _d : (isTrapezoid ? userSpecifiedHeight : true);
|
|
18
19
|
const preparedSeries = series.data.map((dataItem) => {
|
|
19
|
-
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;
|
|
20
|
+
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, _3, _4, _5, _6, _7, _8, _9, _10;
|
|
20
21
|
const id = getUniqId();
|
|
21
22
|
const color = dataItem.color || colorScale(dataItem.name);
|
|
22
23
|
const result = {
|
|
@@ -29,32 +30,36 @@ export function prepareFunnelSeries(args) {
|
|
|
29
30
|
html: get(series, 'dataLabels.html', false),
|
|
30
31
|
format: (_b = series.dataLabels) === null || _b === void 0 ? void 0 : _b.format,
|
|
31
32
|
align: (_d = (_c = series.dataLabels) === null || _c === void 0 ? void 0 : _c.align) !== null && _d !== void 0 ? _d : 'center',
|
|
33
|
+
inside: (_f = (_e = series.dataLabels) === null || _e === void 0 ? void 0 : _e.inside) !== null && _f !== void 0 ? _f : false,
|
|
34
|
+
anchor: (_h = (_g = series.dataLabels) === null || _g === void 0 ? void 0 : _g.anchor) !== null && _h !== void 0 ? _h : 'plot',
|
|
35
|
+
reserveSpace: (_k = (_j = series.dataLabels) === null || _j === void 0 ? void 0 : _j.reserveSpace) !== null && _k !== void 0 ? _k : true,
|
|
36
|
+
padding: (_m = (_l = series.dataLabels) === null || _l === void 0 ? void 0 : _l.padding) !== null && _m !== void 0 ? _m : DEFAULT_DATALABELS_PADDING,
|
|
32
37
|
},
|
|
33
38
|
visible: true,
|
|
34
39
|
name: dataItem.name,
|
|
35
40
|
id,
|
|
36
41
|
color,
|
|
37
42
|
legend: {
|
|
38
|
-
enabled: (
|
|
39
|
-
symbol: ((
|
|
43
|
+
enabled: (_r = (_p = (_o = dataItem.legend) === null || _o === void 0 ? void 0 : _o.enabled) !== null && _p !== void 0 ? _p : (_q = series.legend) === null || _q === void 0 ? void 0 : _q.enabled) !== null && _r !== void 0 ? _r : legend.enabled,
|
|
44
|
+
symbol: ((_s = dataItem.legend) === null || _s === void 0 ? void 0 : _s.symbol)
|
|
40
45
|
? prepareLegendSymbol(dataItem)
|
|
41
46
|
: prepareLegendSymbol(series),
|
|
42
|
-
groupId: (
|
|
43
|
-
itemText: (
|
|
47
|
+
groupId: (_u = (_t = dataItem.legend) === null || _t === void 0 ? void 0 : _t.groupId) !== null && _u !== void 0 ? _u : getUniqId(),
|
|
48
|
+
itemText: (_w = (_v = dataItem.legend) === null || _v === void 0 ? void 0 : _v.itemText) !== null && _w !== void 0 ? _w : dataItem.name,
|
|
44
49
|
},
|
|
45
50
|
cursor: get(series, 'cursor', null),
|
|
46
51
|
tooltip: series.tooltip,
|
|
47
52
|
connectors: {
|
|
48
53
|
enabled: isConnectorsEnabled,
|
|
49
54
|
height: isConnectorsEnabled
|
|
50
|
-
? ((
|
|
55
|
+
? ((_y = (_x = series.connectors) === null || _x === void 0 ? void 0 : _x.height) !== null && _y !== void 0 ? _y : (isTrapezoid ? 0 : '25%'))
|
|
51
56
|
: 0,
|
|
52
|
-
lineDashStyle: (
|
|
53
|
-
lineOpacity: (
|
|
54
|
-
lineColor: (
|
|
55
|
-
areaColor: (
|
|
56
|
-
areaOpacity: (
|
|
57
|
-
lineWidth: (
|
|
57
|
+
lineDashStyle: (_0 = (_z = series.connectors) === null || _z === void 0 ? void 0 : _z.lineDashStyle) !== null && _0 !== void 0 ? _0 : 'Dash',
|
|
58
|
+
lineOpacity: (_2 = (_1 = series.connectors) === null || _1 === void 0 ? void 0 : _1.lineOpacity) !== null && _2 !== void 0 ? _2 : (isTrapezoid ? 0 : 1),
|
|
59
|
+
lineColor: (_4 = (_3 = series.connectors) === null || _3 === void 0 ? void 0 : _3.lineColor) !== null && _4 !== void 0 ? _4 : 'var(--g-color-line-generic-active)',
|
|
60
|
+
areaColor: (_6 = (_5 = series.connectors) === null || _5 === void 0 ? void 0 : _5.areaColor) !== null && _6 !== void 0 ? _6 : color,
|
|
61
|
+
areaOpacity: (_8 = (_7 = series.connectors) === null || _7 === void 0 ? void 0 : _7.areaOpacity) !== null && _8 !== void 0 ? _8 : (isTrapezoid ? 0 : 0.25),
|
|
62
|
+
lineWidth: (_10 = (_9 = series.connectors) === null || _9 === void 0 ? void 0 : _9.lineWidth) !== null && _10 !== void 0 ? _10 : 1,
|
|
58
63
|
},
|
|
59
64
|
};
|
|
60
65
|
return result;
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/heatmap/get-tooltip-data';
|
|
2
|
+
import { prepareHeatmapData } from '../../core/shapes/heatmap/prepare-data';
|
|
3
|
+
import { renderHeatmap } from '../../core/shapes/heatmap/renderer';
|
|
1
4
|
import { prepareHeatmapSeries } from './prepare';
|
|
5
|
+
async function prepareShapeData(args) {
|
|
6
|
+
const { series, xAxis, xScale, yAxis, yScale } = args;
|
|
7
|
+
if (!xAxis || !xScale || !(yScale === null || yScale === void 0 ? void 0 : yScale[0])) {
|
|
8
|
+
return { renderData: [], tooltipItems: [] };
|
|
9
|
+
}
|
|
10
|
+
const data = await prepareHeatmapData({
|
|
11
|
+
series: series[0],
|
|
12
|
+
xAxis,
|
|
13
|
+
xScale,
|
|
14
|
+
yAxis: yAxis[0],
|
|
15
|
+
yScale: yScale[0],
|
|
16
|
+
});
|
|
17
|
+
return { renderData: [data], tooltipItems: [data] };
|
|
18
|
+
}
|
|
19
|
+
function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
|
|
20
|
+
return renderHeatmap({ plot }, preparedData[0], seriesOptions, dispatcher);
|
|
21
|
+
}
|
|
2
22
|
export const heatmapPlugin = {
|
|
3
23
|
type: 'heatmap',
|
|
4
24
|
prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareHeatmapSeries({
|
|
@@ -7,4 +27,7 @@ export const heatmapPlugin = {
|
|
|
7
27
|
legend,
|
|
8
28
|
colorScale,
|
|
9
29
|
}),
|
|
30
|
+
prepareShapeData,
|
|
31
|
+
renderShapes,
|
|
32
|
+
getTooltipData: getTooltipData,
|
|
10
33
|
};
|
|
@@ -1,5 +1,33 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/line/get-tooltip-data';
|
|
2
|
+
import { prepareLineData } from '../../core/shapes/line/prepare-data';
|
|
3
|
+
import { renderLine } from '../../core/shapes/line/renderer';
|
|
1
4
|
import { prepareLineSeries } from './prepare';
|
|
5
|
+
async function prepareShapeData(args) {
|
|
6
|
+
const { series, seriesOptions, xAxis, xScale, yAxis, yScale, split, isOutsideBounds, isRangeSlider, otherLayers, } = args;
|
|
7
|
+
if (!xAxis || !xScale || !(yScale === null || yScale === void 0 ? void 0 : yScale.length) || !split) {
|
|
8
|
+
return { renderData: [], tooltipItems: [] };
|
|
9
|
+
}
|
|
10
|
+
const data = await prepareLineData({
|
|
11
|
+
series: series,
|
|
12
|
+
seriesOptions,
|
|
13
|
+
xAxis,
|
|
14
|
+
xScale,
|
|
15
|
+
yAxis: yAxis !== null && yAxis !== void 0 ? yAxis : [],
|
|
16
|
+
yScale,
|
|
17
|
+
split,
|
|
18
|
+
isOutsideBounds: isOutsideBounds !== null && isOutsideBounds !== void 0 ? isOutsideBounds : (() => false),
|
|
19
|
+
isRangeSlider,
|
|
20
|
+
otherLayers: otherLayers !== null && otherLayers !== void 0 ? otherLayers : [],
|
|
21
|
+
});
|
|
22
|
+
return { renderData: data, tooltipItems: data };
|
|
23
|
+
}
|
|
24
|
+
function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
|
|
25
|
+
return renderLine({ plot }, preparedData, seriesOptions, dispatcher);
|
|
26
|
+
}
|
|
2
27
|
export const linePlugin = {
|
|
3
28
|
type: 'line',
|
|
4
29
|
prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareLineSeries({ series: series, seriesOptions, legend, colorScale }),
|
|
30
|
+
prepareShapeData,
|
|
31
|
+
renderShapes,
|
|
32
|
+
getTooltipData: getTooltipData,
|
|
5
33
|
};
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/pie/get-tooltip-data';
|
|
2
|
+
import { preparePieData } from '../../core/shapes/pie/prepare-data';
|
|
3
|
+
import { renderPie } from '../../core/shapes/pie/renderer';
|
|
1
4
|
import { preparePieSeries } from './prepare';
|
|
5
|
+
async function prepareShapeData({ series, boundsWidth, boundsHeight, }) {
|
|
6
|
+
const data = await preparePieData({
|
|
7
|
+
series: series,
|
|
8
|
+
boundsWidth,
|
|
9
|
+
boundsHeight,
|
|
10
|
+
});
|
|
11
|
+
return { renderData: data, tooltipItems: data };
|
|
12
|
+
}
|
|
13
|
+
function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
|
|
14
|
+
return renderPie({ plot }, preparedData, seriesOptions, dispatcher);
|
|
15
|
+
}
|
|
2
16
|
export const piePlugin = {
|
|
3
17
|
type: 'pie',
|
|
18
|
+
useClipPath: false,
|
|
4
19
|
prepareSeries: ({ series, seriesOptions, legend, colors }) => preparePieSeries({ series: series, seriesOptions, legend, colors }),
|
|
20
|
+
prepareShapeData,
|
|
21
|
+
renderShapes,
|
|
22
|
+
getTooltipData: getTooltipData,
|
|
5
23
|
};
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/radar/get-tooltip-data';
|
|
2
|
+
import { prepareRadarData } from '../../core/shapes/radar/prepare-data';
|
|
3
|
+
import { renderRadar } from '../../core/shapes/radar/renderer';
|
|
1
4
|
import { prepareRadarSeries } from './prepare';
|
|
5
|
+
async function prepareShapeData({ series, boundsWidth, boundsHeight, }) {
|
|
6
|
+
const data = await prepareRadarData({
|
|
7
|
+
series: series,
|
|
8
|
+
boundsWidth,
|
|
9
|
+
boundsHeight,
|
|
10
|
+
});
|
|
11
|
+
return { renderData: data, tooltipItems: data };
|
|
12
|
+
}
|
|
13
|
+
function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
|
|
14
|
+
return renderRadar({ plot }, preparedData, seriesOptions, dispatcher);
|
|
15
|
+
}
|
|
2
16
|
export const radarPlugin = {
|
|
3
17
|
type: 'radar',
|
|
18
|
+
useClipPath: false,
|
|
4
19
|
prepareSeries: ({ series, seriesOptions, legend, colors }) => prepareRadarSeries({ series: series, seriesOptions, legend, colors }),
|
|
20
|
+
prepareShapeData,
|
|
21
|
+
renderShapes,
|
|
22
|
+
getTooltipData: getTooltipData,
|
|
5
23
|
};
|