@gravity-ui/charts 1.24.2 → 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +1 -1
- package/dist/cjs/components/ChartInner/useChartInnerProps.js +0 -1
- package/dist/cjs/components/Legend/index.js +11 -11
- package/dist/cjs/hooks/useAxis/index.js +0 -1
- package/dist/cjs/hooks/useAxis/x-axis.d.ts +1 -3
- package/dist/cjs/hooks/useAxis/x-axis.js +3 -4
- package/dist/cjs/hooks/useAxisScales/index.d.ts +1 -3
- package/dist/cjs/hooks/useAxisScales/index.js +6 -35
- package/dist/cjs/hooks/useRangeSlider/index.js +0 -1
- package/dist/cjs/hooks/useSeries/index.js +8 -8
- package/dist/cjs/hooks/useSeries/prepare-area.js +7 -5
- package/dist/cjs/hooks/useSeries/prepare-bar-x.js +8 -6
- package/dist/cjs/hooks/useSeries/prepare-bar-y.d.ts +2 -0
- package/dist/cjs/hooks/useSeries/prepare-bar-y.js +7 -5
- package/dist/cjs/hooks/useSeries/prepare-funnel.js +14 -10
- package/dist/cjs/hooks/useSeries/prepare-heatmap.js +9 -7
- package/dist/cjs/hooks/useSeries/prepare-legend.js +6 -4
- package/dist/cjs/hooks/useSeries/prepare-line.js +6 -4
- package/dist/cjs/hooks/useSeries/prepare-pie.js +10 -6
- package/dist/cjs/hooks/useSeries/prepare-radar.js +7 -5
- package/dist/cjs/hooks/useSeries/prepare-sankey.js +3 -1
- package/dist/cjs/hooks/useSeries/prepare-scatter.js +4 -1
- package/dist/cjs/hooks/useSeries/prepare-treemap.js +4 -2
- package/dist/cjs/hooks/useSeries/prepare-waterfall.js +13 -8
- package/dist/cjs/hooks/useSeries/types.d.ts +5 -0
- package/dist/cjs/hooks/useSeries/utils.d.ts +7 -3
- package/dist/cjs/hooks/useSeries/utils.js +2 -2
- package/dist/cjs/hooks/useShapes/area/prepare-data.js +3 -0
- package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +24 -46
- package/dist/cjs/hooks/useShapes/bar-y/prepare-data.js +0 -3
- package/dist/cjs/hooks/useShapes/waterfall/prepare-data.js +4 -1
- package/dist/cjs/hooks/utils/bar-x.d.ts +3 -2
- package/dist/cjs/hooks/utils/bar-x.js +8 -6
- package/dist/cjs/hooks/utils/bar-y.d.ts +0 -1
- package/dist/cjs/hooks/utils/bar-y.js +3 -3
- package/dist/cjs/types/chart/area.d.ts +3 -3
- package/dist/cjs/types/chart/axis.d.ts +1 -0
- package/dist/cjs/types/chart/bar-x.d.ts +3 -3
- package/dist/cjs/types/chart/bar-y.d.ts +3 -3
- package/dist/cjs/types/chart/base.d.ts +9 -0
- package/dist/cjs/types/chart/funnel.d.ts +10 -6
- package/dist/cjs/types/chart/heatmap.d.ts +3 -3
- package/dist/cjs/types/chart/legend.d.ts +11 -9
- package/dist/cjs/types/chart/line.d.ts +3 -3
- package/dist/cjs/types/chart/pie.d.ts +10 -6
- package/dist/cjs/types/chart/radar.d.ts +3 -3
- package/dist/cjs/types/chart/sankey.d.ts +3 -3
- package/dist/cjs/types/chart/scatter.d.ts +3 -3
- package/dist/cjs/types/chart/treemap.d.ts +3 -3
- package/dist/cjs/types/chart/waterfall.d.ts +2 -2
- package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +1 -1
- package/dist/esm/components/ChartInner/useChartInnerProps.js +0 -1
- package/dist/esm/components/Legend/index.js +11 -11
- package/dist/esm/hooks/useAxis/index.js +0 -1
- package/dist/esm/hooks/useAxis/x-axis.d.ts +1 -3
- package/dist/esm/hooks/useAxis/x-axis.js +3 -4
- package/dist/esm/hooks/useAxisScales/index.d.ts +1 -3
- package/dist/esm/hooks/useAxisScales/index.js +6 -35
- package/dist/esm/hooks/useRangeSlider/index.js +0 -1
- package/dist/esm/hooks/useSeries/index.js +8 -8
- package/dist/esm/hooks/useSeries/prepare-area.js +7 -5
- package/dist/esm/hooks/useSeries/prepare-bar-x.js +8 -6
- package/dist/esm/hooks/useSeries/prepare-bar-y.d.ts +2 -0
- package/dist/esm/hooks/useSeries/prepare-bar-y.js +7 -5
- package/dist/esm/hooks/useSeries/prepare-funnel.js +14 -10
- package/dist/esm/hooks/useSeries/prepare-heatmap.js +9 -7
- package/dist/esm/hooks/useSeries/prepare-legend.js +6 -4
- package/dist/esm/hooks/useSeries/prepare-line.js +6 -4
- package/dist/esm/hooks/useSeries/prepare-pie.js +10 -6
- package/dist/esm/hooks/useSeries/prepare-radar.js +7 -5
- package/dist/esm/hooks/useSeries/prepare-sankey.js +3 -1
- package/dist/esm/hooks/useSeries/prepare-scatter.js +4 -1
- package/dist/esm/hooks/useSeries/prepare-treemap.js +4 -2
- package/dist/esm/hooks/useSeries/prepare-waterfall.js +13 -8
- package/dist/esm/hooks/useSeries/types.d.ts +5 -0
- package/dist/esm/hooks/useSeries/utils.d.ts +7 -3
- package/dist/esm/hooks/useSeries/utils.js +2 -2
- package/dist/esm/hooks/useShapes/area/prepare-data.js +3 -0
- package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +24 -46
- package/dist/esm/hooks/useShapes/bar-y/prepare-data.js +0 -3
- package/dist/esm/hooks/useShapes/waterfall/prepare-data.js +4 -1
- package/dist/esm/hooks/utils/bar-x.d.ts +3 -2
- package/dist/esm/hooks/utils/bar-x.js +8 -6
- package/dist/esm/hooks/utils/bar-y.d.ts +0 -1
- package/dist/esm/hooks/utils/bar-y.js +3 -3
- package/dist/esm/types/chart/area.d.ts +3 -3
- package/dist/esm/types/chart/axis.d.ts +1 -0
- package/dist/esm/types/chart/bar-x.d.ts +3 -3
- package/dist/esm/types/chart/bar-y.d.ts +3 -3
- package/dist/esm/types/chart/base.d.ts +9 -0
- package/dist/esm/types/chart/funnel.d.ts +10 -6
- package/dist/esm/types/chart/heatmap.d.ts +3 -3
- package/dist/esm/types/chart/legend.d.ts +11 -9
- package/dist/esm/types/chart/line.d.ts +3 -3
- package/dist/esm/types/chart/pie.d.ts +10 -6
- package/dist/esm/types/chart/radar.d.ts +3 -3
- package/dist/esm/types/chart/sankey.d.ts +3 -3
- package/dist/esm/types/chart/scatter.d.ts +3 -3
- package/dist/esm/types/chart/treemap.d.ts +3 -3
- package/dist/esm/types/chart/waterfall.d.ts +2 -2
- package/package.json +1 -1
|
@@ -52,7 +52,7 @@ export declare function useChartInnerProps(props: Props): {
|
|
|
52
52
|
xScale: import("../../hooks").ChartScale | undefined;
|
|
53
53
|
yAxis: (Omit<import("../..").ChartAxis, "type" | "labels" | "plotLines" | "plotBands"> & {
|
|
54
54
|
type: import("../..").ChartAxisType;
|
|
55
|
-
labels: Omit<import("../..").ChartAxisLabels, "enabled" | "style" | "padding" | "autoRotation"> & Required<Pick<import("../..").ChartAxisLabels, "
|
|
55
|
+
labels: Omit<import("../..").ChartAxisLabels, "enabled" | "style" | "padding" | "autoRotation"> & Required<Pick<import("../..").ChartAxisLabels, "margin" | "html" | "enabled" | "padding" | "rotation">> & {
|
|
56
56
|
style: import("../..").BaseTextStyle;
|
|
57
57
|
rotation: number;
|
|
58
58
|
height: number;
|
|
@@ -115,7 +115,6 @@ function renderLegendSymbol(args) {
|
|
|
115
115
|
}
|
|
116
116
|
case 'symbol': {
|
|
117
117
|
const y = legendLineHeight / 2;
|
|
118
|
-
const translateX = x + d.symbol.width / 2;
|
|
119
118
|
element
|
|
120
119
|
.append('svg:path')
|
|
121
120
|
.attr('d', () => {
|
|
@@ -124,7 +123,9 @@ function renderLegendSymbol(args) {
|
|
|
124
123
|
// https://d3js.org/d3-shape/symbol#symbol
|
|
125
124
|
return symbol(scatterSymbol, d.symbol.width * d.symbol.width)();
|
|
126
125
|
})
|
|
127
|
-
.attr('transform', () => {
|
|
126
|
+
.attr('transform', (_d, _index, elements) => {
|
|
127
|
+
var _a, _b;
|
|
128
|
+
const translateX = x + ((_b = (_a = elements[0]) === null || _a === void 0 ? void 0 : _a.getBBox()) === null || _b === void 0 ? void 0 : _b.width) / 2;
|
|
128
129
|
return 'translate(' + translateX + ',' + y + ')';
|
|
129
130
|
})
|
|
130
131
|
.attr('class', className)
|
|
@@ -143,7 +144,7 @@ export const Legend = (props) => {
|
|
|
143
144
|
}, [config.maxWidth]);
|
|
144
145
|
React.useEffect(() => {
|
|
145
146
|
async function prepareLegend() {
|
|
146
|
-
var _a, _b, _c,
|
|
147
|
+
var _a, _b, _c, _e, _f, _g, _h, _j;
|
|
147
148
|
if (!ref.current || !htmlLayout) {
|
|
148
149
|
return;
|
|
149
150
|
}
|
|
@@ -158,7 +159,7 @@ export const Legend = (props) => {
|
|
|
158
159
|
let legendWidth = 0;
|
|
159
160
|
if (legend.type === 'discrete') {
|
|
160
161
|
const start = (_b = (_a = config.pagination) === null || _a === void 0 ? void 0 : _a.pages[pageIndex]) === null || _b === void 0 ? void 0 : _b.start;
|
|
161
|
-
const end = (
|
|
162
|
+
const end = (_e = (_c = config.pagination) === null || _c === void 0 ? void 0 : _c.pages[pageIndex]) === null || _e === void 0 ? void 0 : _e.end;
|
|
162
163
|
const pageItems = typeof start === 'number' && typeof end === 'number'
|
|
163
164
|
? items.slice(start, end)
|
|
164
165
|
: items;
|
|
@@ -174,7 +175,7 @@ export const Legend = (props) => {
|
|
|
174
175
|
.append('g')
|
|
175
176
|
.attr('class', b('item'))
|
|
176
177
|
.on('click', function (e, d) {
|
|
177
|
-
onItemClick({ name: d.name, metaKey: e.metaKey });
|
|
178
|
+
onItemClick({ id: d.id, name: d.name, metaKey: e.metaKey });
|
|
178
179
|
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate();
|
|
179
180
|
});
|
|
180
181
|
const getXPosition = (i) => {
|
|
@@ -213,7 +214,7 @@ export const Legend = (props) => {
|
|
|
213
214
|
return '0px';
|
|
214
215
|
})
|
|
215
216
|
.on('click', function (e, d) {
|
|
216
|
-
onItemClick({ name: d.name, metaKey: e.metaKey });
|
|
217
|
+
onItemClick({ id: d.id, name: d.name, metaKey: e.metaKey });
|
|
217
218
|
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate();
|
|
218
219
|
})[legend.html ? 'html' : 'text'](function (d) {
|
|
219
220
|
return d.name;
|
|
@@ -282,7 +283,7 @@ export const Legend = (props) => {
|
|
|
282
283
|
}
|
|
283
284
|
else {
|
|
284
285
|
// gradient rect
|
|
285
|
-
const domain = (
|
|
286
|
+
const domain = (_f = legend.colorScale.domain) !== null && _f !== void 0 ? _f : [];
|
|
286
287
|
const rectHeight = CONTINUOUS_LEGEND_SIZE.height;
|
|
287
288
|
svgElement.call(createGradientRect, {
|
|
288
289
|
y: legend.title.height + legend.title.margin,
|
|
@@ -351,9 +352,9 @@ export const Legend = (props) => {
|
|
|
351
352
|
.attr('class', legendTitleClassname)
|
|
352
353
|
.append('text')
|
|
353
354
|
.attr('dx', dx)
|
|
354
|
-
.attr('font-weight', (
|
|
355
|
-
.attr('font-size', (
|
|
356
|
-
.attr('fill', (
|
|
355
|
+
.attr('font-weight', (_g = legend.title.style.fontWeight) !== null && _g !== void 0 ? _g : null)
|
|
356
|
+
.attr('font-size', (_h = legend.title.style.fontSize) !== null && _h !== void 0 ? _h : null)
|
|
357
|
+
.attr('fill', (_j = legend.title.style.fontColor) !== null && _j !== void 0 ? _j : null)
|
|
357
358
|
.style('dominant-baseline', 'text-before-edge')
|
|
358
359
|
.html(legend.title.text);
|
|
359
360
|
}
|
|
@@ -364,7 +365,6 @@ export const Legend = (props) => {
|
|
|
364
365
|
align: legend.align,
|
|
365
366
|
width: config.maxWidth,
|
|
366
367
|
contentWidth: legendWidth,
|
|
367
|
-
offsetLeft: config.offset.left,
|
|
368
368
|
});
|
|
369
369
|
svgElement
|
|
370
370
|
.attr('transform', `translate(${[left, config.offset.top].join(',')})`)
|
|
@@ -18,7 +18,6 @@ export function useAxis(props) {
|
|
|
18
18
|
xAxis,
|
|
19
19
|
width,
|
|
20
20
|
seriesData,
|
|
21
|
-
seriesOptions: preparedSeriesOptions,
|
|
22
21
|
});
|
|
23
22
|
let estimatedBoundsHeight = boundsHeight !== null && boundsHeight !== void 0 ? boundsHeight : height;
|
|
24
23
|
if (preparedXAxis && typeof boundsHeight !== 'number') {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { ChartSeries, ChartXAxis } from '../../types';
|
|
2
|
-
import type { PreparedSeriesOptions } from '../useSeries/types';
|
|
3
2
|
import type { PreparedXAxis } from './types';
|
|
4
|
-
export declare const getPreparedXAxis: ({ xAxis, seriesData,
|
|
3
|
+
export declare const getPreparedXAxis: ({ xAxis, seriesData, width, }: {
|
|
5
4
|
xAxis?: ChartXAxis;
|
|
6
5
|
seriesData: ChartSeries[];
|
|
7
|
-
seriesOptions: PreparedSeriesOptions;
|
|
8
6
|
width: number;
|
|
9
7
|
}) => Promise<PreparedXAxis | null>;
|
|
@@ -4,8 +4,8 @@ import { calculateCos, calculateNumericProperty, formatAxisTickLabel, getAxisIte
|
|
|
4
4
|
import { createXScale } from '../useAxisScales';
|
|
5
5
|
import { getPreparedRangeSlider } from './range-slider';
|
|
6
6
|
import { prepareAxisPlotLabel } from './utils';
|
|
7
|
-
async function setLabelSettings({ axis, seriesData,
|
|
8
|
-
const scale = createXScale({ axis, series: seriesData,
|
|
7
|
+
async function setLabelSettings({ axis, seriesData, width, autoRotation = true, }) {
|
|
8
|
+
const scale = createXScale({ axis, series: seriesData, boundsWidth: width });
|
|
9
9
|
if (!scale) {
|
|
10
10
|
axis.labels.height = 0;
|
|
11
11
|
axis.labels.rotation = 0;
|
|
@@ -56,7 +56,7 @@ function getMaxPaddingBySeries({ series }) {
|
|
|
56
56
|
}
|
|
57
57
|
return 0.01;
|
|
58
58
|
}
|
|
59
|
-
export const getPreparedXAxis = async ({ xAxis, seriesData,
|
|
59
|
+
export const getPreparedXAxis = async ({ xAxis, seriesData, width, }) => {
|
|
60
60
|
var _a, _b, _c, _d, _e;
|
|
61
61
|
const hasAxisRelatedSeries = seriesData.some(isAxisRelatedSeries);
|
|
62
62
|
if (!hasAxisRelatedSeries) {
|
|
@@ -159,7 +159,6 @@ export const getPreparedXAxis = async ({ xAxis, seriesData, seriesOptions, width
|
|
|
159
159
|
await setLabelSettings({
|
|
160
160
|
axis: preparedXAxis,
|
|
161
161
|
seriesData,
|
|
162
|
-
seriesOptions,
|
|
163
162
|
width,
|
|
164
163
|
autoRotation: (_e = xAxis === null || xAxis === void 0 ? void 0 : xAxis.labels) === null || _e === void 0 ? void 0 : _e.autoRotation,
|
|
165
164
|
});
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { ScaleBand, ScaleLinear, ScaleTime } from 'd3';
|
|
2
|
-
import type { PreparedAxis, PreparedSeries,
|
|
2
|
+
import type { PreparedAxis, PreparedSeries, PreparedSplit, RangeSliderState, ZoomState } from '../../hooks';
|
|
3
3
|
import type { ChartAxis, ChartSeries } from '../../types';
|
|
4
4
|
export type ChartScale = ScaleLinear<number, number> | ScaleBand<string> | ScaleTime<number, number>;
|
|
5
5
|
type Args = {
|
|
6
6
|
boundsWidth: number;
|
|
7
7
|
boundsHeight: number;
|
|
8
8
|
series: PreparedSeries[];
|
|
9
|
-
seriesOptions: PreparedSeriesOptions;
|
|
10
9
|
xAxis: PreparedAxis | null;
|
|
11
10
|
yAxis: PreparedAxis[];
|
|
12
11
|
split: PreparedSplit;
|
|
@@ -27,7 +26,6 @@ export declare function createXScale(args: {
|
|
|
27
26
|
axis: PreparedAxis | ChartAxis;
|
|
28
27
|
boundsWidth: number;
|
|
29
28
|
series: (PreparedSeries | ChartSeries)[];
|
|
30
|
-
seriesOptions: PreparedSeriesOptions;
|
|
31
29
|
rangeSliderState?: RangeSliderState;
|
|
32
30
|
zoomStateX?: [number, number];
|
|
33
31
|
}): ScaleBand<string> | ScaleLinear<number, number, never> | ScaleTime<number, number, never> | undefined;
|
|
@@ -3,7 +3,6 @@ import { extent, scaleBand, scaleLinear, scaleLog, scaleUtc } from 'd3';
|
|
|
3
3
|
import get from 'lodash/get';
|
|
4
4
|
import { DEFAULT_AXIS_TYPE, SERIES_TYPE } from '../../constants';
|
|
5
5
|
import { CHART_SERIES_WITH_VOLUME_ON_Y_AXIS, getAxisCategories, getAxisHeight, getDataCategoryValue, getDefaultMaxXAxisValue, getDefaultMinXAxisValue, getDomainDataXBySeries, getDomainDataYBySeries, getOnlyVisibleSeries, isAxisRelatedSeries, isSeriesWithCategoryValues, } from '../../utils';
|
|
6
|
-
import { getBarXLayoutForNumericScale, groupBarXDataByXValue } from '../utils/bar-x';
|
|
7
6
|
import { getBandSize } from '../utils/get-band-size';
|
|
8
7
|
import { checkIsPointDomain, getMinMaxPropsOrState, hasOnlyMarkerSeries } from './utils';
|
|
9
8
|
const X_AXIS_ZOOM_PADDING = 0.02;
|
|
@@ -214,32 +213,19 @@ function calculateXAxisPadding(series) {
|
|
|
214
213
|
return result;
|
|
215
214
|
}
|
|
216
215
|
function isSeriesWithXAxisOffset(series) {
|
|
217
|
-
const types = [SERIES_TYPE.Heatmap];
|
|
216
|
+
const types = [SERIES_TYPE.Heatmap, SERIES_TYPE.BarX];
|
|
218
217
|
return series.some((s) => types.includes(s.type));
|
|
219
218
|
}
|
|
220
|
-
function getXScaleRange({ boundsWidth,
|
|
219
|
+
function getXScaleRange({ boundsWidth, hasZoomX }) {
|
|
221
220
|
const xAxisZoomPadding = boundsWidth * X_AXIS_ZOOM_PADDING;
|
|
222
221
|
const xRange = [0, boundsWidth];
|
|
223
222
|
const xRangeZoom = [0 + xAxisZoomPadding, boundsWidth - xAxisZoomPadding];
|
|
224
223
|
const range = hasZoomX ? xRangeZoom : xRange;
|
|
225
|
-
const barXSeries = series.filter((s) => s.type === SERIES_TYPE.BarX);
|
|
226
|
-
if (barXSeries.length) {
|
|
227
|
-
const groupedData = groupBarXDataByXValue(barXSeries, axis);
|
|
228
|
-
if (Object.keys(groupedData).length > 1) {
|
|
229
|
-
const { bandSize } = getBarXLayoutForNumericScale({
|
|
230
|
-
plotWidth: boundsWidth,
|
|
231
|
-
groupedData,
|
|
232
|
-
seriesOptions,
|
|
233
|
-
});
|
|
234
|
-
const offset = bandSize / 2;
|
|
235
|
-
return [range[0] + offset, range[1] - offset];
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
224
|
return range;
|
|
239
225
|
}
|
|
240
226
|
// eslint-disable-next-line complexity
|
|
241
227
|
export function createXScale(args) {
|
|
242
|
-
const { axis, boundsWidth, series,
|
|
228
|
+
const { axis, boundsWidth, series, rangeSliderState, zoomStateX } = args;
|
|
243
229
|
const [xMinPropsOrState, xMaxPropsOrState] = getMinMaxPropsOrState({
|
|
244
230
|
axis,
|
|
245
231
|
maxValues: [zoomStateX === null || zoomStateX === void 0 ? void 0 : zoomStateX[1], rangeSliderState === null || rangeSliderState === void 0 ? void 0 : rangeSliderState.max],
|
|
@@ -260,10 +246,7 @@ export function createXScale(args) {
|
|
|
260
246
|
const xAxisMaxPadding = boundsWidth * maxPadding + calculateXAxisPadding(series);
|
|
261
247
|
const range = getXScaleRange({
|
|
262
248
|
boundsWidth,
|
|
263
|
-
series,
|
|
264
|
-
seriesOptions,
|
|
265
249
|
hasZoomX,
|
|
266
|
-
axis,
|
|
267
250
|
});
|
|
268
251
|
switch (axis.order) {
|
|
269
252
|
case 'sortDesc':
|
|
@@ -407,7 +390,7 @@ export function createXScale(args) {
|
|
|
407
390
|
throw new Error('Failed to create xScale');
|
|
408
391
|
}
|
|
409
392
|
const createScales = (args) => {
|
|
410
|
-
const { boundsWidth, boundsHeight, rangeSliderState, series,
|
|
393
|
+
const { boundsWidth, boundsHeight, rangeSliderState, series, split, xAxis, yAxis, zoomState } = args;
|
|
411
394
|
let visibleSeries = getOnlyVisibleSeries(series);
|
|
412
395
|
// Reassign to all series in case of all series unselected,
|
|
413
396
|
// otherwise we will get an empty space without grid
|
|
@@ -419,7 +402,6 @@ const createScales = (args) => {
|
|
|
419
402
|
boundsWidth,
|
|
420
403
|
rangeSliderState,
|
|
421
404
|
series: visibleSeries,
|
|
422
|
-
seriesOptions,
|
|
423
405
|
zoomStateX: zoomState === null || zoomState === void 0 ? void 0 : zoomState.x,
|
|
424
406
|
})
|
|
425
407
|
: undefined,
|
|
@@ -445,7 +427,7 @@ const createScales = (args) => {
|
|
|
445
427
|
* Uses to create scales for axis related series
|
|
446
428
|
*/
|
|
447
429
|
export const useAxisScales = (args) => {
|
|
448
|
-
const { boundsWidth, boundsHeight, rangeSliderState, series,
|
|
430
|
+
const { boundsWidth, boundsHeight, rangeSliderState, series, split, xAxis, yAxis, zoomState } = args;
|
|
449
431
|
return React.useMemo(() => {
|
|
450
432
|
let xScale;
|
|
451
433
|
let yScale;
|
|
@@ -456,7 +438,6 @@ export const useAxisScales = (args) => {
|
|
|
456
438
|
boundsHeight,
|
|
457
439
|
rangeSliderState,
|
|
458
440
|
series,
|
|
459
|
-
seriesOptions,
|
|
460
441
|
split,
|
|
461
442
|
xAxis,
|
|
462
443
|
yAxis,
|
|
@@ -464,15 +445,5 @@ export const useAxisScales = (args) => {
|
|
|
464
445
|
}));
|
|
465
446
|
}
|
|
466
447
|
return { xScale, yScale };
|
|
467
|
-
}, [
|
|
468
|
-
boundsWidth,
|
|
469
|
-
boundsHeight,
|
|
470
|
-
rangeSliderState,
|
|
471
|
-
series,
|
|
472
|
-
seriesOptions,
|
|
473
|
-
split,
|
|
474
|
-
xAxis,
|
|
475
|
-
yAxis,
|
|
476
|
-
zoomState,
|
|
477
|
-
]);
|
|
448
|
+
}, [boundsWidth, boundsHeight, rangeSliderState, series, split, xAxis, yAxis, zoomState]);
|
|
478
449
|
};
|
|
@@ -9,7 +9,7 @@ const useVisibleSeries = ({ preparedSeries, activeLegendItems, }) => {
|
|
|
9
9
|
return React.useMemo(() => {
|
|
10
10
|
return preparedSeries.map((singleSeries) => {
|
|
11
11
|
if (singleSeries.legend.enabled) {
|
|
12
|
-
return Object.assign(Object.assign({}, singleSeries), { visible: activeLegendItems.includes(singleSeries.
|
|
12
|
+
return Object.assign(Object.assign({}, singleSeries), { visible: activeLegendItems.includes(singleSeries.legend.groupId) });
|
|
13
13
|
}
|
|
14
14
|
return singleSeries;
|
|
15
15
|
});
|
|
@@ -61,15 +61,15 @@ export const useSeries = (args) => {
|
|
|
61
61
|
}, [seriesData, seriesOptions, preparedLegend, colors]);
|
|
62
62
|
const prevOriginalSeriesData = usePrevious(originalSeriesData);
|
|
63
63
|
const chartSeries = useVisibleSeries({ preparedSeries, activeLegendItems });
|
|
64
|
-
const handleLegendItemClick = React.useCallback(({
|
|
64
|
+
const handleLegendItemClick = React.useCallback(({ id, metaKey }) => {
|
|
65
65
|
const allItems = getAllLegendItems(preparedSeries);
|
|
66
|
-
const onlyItemSelected = activeLegendItems.length === 1 && activeLegendItems.includes(
|
|
66
|
+
const onlyItemSelected = activeLegendItems.length === 1 && activeLegendItems.includes(id);
|
|
67
67
|
let nextActiveLegendItems;
|
|
68
|
-
if (metaKey && activeLegendItems.includes(
|
|
69
|
-
nextActiveLegendItems = activeLegendItems.filter((item) => item !==
|
|
68
|
+
if (metaKey && activeLegendItems.includes(id)) {
|
|
69
|
+
nextActiveLegendItems = activeLegendItems.filter((item) => item !== id);
|
|
70
70
|
}
|
|
71
|
-
else if (metaKey && !activeLegendItems.includes(
|
|
72
|
-
nextActiveLegendItems = activeLegendItems.concat(
|
|
71
|
+
else if (metaKey && !activeLegendItems.includes(id)) {
|
|
72
|
+
nextActiveLegendItems = activeLegendItems.concat(id);
|
|
73
73
|
}
|
|
74
74
|
else if (onlyItemSelected && allItems.length === 1) {
|
|
75
75
|
nextActiveLegendItems = [];
|
|
@@ -78,7 +78,7 @@ export const useSeries = (args) => {
|
|
|
78
78
|
nextActiveLegendItems = allItems;
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
|
-
nextActiveLegendItems = [
|
|
81
|
+
nextActiveLegendItems = [id];
|
|
82
82
|
}
|
|
83
83
|
setActiveLegendItems(nextActiveLegendItems);
|
|
84
84
|
}, [preparedSeries, activeLegendItems]);
|
|
@@ -32,7 +32,6 @@ function prepareSeriesData(series) {
|
|
|
32
32
|
case 'zero':
|
|
33
33
|
return data.map((p) => { var _a; return (Object.assign(Object.assign({}, p), { y: (_a = p.y) !== null && _a !== void 0 ? _a : 0 })); });
|
|
34
34
|
case 'connect':
|
|
35
|
-
return data.filter((p) => p.y !== null);
|
|
36
35
|
case 'skip':
|
|
37
36
|
default:
|
|
38
37
|
return data;
|
|
@@ -43,7 +42,7 @@ export function prepareArea(args) {
|
|
|
43
42
|
const defaultAreaWidth = get(seriesOptions, 'area.lineWidth', DEFAULT_LINE_WIDTH);
|
|
44
43
|
const defaultOpacity = get(seriesOptions, 'area.opacity', 0.75);
|
|
45
44
|
return seriesList.map((series) => {
|
|
46
|
-
var _a, _b, _c;
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
47
46
|
const id = getUniqId();
|
|
48
47
|
const name = series.name || '';
|
|
49
48
|
const color = series.color || colorScale(name);
|
|
@@ -58,23 +57,26 @@ export function prepareArea(args) {
|
|
|
58
57
|
legend: {
|
|
59
58
|
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
60
59
|
symbol: prepareLegendSymbol(series),
|
|
60
|
+
groupId: (_b = (_a = series.legend) === null || _a === void 0 ? void 0 : _a.groupId) !== null && _b !== void 0 ? _b : getUniqId(),
|
|
61
|
+
itemText: (_d = (_c = series.legend) === null || _c === void 0 ? void 0 : _c.itemText) !== null && _d !== void 0 ? _d : name,
|
|
61
62
|
},
|
|
62
63
|
data: prepareSeriesData(series),
|
|
63
64
|
stacking: series.stacking,
|
|
64
65
|
stackId: getSeriesStackId(series),
|
|
65
66
|
dataLabels: {
|
|
66
|
-
enabled: ((
|
|
67
|
-
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (
|
|
67
|
+
enabled: ((_e = series.dataLabels) === null || _e === void 0 ? void 0 : _e.enabled) || false,
|
|
68
|
+
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_f = series.dataLabels) === null || _f === void 0 ? void 0 : _f.style),
|
|
68
69
|
padding: get(series, 'dataLabels.padding', DEFAULT_DATALABELS_PADDING),
|
|
69
70
|
allowOverlap: get(series, 'dataLabels.allowOverlap', false),
|
|
70
71
|
html: get(series, 'dataLabels.html', false),
|
|
71
|
-
format: (
|
|
72
|
+
format: (_g = series.dataLabels) === null || _g === void 0 ? void 0 : _g.format,
|
|
72
73
|
},
|
|
73
74
|
marker: prepareMarker(series, seriesOptions),
|
|
74
75
|
cursor: get(series, 'cursor', null),
|
|
75
76
|
yAxis: get(series, 'yAxis', 0),
|
|
76
77
|
tooltip: series.tooltip,
|
|
77
78
|
rangeSlider: Object.assign({}, seriesRangeSliderOptionsDefaults, series.rangeSlider),
|
|
79
|
+
nullMode: series.nullMode,
|
|
78
80
|
};
|
|
79
81
|
return prepared;
|
|
80
82
|
}, []);
|
|
@@ -12,13 +12,13 @@ function prepareSeriesData(series) {
|
|
|
12
12
|
return data.map((p) => { var _a; return (Object.assign(Object.assign({}, p), { y: (_a = p.y) !== null && _a !== void 0 ? _a : 0 })); });
|
|
13
13
|
case 'skip':
|
|
14
14
|
default:
|
|
15
|
-
return data
|
|
15
|
+
return data;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
export function prepareBarXSeries(args) {
|
|
19
19
|
const { colorScale, series: seriesList, seriesOptions, legend } = args;
|
|
20
20
|
return seriesList.map((series) => {
|
|
21
|
-
var _a, _b, _c, _d;
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
22
22
|
const name = series.name || '';
|
|
23
23
|
const color = series.color || colorScale(name);
|
|
24
24
|
const dataLabelsInside = series.stacking === 'percent' ? true : get(series, 'dataLabels.inside', false);
|
|
@@ -31,18 +31,20 @@ export function prepareBarXSeries(args) {
|
|
|
31
31
|
legend: {
|
|
32
32
|
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
33
33
|
symbol: prepareLegendSymbol(series),
|
|
34
|
+
groupId: (_b = (_a = series.legend) === null || _a === void 0 ? void 0 : _a.groupId) !== null && _b !== void 0 ? _b : getUniqId(),
|
|
35
|
+
itemText: (_d = (_c = series.legend) === null || _c === void 0 ? void 0 : _c.itemText) !== null && _d !== void 0 ? _d : name,
|
|
34
36
|
},
|
|
35
37
|
data: prepareSeriesData(series),
|
|
36
38
|
stacking: series.stacking,
|
|
37
39
|
stackId: getSeriesStackId(series),
|
|
38
40
|
dataLabels: {
|
|
39
|
-
enabled: ((
|
|
41
|
+
enabled: ((_e = series.dataLabels) === null || _e === void 0 ? void 0 : _e.enabled) || false,
|
|
40
42
|
inside: dataLabelsInside,
|
|
41
|
-
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (
|
|
42
|
-
allowOverlap: ((
|
|
43
|
+
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_f = series.dataLabels) === null || _f === void 0 ? void 0 : _f.style),
|
|
44
|
+
allowOverlap: ((_g = series.dataLabels) === null || _g === void 0 ? void 0 : _g.allowOverlap) || false,
|
|
43
45
|
padding: get(series, 'dataLabels.padding', DEFAULT_DATALABELS_PADDING),
|
|
44
46
|
html: get(series, 'dataLabels.html', false),
|
|
45
|
-
format: (
|
|
47
|
+
format: (_h = series.dataLabels) === null || _h === void 0 ? void 0 : _h.format,
|
|
46
48
|
},
|
|
47
49
|
cursor: get(series, 'cursor', null),
|
|
48
50
|
yAxis: get(series, 'yAxis', 0),
|
|
@@ -13,7 +13,7 @@ function prepareSeriesData(series) {
|
|
|
13
13
|
return data.map((p) => { var _a; return (Object.assign(Object.assign({}, p), { x: (_a = p.x) !== null && _a !== void 0 ? _a : 0 })); });
|
|
14
14
|
case 'skip':
|
|
15
15
|
default:
|
|
16
|
-
return data
|
|
16
|
+
return data;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
async function prepareDataLabels(series) {
|
|
@@ -46,7 +46,7 @@ async function prepareDataLabels(series) {
|
|
|
46
46
|
export function prepareBarYSeries(args) {
|
|
47
47
|
const { colorScale, series: seriesList, seriesOptions, legend } = args;
|
|
48
48
|
return Promise.all(seriesList.map(async (series) => {
|
|
49
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
49
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
50
50
|
const name = series.name || '';
|
|
51
51
|
const color = series.color || colorScale(name);
|
|
52
52
|
return {
|
|
@@ -58,15 +58,17 @@ export function prepareBarYSeries(args) {
|
|
|
58
58
|
legend: {
|
|
59
59
|
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
60
60
|
symbol: prepareLegendSymbol(series),
|
|
61
|
+
groupId: (_b = (_a = series.legend) === null || _a === void 0 ? void 0 : _a.groupId) !== null && _b !== void 0 ? _b : getUniqId(),
|
|
62
|
+
itemText: (_d = (_c = series.legend) === null || _c === void 0 ? void 0 : _c.itemText) !== null && _d !== void 0 ? _d : name,
|
|
61
63
|
},
|
|
62
64
|
data: prepareSeriesData(series),
|
|
63
65
|
stacking: series.stacking,
|
|
64
66
|
stackId: getSeriesStackId(series),
|
|
65
67
|
dataLabels: await prepareDataLabels(series),
|
|
66
68
|
cursor: get(series, 'cursor', null),
|
|
67
|
-
borderRadius: (
|
|
68
|
-
borderWidth: (
|
|
69
|
-
borderColor: (
|
|
69
|
+
borderRadius: (_g = (_e = series.borderRadius) !== null && _e !== void 0 ? _e : (_f = seriesOptions === null || seriesOptions === void 0 ? void 0 : seriesOptions['bar-y']) === null || _f === void 0 ? void 0 : _f.borderRadius) !== null && _g !== void 0 ? _g : 0,
|
|
70
|
+
borderWidth: (_k = (_h = series.borderWidth) !== null && _h !== void 0 ? _h : (_j = seriesOptions === null || seriesOptions === void 0 ? void 0 : seriesOptions['bar-y']) === null || _j === void 0 ? void 0 : _j.borderWidth) !== null && _k !== void 0 ? _k : 0,
|
|
71
|
+
borderColor: (_o = (_l = series.borderColor) !== null && _l !== void 0 ? _l : (_m = seriesOptions === null || seriesOptions === void 0 ? void 0 : seriesOptions['bar-y']) === null || _m === void 0 ? void 0 : _m.borderColor) !== null && _o !== void 0 ? _o : 'var(--gcharts-shape-border-color)',
|
|
70
72
|
tooltip: series.tooltip,
|
|
71
73
|
};
|
|
72
74
|
}));
|
|
@@ -10,7 +10,7 @@ export function prepareFunnelSeries(args) {
|
|
|
10
10
|
const colorScale = scaleOrdinal(dataNames, colors);
|
|
11
11
|
const isConnectorsEnabled = (_b = (_a = series.connectors) === null || _a === void 0 ? void 0 : _a.enabled) !== null && _b !== void 0 ? _b : true;
|
|
12
12
|
const preparedSeries = series.data.map((dataItem) => {
|
|
13
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
14
14
|
const id = getUniqId();
|
|
15
15
|
const color = dataItem.color || colorScale(dataItem.name);
|
|
16
16
|
const result = {
|
|
@@ -28,20 +28,24 @@ export function prepareFunnelSeries(args) {
|
|
|
28
28
|
id,
|
|
29
29
|
color,
|
|
30
30
|
legend: {
|
|
31
|
-
enabled:
|
|
32
|
-
symbol:
|
|
31
|
+
enabled: (_h = (_f = (_e = dataItem.legend) === null || _e === void 0 ? void 0 : _e.enabled) !== null && _f !== void 0 ? _f : (_g = series.legend) === null || _g === void 0 ? void 0 : _g.enabled) !== null && _h !== void 0 ? _h : legend.enabled,
|
|
32
|
+
symbol: ((_j = dataItem.legend) === null || _j === void 0 ? void 0 : _j.symbol)
|
|
33
|
+
? prepareLegendSymbol(dataItem)
|
|
34
|
+
: prepareLegendSymbol(series),
|
|
35
|
+
groupId: (_l = (_k = dataItem.legend) === null || _k === void 0 ? void 0 : _k.groupId) !== null && _l !== void 0 ? _l : getUniqId(),
|
|
36
|
+
itemText: (_o = (_m = dataItem.legend) === null || _m === void 0 ? void 0 : _m.itemText) !== null && _o !== void 0 ? _o : dataItem.name,
|
|
33
37
|
},
|
|
34
38
|
cursor: get(series, 'cursor', null),
|
|
35
39
|
tooltip: series.tooltip,
|
|
36
40
|
connectors: {
|
|
37
41
|
enabled: isConnectorsEnabled,
|
|
38
|
-
height: isConnectorsEnabled ? ((
|
|
39
|
-
lineDashStyle: (
|
|
40
|
-
lineOpacity: (
|
|
41
|
-
lineColor: (
|
|
42
|
-
areaColor: (
|
|
43
|
-
areaOpacity: (
|
|
44
|
-
lineWidth: (
|
|
42
|
+
height: isConnectorsEnabled ? ((_q = (_p = series.connectors) === null || _p === void 0 ? void 0 : _p.height) !== null && _q !== void 0 ? _q : '25%') : 0,
|
|
43
|
+
lineDashStyle: (_s = (_r = series.connectors) === null || _r === void 0 ? void 0 : _r.lineDashStyle) !== null && _s !== void 0 ? _s : 'Dash',
|
|
44
|
+
lineOpacity: (_u = (_t = series.connectors) === null || _t === void 0 ? void 0 : _t.lineOpacity) !== null && _u !== void 0 ? _u : 1,
|
|
45
|
+
lineColor: (_w = (_v = series.connectors) === null || _v === void 0 ? void 0 : _v.lineColor) !== null && _w !== void 0 ? _w : 'var(--g-color-line-generic-active)',
|
|
46
|
+
areaColor: (_y = (_x = series.connectors) === null || _x === void 0 ? void 0 : _x.areaColor) !== null && _y !== void 0 ? _y : color,
|
|
47
|
+
areaOpacity: (_0 = (_z = series.connectors) === null || _z === void 0 ? void 0 : _z.areaOpacity) !== null && _0 !== void 0 ? _0 : 0.25,
|
|
48
|
+
lineWidth: (_2 = (_1 = series.connectors) === null || _1 === void 0 ? void 0 : _1.lineWidth) !== null && _2 !== void 0 ? _2 : 1,
|
|
45
49
|
},
|
|
46
50
|
};
|
|
47
51
|
return result;
|
|
@@ -18,7 +18,7 @@ function prepareSeriesData(series) {
|
|
|
18
18
|
export function prepareHeatmapSeries(args) {
|
|
19
19
|
const { colorScale, series: seriesList, seriesOptions, legend } = args;
|
|
20
20
|
return seriesList.map((series) => {
|
|
21
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
22
22
|
const name = series.name || '';
|
|
23
23
|
const color = series.color || colorScale(name);
|
|
24
24
|
return {
|
|
@@ -30,20 +30,22 @@ export function prepareHeatmapSeries(args) {
|
|
|
30
30
|
legend: {
|
|
31
31
|
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
32
32
|
symbol: prepareLegendSymbol(series),
|
|
33
|
+
groupId: (_b = (_a = series.legend) === null || _a === void 0 ? void 0 : _a.groupId) !== null && _b !== void 0 ? _b : getUniqId(),
|
|
34
|
+
itemText: (_d = (_c = series.legend) === null || _c === void 0 ? void 0 : _c.itemText) !== null && _d !== void 0 ? _d : name,
|
|
33
35
|
},
|
|
34
36
|
data: prepareSeriesData(series),
|
|
35
37
|
dataLabels: {
|
|
36
|
-
enabled: ((
|
|
37
|
-
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (
|
|
38
|
+
enabled: ((_e = series.dataLabels) === null || _e === void 0 ? void 0 : _e.enabled) || false,
|
|
39
|
+
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_f = series.dataLabels) === null || _f === void 0 ? void 0 : _f.style),
|
|
38
40
|
padding: get(series, 'dataLabels.padding', DEFAULT_DATALABELS_PADDING),
|
|
39
|
-
html: (
|
|
40
|
-
format: (
|
|
41
|
+
html: (_h = (_g = series.dataLabels) === null || _g === void 0 ? void 0 : _g.html) !== null && _h !== void 0 ? _h : false,
|
|
42
|
+
format: (_j = series.dataLabels) === null || _j === void 0 ? void 0 : _j.format,
|
|
41
43
|
},
|
|
42
44
|
cursor: get(series, 'cursor', null),
|
|
43
45
|
yAxis: get(series, 'yAxis', 0),
|
|
44
46
|
tooltip: series.tooltip,
|
|
45
|
-
borderColor: (
|
|
46
|
-
borderWidth: (
|
|
47
|
+
borderColor: (_m = (_k = series.borderColor) !== null && _k !== void 0 ? _k : (_l = seriesOptions === null || seriesOptions === void 0 ? void 0 : seriesOptions.heatmap) === null || _l === void 0 ? void 0 : _l.borderColor) !== null && _m !== void 0 ? _m : 'var(--gcharts-shape-border-color)',
|
|
48
|
+
borderWidth: (_q = (_o = series.borderWidth) !== null && _o !== void 0 ? _o : (_p = seriesOptions === null || seriesOptions === void 0 ? void 0 : seriesOptions.heatmap) === null || _p === void 0 ? void 0 : _p.borderWidth) !== null && _q !== void 0 ? _q : 0,
|
|
47
49
|
};
|
|
48
50
|
}, []);
|
|
49
51
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { select } from 'd3';
|
|
2
|
+
import { groupBy } from 'lodash';
|
|
2
3
|
import clone from 'lodash/clone';
|
|
3
4
|
import get from 'lodash/get';
|
|
4
5
|
import merge from 'lodash/merge';
|
|
@@ -75,10 +76,11 @@ export async function getPreparedLegend(args) {
|
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
78
|
function getFlattenLegendItems(series, preparedLegend) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
const grouped = groupBy(series, (s) => s.legend.groupId);
|
|
80
|
+
return Object.values(grouped).reduce((acc, items) => {
|
|
81
|
+
const s = items.find((item) => item.legend.enabled);
|
|
82
|
+
if (s) {
|
|
83
|
+
acc.push(Object.assign(Object.assign({}, s), { id: s.legend.groupId, name: s.legend.itemText, height: preparedLegend.lineHeight, symbol: s.legend.symbol }));
|
|
82
84
|
}
|
|
83
85
|
return acc;
|
|
84
86
|
}, []);
|
|
@@ -60,7 +60,7 @@ export function prepareLineSeries(args) {
|
|
|
60
60
|
const defaultLineWidth = get(seriesOptions, 'line.lineWidth', DEFAULT_LINE_WIDTH);
|
|
61
61
|
const defaultDashStyle = get(seriesOptions, 'line.dashStyle', DEFAULT_DASH_STYLE);
|
|
62
62
|
return seriesList.map((series) => {
|
|
63
|
-
var _a, _b, _c;
|
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
64
64
|
const id = getUniqId();
|
|
65
65
|
const name = series.name || '';
|
|
66
66
|
const color = series.color || colorScale(name);
|
|
@@ -75,15 +75,17 @@ export function prepareLineSeries(args) {
|
|
|
75
75
|
legend: {
|
|
76
76
|
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
77
77
|
symbol: prepareLineLegendSymbol(series, seriesOptions),
|
|
78
|
+
groupId: (_b = (_a = series.legend) === null || _a === void 0 ? void 0 : _a.groupId) !== null && _b !== void 0 ? _b : getUniqId(),
|
|
79
|
+
itemText: (_d = (_c = series.legend) === null || _c === void 0 ? void 0 : _c.itemText) !== null && _d !== void 0 ? _d : name,
|
|
78
80
|
},
|
|
79
81
|
data: prepareSeriesData(series),
|
|
80
82
|
dataLabels: {
|
|
81
|
-
enabled: ((
|
|
82
|
-
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (
|
|
83
|
+
enabled: ((_e = series.dataLabels) === null || _e === void 0 ? void 0 : _e.enabled) || false,
|
|
84
|
+
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_f = series.dataLabels) === null || _f === void 0 ? void 0 : _f.style),
|
|
83
85
|
padding: get(series, 'dataLabels.padding', DEFAULT_DATALABELS_PADDING),
|
|
84
86
|
allowOverlap: get(series, 'dataLabels.allowOverlap', false),
|
|
85
87
|
html: get(series, 'dataLabels.html', false),
|
|
86
|
-
format: (
|
|
88
|
+
format: (_g = series.dataLabels) === null || _g === void 0 ? void 0 : _g.format,
|
|
87
89
|
},
|
|
88
90
|
marker: prepareMarker(series, seriesOptions),
|
|
89
91
|
dashStyle: dashStyle,
|