@gravity-ui/charts 1.46.1 → 1.48.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/AxisX/prepare-axis-data.js +9 -6
- package/dist/cjs/components/AxisY/prepare-axis-data.js +11 -4
- package/dist/cjs/components/ChartInner/index.js +1 -0
- package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +1 -0
- package/dist/cjs/components/ChartInner/useChartInnerProps.js +12 -5
- package/dist/cjs/core/axes/types.d.ts +4 -2
- package/dist/cjs/core/axes/x-axis.js +2 -0
- package/dist/cjs/core/axes/y-axis.js +2 -0
- package/dist/cjs/core/brush/index.d.ts +2 -0
- package/dist/cjs/core/brush/index.js +2 -0
- package/dist/cjs/{hooks/useBrush → core/brush}/types.d.ts +2 -2
- package/dist/{esm/hooks/useBrush → cjs/core/brush}/utils.d.ts +1 -1
- package/dist/cjs/core/chart/index.d.ts +1 -0
- package/dist/cjs/core/chart/index.js +1 -0
- package/dist/cjs/core/chart/types.d.ts +8 -0
- package/dist/cjs/core/index.d.ts +3 -0
- package/dist/cjs/core/index.js +3 -0
- package/dist/cjs/core/layout/chart-dimensions.d.ts +1 -1
- package/dist/cjs/core/range-slider/index.d.ts +2 -0
- package/dist/cjs/core/range-slider/index.js +2 -0
- package/dist/cjs/core/range-slider/types.d.ts +4 -0
- package/dist/cjs/{hooks/useRangeSlider → core/range-slider}/utils.d.ts +5 -5
- package/dist/cjs/{hooks/useRangeSlider → core/range-slider}/utils.js +1 -1
- package/dist/cjs/core/scales/x-scale.d.ts +2 -2
- package/dist/cjs/core/scales/y-scale.js +21 -0
- package/dist/cjs/core/series/prepare-legend.d.ts +1 -1
- package/dist/cjs/core/series/prepare-scatter.js +11 -3
- package/dist/cjs/core/series/types.d.ts +8 -0
- package/dist/cjs/core/shapes/area/prepare-data.js +8 -50
- package/dist/cjs/core/shapes/area/renderer.js +8 -14
- package/dist/cjs/core/shapes/area/types.d.ts +6 -5
- package/dist/cjs/core/shapes/bar-x/prepare-data.js +49 -35
- package/dist/cjs/core/shapes/bar-x/renderer.js +6 -12
- package/dist/cjs/core/shapes/bar-y/renderer.js +6 -12
- package/dist/cjs/core/shapes/data-labels.d.ts +15 -0
- package/dist/cjs/core/shapes/data-labels.js +15 -0
- package/dist/cjs/core/shapes/funnel/renderer.js +6 -11
- package/dist/cjs/core/shapes/heatmap/prepare-data.js +1 -0
- package/dist/cjs/core/shapes/heatmap/renderer.js +6 -11
- package/dist/cjs/core/shapes/heatmap/types.d.ts +1 -0
- package/dist/cjs/core/shapes/line/prepare-data.js +22 -59
- package/dist/cjs/core/shapes/line/renderer.js +7 -13
- package/dist/cjs/core/shapes/line/types.d.ts +5 -4
- package/dist/cjs/core/shapes/radar/renderer.js +8 -12
- package/dist/cjs/core/shapes/sankey/renderer.js +6 -12
- package/dist/cjs/core/shapes/scatter/prepare-data.d.ts +5 -2
- package/dist/cjs/core/shapes/scatter/prepare-data.js +43 -4
- package/dist/cjs/core/shapes/scatter/renderer.d.ts +2 -2
- package/dist/cjs/core/shapes/scatter/renderer.js +9 -1
- package/dist/cjs/core/shapes/scatter/types.d.ts +6 -1
- package/dist/cjs/core/shapes/utils.d.ts +24 -0
- package/dist/cjs/core/shapes/utils.js +48 -0
- package/dist/cjs/core/shapes/waterfall/renderer.js +6 -12
- package/dist/cjs/core/shapes/x-range/renderer.js +7 -13
- package/dist/cjs/core/types/chart/axis.d.ts +20 -0
- package/dist/cjs/core/types/chart/base.d.ts +17 -3
- package/dist/cjs/core/types/chart/scatter.d.ts +2 -0
- package/dist/cjs/core/types/chart/tooltip.d.ts +3 -3
- package/dist/cjs/core/types/formatter.d.ts +1 -40
- package/dist/cjs/core/utils/data-labels.d.ts +46 -0
- package/dist/cjs/core/utils/data-labels.js +64 -0
- package/dist/cjs/core/utils/format.d.ts +2 -2
- package/dist/cjs/core/utils/get-closest-data.js +13 -8
- package/dist/cjs/core/utils/index.d.ts +1 -0
- package/dist/cjs/core/utils/index.js +1 -0
- package/dist/cjs/core/zoom/index.d.ts +2 -0
- package/dist/cjs/core/zoom/index.js +2 -0
- package/dist/{esm/hooks/useZoom → cjs/core/zoom}/utils.d.ts +3 -3
- package/dist/{esm/hooks/useZoom → cjs/core/zoom}/utils.js +1 -1
- package/dist/cjs/core/zoom/zoom.d.ts +3 -3
- package/dist/cjs/hooks/index.d.ts +2 -2
- package/dist/cjs/hooks/index.js +2 -2
- package/dist/cjs/hooks/types.d.ts +2 -8
- package/dist/cjs/hooks/useBrush/index.d.ts +1 -1
- package/dist/cjs/hooks/useBrush/index.js +1 -1
- package/dist/cjs/hooks/useRangeSlider/index.js +3 -3
- package/dist/cjs/hooks/useRangeSlider/types.d.ts +5 -7
- package/dist/cjs/hooks/useShapes/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/index.js +5 -3
- package/dist/cjs/hooks/useShapes/scatter/index.d.ts +2 -2
- package/dist/cjs/hooks/useShapes/scatter/index.js +4 -1
- package/dist/cjs/hooks/useShapes/styles.css +8 -25
- package/dist/cjs/hooks/useShapes/utils.d.ts +1 -1
- package/dist/cjs/hooks/useZoom/index.d.ts +1 -1
- package/dist/cjs/hooks/useZoom/index.js +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/libs/format-number/index.js +82 -14
- package/dist/cjs/libs/format-number/presets.d.ts +40 -0
- package/dist/cjs/libs/format-number/presets.js +66 -0
- package/dist/cjs/libs/format-number/types.d.ts +82 -3
- package/dist/esm/components/AxisX/prepare-axis-data.js +9 -6
- package/dist/esm/components/AxisY/prepare-axis-data.js +11 -4
- package/dist/esm/components/ChartInner/index.js +1 -0
- package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +1 -0
- package/dist/esm/components/ChartInner/useChartInnerProps.js +12 -5
- package/dist/esm/core/axes/types.d.ts +4 -2
- package/dist/esm/core/axes/x-axis.js +2 -0
- package/dist/esm/core/axes/y-axis.js +2 -0
- package/dist/esm/core/brush/index.d.ts +2 -0
- package/dist/esm/core/brush/index.js +2 -0
- package/dist/esm/{hooks/useBrush → core/brush}/types.d.ts +2 -2
- package/dist/esm/core/brush/types.js +1 -0
- package/dist/{cjs/hooks/useBrush → esm/core/brush}/utils.d.ts +1 -1
- package/dist/esm/core/chart/index.d.ts +1 -0
- package/dist/esm/core/chart/index.js +1 -0
- package/dist/esm/core/chart/types.d.ts +8 -0
- package/dist/esm/core/chart/types.js +1 -0
- package/dist/esm/core/index.d.ts +3 -0
- package/dist/esm/core/index.js +3 -0
- package/dist/esm/core/layout/chart-dimensions.d.ts +1 -1
- package/dist/esm/core/range-slider/index.d.ts +2 -0
- package/dist/esm/core/range-slider/index.js +2 -0
- package/dist/esm/core/range-slider/types.d.ts +4 -0
- package/dist/esm/core/range-slider/types.js +1 -0
- package/dist/esm/{hooks/useRangeSlider → core/range-slider}/utils.d.ts +5 -5
- package/dist/esm/{hooks/useRangeSlider → core/range-slider}/utils.js +1 -1
- package/dist/esm/core/scales/x-scale.d.ts +2 -2
- package/dist/esm/core/scales/y-scale.js +21 -0
- package/dist/esm/core/series/prepare-legend.d.ts +1 -1
- package/dist/esm/core/series/prepare-scatter.js +11 -3
- package/dist/esm/core/series/types.d.ts +8 -0
- package/dist/esm/core/shapes/area/prepare-data.js +8 -50
- package/dist/esm/core/shapes/area/renderer.js +8 -14
- package/dist/esm/core/shapes/area/types.d.ts +6 -5
- package/dist/esm/core/shapes/bar-x/prepare-data.js +49 -35
- package/dist/esm/core/shapes/bar-x/renderer.js +6 -12
- package/dist/esm/core/shapes/bar-y/renderer.js +6 -12
- package/dist/esm/core/shapes/data-labels.d.ts +15 -0
- package/dist/esm/core/shapes/data-labels.js +15 -0
- package/dist/esm/core/shapes/funnel/renderer.js +6 -11
- package/dist/esm/core/shapes/heatmap/prepare-data.js +1 -0
- package/dist/esm/core/shapes/heatmap/renderer.js +6 -11
- package/dist/esm/core/shapes/heatmap/types.d.ts +1 -0
- package/dist/esm/core/shapes/line/prepare-data.js +22 -59
- package/dist/esm/core/shapes/line/renderer.js +7 -13
- package/dist/esm/core/shapes/line/types.d.ts +5 -4
- package/dist/esm/core/shapes/radar/renderer.js +8 -12
- package/dist/esm/core/shapes/sankey/renderer.js +6 -12
- package/dist/esm/core/shapes/scatter/prepare-data.d.ts +5 -2
- package/dist/esm/core/shapes/scatter/prepare-data.js +43 -4
- package/dist/esm/core/shapes/scatter/renderer.d.ts +2 -2
- package/dist/esm/core/shapes/scatter/renderer.js +9 -1
- package/dist/esm/core/shapes/scatter/types.d.ts +6 -1
- package/dist/esm/core/shapes/utils.d.ts +24 -0
- package/dist/esm/core/shapes/utils.js +48 -0
- package/dist/esm/core/shapes/waterfall/renderer.js +6 -12
- package/dist/esm/core/shapes/x-range/renderer.js +7 -13
- package/dist/esm/core/types/chart/axis.d.ts +20 -0
- package/dist/esm/core/types/chart/base.d.ts +17 -3
- package/dist/esm/core/types/chart/scatter.d.ts +2 -0
- package/dist/esm/core/types/chart/tooltip.d.ts +3 -3
- package/dist/esm/core/types/formatter.d.ts +1 -40
- package/dist/esm/core/utils/data-labels.d.ts +46 -0
- package/dist/esm/core/utils/data-labels.js +64 -0
- package/dist/esm/core/utils/format.d.ts +2 -2
- package/dist/esm/core/utils/get-closest-data.js +13 -8
- package/dist/esm/core/utils/index.d.ts +1 -0
- package/dist/esm/core/utils/index.js +1 -0
- package/dist/esm/core/zoom/index.d.ts +2 -0
- package/dist/esm/core/zoom/index.js +2 -0
- package/dist/esm/core/zoom/types.js +1 -0
- package/dist/{cjs/hooks/useZoom → esm/core/zoom}/utils.d.ts +3 -3
- package/dist/{cjs/hooks/useZoom → esm/core/zoom}/utils.js +1 -1
- package/dist/esm/core/zoom/zoom.d.ts +3 -3
- package/dist/esm/hooks/index.d.ts +2 -2
- package/dist/esm/hooks/index.js +2 -2
- package/dist/esm/hooks/types.d.ts +2 -8
- package/dist/esm/hooks/useBrush/index.d.ts +1 -1
- package/dist/esm/hooks/useBrush/index.js +1 -1
- package/dist/esm/hooks/useRangeSlider/index.js +3 -3
- package/dist/esm/hooks/useRangeSlider/types.d.ts +5 -7
- package/dist/esm/hooks/useShapes/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/index.js +5 -3
- package/dist/esm/hooks/useShapes/scatter/index.d.ts +2 -2
- package/dist/esm/hooks/useShapes/scatter/index.js +4 -1
- package/dist/esm/hooks/useShapes/styles.css +8 -25
- package/dist/esm/hooks/useShapes/utils.d.ts +1 -1
- package/dist/esm/hooks/useZoom/index.d.ts +1 -1
- package/dist/esm/hooks/useZoom/index.js +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/libs/format-number/index.js +82 -14
- package/dist/esm/libs/format-number/presets.d.ts +40 -0
- package/dist/esm/libs/format-number/presets.js +66 -0
- package/dist/esm/libs/format-number/types.d.ts +82 -3
- package/package.json +1 -1
- /package/dist/cjs/{hooks/useBrush → core/brush}/types.js +0 -0
- /package/dist/cjs/{hooks/useBrush → core/brush}/utils.js +0 -0
- /package/dist/cjs/{hooks/useZoom → core/chart}/types.js +0 -0
- /package/dist/{esm/hooks/useBrush → cjs/core/range-slider}/types.js +0 -0
- /package/dist/cjs/{hooks/useZoom → core/zoom}/types.d.ts +0 -0
- /package/dist/{esm/hooks/useZoom → cjs/core/zoom}/types.js +0 -0
- /package/dist/esm/{hooks/useBrush → core/brush}/utils.js +0 -0
- /package/dist/esm/{hooks/useZoom → core/zoom}/types.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AxisCrosshair, AxisPlotBand, AxisPlotShape, BaseTextStyle, ChartAxis, ChartAxisLabels, ChartAxisRangeSlider, ChartAxisTitleAlignment, ChartAxisTitleRotation, ChartAxisType, DeepRequired, MeaningfulAny, PlotLayerPlacement } from '../../types';
|
|
1
|
+
import type { AxisCrosshair, AxisPlotBand, AxisPlotShape, BaseTextStyle, ChartAxis, ChartAxisLabels, ChartAxisRangeSlider, ChartAxisTitleAlignment, ChartAxisTitleRotation, ChartAxisType, DeepRequired, MeaningfulAny, PlotBandAlign, PlotLayerPlacement } from '../../types';
|
|
2
2
|
import type { DashStyle } from '../constants';
|
|
3
3
|
type PreparedAxisLabels = Omit<ChartAxisLabels, 'enabled' | 'padding' | 'style' | 'autoRotation'> & Required<Pick<ChartAxisLabels, 'enabled' | 'padding' | 'margin' | 'rotation' | 'html'>> & {
|
|
4
4
|
style: BaseTextStyle;
|
|
@@ -8,7 +8,8 @@ type PreparedAxisLabels = Omit<ChartAxisLabels, 'enabled' | 'padding' | 'style'
|
|
|
8
8
|
lineHeight: number;
|
|
9
9
|
maxWidth: number;
|
|
10
10
|
};
|
|
11
|
-
export type PreparedAxisPlotBand = Required<AxisPlotBand
|
|
11
|
+
export type PreparedAxisPlotBand = Required<Omit<AxisPlotBand, 'size' | 'align'>> & {
|
|
12
|
+
align: PlotBandAlign;
|
|
12
13
|
custom?: MeaningfulAny;
|
|
13
14
|
label: {
|
|
14
15
|
text: string;
|
|
@@ -16,6 +17,7 @@ export type PreparedAxisPlotBand = Required<AxisPlotBand> & {
|
|
|
16
17
|
padding: number;
|
|
17
18
|
qa?: string;
|
|
18
19
|
};
|
|
20
|
+
size?: number | string;
|
|
19
21
|
};
|
|
20
22
|
type PreparedAxisCrosshair = Required<AxisCrosshair>;
|
|
21
23
|
export type PreparedAxisPlotLine = {
|
|
@@ -166,6 +166,8 @@ export const getPreparedXAxis = async ({ xAxis, seriesData, width, boundsWidth,
|
|
|
166
166
|
opacity: get(d, 'opacity', 1),
|
|
167
167
|
from: get(d, 'from', 0),
|
|
168
168
|
to: get(d, 'to', 0),
|
|
169
|
+
align: get(d, 'align', 'start'),
|
|
170
|
+
size: d.size,
|
|
169
171
|
layerPlacement: get(d, 'layerPlacement', 'before'),
|
|
170
172
|
custom: d.custom,
|
|
171
173
|
label: prepareAxisPlotLabel(d),
|
|
@@ -181,6 +181,8 @@ export const getPreparedYAxis = ({ height, boundsHeight, width, seriesData, yAxi
|
|
|
181
181
|
opacity: get(d, 'opacity', 1),
|
|
182
182
|
from: get(d, 'from', 0),
|
|
183
183
|
to: get(d, 'to', 0),
|
|
184
|
+
align: get(d, 'align', 'start'),
|
|
185
|
+
size: d.size,
|
|
184
186
|
layerPlacement: get(d, 'layerPlacement', 'before'),
|
|
185
187
|
custom: d.custom,
|
|
186
188
|
label: prepareAxisPlotLabel(d),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BrushBehavior } from 'd3-brush';
|
|
2
|
-
import type { ZoomType } from '
|
|
3
|
-
import type { ChartBrush, DeepRequired } from '
|
|
2
|
+
import type { ZoomType } from '../constants';
|
|
3
|
+
import type { ChartBrush, DeepRequired } from '../types';
|
|
4
4
|
export type BrushSelection = [number, number] | [[number, number], [number, number]];
|
|
5
5
|
export interface BrushArea {
|
|
6
6
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BrushBehavior } from 'd3-brush';
|
|
2
|
-
import type { ChartBrush, DeepRequired } from '
|
|
2
|
+
import type { ChartBrush, DeepRequired } from '../types';
|
|
3
3
|
import type { BrushSelection } from './types';
|
|
4
4
|
export declare function isOneDimensionalSelection(selection?: BrushSelection | null): selection is [number, number];
|
|
5
5
|
export declare function setBrushBorder(this: SVGGElement, _brushInstance: BrushBehavior<unknown>, selection: BrushSelection | null, options: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChartBrush, ChartMargin, ChartZoom, DeepRequired } from '../types';
|
|
2
|
+
export type PreparedZoom = DeepRequired<Omit<ChartZoom, 'enabled' | 'brush'>> & DeepRequired<{
|
|
3
|
+
brush: ChartBrush;
|
|
4
|
+
}>;
|
|
5
|
+
export type PreparedChart = {
|
|
6
|
+
margin: ChartMargin;
|
|
7
|
+
zoom: PreparedZoom | null;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/core/index.d.ts
CHANGED
package/dist/esm/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { PreparedChart } from '../../hooks/types';
|
|
2
1
|
import type { ChartMargin, LegendConfig } from '../../types';
|
|
3
2
|
import type { PreparedXAxis, PreparedYAxis } from '../axes/types';
|
|
3
|
+
import type { PreparedChart } from '../chart/types';
|
|
4
4
|
import type { PreparedLegend, PreparedSeries } from '../series';
|
|
5
5
|
export declare const getBoundsWidth: (args: {
|
|
6
6
|
chartWidth: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { PreparedChart } from '../types';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
1
|
+
import type { PreparedRangeSlider } from '../axes/types';
|
|
2
|
+
import type { BrushSelection } from '../brush/types';
|
|
3
|
+
import type { PreparedChart } from '../chart/types';
|
|
4
|
+
import type { ChartScale } from '../scales/types';
|
|
5
|
+
import type { PreparedLegend } from '../series/types';
|
|
6
6
|
import type { RangeSliderState } from './types';
|
|
7
7
|
export declare function getRangeSliderOffsetTop(args: {
|
|
8
8
|
height: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { RangeSliderState } from '../../hooks';
|
|
2
|
-
import type { ChartAxis, ChartSeries } from '../../types';
|
|
3
1
|
import type { PreparedAxis } from '../axes/types';
|
|
2
|
+
import type { RangeSliderState } from '../range-slider/types';
|
|
4
3
|
import type { PreparedSeries } from '../series';
|
|
4
|
+
import type { ChartAxis, ChartSeries } from '../types';
|
|
5
5
|
export declare function createXScale(args: {
|
|
6
6
|
axis: PreparedAxis | ChartAxis;
|
|
7
7
|
boundsWidth: number;
|
|
@@ -218,6 +218,27 @@ export function createYScale(args) {
|
|
|
218
218
|
else {
|
|
219
219
|
yMax = hasSeriesWithVolumeOnYAxis ? Math.max(yMaxDomain, 0) : yMaxDomain;
|
|
220
220
|
}
|
|
221
|
+
// When the user pins only one of min/max on the wrong side of all data,
|
|
222
|
+
// d3 produces either an inverted scale (yMax<yMin, silently flips the
|
|
223
|
+
// axis) or a degenerate one (yMax===yMin, maps everything to the range
|
|
224
|
+
// midpoint); both leave phantom hover targets inside an empty plot.
|
|
225
|
+
// Expand the auto-computed side so the scale stays sane. Only applies
|
|
226
|
+
// when the opposite bound is auto-derived — if the user supplied both
|
|
227
|
+
// bounds, trust the explicit range and let point filtering hide the
|
|
228
|
+
// rest. Comparison uses the raw data extent because upstream coercions
|
|
229
|
+
// like volume-series `yMax = Math.max(yMaxDomain, 0)` can make the
|
|
230
|
+
// post-coerced yMin/yMax lie about where data actually sits.
|
|
231
|
+
// Logarithmic has its own guard.
|
|
232
|
+
if (axis.type === 'linear') {
|
|
233
|
+
const minIsUserSet = typeof yMinPropsOrState === 'number';
|
|
234
|
+
const maxIsUserSet = typeof yMaxPropsOrState === 'number';
|
|
235
|
+
if (minIsUserSet && !maxIsUserSet && yMaxDomain < yMin) {
|
|
236
|
+
yMax = yMin + Math.max(Math.abs(yMin), 1);
|
|
237
|
+
}
|
|
238
|
+
else if (maxIsUserSet && !minIsUserSet && yMinDomain > yMax) {
|
|
239
|
+
yMin = yMax - Math.max(Math.abs(yMax), 1);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
221
242
|
const scaleFn = axis.type === 'logarithmic' ? scaleLog : scaleLinear;
|
|
222
243
|
let scale = scaleFn().domain([yMin, yMax]).range(range);
|
|
223
244
|
let offsetMin = 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PreparedChart } from '../../hooks/types';
|
|
2
1
|
import type { ChartData } from '../../types';
|
|
2
|
+
import type { PreparedChart } from '../chart/types';
|
|
3
3
|
import type { LegendItem, PreparedLegend, PreparedSeries } from './types';
|
|
4
4
|
export declare function getPreparedLegend(args: {
|
|
5
5
|
legend: ChartData['legend'];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
2
|
import merge from 'lodash/merge';
|
|
3
|
-
import { seriesRangeSliderOptionsDefaults } from '../constants';
|
|
3
|
+
import { DEFAULT_DATALABELS_STYLE, seriesRangeSliderOptionsDefaults } from '../constants';
|
|
4
4
|
import { getSymbolType, getUniqId } from '../utils';
|
|
5
|
-
import { DEFAULT_HALO_OPTIONS, DEFAULT_POINT_MARKER_OPTIONS } from './constants';
|
|
5
|
+
import { DEFAULT_DATALABELS_PADDING, DEFAULT_HALO_OPTIONS, DEFAULT_POINT_MARKER_OPTIONS, } from './constants';
|
|
6
6
|
import { prepareLegendSymbol } from './utils';
|
|
7
7
|
function prepareMarker(series, seriesOptions, index) {
|
|
8
8
|
const seriesHoverState = get(seriesOptions, 'scatter.states.hover');
|
|
@@ -39,7 +39,7 @@ function prepareSeriesData(series) {
|
|
|
39
39
|
export function prepareScatterSeries(args) {
|
|
40
40
|
const { colorScale, series, seriesOptions, legend } = args;
|
|
41
41
|
return series.map((s, index) => {
|
|
42
|
-
var _a, _b, _c, _d, _e, _f;
|
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
43
43
|
const id = getUniqId();
|
|
44
44
|
const name = 'name' in s && s.name ? s.name : '';
|
|
45
45
|
const symbolType = s.symbolType || getSymbolType(index);
|
|
@@ -56,6 +56,14 @@ export function prepareScatterSeries(args) {
|
|
|
56
56
|
itemText: (_f = (_e = s.legend) === null || _e === void 0 ? void 0 : _e.itemText) !== null && _f !== void 0 ? _f : name,
|
|
57
57
|
},
|
|
58
58
|
data: prepareSeriesData(s),
|
|
59
|
+
dataLabels: {
|
|
60
|
+
enabled: ((_g = s.dataLabels) === null || _g === void 0 ? void 0 : _g.enabled) || false,
|
|
61
|
+
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_h = s.dataLabels) === null || _h === void 0 ? void 0 : _h.style),
|
|
62
|
+
padding: get(s, 'dataLabels.padding', DEFAULT_DATALABELS_PADDING),
|
|
63
|
+
allowOverlap: get(s, 'dataLabels.allowOverlap', false),
|
|
64
|
+
html: get(s, 'dataLabels.html', false),
|
|
65
|
+
format: (_j = s.dataLabels) === null || _j === void 0 ? void 0 : _j.format,
|
|
66
|
+
},
|
|
59
67
|
marker: prepareMarker(s, seriesOptions, index),
|
|
60
68
|
cursor: get(s, 'cursor', null),
|
|
61
69
|
yAxis: get(s, 'yAxis', 0),
|
|
@@ -101,6 +101,14 @@ type BasePreparedAxisRelatedSeries = {
|
|
|
101
101
|
export type PreparedScatterSeries = {
|
|
102
102
|
type: ScatterSeries['type'];
|
|
103
103
|
data: ScatterSeriesData[];
|
|
104
|
+
dataLabels: {
|
|
105
|
+
enabled: boolean;
|
|
106
|
+
style: BaseTextStyle;
|
|
107
|
+
padding: number;
|
|
108
|
+
allowOverlap: boolean;
|
|
109
|
+
html: boolean;
|
|
110
|
+
format?: ValueFormat;
|
|
111
|
+
};
|
|
104
112
|
marker: {
|
|
105
113
|
states: {
|
|
106
114
|
normal: {
|
|
@@ -2,9 +2,8 @@ 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 { getXValue, getYValue } from '../../shapes/utils';
|
|
6
|
-
import { getDataCategoryValue,
|
|
7
|
-
import { getFormattedValue } from '../../utils/format';
|
|
5
|
+
import { getXValue, getYValue, markHiddenPointsOutOfYRange } from '../../shapes/utils';
|
|
6
|
+
import { getDataCategoryValue, preparePointDataLabels } from '../../utils';
|
|
8
7
|
function getXValues(series, xAxis, xScale) {
|
|
9
8
|
const categories = xAxis.categories || [];
|
|
10
9
|
const xValues = series.reduce((acc, s) => {
|
|
@@ -30,52 +29,6 @@ function getXValues(series, xAxis, xScale) {
|
|
|
30
29
|
}
|
|
31
30
|
return sort(Array.from(xValues), (d) => d[1]);
|
|
32
31
|
}
|
|
33
|
-
async function prepareDataLabels({ series, points, xMax, yAxisTop, isOutsideBounds, }) {
|
|
34
|
-
var _a;
|
|
35
|
-
const svgLabels = [];
|
|
36
|
-
const htmlLabels = [];
|
|
37
|
-
const getTextSize = getTextSizeFn({ style: series.dataLabels.style });
|
|
38
|
-
for (let pointsIndex = 0; pointsIndex < points.length; pointsIndex++) {
|
|
39
|
-
const point = points[pointsIndex];
|
|
40
|
-
if (point.y === null || isOutsideBounds(point.x, point.y)) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
const text = getFormattedValue(Object.assign({ value: (_a = point.data.label) !== null && _a !== void 0 ? _a : point.data.y }, series.dataLabels));
|
|
44
|
-
if (series.dataLabels.html) {
|
|
45
|
-
const size = await getLabelsSize({
|
|
46
|
-
labels: [text],
|
|
47
|
-
style: series.dataLabels.style,
|
|
48
|
-
html: series.dataLabels.html,
|
|
49
|
-
});
|
|
50
|
-
const labelSize = { width: size.maxWidth, height: size.maxHeight };
|
|
51
|
-
const x = Math.min(xMax - labelSize.width, Math.max(0, point.x - labelSize.width / 2));
|
|
52
|
-
const y = Math.max(yAxisTop, point.y - series.dataLabels.padding - labelSize.height);
|
|
53
|
-
htmlLabels.push({
|
|
54
|
-
x,
|
|
55
|
-
y,
|
|
56
|
-
content: text,
|
|
57
|
-
size: labelSize,
|
|
58
|
-
style: series.dataLabels.style,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
const labelSize = await getTextSize(text);
|
|
63
|
-
const x = Math.min(xMax - labelSize.width, Math.max(0, point.x - labelSize.width / 2));
|
|
64
|
-
const y = Math.max(yAxisTop, point.y - series.dataLabels.padding - labelSize.height + labelSize.hangingOffset);
|
|
65
|
-
svgLabels.push({
|
|
66
|
-
text,
|
|
67
|
-
x,
|
|
68
|
-
y,
|
|
69
|
-
style: series.dataLabels.style,
|
|
70
|
-
size: labelSize,
|
|
71
|
-
textAnchor: 'start',
|
|
72
|
-
series,
|
|
73
|
-
active: true,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return { svgLabels, htmlLabels };
|
|
78
|
-
}
|
|
79
32
|
export const prepareAreaData = async (args) => {
|
|
80
33
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
81
34
|
const { series, seriesOptions, xAxis, xScale, yAxis, yScale, split, isOutsideBounds, isRangeSlider, } = args;
|
|
@@ -315,6 +268,11 @@ export const prepareAreaData = async (args) => {
|
|
|
315
268
|
}
|
|
316
269
|
return result;
|
|
317
270
|
}, []);
|
|
271
|
+
markHiddenPointsOutOfYRange({
|
|
272
|
+
points,
|
|
273
|
+
yScale: seriesYScale,
|
|
274
|
+
yAxisTop,
|
|
275
|
+
});
|
|
318
276
|
seriesStackData.push({
|
|
319
277
|
annotations,
|
|
320
278
|
points,
|
|
@@ -335,7 +293,7 @@ export const prepareAreaData = async (args) => {
|
|
|
335
293
|
const currentYAxis = yAxis[item.series.yAxis];
|
|
336
294
|
const itemYAxisTop = ((_p = split.plots[currentYAxis.plotIndex]) === null || _p === void 0 ? void 0 : _p.top) || 0;
|
|
337
295
|
if (item.series.dataLabels.enabled && !isRangeSlider) {
|
|
338
|
-
const labelsData = await
|
|
296
|
+
const labelsData = await preparePointDataLabels({
|
|
339
297
|
series: item.series,
|
|
340
298
|
points: item.points,
|
|
341
299
|
xMax,
|
|
@@ -5,6 +5,7 @@ import get from 'lodash/get';
|
|
|
5
5
|
import { block } from '../../../utils';
|
|
6
6
|
import { filterOverlappingLabels } from '../../utils';
|
|
7
7
|
import { renderAnnotations } from '../annotation';
|
|
8
|
+
import { renderDataLabels } from '../data-labels';
|
|
8
9
|
import { getMarkerHaloVisibility, getMarkerVisibility, renderMarker, selectMarkerHalo, selectMarkerSymbol, setMarker, } from '../marker';
|
|
9
10
|
import { setActiveState } from '../utils';
|
|
10
11
|
const b = block('area');
|
|
@@ -17,7 +18,7 @@ export function renderArea(elements, preparedData, seriesOptions, allowOverlapDa
|
|
|
17
18
|
const inactiveOptions = get(seriesOptions, 'area.states.inactive');
|
|
18
19
|
const line = lineGenerator()
|
|
19
20
|
.x((d) => d.x)
|
|
20
|
-
.defined((d) => d.y !== null)
|
|
21
|
+
.defined((d) => d.y !== null && !d.hiddenInLine)
|
|
21
22
|
.y((d) => d.y);
|
|
22
23
|
plotSvgElement.selectAll('*').remove();
|
|
23
24
|
markersSvgElement.selectAll('*').remove();
|
|
@@ -37,7 +38,7 @@ export function renderArea(elements, preparedData, seriesOptions, allowOverlapDa
|
|
|
37
38
|
.attr('stroke-linejoin', 'round')
|
|
38
39
|
.attr('stroke-linecap', 'round');
|
|
39
40
|
const area = areaGenerator()
|
|
40
|
-
.defined((d) => d.y !== null)
|
|
41
|
+
.defined((d) => d.y !== null && !d.hiddenInLine)
|
|
41
42
|
.x((d) => d.x)
|
|
42
43
|
.y0((d) => d.y0)
|
|
43
44
|
.y1((d) => d.y);
|
|
@@ -53,18 +54,11 @@ export function renderArea(elements, preparedData, seriesOptions, allowOverlapDa
|
|
|
53
54
|
if (!allowOverlapDataLabels) {
|
|
54
55
|
dataLabels = filterOverlappingLabels(dataLabels);
|
|
55
56
|
}
|
|
56
|
-
const labelsSelection =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
.attr('class', b('label'))
|
|
62
|
-
.attr('x', (d) => d.x)
|
|
63
|
-
.attr('y', (d) => d.y)
|
|
64
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
65
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
66
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
67
|
-
.style('fill', (d) => d.style.fontColor || null);
|
|
57
|
+
const labelsSelection = renderDataLabels({
|
|
58
|
+
container: plotSvgElement,
|
|
59
|
+
data: dataLabels,
|
|
60
|
+
className: b('label'),
|
|
61
|
+
});
|
|
68
62
|
const markers = preparedData.reduce((acc, d) => acc.concat(d.markers), []);
|
|
69
63
|
const markerSelection = markersSvgElement
|
|
70
64
|
.selectAll('marker')
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { AreaSeriesData, HtmlItem, LabelData } from '../../../types';
|
|
2
2
|
import type { AnnotationAnchor, PreparedAnnotation, PreparedAreaSeries } from '../../series/types';
|
|
3
3
|
export type PointData = {
|
|
4
|
-
y0: number;
|
|
5
|
-
x: number;
|
|
6
|
-
y: number | null;
|
|
7
|
-
data: AreaSeriesData;
|
|
8
|
-
series: PreparedAreaSeries;
|
|
9
4
|
annotation?: PreparedAnnotation;
|
|
10
5
|
color?: string;
|
|
6
|
+
data: AreaSeriesData;
|
|
7
|
+
hiddenInLine?: boolean;
|
|
8
|
+
series: PreparedAreaSeries;
|
|
9
|
+
x: number;
|
|
10
|
+
y: number | null;
|
|
11
|
+
y0: number;
|
|
11
12
|
};
|
|
12
13
|
export type MarkerPointData = PointData & {
|
|
13
14
|
y: number;
|
|
@@ -3,37 +3,59 @@ import get from 'lodash/get';
|
|
|
3
3
|
import { prepareAnnotation } from '../../series/prepare-annotation';
|
|
4
4
|
import { getSeriesStackId } from '../../series/utils';
|
|
5
5
|
import { MIN_BAR_GAP, MIN_BAR_GROUP_GAP, MIN_BAR_WIDTH } from '../../shapes/bar-constants';
|
|
6
|
-
import { getDataCategoryValue, getLabelsSize } from '../../utils';
|
|
6
|
+
import { getDataCategoryValue, getLabelsSize, getTextSizeFn } from '../../utils';
|
|
7
7
|
import { getBandSize } from '../../utils/band-size';
|
|
8
8
|
import { getFormattedValue } from '../../utils/format';
|
|
9
9
|
const isSeriesDataValid = (d) => d.y !== null;
|
|
10
10
|
async function getLabelData(d, xMax) {
|
|
11
11
|
var _a;
|
|
12
12
|
if (!d.series.dataLabels.enabled) {
|
|
13
|
-
return
|
|
13
|
+
return {};
|
|
14
14
|
}
|
|
15
15
|
const text = getFormattedValue(Object.assign({ value: (_a = d.data.label) !== null && _a !== void 0 ? _a : d.data.y }, d.series.dataLabels));
|
|
16
16
|
const style = d.series.dataLabels.style;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
if (d.series.dataLabels.html) {
|
|
18
|
+
const { maxHeight: height, maxWidth: width } = await getLabelsSize({
|
|
19
|
+
labels: [text],
|
|
20
|
+
style,
|
|
21
|
+
html: true,
|
|
22
|
+
});
|
|
23
|
+
let y = Math.max(height, d.y - d.series.dataLabels.padding);
|
|
24
|
+
if (d.series.dataLabels.inside) {
|
|
25
|
+
y = d.y + d.height / 2;
|
|
26
|
+
}
|
|
27
|
+
const centerX = Math.min(xMax - width / 2, Math.max(width / 2, d.x + d.width / 2));
|
|
28
|
+
return {
|
|
29
|
+
htmlLabel: {
|
|
30
|
+
content: text,
|
|
31
|
+
x: centerX - width / 2,
|
|
32
|
+
y: y - height,
|
|
33
|
+
size: { width, height },
|
|
34
|
+
style,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const getTextSize = getTextSizeFn({ style });
|
|
40
|
+
const { width, height, hangingOffset } = await getTextSize(text);
|
|
41
|
+
let y = Math.max(hangingOffset, d.y - height + hangingOffset - d.series.dataLabels.padding);
|
|
42
|
+
if (d.series.dataLabels.inside) {
|
|
43
|
+
const centerY = d.y + d.height / 2;
|
|
44
|
+
y = Math.min(d.y + d.height - height + hangingOffset, centerY - height / 2 + hangingOffset);
|
|
45
|
+
}
|
|
46
|
+
const centerX = Math.min(xMax - width / 2, Math.max(width / 2, d.x + d.width / 2));
|
|
47
|
+
return {
|
|
48
|
+
svgLabel: {
|
|
49
|
+
text,
|
|
50
|
+
x: centerX,
|
|
51
|
+
y,
|
|
52
|
+
style,
|
|
53
|
+
size: { width, height, hangingOffset },
|
|
54
|
+
textAnchor: 'middle',
|
|
55
|
+
series: d.series,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
26
58
|
}
|
|
27
|
-
const centerX = Math.min(xMax - width / 2, Math.max(width / 2, d.x + d.width / 2));
|
|
28
|
-
return {
|
|
29
|
-
text,
|
|
30
|
-
x: html ? centerX - width / 2 : centerX,
|
|
31
|
-
y: html ? y - height : y,
|
|
32
|
-
style,
|
|
33
|
-
size: { width, height },
|
|
34
|
-
textAnchor: 'middle',
|
|
35
|
-
series: d.series,
|
|
36
|
-
};
|
|
37
59
|
}
|
|
38
60
|
export const prepareBarXData = async (args) => {
|
|
39
61
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
@@ -232,20 +254,12 @@ export const prepareBarXData = async (args) => {
|
|
|
232
254
|
if (barData.series.dataLabels.enabled &&
|
|
233
255
|
!isRangeSlider &&
|
|
234
256
|
(!isBarOutsideBounds || isZeroValue)) {
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
content: label.text,
|
|
242
|
-
size: label.size,
|
|
243
|
-
style: label.style,
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
barData.svgLabels.push(label);
|
|
248
|
-
}
|
|
257
|
+
const { svgLabel, htmlLabel } = await getLabelData(barData, xMax);
|
|
258
|
+
if (svgLabel) {
|
|
259
|
+
barData.svgLabels.push(svgLabel);
|
|
260
|
+
}
|
|
261
|
+
if (htmlLabel) {
|
|
262
|
+
barData.htmlLabels.push(htmlLabel);
|
|
249
263
|
}
|
|
250
264
|
}
|
|
251
265
|
}
|
|
@@ -4,6 +4,7 @@ import get from 'lodash/get';
|
|
|
4
4
|
import { block } from '../../../utils';
|
|
5
5
|
import { filterOverlappingLabels } from '../../utils';
|
|
6
6
|
import { renderAnnotations } from '../annotation';
|
|
7
|
+
import { renderDataLabels } from '../data-labels';
|
|
7
8
|
import { getRectPath } from '../utils';
|
|
8
9
|
const b = block('bar-x');
|
|
9
10
|
export function renderBarX(elements, preparedData, seriesOptions, allowOverlapDataLabels, dispatcher) {
|
|
@@ -37,18 +38,11 @@ export function renderBarX(elements, preparedData, seriesOptions, allowOverlapDa
|
|
|
37
38
|
if (!allowOverlapDataLabels) {
|
|
38
39
|
dataLabels = filterOverlappingLabels(dataLabels);
|
|
39
40
|
}
|
|
40
|
-
const labelSelection =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.attr('class', b('label'))
|
|
46
|
-
.attr('x', (d) => d.x)
|
|
47
|
-
.attr('y', (d) => d.y)
|
|
48
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
49
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
50
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
51
|
-
.style('fill', (d) => d.style.fontColor || null);
|
|
41
|
+
const labelSelection = renderDataLabels({
|
|
42
|
+
container: svgElement,
|
|
43
|
+
data: dataLabels,
|
|
44
|
+
className: b('label'),
|
|
45
|
+
});
|
|
52
46
|
const annotationAnchors = [];
|
|
53
47
|
for (const d of preparedData) {
|
|
54
48
|
if (d.annotation) {
|
|
@@ -2,6 +2,7 @@ import { color } from 'd3-color';
|
|
|
2
2
|
import { select } from 'd3-selection';
|
|
3
3
|
import get from 'lodash/get';
|
|
4
4
|
import { block } from '../../../utils';
|
|
5
|
+
import { renderDataLabels } from '../data-labels';
|
|
5
6
|
import { getAdjustedRectBorderPath, getAdjustedRectPath } from './utils';
|
|
6
7
|
const b = block('bar-y');
|
|
7
8
|
export function renderBarY(elements, preparedData, seriesOptions, dispatcher) {
|
|
@@ -31,18 +32,11 @@ export function renderBarY(elements, preparedData, seriesOptions, dispatcher) {
|
|
|
31
32
|
.attr('fill-rule', 'evenodd')
|
|
32
33
|
.attr('opacity', (d) => d.data.opacity || null)
|
|
33
34
|
.attr('pointer-events', 'none');
|
|
34
|
-
const labelSelection =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.attr('class', b('label'))
|
|
40
|
-
.attr('x', (d) => d.x)
|
|
41
|
-
.attr('y', (d) => d.y)
|
|
42
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
43
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
44
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
45
|
-
.style('fill', (d) => d.style.fontColor || null);
|
|
35
|
+
const labelSelection = renderDataLabels({
|
|
36
|
+
container: svgElement,
|
|
37
|
+
data: dataLabels,
|
|
38
|
+
className: b('label'),
|
|
39
|
+
});
|
|
46
40
|
const hoverOptions = get(seriesOptions, 'bar-y.states.hover');
|
|
47
41
|
const inactiveOptions = get(seriesOptions, 'bar-y.states.inactive');
|
|
48
42
|
function handleShapeHover(data) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Selection } from 'd3-selection';
|
|
2
|
+
import type { BaseTextStyle } from '../types/chart/base';
|
|
3
|
+
type RenderableLabelData = {
|
|
4
|
+
text: string;
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
textAnchor: 'start' | 'end' | 'middle';
|
|
8
|
+
style: BaseTextStyle;
|
|
9
|
+
};
|
|
10
|
+
export declare function renderDataLabels<T extends RenderableLabelData>(args: {
|
|
11
|
+
container: Selection<SVGGElement, unknown, null, undefined>;
|
|
12
|
+
data: T[];
|
|
13
|
+
className: string;
|
|
14
|
+
}): Selection<SVGTextElement, T, SVGGElement, unknown>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function renderDataLabels(args) {
|
|
2
|
+
const { container, data, className } = args;
|
|
3
|
+
return container
|
|
4
|
+
.selectAll('text')
|
|
5
|
+
.data(data)
|
|
6
|
+
.join('text')
|
|
7
|
+
.html((d) => d.text)
|
|
8
|
+
.attr('class', className)
|
|
9
|
+
.attr('x', (d) => d.x)
|
|
10
|
+
.attr('y', (d) => d.y)
|
|
11
|
+
.attr('text-anchor', (d) => d.textAnchor)
|
|
12
|
+
.style('font-size', (d) => d.style.fontSize)
|
|
13
|
+
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
14
|
+
.style('fill', (d) => d.style.fontColor || null);
|
|
15
|
+
}
|