@gravity-ui/charts 1.51.0 → 1.51.3
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/AxisY/utils.js +16 -4
- package/dist/cjs/components/index.js +25 -17
- package/dist/cjs/core/series/plugin.d.ts +14 -0
- package/dist/cjs/core/series/plugin.js +1 -0
- package/dist/cjs/core/series/prepareSeries.d.ts +3 -10
- package/dist/cjs/core/series/prepareSeries.js +3 -126
- package/dist/cjs/core/series/seriesRegistry.d.ts +3 -0
- package/dist/cjs/core/series/seriesRegistry.js +12 -0
- package/dist/cjs/core/shapes/area/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/area/get-tooltip-data.js +19 -0
- package/dist/cjs/core/shapes/area/types.d.ts +3 -3
- package/dist/cjs/core/shapes/bar-x/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/bar-x/get-tooltip-data.js +20 -0
- package/dist/cjs/core/shapes/bar-x/types.d.ts +3 -3
- package/dist/cjs/core/shapes/bar-y/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/bar-y/get-tooltip-data.js +32 -0
- package/dist/cjs/core/shapes/bar-y/prepare-data.js +6 -6
- package/dist/cjs/core/shapes/bar-y/types.d.ts +3 -3
- package/dist/cjs/core/shapes/funnel/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/funnel/get-tooltip-data.js +21 -0
- package/dist/cjs/core/shapes/funnel/prepare-data.js +6 -4
- package/dist/cjs/core/shapes/funnel/types.d.ts +3 -3
- package/dist/cjs/core/shapes/heatmap/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/heatmap/get-tooltip-data.js +21 -0
- package/dist/cjs/core/shapes/heatmap/prepare-data.js +1 -1
- package/dist/cjs/core/shapes/heatmap/types.d.ts +3 -3
- package/dist/cjs/core/shapes/line/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/line/get-tooltip-data.js +18 -0
- package/dist/cjs/core/shapes/line/types.d.ts +3 -3
- package/dist/cjs/core/shapes/pie/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/pie/get-tooltip-data.js +27 -0
- package/dist/cjs/core/shapes/pie/types.d.ts +3 -3
- package/dist/cjs/core/shapes/radar/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/radar/get-tooltip-data.js +35 -0
- package/dist/cjs/core/shapes/radar/types.d.ts +3 -3
- package/dist/cjs/core/shapes/sankey/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/sankey/get-tooltip-data.js +32 -0
- package/dist/cjs/core/shapes/sankey/prepare-data.js +2 -2
- package/dist/cjs/core/shapes/sankey/types.d.ts +3 -3
- package/dist/cjs/core/shapes/scatter/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/scatter/get-tooltip-data.js +19 -0
- package/dist/cjs/core/shapes/scatter/types.d.ts +2 -2
- package/dist/cjs/core/shapes/treemap/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/treemap/get-tooltip-data.js +18 -0
- package/dist/cjs/core/shapes/treemap/prepare-data.js +3 -3
- package/dist/cjs/core/shapes/treemap/types.d.ts +3 -3
- package/dist/cjs/core/shapes/types.d.ts +4 -0
- package/dist/cjs/core/shapes/types.js +1 -0
- package/dist/cjs/core/shapes/waterfall/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/waterfall/get-tooltip-data.js +15 -0
- package/dist/cjs/core/shapes/waterfall/prepare-data.js +1 -1
- package/dist/cjs/core/shapes/waterfall/types.d.ts +3 -3
- package/dist/cjs/core/shapes/x-range/get-tooltip-data.d.ts +3 -0
- package/dist/cjs/core/shapes/x-range/get-tooltip-data.js +22 -0
- package/dist/cjs/core/shapes/x-range/types.d.ts +3 -3
- package/dist/cjs/core/types/chart/funnel.d.ts +9 -4
- package/dist/cjs/core/utils/axis/x-axis.js +16 -4
- package/dist/cjs/core/utils/get-closest-data.d.ts +2 -11
- package/dist/cjs/core/utils/get-closest-data.js +47 -326
- package/dist/cjs/core/utils/tooltip-helpers.d.ts +43 -0
- package/dist/cjs/core/utils/tooltip-helpers.js +72 -0
- package/dist/cjs/hooks/useShapes/bar-y/index.js +1 -1
- package/dist/cjs/hooks/useShapes/heatmap/index.js +1 -1
- package/dist/cjs/hooks/useShapes/sankey/index.js +1 -1
- package/dist/cjs/hooks/useShapes/treemap/index.js +1 -1
- package/dist/cjs/hooks/useShapes/waterfall/index.js +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/plugins/area/index.d.ts +3 -0
- package/dist/cjs/plugins/area/index.js +5 -0
- package/dist/cjs/{core/series/prepare-area.d.ts → plugins/area/prepare.d.ts} +2 -2
- package/dist/cjs/{core/series/prepare-area.js → plugins/area/prepare.js} +4 -4
- package/dist/cjs/plugins/bar-x/index.d.ts +3 -0
- package/dist/cjs/plugins/bar-x/index.js +5 -0
- package/dist/{esm/core/series/prepare-bar-x.d.ts → cjs/plugins/bar-x/prepare.d.ts} +1 -1
- package/dist/{esm/core/series/prepare-bar-x.js → cjs/plugins/bar-x/prepare.js} +4 -4
- package/dist/cjs/plugins/bar-y/index.d.ts +3 -0
- package/dist/cjs/plugins/bar-y/index.js +5 -0
- package/dist/cjs/{core/series/prepare-bar-y.d.ts → plugins/bar-y/prepare.d.ts} +2 -2
- package/dist/cjs/{core/series/prepare-bar-y.js → plugins/bar-y/prepare.js} +4 -4
- package/dist/cjs/plugins/funnel/index.d.ts +3 -0
- package/dist/cjs/plugins/funnel/index.js +5 -0
- package/dist/cjs/{core/series/prepare-funnel.d.ts → plugins/funnel/prepare.d.ts} +2 -2
- package/dist/{esm/core/series/prepare-funnel.js → cjs/plugins/funnel/prepare.js} +15 -9
- package/dist/cjs/plugins/heatmap/index.d.ts +3 -0
- package/dist/cjs/plugins/heatmap/index.js +10 -0
- package/dist/{esm/core/series/prepare-heatmap.d.ts → cjs/plugins/heatmap/prepare.d.ts} +1 -1
- package/dist/{esm/core/series/prepare-heatmap.js → cjs/plugins/heatmap/prepare.js} +4 -4
- package/dist/cjs/plugins/index.d.ts +1 -0
- package/dist/cjs/plugins/index.js +27 -0
- package/dist/cjs/plugins/line/index.d.ts +3 -0
- package/dist/cjs/plugins/line/index.js +5 -0
- package/dist/cjs/{core/series/prepare-line.d.ts → plugins/line/prepare.d.ts} +2 -2
- package/dist/cjs/{core/series/prepare-line.js → plugins/line/prepare.js} +3 -3
- package/dist/cjs/plugins/pie/index.d.ts +3 -0
- package/dist/cjs/plugins/pie/index.js +5 -0
- package/dist/cjs/{core/series/prepare-pie.d.ts → plugins/pie/prepare.d.ts} +2 -2
- package/dist/cjs/plugins/pie/prepare.js +84 -0
- package/dist/cjs/plugins/radar/index.d.ts +3 -0
- package/dist/cjs/plugins/radar/index.js +5 -0
- package/dist/cjs/{core/series/prepare-radar.d.ts → plugins/radar/prepare.d.ts} +2 -2
- package/dist/cjs/{core/series/prepare-radar.js → plugins/radar/prepare.js} +4 -4
- package/dist/cjs/plugins/sankey/index.d.ts +3 -0
- package/dist/cjs/plugins/sankey/index.js +5 -0
- package/dist/cjs/{core/series/prepare-sankey.d.ts → plugins/sankey/prepare.d.ts} +1 -1
- package/dist/cjs/{core/series/prepare-sankey.js → plugins/sankey/prepare.js} +3 -3
- package/dist/cjs/plugins/scatter/index.d.ts +3 -0
- package/dist/cjs/plugins/scatter/index.js +10 -0
- package/dist/cjs/{core/series/prepare-scatter.d.ts → plugins/scatter/prepare.d.ts} +1 -1
- package/dist/{esm/core/series/prepare-scatter.js → cjs/plugins/scatter/prepare.js} +4 -4
- package/dist/cjs/plugins/treemap/index.d.ts +3 -0
- package/dist/cjs/plugins/treemap/index.js +5 -0
- package/dist/{esm/core/series/prepare-treemap.d.ts → cjs/plugins/treemap/prepare.d.ts} +1 -1
- package/dist/cjs/{core/series/prepare-treemap.js → plugins/treemap/prepare.js} +4 -4
- package/dist/cjs/plugins/waterfall/index.d.ts +3 -0
- package/dist/cjs/plugins/waterfall/index.js +5 -0
- package/dist/cjs/{core/series/prepare-waterfall.d.ts → plugins/waterfall/prepare.d.ts} +1 -1
- package/dist/{esm/core/series/prepare-waterfall.js → cjs/plugins/waterfall/prepare.js} +4 -4
- package/dist/cjs/plugins/x-range/index.d.ts +3 -0
- package/dist/cjs/plugins/x-range/index.js +5 -0
- package/dist/cjs/{core/series/prepare-x-range.d.ts → plugins/x-range/prepare.d.ts} +1 -1
- package/dist/cjs/{core/series/prepare-x-range.js → plugins/x-range/prepare.js} +4 -4
- package/dist/cjs/setup-jsdom.d.ts +1 -0
- package/dist/cjs/setup-jsdom.js +30 -4
- package/dist/esm/components/AxisY/utils.js +16 -4
- package/dist/esm/components/index.js +25 -17
- package/dist/esm/core/series/plugin.d.ts +14 -0
- package/dist/esm/core/series/plugin.js +1 -0
- package/dist/esm/core/series/prepareSeries.d.ts +3 -10
- package/dist/esm/core/series/prepareSeries.js +3 -126
- package/dist/esm/core/series/seriesRegistry.d.ts +3 -0
- package/dist/esm/core/series/seriesRegistry.js +12 -0
- package/dist/esm/core/shapes/area/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/area/get-tooltip-data.js +19 -0
- package/dist/esm/core/shapes/area/types.d.ts +3 -3
- package/dist/esm/core/shapes/bar-x/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/bar-x/get-tooltip-data.js +20 -0
- package/dist/esm/core/shapes/bar-x/types.d.ts +3 -3
- package/dist/esm/core/shapes/bar-y/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/bar-y/get-tooltip-data.js +32 -0
- package/dist/esm/core/shapes/bar-y/prepare-data.js +6 -6
- package/dist/esm/core/shapes/bar-y/types.d.ts +3 -3
- package/dist/esm/core/shapes/funnel/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/funnel/get-tooltip-data.js +21 -0
- package/dist/esm/core/shapes/funnel/prepare-data.js +6 -4
- package/dist/esm/core/shapes/funnel/types.d.ts +3 -3
- package/dist/esm/core/shapes/heatmap/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/heatmap/get-tooltip-data.js +21 -0
- package/dist/esm/core/shapes/heatmap/prepare-data.js +1 -1
- package/dist/esm/core/shapes/heatmap/types.d.ts +3 -3
- package/dist/esm/core/shapes/line/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/line/get-tooltip-data.js +18 -0
- package/dist/esm/core/shapes/line/types.d.ts +3 -3
- package/dist/esm/core/shapes/pie/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/pie/get-tooltip-data.js +27 -0
- package/dist/esm/core/shapes/pie/types.d.ts +3 -3
- package/dist/esm/core/shapes/radar/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/radar/get-tooltip-data.js +35 -0
- package/dist/esm/core/shapes/radar/types.d.ts +3 -3
- package/dist/esm/core/shapes/sankey/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/sankey/get-tooltip-data.js +32 -0
- package/dist/esm/core/shapes/sankey/prepare-data.js +2 -2
- package/dist/esm/core/shapes/sankey/types.d.ts +3 -3
- package/dist/esm/core/shapes/scatter/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/scatter/get-tooltip-data.js +19 -0
- package/dist/esm/core/shapes/scatter/types.d.ts +2 -2
- package/dist/esm/core/shapes/treemap/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/treemap/get-tooltip-data.js +18 -0
- package/dist/esm/core/shapes/treemap/prepare-data.js +3 -3
- package/dist/esm/core/shapes/treemap/types.d.ts +3 -3
- package/dist/esm/core/shapes/types.d.ts +4 -0
- package/dist/esm/core/shapes/types.js +1 -0
- package/dist/esm/core/shapes/waterfall/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/waterfall/get-tooltip-data.js +15 -0
- package/dist/esm/core/shapes/waterfall/prepare-data.js +1 -1
- package/dist/esm/core/shapes/waterfall/types.d.ts +3 -3
- package/dist/esm/core/shapes/x-range/get-tooltip-data.d.ts +3 -0
- package/dist/esm/core/shapes/x-range/get-tooltip-data.js +22 -0
- package/dist/esm/core/shapes/x-range/types.d.ts +3 -3
- package/dist/esm/core/types/chart/funnel.d.ts +9 -4
- package/dist/esm/core/utils/axis/x-axis.js +16 -4
- package/dist/esm/core/utils/get-closest-data.d.ts +2 -11
- package/dist/esm/core/utils/get-closest-data.js +47 -326
- package/dist/esm/core/utils/tooltip-helpers.d.ts +43 -0
- package/dist/esm/core/utils/tooltip-helpers.js +72 -0
- package/dist/esm/hooks/useShapes/bar-y/index.js +1 -1
- package/dist/esm/hooks/useShapes/heatmap/index.js +1 -1
- package/dist/esm/hooks/useShapes/sankey/index.js +1 -1
- package/dist/esm/hooks/useShapes/treemap/index.js +1 -1
- package/dist/esm/hooks/useShapes/waterfall/index.js +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/plugins/area/index.d.ts +3 -0
- package/dist/esm/plugins/area/index.js +5 -0
- package/dist/esm/{core/series/prepare-area.d.ts → plugins/area/prepare.d.ts} +2 -2
- package/dist/esm/{core/series/prepare-area.js → plugins/area/prepare.js} +4 -4
- package/dist/esm/plugins/bar-x/index.d.ts +3 -0
- package/dist/esm/plugins/bar-x/index.js +5 -0
- package/dist/{cjs/core/series/prepare-bar-x.d.ts → esm/plugins/bar-x/prepare.d.ts} +1 -1
- package/dist/{cjs/core/series/prepare-bar-x.js → esm/plugins/bar-x/prepare.js} +4 -4
- package/dist/esm/plugins/bar-y/index.d.ts +3 -0
- package/dist/esm/plugins/bar-y/index.js +5 -0
- package/dist/esm/{core/series/prepare-bar-y.d.ts → plugins/bar-y/prepare.d.ts} +5 -5
- package/dist/esm/{core/series/prepare-bar-y.js → plugins/bar-y/prepare.js} +4 -4
- package/dist/esm/plugins/funnel/index.d.ts +3 -0
- package/dist/esm/plugins/funnel/index.js +5 -0
- package/dist/esm/{core/series/prepare-funnel.d.ts → plugins/funnel/prepare.d.ts} +2 -2
- package/dist/{cjs/core/series/prepare-funnel.js → esm/plugins/funnel/prepare.js} +15 -9
- package/dist/esm/plugins/heatmap/index.d.ts +3 -0
- package/dist/esm/plugins/heatmap/index.js +10 -0
- package/dist/{cjs/core/series/prepare-heatmap.d.ts → esm/plugins/heatmap/prepare.d.ts} +1 -1
- package/dist/{cjs/core/series/prepare-heatmap.js → esm/plugins/heatmap/prepare.js} +4 -4
- package/dist/esm/plugins/index.d.ts +1 -0
- package/dist/esm/plugins/index.js +27 -0
- package/dist/esm/plugins/line/index.d.ts +3 -0
- package/dist/esm/plugins/line/index.js +5 -0
- package/dist/esm/{core/series/prepare-line.d.ts → plugins/line/prepare.d.ts} +2 -2
- package/dist/esm/{core/series/prepare-line.js → plugins/line/prepare.js} +3 -3
- package/dist/esm/plugins/pie/index.d.ts +3 -0
- package/dist/esm/plugins/pie/index.js +5 -0
- package/dist/esm/{core/series/prepare-pie.d.ts → plugins/pie/prepare.d.ts} +2 -2
- package/dist/esm/plugins/pie/prepare.js +84 -0
- package/dist/esm/plugins/radar/index.d.ts +3 -0
- package/dist/esm/plugins/radar/index.js +5 -0
- package/dist/esm/{core/series/prepare-radar.d.ts → plugins/radar/prepare.d.ts} +2 -2
- package/dist/esm/{core/series/prepare-radar.js → plugins/radar/prepare.js} +4 -4
- package/dist/esm/plugins/sankey/index.d.ts +3 -0
- package/dist/esm/plugins/sankey/index.js +5 -0
- package/dist/esm/{core/series/prepare-sankey.d.ts → plugins/sankey/prepare.d.ts} +1 -1
- package/dist/esm/{core/series/prepare-sankey.js → plugins/sankey/prepare.js} +3 -3
- package/dist/esm/plugins/scatter/index.d.ts +3 -0
- package/dist/esm/plugins/scatter/index.js +10 -0
- package/dist/esm/{core/series/prepare-scatter.d.ts → plugins/scatter/prepare.d.ts} +1 -1
- package/dist/{cjs/core/series/prepare-scatter.js → esm/plugins/scatter/prepare.js} +4 -4
- package/dist/esm/plugins/treemap/index.d.ts +3 -0
- package/dist/esm/plugins/treemap/index.js +5 -0
- package/dist/{cjs/core/series/prepare-treemap.d.ts → esm/plugins/treemap/prepare.d.ts} +1 -1
- package/dist/esm/{core/series/prepare-treemap.js → plugins/treemap/prepare.js} +4 -4
- package/dist/esm/plugins/waterfall/index.d.ts +3 -0
- package/dist/esm/plugins/waterfall/index.js +5 -0
- package/dist/esm/{core/series/prepare-waterfall.d.ts → plugins/waterfall/prepare.d.ts} +1 -1
- package/dist/{cjs/core/series/prepare-waterfall.js → esm/plugins/waterfall/prepare.js} +4 -4
- package/dist/esm/plugins/x-range/index.d.ts +3 -0
- package/dist/esm/plugins/x-range/index.js +5 -0
- package/dist/esm/{core/series/prepare-x-range.d.ts → plugins/x-range/prepare.d.ts} +1 -1
- package/dist/esm/{core/series/prepare-x-range.js → plugins/x-range/prepare.js} +4 -4
- package/dist/esm/setup-jsdom.d.ts +1 -0
- package/dist/esm/setup-jsdom.js +30 -4
- package/package.json +3 -2
- package/dist/cjs/core/series/prepare-pie.js +0 -83
- package/dist/esm/core/series/prepare-pie.js +0 -83
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScaleOrdinal } from 'd3-scale';
|
|
2
|
+
import type { PreparedLegend } from '../../core/series/types';
|
|
2
3
|
import type { BarYSeries, BarYSeriesData, ChartSeriesOptions } from '../../types';
|
|
3
|
-
import type { PreparedLegend } from './types';
|
|
4
4
|
type PrepareBarYSeriesArgs = {
|
|
5
5
|
colorScale: ScaleOrdinal<string, string>;
|
|
6
6
|
series: BarYSeries[];
|
|
@@ -17,11 +17,11 @@ export declare function prepareBarYSeries(args: PrepareBarYSeriesArgs): Promise<
|
|
|
17
17
|
padding: number;
|
|
18
18
|
enabled: boolean;
|
|
19
19
|
inside: boolean;
|
|
20
|
-
style: import("
|
|
20
|
+
style: import("../..").BaseTextStyle;
|
|
21
21
|
maxHeight: number;
|
|
22
22
|
maxWidth: number;
|
|
23
23
|
html: boolean;
|
|
24
|
-
format?: import("
|
|
24
|
+
format?: import("../..").ValueFormat;
|
|
25
25
|
allowOverlap: boolean;
|
|
26
26
|
};
|
|
27
27
|
borderRadius: number;
|
|
@@ -36,9 +36,9 @@ export declare function prepareBarYSeries(args: PrepareBarYSeriesArgs): Promise<
|
|
|
36
36
|
groupId: string;
|
|
37
37
|
itemText: string;
|
|
38
38
|
enabled: boolean;
|
|
39
|
-
symbol: import("
|
|
39
|
+
symbol: import("../../core/series/types").PreparedLegendSymbol;
|
|
40
40
|
};
|
|
41
41
|
cursor: string | null;
|
|
42
|
-
tooltip: import("
|
|
42
|
+
tooltip: import("../..").ChartSeries["tooltip"];
|
|
43
43
|
})[]>;
|
|
44
44
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
|
-
import { DEFAULT_DATALABELS_STYLE } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { DEFAULT_DATALABELS_STYLE } from '../../core/constants';
|
|
3
|
+
import { getSeriesStackId, prepareLegendSymbol } from '../../core/series/utils';
|
|
4
|
+
import { getLabelsSize, getUniqId } from '../../core/utils';
|
|
5
|
+
import { getFormattedValue } from '../../core/utils/format';
|
|
6
6
|
const DEFAULT_LABEL_PADDING = 7;
|
|
7
7
|
function prepareSeriesData(series) {
|
|
8
8
|
var _a;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { PreparedLegend, PreparedSeries } from '../../core/series/types';
|
|
1
2
|
import type { ChartSeriesOptions, FunnelSeries } from '../../types';
|
|
2
|
-
import type { PreparedLegend, PreparedSeries } from './types';
|
|
3
3
|
type PrepareFunnelSeriesArgs = {
|
|
4
|
-
series: FunnelSeries;
|
|
4
|
+
series: FunnelSeries[];
|
|
5
5
|
seriesOptions?: ChartSeriesOptions;
|
|
6
6
|
legend: PreparedLegend;
|
|
7
7
|
colors: string[];
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { scaleOrdinal } from 'd3-scale';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
|
-
import { DEFAULT_DATALABELS_STYLE } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { DEFAULT_DATALABELS_STYLE } from '../../core/constants';
|
|
4
|
+
import { prepareLegendSymbol } from '../../core/series/utils';
|
|
5
|
+
import { getUniqId } from '../../core/utils';
|
|
6
6
|
export function prepareFunnelSeries(args) {
|
|
7
|
-
var _a, _b, _c;
|
|
8
|
-
const { series, legend, colors } = args;
|
|
7
|
+
var _a, _b, _c, _d;
|
|
8
|
+
const { series: seriesList, legend, colors } = args;
|
|
9
|
+
const series = seriesList[0];
|
|
9
10
|
const dataNames = series.data.map((d) => d.name);
|
|
10
11
|
const colorScale = scaleOrdinal(dataNames, colors);
|
|
11
12
|
const shape = (_a = series.shape) !== null && _a !== void 0 ? _a : 'rectangle';
|
|
12
13
|
const isTrapezoid = shape === 'trapezoid';
|
|
13
|
-
const
|
|
14
|
+
const userSpecifiedHeight = ((_b = series.connectors) === null || _b === void 0 ? void 0 : _b.height) !== undefined;
|
|
15
|
+
// For trapezoid: enable connectors only when the user has explicitly set a height or enabled them.
|
|
16
|
+
// For rectangle: enable by default.
|
|
17
|
+
const isConnectorsEnabled = (_d = (_c = series.connectors) === null || _c === void 0 ? void 0 : _c.enabled) !== null && _d !== void 0 ? _d : (isTrapezoid ? userSpecifiedHeight : true);
|
|
14
18
|
const preparedSeries = series.data.map((dataItem) => {
|
|
15
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;
|
|
16
20
|
const id = getUniqId();
|
|
@@ -42,12 +46,14 @@ export function prepareFunnelSeries(args) {
|
|
|
42
46
|
tooltip: series.tooltip,
|
|
43
47
|
connectors: {
|
|
44
48
|
enabled: isConnectorsEnabled,
|
|
45
|
-
height: isConnectorsEnabled
|
|
49
|
+
height: isConnectorsEnabled
|
|
50
|
+
? ((_q = (_p = series.connectors) === null || _p === void 0 ? void 0 : _p.height) !== null && _q !== void 0 ? _q : (isTrapezoid ? 0 : '25%'))
|
|
51
|
+
: 0,
|
|
46
52
|
lineDashStyle: (_s = (_r = series.connectors) === null || _r === void 0 ? void 0 : _r.lineDashStyle) !== null && _s !== void 0 ? _s : 'Dash',
|
|
47
|
-
lineOpacity: (_u = (_t = series.connectors) === null || _t === void 0 ? void 0 : _t.lineOpacity) !== null && _u !== void 0 ? _u : 1,
|
|
53
|
+
lineOpacity: (_u = (_t = series.connectors) === null || _t === void 0 ? void 0 : _t.lineOpacity) !== null && _u !== void 0 ? _u : (isTrapezoid ? 0 : 1),
|
|
48
54
|
lineColor: (_w = (_v = series.connectors) === null || _v === void 0 ? void 0 : _v.lineColor) !== null && _w !== void 0 ? _w : 'var(--g-color-line-generic-active)',
|
|
49
55
|
areaColor: (_y = (_x = series.connectors) === null || _x === void 0 ? void 0 : _x.areaColor) !== null && _y !== void 0 ? _y : color,
|
|
50
|
-
areaOpacity: (_0 = (_z = series.connectors) === null || _z === void 0 ? void 0 : _z.areaOpacity) !== null && _0 !== void 0 ? _0 : 0.25,
|
|
56
|
+
areaOpacity: (_0 = (_z = series.connectors) === null || _z === void 0 ? void 0 : _z.areaOpacity) !== null && _0 !== void 0 ? _0 : (isTrapezoid ? 0 : 0.25),
|
|
51
57
|
lineWidth: (_2 = (_1 = series.connectors) === null || _1 === void 0 ? void 0 : _1.lineWidth) !== null && _2 !== void 0 ? _2 : 1,
|
|
52
58
|
},
|
|
53
59
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { prepareHeatmapSeries } from './prepare';
|
|
2
|
+
export const heatmapPlugin = {
|
|
3
|
+
type: 'heatmap',
|
|
4
|
+
prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareHeatmapSeries({
|
|
5
|
+
series: series,
|
|
6
|
+
seriesOptions,
|
|
7
|
+
legend,
|
|
8
|
+
colorScale,
|
|
9
|
+
}),
|
|
10
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScaleOrdinal } from 'd3-scale';
|
|
2
|
+
import type { PreparedLegend, PreparedSeries } from '../../core/series/types';
|
|
2
3
|
import type { ChartSeriesOptions, HeatmapSeries } from '../../types';
|
|
3
|
-
import type { PreparedLegend, PreparedSeries } from './types';
|
|
4
4
|
type PrepareHeatmapSeriesArgs = {
|
|
5
5
|
colorScale: ScaleOrdinal<string, string>;
|
|
6
6
|
series: HeatmapSeries[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
|
-
import { DEFAULT_DATALABELS_STYLE } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { DEFAULT_DATALABELS_STYLE } from '../../core/constants';
|
|
3
|
+
import { DEFAULT_DATALABELS_PADDING } from '../../core/series/constants';
|
|
4
|
+
import { prepareLegendSymbol } from '../../core/series/utils';
|
|
5
|
+
import { getUniqId } from '../../core/utils';
|
|
6
6
|
function prepareSeriesData(series) {
|
|
7
7
|
var _a;
|
|
8
8
|
const nullMode = (_a = series.nullMode) !== null && _a !== void 0 ? _a : 'skip';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { registerSeriesPlugin } from '../core/series/seriesRegistry';
|
|
2
|
+
import { areaPlugin } from './area';
|
|
3
|
+
import { barXPlugin } from './bar-x';
|
|
4
|
+
import { barYPlugin } from './bar-y';
|
|
5
|
+
import { funnelPlugin } from './funnel';
|
|
6
|
+
import { heatmapPlugin } from './heatmap';
|
|
7
|
+
import { linePlugin } from './line';
|
|
8
|
+
import { piePlugin } from './pie';
|
|
9
|
+
import { radarPlugin } from './radar';
|
|
10
|
+
import { sankeyPlugin } from './sankey';
|
|
11
|
+
import { scatterPlugin } from './scatter';
|
|
12
|
+
import { treemapPlugin } from './treemap';
|
|
13
|
+
import { waterfallPlugin } from './waterfall';
|
|
14
|
+
import { xRangePlugin } from './x-range';
|
|
15
|
+
registerSeriesPlugin(areaPlugin);
|
|
16
|
+
registerSeriesPlugin(barXPlugin);
|
|
17
|
+
registerSeriesPlugin(barYPlugin);
|
|
18
|
+
registerSeriesPlugin(funnelPlugin);
|
|
19
|
+
registerSeriesPlugin(heatmapPlugin);
|
|
20
|
+
registerSeriesPlugin(linePlugin);
|
|
21
|
+
registerSeriesPlugin(piePlugin);
|
|
22
|
+
registerSeriesPlugin(radarPlugin);
|
|
23
|
+
registerSeriesPlugin(sankeyPlugin);
|
|
24
|
+
registerSeriesPlugin(scatterPlugin);
|
|
25
|
+
registerSeriesPlugin(treemapPlugin);
|
|
26
|
+
registerSeriesPlugin(waterfallPlugin);
|
|
27
|
+
registerSeriesPlugin(xRangePlugin);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ScaleOrdinal } from 'd3-scale';
|
|
2
|
+
import type { PreparedLegend, PreparedLineSeries } from '../../core/series/types';
|
|
2
3
|
import type { ChartSeriesOptions, LineSeries } from '../../types';
|
|
3
|
-
import type { PreparedLegend, PreparedLineSeries } from './types';
|
|
4
4
|
export declare const DEFAULT_LEGEND_SYMBOL_SIZE = 16;
|
|
5
5
|
export declare const DEFAULT_LINE_WIDTH = 1;
|
|
6
6
|
export declare const DEFAULT_DASH_STYLE: "Solid";
|
|
7
7
|
export declare const DEFAULT_MARKER: {
|
|
8
8
|
enabled: boolean;
|
|
9
|
-
symbol: `${import("
|
|
9
|
+
symbol: `${import("../../core/constants").SymbolType}`;
|
|
10
10
|
borderColor: string;
|
|
11
11
|
borderWidth: number;
|
|
12
12
|
radius: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
2
|
import merge from 'lodash/merge';
|
|
3
|
-
import { DASH_STYLE, DEFAULT_DATALABELS_STYLE, LineCap, LineJoin, seriesRangeSliderOptionsDefaults, } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { DASH_STYLE, DEFAULT_DATALABELS_STYLE, LineCap, LineJoin, seriesRangeSliderOptionsDefaults, } from '../../core/constants';
|
|
4
|
+
import { DEFAULT_DATALABELS_PADDING, DEFAULT_HALO_OPTIONS, DEFAULT_LEGEND_SYMBOL_PADDING, DEFAULT_POINT_MARKER_OPTIONS, } from '../../core/series/constants';
|
|
5
|
+
import { getUniqId } from '../../core/utils';
|
|
6
6
|
export const DEFAULT_LEGEND_SYMBOL_SIZE = 16;
|
|
7
7
|
export const DEFAULT_LINE_WIDTH = 1;
|
|
8
8
|
export const DEFAULT_DASH_STYLE = DASH_STYLE.Solid;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { PreparedLegend, PreparedSeries } from '../../core/series/types';
|
|
1
2
|
import type { ChartSeriesOptions, PieSeries } from '../../types';
|
|
2
|
-
import type { PreparedLegend, PreparedSeries } from './types';
|
|
3
3
|
type PreparePieSeriesArgs = {
|
|
4
|
-
series: PieSeries;
|
|
4
|
+
series: PieSeries[];
|
|
5
5
|
seriesOptions?: ChartSeriesOptions;
|
|
6
6
|
legend: PreparedLegend;
|
|
7
7
|
colors: string[];
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { scaleOrdinal } from 'd3-scale';
|
|
2
|
+
import get from 'lodash/get';
|
|
3
|
+
import { DEFAULT_DATALABELS_STYLE } from '../../core/constants';
|
|
4
|
+
import { DEFAULT_DATALABELS_PADDING } from '../../core/series/constants';
|
|
5
|
+
import { prepareLegendSymbol } from '../../core/series/utils';
|
|
6
|
+
import { getUniqId } from '../../core/utils';
|
|
7
|
+
function prepareSeriesData(series) {
|
|
8
|
+
var _a;
|
|
9
|
+
const nullMode = (_a = series.nullMode) !== null && _a !== void 0 ? _a : 'skip';
|
|
10
|
+
const data = series.data;
|
|
11
|
+
switch (nullMode) {
|
|
12
|
+
case 'zero':
|
|
13
|
+
return data.map((p) => { var _a; return (Object.assign(Object.assign({}, p), { value: (_a = p.value) !== null && _a !== void 0 ? _a : 0 })); });
|
|
14
|
+
case 'skip':
|
|
15
|
+
default:
|
|
16
|
+
return data.filter((p) => p.value !== null);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function preparePieSeries(args) {
|
|
20
|
+
const { series: seriesList, seriesOptions, legend, colors } = args;
|
|
21
|
+
return seriesList.flatMap((series) => {
|
|
22
|
+
const preparedData = prepareSeriesData(series);
|
|
23
|
+
const dataNames = preparedData.map((d) => d.name);
|
|
24
|
+
const colorScale = scaleOrdinal(dataNames, colors);
|
|
25
|
+
const stackId = getUniqId();
|
|
26
|
+
const seriesHoverState = get(seriesOptions, 'pie.states.hover');
|
|
27
|
+
return preparedData.map((dataItem) => {
|
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
29
|
+
const id = getUniqId();
|
|
30
|
+
const result = {
|
|
31
|
+
type: 'pie',
|
|
32
|
+
data: dataItem,
|
|
33
|
+
dataLabels: {
|
|
34
|
+
enabled: get(series, 'dataLabels.enabled', true),
|
|
35
|
+
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_a = series.dataLabels) === null || _a === void 0 ? void 0 : _a.style),
|
|
36
|
+
padding: get(series, 'dataLabels.padding', DEFAULT_DATALABELS_PADDING),
|
|
37
|
+
allowOverlap: get(series, 'dataLabels.allowOverlap', false),
|
|
38
|
+
connectorPadding: get(series, 'dataLabels.connectorPadding', 5),
|
|
39
|
+
connectorShape: get(series, 'dataLabels.connectorShape', 'polyline'),
|
|
40
|
+
distance: get(series, 'dataLabels.distance', 25),
|
|
41
|
+
connectorCurve: get(series, 'dataLabels.connectorCurve', 'basic'),
|
|
42
|
+
html: get(series, 'dataLabels.html', false),
|
|
43
|
+
format: (_b = series.dataLabels) === null || _b === void 0 ? void 0 : _b.format,
|
|
44
|
+
},
|
|
45
|
+
label: dataItem.label,
|
|
46
|
+
value: dataItem.value,
|
|
47
|
+
visible: typeof dataItem.visible === 'boolean' ? dataItem.visible : true,
|
|
48
|
+
name: dataItem.name,
|
|
49
|
+
id,
|
|
50
|
+
color: dataItem.color || colorScale(dataItem.name),
|
|
51
|
+
legend: {
|
|
52
|
+
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,
|
|
53
|
+
symbol: ((_g = dataItem.legend) === null || _g === void 0 ? void 0 : _g.symbol)
|
|
54
|
+
? prepareLegendSymbol(dataItem)
|
|
55
|
+
: prepareLegendSymbol(series),
|
|
56
|
+
groupId: (_j = (_h = dataItem.legend) === null || _h === void 0 ? void 0 : _h.groupId) !== null && _j !== void 0 ? _j : getUniqId(),
|
|
57
|
+
itemText: (_l = (_k = dataItem.legend) === null || _k === void 0 ? void 0 : _k.itemText) !== null && _l !== void 0 ? _l : dataItem.name,
|
|
58
|
+
},
|
|
59
|
+
center: series.center || ['50%', '50%'],
|
|
60
|
+
borderColor: series.borderColor || '',
|
|
61
|
+
borderRadius: (_m = series.borderRadius) !== null && _m !== void 0 ? _m : 0,
|
|
62
|
+
borderWidth: (_o = series.borderWidth) !== null && _o !== void 0 ? _o : 1,
|
|
63
|
+
radius: (_q = (_p = dataItem.radius) !== null && _p !== void 0 ? _p : series.radius) !== null && _q !== void 0 ? _q : '100%',
|
|
64
|
+
innerRadius: series.innerRadius || 0,
|
|
65
|
+
minRadius: series.minRadius,
|
|
66
|
+
stackId,
|
|
67
|
+
states: {
|
|
68
|
+
hover: {
|
|
69
|
+
halo: {
|
|
70
|
+
enabled: get(seriesHoverState, 'halo.enabled', true),
|
|
71
|
+
opacity: get(seriesHoverState, 'halo.opacity', 0.25),
|
|
72
|
+
size: get(seriesHoverState, 'halo.size', 10),
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
renderCustomShape: series.renderCustomShape,
|
|
77
|
+
opacity: get(dataItem, 'opacity', null),
|
|
78
|
+
cursor: get(series, 'cursor', null),
|
|
79
|
+
tooltip: series.tooltip,
|
|
80
|
+
};
|
|
81
|
+
return result;
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { PreparedLegend, PreparedRadarSeries } from '../../core/series/types';
|
|
1
2
|
import type { ChartSeriesOptions, RadarSeries } from '../../types';
|
|
2
|
-
import type { PreparedLegend, PreparedRadarSeries } from './types';
|
|
3
3
|
type PrepareRadarSeriesArgs = {
|
|
4
4
|
series: RadarSeries[];
|
|
5
5
|
seriesOptions?: ChartSeriesOptions;
|
|
@@ -9,7 +9,7 @@ type PrepareRadarSeriesArgs = {
|
|
|
9
9
|
export declare const DEFAULT_MARKER: {
|
|
10
10
|
enabled: boolean;
|
|
11
11
|
radius: number;
|
|
12
|
-
symbol: `${import("
|
|
12
|
+
symbol: `${import("../../core/constants").SymbolType}`;
|
|
13
13
|
borderColor: string;
|
|
14
14
|
borderWidth: number;
|
|
15
15
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { scaleOrdinal } from 'd3-scale';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
3
|
import merge from 'lodash/merge';
|
|
4
|
-
import { DEFAULT_DATALABELS_STYLE } from '
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { DEFAULT_DATALABELS_STYLE } from '../../core/constants';
|
|
5
|
+
import { DEFAULT_DATALABELS_PADDING, DEFAULT_HALO_OPTIONS, DEFAULT_POINT_MARKER_OPTIONS, } from '../../core/series/constants';
|
|
6
|
+
import { prepareLegendSymbol } from '../../core/series/utils';
|
|
7
|
+
import { getUniqId } from '../../core/utils';
|
|
8
8
|
export const DEFAULT_MARKER = Object.assign(Object.assign({}, DEFAULT_POINT_MARKER_OPTIONS), { enabled: true, radius: 2 });
|
|
9
9
|
function prepareMarker(series, seriesOptions) {
|
|
10
10
|
var _a;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScaleOrdinal } from 'd3-scale';
|
|
2
|
+
import type { PreparedLegend, PreparedSankeySeries } from '../../core/series/types';
|
|
2
3
|
import type { ChartSeriesOptions, SankeySeries } from '../../types';
|
|
3
|
-
import type { PreparedLegend, PreparedSankeySeries } from './types';
|
|
4
4
|
type PrepareSankeySeriesArgs = {
|
|
5
5
|
colorScale: ScaleOrdinal<string, string>;
|
|
6
6
|
legend: PreparedLegend;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
|
-
import { DEFAULT_DATALABELS_STYLE } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { DEFAULT_DATALABELS_STYLE } from '../../core/constants';
|
|
3
|
+
import { prepareLegendSymbol } from '../../core/series/utils';
|
|
4
|
+
import { getUniqId } from '../../core/utils';
|
|
5
5
|
export function prepareSankeySeries(args) {
|
|
6
6
|
const { colorScale, legend, series } = args;
|
|
7
7
|
return series.map((s) => {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { prepareScatterSeries } from './prepare';
|
|
2
|
+
export const scatterPlugin = {
|
|
3
|
+
type: 'scatter',
|
|
4
|
+
prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareScatterSeries({
|
|
5
|
+
series: series,
|
|
6
|
+
seriesOptions,
|
|
7
|
+
legend,
|
|
8
|
+
colorScale,
|
|
9
|
+
}),
|
|
10
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScaleOrdinal } from 'd3-scale';
|
|
2
|
+
import type { PreparedLegend, PreparedScatterSeries } from '../../core/series/types';
|
|
2
3
|
import type { ChartSeriesOptions, ScatterSeries } from '../../types';
|
|
3
|
-
import type { PreparedLegend, PreparedScatterSeries } from './types';
|
|
4
4
|
interface PrepareScatterSeriesArgs {
|
|
5
5
|
colorScale: ScaleOrdinal<string, string>;
|
|
6
6
|
series: ScatterSeries[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
2
|
import merge from 'lodash/merge';
|
|
3
|
-
import { DEFAULT_DATALABELS_STYLE, seriesRangeSliderOptionsDefaults } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { DEFAULT_DATALABELS_STYLE, seriesRangeSliderOptionsDefaults } from '../../core/constants';
|
|
4
|
+
import { DEFAULT_DATALABELS_PADDING, DEFAULT_HALO_OPTIONS, DEFAULT_POINT_MARKER_OPTIONS, } from '../../core/series/constants';
|
|
5
|
+
import { prepareLegendSymbol } from '../../core/series/utils';
|
|
6
|
+
import { getSymbolType, getUniqId } from '../../core/utils';
|
|
7
7
|
function prepareMarker(series, seriesOptions, index) {
|
|
8
8
|
const seriesHoverState = get(seriesOptions, 'scatter.states.hover');
|
|
9
9
|
const markerNormalState = Object.assign(Object.assign({}, DEFAULT_POINT_MARKER_OPTIONS), { enabled: true, symbol: series.symbolType || getSymbolType(index) });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScaleOrdinal } from 'd3-scale';
|
|
2
|
+
import type { PreparedLegend, PreparedTreemapSeries } from '../../core/series/types';
|
|
2
3
|
import type { ChartSeriesOptions, TreemapSeries } from '../../types';
|
|
3
|
-
import type { PreparedLegend, PreparedTreemapSeries } from './types';
|
|
4
4
|
type PrepareTreemapSeriesArgs = {
|
|
5
5
|
colorScale: ScaleOrdinal<string, string>;
|
|
6
6
|
legend: PreparedLegend;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
|
-
import { DEFAULT_DATALABELS_STYLE, LayoutAlgorithm } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { DEFAULT_DATALABELS_STYLE, LayoutAlgorithm } from '../../core/constants';
|
|
3
|
+
import { DEFAULT_DATALABELS_PADDING } from '../../core/series/constants';
|
|
4
|
+
import { prepareLegendSymbol } from '../../core/series/utils';
|
|
5
|
+
import { getUniqId } from '../../core/utils';
|
|
6
6
|
export function prepareTreemap(args) {
|
|
7
7
|
const { colorScale, legend, series } = args;
|
|
8
8
|
return series.map((s) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScaleOrdinal } from 'd3-scale';
|
|
2
|
+
import type { PreparedLegend, PreparedSeries } from '../../core/series/types';
|
|
2
3
|
import type { WaterfallSeries } from '../../types';
|
|
3
|
-
import type { PreparedLegend, PreparedSeries } from './types';
|
|
4
4
|
type PrepareWaterfallSeriesArgs = {
|
|
5
5
|
colorScale: ScaleOrdinal<string, string>;
|
|
6
6
|
series: WaterfallSeries[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
|
-
import { DEFAULT_DATALABELS_STYLE } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { DEFAULT_DATALABELS_STYLE } from '../../core/constants';
|
|
3
|
+
import { DEFAULT_DATALABELS_PADDING } from '../../core/series/constants';
|
|
4
|
+
import { prepareLegendSymbol } from '../../core/series/utils';
|
|
5
|
+
import { getUniqId } from '../../core/utils';
|
|
6
6
|
function prepareSeriesData(series) {
|
|
7
7
|
var _a;
|
|
8
8
|
const nullMode = (_a = series.nullMode) !== null && _a !== void 0 ? _a : 'skip';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScaleOrdinal } from 'd3-scale';
|
|
2
|
+
import type { PreparedLegend, PreparedXRangeSeries } from '../../core/series/types';
|
|
2
3
|
import type { ChartSeriesOptions, XRangeSeries } from '../../types';
|
|
3
|
-
import type { PreparedLegend, PreparedXRangeSeries } from './types';
|
|
4
4
|
type PrepareXRangeSeriesArgs = {
|
|
5
5
|
colorScale: ScaleOrdinal<string, string>;
|
|
6
6
|
series: XRangeSeries[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
|
-
import { DASH_STYLE, DEFAULT_DATALABELS_STYLE } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { DASH_STYLE, DEFAULT_DATALABELS_STYLE } from '../../core/constants';
|
|
3
|
+
import { DEFAULT_DATALABELS_PADDING } from '../../core/series/constants';
|
|
4
|
+
import { prepareLegendSymbol } from '../../core/series/utils';
|
|
5
|
+
import { getUniqId } from '../../core/utils';
|
|
6
6
|
export function prepareXRangeSeries(args) {
|
|
7
7
|
const { colorScale, series: seriesList, seriesOptions, legend } = args;
|
|
8
8
|
return seriesList.map((series) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './plugins';
|
package/dist/esm/setup-jsdom.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import './plugins';
|
|
2
2
|
// Global mocks for jsdom environment.
|
|
3
3
|
// Guarded by typeof checks so this file is safe to run in the `node` environment too.
|
|
4
4
|
if (typeof document !== 'undefined') {
|
|
@@ -11,10 +11,36 @@ if (typeof document !== 'undefined') {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
if (typeof ResizeObserver === 'undefined') {
|
|
14
|
+
const resizeObserverCallbacks = new Map();
|
|
14
15
|
global.ResizeObserver = class ResizeObserver {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
constructor(callback) {
|
|
17
|
+
this.callback = callback;
|
|
18
|
+
}
|
|
19
|
+
observe(target) {
|
|
20
|
+
if (!resizeObserverCallbacks.has(target)) {
|
|
21
|
+
resizeObserverCallbacks.set(target, new Set());
|
|
22
|
+
}
|
|
23
|
+
resizeObserverCallbacks.get(target).add(this.callback);
|
|
24
|
+
}
|
|
25
|
+
unobserve(target) {
|
|
26
|
+
var _a;
|
|
27
|
+
(_a = resizeObserverCallbacks.get(target)) === null || _a === void 0 ? void 0 : _a.delete(this.callback);
|
|
28
|
+
}
|
|
29
|
+
disconnect() {
|
|
30
|
+
resizeObserverCallbacks.forEach((callbacks) => {
|
|
31
|
+
callbacks.delete(this.callback);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Test helper: simulate a ResizeObserver notification for the given element.
|
|
37
|
+
*/
|
|
38
|
+
global.__triggerResizeObserver = (target) => {
|
|
39
|
+
const callbacks = resizeObserverCallbacks.get(target);
|
|
40
|
+
if (callbacks) {
|
|
41
|
+
const entry = [{ target, contentRect: target.getBoundingClientRect() }];
|
|
42
|
+
callbacks.forEach((cb) => cb(entry, {}));
|
|
43
|
+
}
|
|
18
44
|
};
|
|
19
45
|
}
|
|
20
46
|
if (typeof HTMLCanvasElement !== 'undefined') {
|