@gravity-ui/charts 1.51.8 → 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/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/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/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/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/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/package.json +1 -1
- 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,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
|
};
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/sankey/get-tooltip-data';
|
|
2
|
+
import { prepareSankeyData } from '../../core/shapes/sankey/prepare-data';
|
|
3
|
+
import { renderSankey } from '../../core/shapes/sankey/renderer';
|
|
1
4
|
import { prepareSankeySeries } from './prepare';
|
|
5
|
+
function prepareShapeData({ series, boundsWidth, boundsHeight, }) {
|
|
6
|
+
const data = prepareSankeyData({
|
|
7
|
+
series: series[0],
|
|
8
|
+
width: boundsWidth,
|
|
9
|
+
height: boundsHeight,
|
|
10
|
+
});
|
|
11
|
+
return { renderData: [data], tooltipItems: [data] };
|
|
12
|
+
}
|
|
13
|
+
function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
|
|
14
|
+
return renderSankey({ plot }, preparedData[0], seriesOptions, dispatcher);
|
|
15
|
+
}
|
|
2
16
|
export const sankeyPlugin = {
|
|
3
17
|
type: 'sankey',
|
|
18
|
+
useClipPath: false,
|
|
4
19
|
prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareSankeySeries({ series: series, seriesOptions, legend, colorScale }),
|
|
20
|
+
prepareShapeData,
|
|
21
|
+
renderShapes,
|
|
22
|
+
getTooltipData: getTooltipData,
|
|
5
23
|
};
|
|
@@ -1,4 +1,27 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/scatter/get-tooltip-data';
|
|
2
|
+
import { prepareScatterData } from '../../core/shapes/scatter/prepare-data';
|
|
3
|
+
import { renderScatter } from '../../core/shapes/scatter/renderer';
|
|
1
4
|
import { prepareScatterSeries } from './prepare';
|
|
5
|
+
async function prepareShapeData(args) {
|
|
6
|
+
const { series, xAxis, xScale, yAxis, yScale, split, isOutsideBounds, isRangeSlider } = args;
|
|
7
|
+
if (!xAxis || !xScale || !(yScale === null || yScale === void 0 ? void 0 : yScale.length) || !split) {
|
|
8
|
+
return { renderData: [], tooltipItems: [] };
|
|
9
|
+
}
|
|
10
|
+
const data = await prepareScatterData({
|
|
11
|
+
series: series,
|
|
12
|
+
xAxis,
|
|
13
|
+
xScale,
|
|
14
|
+
yAxis: yAxis !== null && yAxis !== void 0 ? yAxis : [],
|
|
15
|
+
yScale,
|
|
16
|
+
split,
|
|
17
|
+
isOutsideBounds: isOutsideBounds !== null && isOutsideBounds !== void 0 ? isOutsideBounds : (() => false),
|
|
18
|
+
isRangeSlider,
|
|
19
|
+
});
|
|
20
|
+
return { renderData: [data], tooltipItems: data.scatterData };
|
|
21
|
+
}
|
|
22
|
+
function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
|
|
23
|
+
return renderScatter({ plot }, preparedData[0], seriesOptions, dispatcher);
|
|
24
|
+
}
|
|
2
25
|
export const scatterPlugin = {
|
|
3
26
|
type: 'scatter',
|
|
4
27
|
prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareScatterSeries({
|
|
@@ -7,4 +30,7 @@ export const scatterPlugin = {
|
|
|
7
30
|
legend,
|
|
8
31
|
colorScale,
|
|
9
32
|
}),
|
|
33
|
+
prepareShapeData,
|
|
34
|
+
renderShapes,
|
|
35
|
+
getTooltipData: getTooltipData,
|
|
10
36
|
};
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/treemap/get-tooltip-data';
|
|
2
|
+
import { prepareTreemapData } from '../../core/shapes/treemap/prepare-data';
|
|
3
|
+
import { renderTreemap } from '../../core/shapes/treemap/renderer';
|
|
1
4
|
import { prepareTreemap } from './prepare';
|
|
5
|
+
async function prepareShapeData({ series, boundsWidth, boundsHeight, }) {
|
|
6
|
+
const data = await prepareTreemapData({
|
|
7
|
+
series: series[0],
|
|
8
|
+
width: boundsWidth,
|
|
9
|
+
height: boundsHeight,
|
|
10
|
+
});
|
|
11
|
+
return { renderData: [data], tooltipItems: [data] };
|
|
12
|
+
}
|
|
13
|
+
function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
|
|
14
|
+
return renderTreemap({ plot }, preparedData[0], seriesOptions, dispatcher);
|
|
15
|
+
}
|
|
2
16
|
export const treemapPlugin = {
|
|
3
17
|
type: 'treemap',
|
|
18
|
+
useClipPath: false,
|
|
4
19
|
prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareTreemap({ series: series, seriesOptions, legend, colorScale }),
|
|
20
|
+
prepareShapeData,
|
|
21
|
+
renderShapes,
|
|
22
|
+
getTooltipData: getTooltipData,
|
|
5
23
|
};
|
|
@@ -1,5 +1,44 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/waterfall/get-tooltip-data';
|
|
2
|
+
import { prepareWaterfallData } from '../../core/shapes/waterfall/prepare-data';
|
|
3
|
+
import { renderWaterfall } from '../../core/shapes/waterfall/renderer';
|
|
4
|
+
import { filterOverlappingLabels } from '../../core/utils';
|
|
1
5
|
import { prepareWaterfallSeries } from './prepare';
|
|
6
|
+
async function prepareShapeData(args) {
|
|
7
|
+
const { series, seriesOptions, xAxis, xScale, yAxis, yScale } = args;
|
|
8
|
+
if (!xAxis || !xScale || !(yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
|
|
9
|
+
return { renderData: [], tooltipItems: [] };
|
|
10
|
+
}
|
|
11
|
+
const data = await prepareWaterfallData({
|
|
12
|
+
series: series,
|
|
13
|
+
seriesOptions,
|
|
14
|
+
xAxis,
|
|
15
|
+
xScale,
|
|
16
|
+
yAxis: yAxis !== null && yAxis !== void 0 ? yAxis : [],
|
|
17
|
+
yScale,
|
|
18
|
+
});
|
|
19
|
+
const allowOverlap = data.some((d) => d.series.dataLabels.allowOverlap);
|
|
20
|
+
if (!allowOverlap) {
|
|
21
|
+
const filtered = filterOverlappingLabels(data.flatMap((d) => d.htmlLabels));
|
|
22
|
+
const [first, ...rest] = data;
|
|
23
|
+
if (first) {
|
|
24
|
+
const filteredData = [
|
|
25
|
+
Object.assign(Object.assign({}, first), { htmlLabels: filtered }),
|
|
26
|
+
...rest.map((d) => (Object.assign(Object.assign({}, d), { htmlLabels: [] }))),
|
|
27
|
+
];
|
|
28
|
+
return { renderData: filteredData, tooltipItems: filteredData };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return { renderData: data, tooltipItems: data };
|
|
32
|
+
}
|
|
33
|
+
function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
|
|
34
|
+
const data = preparedData;
|
|
35
|
+
const allowOverlap = data.some((d) => d.series.dataLabels.allowOverlap);
|
|
36
|
+
return renderWaterfall({ plot }, data, seriesOptions, allowOverlap, dispatcher);
|
|
37
|
+
}
|
|
2
38
|
export const waterfallPlugin = {
|
|
3
39
|
type: 'waterfall',
|
|
4
40
|
prepareSeries: ({ series, legend, colorScale, colors }) => prepareWaterfallSeries({ series: series, legend, colorScale, colors }),
|
|
41
|
+
prepareShapeData,
|
|
42
|
+
renderShapes,
|
|
43
|
+
getTooltipData: getTooltipData,
|
|
5
44
|
};
|
|
@@ -1,5 +1,30 @@
|
|
|
1
|
+
import { getTooltipData } from '../../core/shapes/x-range/get-tooltip-data';
|
|
2
|
+
import { prepareXRangeData } from '../../core/shapes/x-range/prepare-data';
|
|
3
|
+
import { renderXRange } from '../../core/shapes/x-range/renderer';
|
|
1
4
|
import { prepareXRangeSeries } from './prepare';
|
|
5
|
+
async function prepareShapeData(args) {
|
|
6
|
+
const { series, xAxis, xScale, yAxis, yScale, boundsWidth, isRangeSlider } = args;
|
|
7
|
+
if (!xAxis || !xScale || !(yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
|
|
8
|
+
return { renderData: [], tooltipItems: [] };
|
|
9
|
+
}
|
|
10
|
+
const data = await prepareXRangeData({
|
|
11
|
+
series: series,
|
|
12
|
+
xAxis,
|
|
13
|
+
xScale,
|
|
14
|
+
yAxis: yAxis !== null && yAxis !== void 0 ? yAxis : [],
|
|
15
|
+
yScale,
|
|
16
|
+
boundsWidth,
|
|
17
|
+
isRangeSlider,
|
|
18
|
+
});
|
|
19
|
+
return { renderData: data, tooltipItems: data };
|
|
20
|
+
}
|
|
21
|
+
function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
|
|
22
|
+
return renderXRange({ plot }, preparedData, seriesOptions, dispatcher);
|
|
23
|
+
}
|
|
2
24
|
export const xRangePlugin = {
|
|
3
25
|
type: 'x-range',
|
|
4
26
|
prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareXRangeSeries({ series: series, seriesOptions, legend, colorScale }),
|
|
27
|
+
prepareShapeData,
|
|
28
|
+
renderShapes,
|
|
29
|
+
getTooltipData: getTooltipData,
|
|
5
30
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Dispatch } from 'd3-dispatch';
|
|
3
3
|
import type { ChartScale } from '../../core/scales/types';
|
|
4
|
-
import type {
|
|
4
|
+
import type { TooltipItemData } from '../../core/shapes/types';
|
|
5
|
+
import type { PreparedXAxis, PreparedYAxis } from '../../hooks';
|
|
5
6
|
import type { useChartInnerState } from './useChartInnerState';
|
|
6
7
|
type ChartInnerState = ReturnType<typeof useChartInnerState>;
|
|
7
8
|
type Props = {
|
|
@@ -10,7 +11,7 @@ type Props = {
|
|
|
10
11
|
boundsOffsetTop: number;
|
|
11
12
|
boundsWidth: number;
|
|
12
13
|
dispatcher: Dispatch<object>;
|
|
13
|
-
shapesData:
|
|
14
|
+
shapesData: TooltipItemData[];
|
|
14
15
|
svgContainer: SVGSVGElement | null;
|
|
15
16
|
togglePinTooltip: ChartInnerState['togglePinTooltip'];
|
|
16
17
|
tooltipPinned: boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { pointer } from 'd3-selection';
|
|
3
|
-
import get from 'lodash/get';
|
|
4
3
|
import throttle from 'lodash/throttle';
|
|
5
4
|
import { EventType } from '../../core/utils';
|
|
6
5
|
import { getClosestPoints } from '../../core/utils/get-closest-data';
|
|
@@ -21,10 +20,9 @@ export function useChartInnerHandlers(props) {
|
|
|
21
20
|
dispatcher.call(EventType.POINTERMOVE_CHART, {}, undefined, event);
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
24
|
-
const shapesDataWithTooltipEnabled = shapesData.filter((d) => get(d, 'series.tooltip.enabled', true));
|
|
25
23
|
const closest = getClosestPoints({
|
|
26
24
|
position: [x, y],
|
|
27
|
-
shapesData
|
|
25
|
+
shapesData,
|
|
28
26
|
boundsHeight,
|
|
29
27
|
boundsWidth,
|
|
30
28
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Dispatch } from 'd3-dispatch';
|
|
3
|
-
import type {
|
|
3
|
+
import type { TooltipItemData } from '../../core/shapes/types';
|
|
4
|
+
import type { ChartScale, LegendItem, OnLegendItemClick, PreparedLegend, PreparedSeries, PreparedSplit, PreparedXAxis, PreparedYAxis, RangeSliderState, ZoomState } from '../../hooks';
|
|
4
5
|
import type { PreparedChart, PreparedTitle } from '../../hooks/types';
|
|
5
6
|
import type { LegendConfig } from '../../types';
|
|
6
7
|
import type { ChartInnerProps } from './types';
|
|
@@ -22,7 +23,7 @@ export declare function useChartInnerProps(props: Props): {
|
|
|
22
23
|
boundsWidth: number;
|
|
23
24
|
xAxis: PreparedXAxis | null;
|
|
24
25
|
yAxis: PreparedYAxis[];
|
|
25
|
-
shapesData:
|
|
26
|
+
shapesData: TooltipItemData[];
|
|
26
27
|
shapesReady: boolean;
|
|
27
28
|
handleLegendItemClick: OnLegendItemClick;
|
|
28
29
|
preparedTitle: PreparedTitle | undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Dispatch } from 'd3-dispatch';
|
|
3
3
|
import type { ChartScale } from '../../core/scales/types';
|
|
4
|
-
import type {
|
|
4
|
+
import type { TooltipItemData } from '../../core/shapes/types';
|
|
5
|
+
import type { PreparedXAxis, PreparedYAxis } from '../../hooks';
|
|
5
6
|
type Props = {
|
|
6
7
|
boundsHeight: number;
|
|
7
8
|
boundsOffsetLeft: number;
|
|
@@ -14,7 +15,7 @@ type Props = {
|
|
|
14
15
|
};
|
|
15
16
|
};
|
|
16
17
|
dispatcher: Dispatch<object>;
|
|
17
|
-
shapesData:
|
|
18
|
+
shapesData: TooltipItemData[];
|
|
18
19
|
shapesReady: boolean;
|
|
19
20
|
svgRef: React.RefObject<SVGSVGElement | null>;
|
|
20
21
|
xAxis: PreparedXAxis | null;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
1
2
|
import type { ScaleOrdinal } from 'd3-scale';
|
|
2
|
-
import type { ChartSeries, ChartSeriesOptions } from '../../types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ChartSeries, ChartSeriesOptions, ShapeDataWithLabels } from '../../types';
|
|
4
|
+
import type { PreparedXAxis, PreparedYAxis } from '../axes/types';
|
|
5
|
+
import type { PreparedSplit } from '../layout/split-types';
|
|
6
|
+
import type { ChartScale } from '../scales/types';
|
|
7
|
+
import type { SeriesShapeData, TooltipItemData } from '../shapes/types';
|
|
8
|
+
import type { GetTooltipDataFn } from '../utils/tooltip-helpers';
|
|
9
|
+
import type { PreparedLegend, PreparedSeries, PreparedSeriesOptions } from './types';
|
|
4
10
|
export interface PrepareSeriesArgs {
|
|
5
11
|
series: ChartSeries[];
|
|
6
12
|
seriesOptions?: ChartSeriesOptions;
|
|
@@ -8,7 +14,46 @@ export interface PrepareSeriesArgs {
|
|
|
8
14
|
colorScale: ScaleOrdinal<string, string>;
|
|
9
15
|
colors: string[];
|
|
10
16
|
}
|
|
17
|
+
export interface PrepareShapeDataArgs {
|
|
18
|
+
series: PreparedSeries[];
|
|
19
|
+
boundsWidth: number;
|
|
20
|
+
boundsHeight: number;
|
|
21
|
+
seriesOptions: PreparedSeriesOptions;
|
|
22
|
+
xAxis?: PreparedXAxis | null;
|
|
23
|
+
yAxis?: PreparedYAxis[];
|
|
24
|
+
xScale?: ChartScale;
|
|
25
|
+
yScale?: (ChartScale | undefined)[];
|
|
26
|
+
split?: PreparedSplit;
|
|
27
|
+
isOutsideBounds?: (x: number, y: number) => boolean;
|
|
28
|
+
isRangeSlider?: boolean;
|
|
29
|
+
otherLayers?: ShapeDataWithLabels[];
|
|
30
|
+
}
|
|
31
|
+
export interface PrepareShapeDataResult {
|
|
32
|
+
renderData: SeriesShapeData[];
|
|
33
|
+
tooltipItems: TooltipItemData[];
|
|
34
|
+
}
|
|
35
|
+
export interface RenderShapesArgs {
|
|
36
|
+
plot: SVGGElement;
|
|
37
|
+
preparedData: SeriesShapeData[];
|
|
38
|
+
seriesOptions: PreparedSeriesOptions;
|
|
39
|
+
boundsWidth: number;
|
|
40
|
+
boundsHeight: number;
|
|
41
|
+
dispatcher?: Dispatch<object>;
|
|
42
|
+
}
|
|
11
43
|
export interface SeriesPlugin<T extends ChartSeries = ChartSeries> {
|
|
44
|
+
/** Unique series type identifier (e.g. `'line'`, `'bar-x'`). Used for plugin lookup and CSS class generation. */
|
|
12
45
|
type: T['type'];
|
|
46
|
+
/**
|
|
47
|
+
* Whether the shape `<g>` element should be clipped to the chart bounds.
|
|
48
|
+
* Defaults to `true`. Set to `false` for series that render outside the plot area (e.g. pie, radar, treemap).
|
|
49
|
+
*/
|
|
50
|
+
useClipPath?: boolean;
|
|
51
|
+
/** Transforms raw chart series config into prepared series objects used throughout the render pipeline. */
|
|
13
52
|
prepareSeries(args: PrepareSeriesArgs): PreparedSeries[] | Promise<PreparedSeries[]>;
|
|
53
|
+
/** Computes shape data (geometry, labels, markers) from prepared series. Called once per render cycle. */
|
|
54
|
+
prepareShapeData(args: PrepareShapeDataArgs): PrepareShapeDataResult | Promise<PrepareShapeDataResult>;
|
|
55
|
+
/** Renders shapes into the provided SVG `<g>` element using D3. May return a cleanup function. */
|
|
56
|
+
renderShapes(args: RenderShapesArgs): (() => void) | void;
|
|
57
|
+
/** Returns tooltip data for a given pointer position and prepared series. */
|
|
58
|
+
getTooltipData: GetTooltipDataFn;
|
|
14
59
|
}
|
|
@@ -369,6 +369,10 @@ export type PreparedFunnelSeries = {
|
|
|
369
369
|
html: boolean;
|
|
370
370
|
format?: ValueFormat;
|
|
371
371
|
align: Required<Required<FunnelSeries>['dataLabels']>['align'];
|
|
372
|
+
inside: boolean;
|
|
373
|
+
reserveSpace: boolean;
|
|
374
|
+
padding: number;
|
|
375
|
+
anchor: Required<Required<FunnelSeries>['dataLabels']>['anchor'];
|
|
372
376
|
};
|
|
373
377
|
connectors: Required<FunnelSeries['connectors']>;
|
|
374
378
|
} & BasePreparedSeries;
|
|
@@ -2,8 +2,9 @@ import { group, min, sort } from 'd3-array';
|
|
|
2
2
|
import isNil from 'lodash/isNil';
|
|
3
3
|
import round from 'lodash/round';
|
|
4
4
|
import { prepareAnnotation } from '../../series/prepare-annotation';
|
|
5
|
+
import { buildHoverMarkerGetter } from '../../shapes/marker';
|
|
5
6
|
import { getXValue, getYValue, markHiddenPointsOutOfYRange } from '../../shapes/utils';
|
|
6
|
-
import { getDataCategoryValue, preparePointDataLabels } from '../../utils';
|
|
7
|
+
import { getDataCategoryValue, preparePointDataLabels, shouldPrepareSeriesDataLabels, } from '../../utils';
|
|
7
8
|
function getXValues(series, xAxis, xScale) {
|
|
8
9
|
const categories = xAxis.categories || [];
|
|
9
10
|
const xValues = series.reduce((acc, s) => {
|
|
@@ -242,41 +243,50 @@ export const prepareAreaData = async (args) => {
|
|
|
242
243
|
});
|
|
243
244
|
}
|
|
244
245
|
}
|
|
245
|
-
|
|
246
|
+
markHiddenPointsOutOfYRange({
|
|
247
|
+
points,
|
|
248
|
+
yScale: seriesYScale,
|
|
249
|
+
yAxisTop,
|
|
250
|
+
});
|
|
251
|
+
const normalState = s.marker.states.normal;
|
|
246
252
|
const hasPerPointNormalMarkers = s.data.some((d) => { var _a, _b, _c; return (_c = (_b = (_a = d.marker) === null || _a === void 0 ? void 0 : _a.states) === null || _b === void 0 ? void 0 : _b.normal) === null || _c === void 0 ? void 0 : _c.enabled; });
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
var _a, _b, _c, _d;
|
|
250
|
-
if (p.y === null) {
|
|
251
|
-
return
|
|
253
|
+
const markers = s.marker.states.normal.enabled || hasPerPointNormalMarkers
|
|
254
|
+
? points.reduce((acc, p) => {
|
|
255
|
+
var _a, _b, _c, _d, _e;
|
|
256
|
+
if (p.y === null || p.hiddenInLine) {
|
|
257
|
+
return acc;
|
|
252
258
|
}
|
|
253
259
|
const pointNormalEnabled = (_d = (_c = (_b = (_a = p.data.marker) === null || _a === void 0 ? void 0 : _a.states) === null || _b === void 0 ? void 0 : _b.normal) === null || _c === void 0 ? void 0 : _c.enabled) !== null && _d !== void 0 ? _d : false;
|
|
254
260
|
if (s.marker.states.normal.enabled || pointNormalEnabled) {
|
|
255
|
-
|
|
256
|
-
|
|
261
|
+
acc.push({
|
|
262
|
+
cx: p.x,
|
|
263
|
+
cy: p.y,
|
|
264
|
+
radius: normalState.radius,
|
|
265
|
+
symbolType: normalState.symbol,
|
|
266
|
+
fill: (_e = p.color) !== null && _e !== void 0 ? _e : s.color,
|
|
267
|
+
stroke: normalState.borderColor,
|
|
268
|
+
strokeWidth: normalState.borderWidth,
|
|
269
|
+
opacity: 1,
|
|
257
270
|
active: true,
|
|
258
|
-
hovered: false,
|
|
259
271
|
clipped: isOutsideBounds(p.x, p.y),
|
|
272
|
+
series: { id: s.id },
|
|
273
|
+
data: p.data,
|
|
260
274
|
});
|
|
261
275
|
}
|
|
262
|
-
return
|
|
263
|
-
}, [])
|
|
264
|
-
|
|
276
|
+
return acc;
|
|
277
|
+
}, [])
|
|
278
|
+
: [];
|
|
265
279
|
const annotations = points.reduce((result, p) => {
|
|
266
280
|
if (p.annotation && p.y !== null) {
|
|
267
281
|
result.push({ annotation: p.annotation, x: p.x, y: p.y });
|
|
268
282
|
}
|
|
269
283
|
return result;
|
|
270
284
|
}, []);
|
|
271
|
-
markHiddenPointsOutOfYRange({
|
|
272
|
-
points,
|
|
273
|
-
yScale: seriesYScale,
|
|
274
|
-
yAxisTop,
|
|
275
|
-
});
|
|
276
285
|
seriesStackData.push({
|
|
277
286
|
annotations,
|
|
278
287
|
points,
|
|
279
288
|
markers,
|
|
289
|
+
getHoverMarkers: buildHoverMarkerGetter(points, s),
|
|
280
290
|
svgLabels: [],
|
|
281
291
|
color: s.color,
|
|
282
292
|
opacity: s.opacity,
|
|
@@ -292,7 +302,7 @@ export const prepareAreaData = async (args) => {
|
|
|
292
302
|
const item = seriesStackData[itemIndex];
|
|
293
303
|
const currentYAxis = yAxis[item.series.yAxis];
|
|
294
304
|
const itemYAxisTop = ((_p = split.plots[currentYAxis.plotIndex]) === null || _p === void 0 ? void 0 : _p.top) || 0;
|
|
295
|
-
if (item.series
|
|
305
|
+
if (!isRangeSlider && shouldPrepareSeriesDataLabels(item.series)) {
|
|
296
306
|
const labelsData = await preparePointDataLabels({
|
|
297
307
|
series: item.series,
|
|
298
308
|
points: item.points,
|
|
@@ -3,9 +3,4 @@ import type { PreparedSeriesOptions } from '../../series/types';
|
|
|
3
3
|
import type { PreparedAreaData } from './types';
|
|
4
4
|
export declare function renderArea(elements: {
|
|
5
5
|
plot: SVGGElement;
|
|
6
|
-
markers: SVGGElement;
|
|
7
|
-
hoverMarkers: SVGGElement;
|
|
8
|
-
annotations: SVGGElement;
|
|
9
|
-
boundsWidth: number;
|
|
10
|
-
boundsHeight: number;
|
|
11
6
|
}, preparedData: PreparedAreaData[], seriesOptions: PreparedSeriesOptions, allowOverlapDataLabels: boolean, dispatcher?: Dispatch<object>): () => void;
|