@gravity-ui/chartkit 4.20.1 → 5.1.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/build/components/ChartKit.css +20 -20
- package/build/components/ChartKit.d.ts +2 -2
- package/build/components/ErrorBoundary/ErrorBoundary.js +1 -1
- package/build/libs/settings/settings.d.ts +1 -1
- package/build/libs/settings/settings.js +1 -1
- package/build/plugins/d3/examples/area/PercentStacking.js +1 -1
- package/build/plugins/d3/examples/area/StackedArea.js +1 -1
- package/build/plugins/d3/examples/combined/LineAndBarX.js +1 -1
- package/build/plugins/d3/examples/pie/DonutWithTotals.js +1 -1
- package/build/plugins/d3/renderer/D3Widget.d.ts +1 -1
- package/build/plugins/d3/renderer/D3Widget.js +1 -1
- package/build/plugins/d3/renderer/components/AxisX.d.ts +1 -1
- package/build/plugins/d3/renderer/components/AxisX.js +2 -2
- package/build/plugins/d3/renderer/components/AxisY.js +1 -1
- package/build/plugins/d3/renderer/components/Chart.js +13 -4
- package/build/plugins/d3/renderer/components/Legend.d.ts +1 -1
- package/build/plugins/d3/renderer/components/Legend.js +2 -2
- package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.js +1 -1
- package/build/plugins/d3/renderer/components/Tooltip/TooltipTriggerArea.js +19 -7
- package/build/plugins/d3/renderer/components/Tooltip/index.js +1 -1
- package/build/plugins/d3/renderer/components/styles.css +1 -1
- package/build/plugins/d3/renderer/d3-dispatcher.js +1 -1
- package/build/plugins/d3/renderer/hooks/useAxisScales/index.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useAxisScales/index.js +2 -2
- package/build/plugins/d3/renderer/hooks/useChartOptions/types.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.js +1 -1
- package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.js +2 -2
- package/build/plugins/d3/renderer/hooks/useSeries/index.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useSeries/index.js +2 -2
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-area.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-area.js +1 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-x.js +1 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-y.js +2 -2
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-legend.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-legend.js +1 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-line.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-line.js +2 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.js +3 -2
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-scatter.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-scatter.js +2 -2
- package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.js +2 -2
- package/build/plugins/d3/renderer/hooks/useSeries/types.d.ts +4 -2
- package/build/plugins/d3/renderer/hooks/useSeries/utils.d.ts +2 -2
- package/build/plugins/d3/renderer/hooks/useSeries/utils.js +1 -1
- package/build/plugins/d3/renderer/hooks/useShapes/area/index.js +2 -2
- package/build/plugins/d3/renderer/hooks/useShapes/area/prepare-data.d.ts +2 -2
- package/build/plugins/d3/renderer/hooks/useShapes/area/prepare-data.js +1 -1
- package/build/plugins/d3/renderer/hooks/useShapes/area/types.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/index.js +3 -2
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/prepare-data.js +1 -0
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/types.d.ts +2 -1
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/index.js +3 -2
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/prepare-data.js +1 -0
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/types.d.ts +1 -0
- package/build/plugins/d3/renderer/hooks/useShapes/index.d.ts +6 -6
- package/build/plugins/d3/renderer/hooks/useShapes/index.js +6 -6
- package/build/plugins/d3/renderer/hooks/useShapes/line/index.js +3 -2
- package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.d.ts +2 -2
- package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.js +2 -1
- package/build/plugins/d3/renderer/hooks/useShapes/line/types.d.ts +3 -2
- package/build/plugins/d3/renderer/hooks/useShapes/marker.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useShapes/marker.js +10 -3
- package/build/plugins/d3/renderer/hooks/useShapes/pie/index.js +20 -11
- package/build/plugins/d3/renderer/hooks/useShapes/pie/prepare-data.js +1 -0
- package/build/plugins/d3/renderer/hooks/useShapes/pie/types.d.ts +3 -2
- package/build/plugins/d3/renderer/hooks/useShapes/pie/utils.js +1 -1
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.js +14 -4
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.js +2 -0
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/types.d.ts +1 -0
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/index.js +11 -4
- package/build/plugins/d3/renderer/hooks/useShapes/utils.d.ts +1 -1
- package/build/plugins/d3/renderer/hooks/useTooltip/index.d.ts +1 -1
- package/build/plugins/d3/renderer/utils/axis-generators/bottom.js +1 -1
- package/build/plugins/d3/renderer/utils/axis.d.ts +1 -1
- package/build/plugins/d3/renderer/utils/index.js +3 -3
- package/build/plugins/d3/renderer/utils/symbol.js +1 -1
- package/build/plugins/d3/renderer/validation/index.js +1 -1
- package/build/plugins/highcharts/renderer/components/HighchartsComponent.d.ts +1 -1
- package/build/plugins/highcharts/renderer/components/HighchartsComponent.js +2 -2
- package/build/plugins/highcharts/renderer/components/HighchartsReact.js +7 -1
- package/build/plugins/highcharts/renderer/components/StyledSplitPane/StyledSplitPane.css +1 -1
- package/build/plugins/highcharts/renderer/helpers/config/config.js +15 -15
- package/build/plugins/highcharts/renderer/helpers/config/handleLegendItemClick.js +1 -1
- package/build/plugins/highcharts/renderer/helpers/config/options.d.ts +98 -98
- package/build/plugins/highcharts/renderer/helpers/config/options.js +1 -1
- package/build/plugins/highcharts/renderer/helpers/config/utils/index.d.ts +39 -10
- package/build/plugins/highcharts/renderer/helpers/graph.css +4 -4
- package/build/plugins/highcharts/renderer/helpers/graph.d.ts +1 -1
- package/build/plugins/highcharts/renderer/helpers/graph.js +2 -2
- package/build/plugins/highcharts/renderer/helpers/highcharts/highcharts.js +2 -2
- package/build/plugins/highcharts/renderer/helpers/prepare-data.js +2 -2
- package/build/plugins/highcharts/renderer/helpers/tooltip/index.js +1 -1
- package/build/plugins/highcharts/renderer/helpers/tooltip/tooltip.css +6 -7
- package/build/plugins/highcharts/types/highcharts-extends.d.ts +1 -0
- package/build/plugins/highcharts/types/widget.d.ts +2 -2
- package/build/plugins/indicator/renderer/IndicatorWidget.css +1 -1
- package/build/plugins/indicator/renderer/IndicatorWidget.js +1 -1
- package/build/plugins/shared/format-number/format-number.d.ts +1 -1
- package/build/plugins/shared/format-number/format-number.js +2 -2
- package/build/plugins/shared/format-number/format-number.test.js +1 -1
- package/build/plugins/yagr/renderer/YagrWidget.css +1 -1
- package/build/plugins/yagr/renderer/YagrWidget.js +5 -3
- package/build/plugins/yagr/renderer/tooltip/tooltip.css +15 -16
- package/build/plugins/yagr/renderer/utils.d.ts +1 -1
- package/build/plugins/yagr/renderer/utils.js +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/widget-data/area.d.ts +15 -0
- package/build/types/widget-data/bar-x.d.ts +3 -1
- package/build/types/widget-data/bar-y.d.ts +3 -1
- package/build/types/widget-data/chart.d.ts +6 -0
- package/build/types/widget-data/line.d.ts +10 -1
- package/build/types/widget-data/pie.d.ts +2 -0
- package/build/types/widget-data/scatter.d.ts +3 -0
- package/build/types/widget-data/series.d.ts +6 -6
- package/build/types/widget-data/tooltip.d.ts +3 -3
- package/build/types/widget.d.ts +2 -2
- package/package.json +23 -24
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { color, line as lineGenerator,
|
|
2
|
+
import { area as areaGenerator, color, line as lineGenerator, select } from 'd3';
|
|
3
3
|
import get from 'lodash/get';
|
|
4
4
|
import { block } from '../../../../../../utils/cn';
|
|
5
5
|
import { filterOverlappingLabels } from '../../../utils';
|
|
6
|
-
import { setActiveState } from '../utils';
|
|
7
6
|
import { getMarkerHaloVisibility, getMarkerVisibility, renderMarker, selectMarkerHalo, selectMarkerSymbol, setMarker, } from '../marker';
|
|
7
|
+
import { setActiveState } from '../utils';
|
|
8
8
|
const b = block('d3-area');
|
|
9
9
|
export const AreaSeriesShapes = (args) => {
|
|
10
10
|
const { dispatcher, preparedData, seriesOptions } = args;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { PreparedAreaSeries } from '../../useSeries/types';
|
|
2
|
-
import type { PreparedAxis } from '../../useChartOptions/types';
|
|
3
1
|
import type { ChartScale } from '../../useAxisScales';
|
|
2
|
+
import type { PreparedAxis } from '../../useChartOptions/types';
|
|
3
|
+
import type { PreparedAreaSeries } from '../../useSeries/types';
|
|
4
4
|
import type { PreparedAreaData } from './types';
|
|
5
5
|
export declare const prepareAreaData: (args: {
|
|
6
6
|
series: PreparedAreaSeries[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { group, sort } from 'd3';
|
|
2
|
-
import { getXValue, getYValue } from '../utils';
|
|
3
2
|
import { getLabelsSize, getLeftPosition } from '../../../utils';
|
|
3
|
+
import { getXValue, getYValue } from '../utils';
|
|
4
4
|
function getLabelData(point, series, xMax) {
|
|
5
5
|
const text = String(point.data.label || point.data.y);
|
|
6
6
|
const style = series.dataLabels.style;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PreparedAreaSeries } from '../../useSeries/types';
|
|
2
1
|
import { AreaSeriesData } from '../../../../../../types';
|
|
3
2
|
import { LabelData } from '../../../types';
|
|
3
|
+
import { PreparedAreaSeries } from '../../useSeries/types';
|
|
4
4
|
export type PointData = {
|
|
5
5
|
y0: number;
|
|
6
6
|
x: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
2
|
import { color, select } from 'd3';
|
|
3
|
+
import get from 'lodash/get';
|
|
4
4
|
import { block } from '../../../../../../utils/cn';
|
|
5
5
|
import { filterOverlappingLabels } from '../../../utils';
|
|
6
6
|
export { prepareBarXData } from './prepare-data';
|
|
@@ -27,7 +27,8 @@ export const BarXSeriesShapes = (args) => {
|
|
|
27
27
|
.attr('y', (d) => d.y)
|
|
28
28
|
.attr('height', (d) => d.height)
|
|
29
29
|
.attr('width', (d) => d.width)
|
|
30
|
-
.attr('fill', (d) => d.data.color || d.series.color)
|
|
30
|
+
.attr('fill', (d) => d.data.color || d.series.color)
|
|
31
|
+
.attr('opacity', (d) => d.opacity);
|
|
31
32
|
let dataLabels = preparedData.map((d) => d.label).filter(Boolean);
|
|
32
33
|
if (!((_a = preparedData[0]) === null || _a === void 0 ? void 0 : _a.series.dataLabels.allowOverlap)) {
|
|
33
34
|
dataLabels = filterOverlappingLabels(dataLabels);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TooltipDataChunkBarX } from '../../../../../../types';
|
|
2
|
-
import { PreparedBarXSeries } from '../../useSeries/types';
|
|
3
2
|
import { LabelData } from '../../../types';
|
|
3
|
+
import { PreparedBarXSeries } from '../../useSeries/types';
|
|
4
4
|
export type PreparedBarXData = Omit<TooltipDataChunkBarX, 'series'> & {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
9
|
+
opacity: number | null;
|
|
9
10
|
series: PreparedBarXSeries;
|
|
10
11
|
label?: LabelData;
|
|
11
12
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
2
|
import { color, select } from 'd3';
|
|
3
|
+
import get from 'lodash/get';
|
|
4
4
|
import { block } from '../../../../../../utils/cn';
|
|
5
5
|
export { prepareBarYData } from './prepare-data';
|
|
6
6
|
const DEFAULT_LABEL_PADDING = 7;
|
|
@@ -23,7 +23,8 @@ export const BarYSeriesShapes = (args) => {
|
|
|
23
23
|
.attr('y', (d) => d.y)
|
|
24
24
|
.attr('height', (d) => d.height)
|
|
25
25
|
.attr('width', (d) => d.width)
|
|
26
|
-
.attr('fill', (d) => d.color)
|
|
26
|
+
.attr('fill', (d) => d.color)
|
|
27
|
+
.attr('opacity', (d) => d.data.opacity || null);
|
|
27
28
|
const dataLabels = preparedData.filter((d) => d.series.dataLabels.enabled);
|
|
28
29
|
const labelSelection = svgElement
|
|
29
30
|
.selectAll('text')
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Dispatch } from 'd3';
|
|
3
|
-
import type { PreparedAxis } from '../useChartOptions/types';
|
|
4
|
-
import type { ChartScale } from '../useAxisScales';
|
|
5
3
|
import type { PreparedSeries, PreparedSeriesOptions } from '../';
|
|
4
|
+
import type { ChartScale } from '../useAxisScales';
|
|
5
|
+
import type { PreparedAxis } from '../useChartOptions/types';
|
|
6
|
+
import type { PreparedAreaData } from './area/types';
|
|
6
7
|
import type { PreparedBarXData } from './bar-x';
|
|
7
|
-
import type { PreparedScatterData } from './scatter/types';
|
|
8
|
-
import type { PreparedPieData } from './pie/types';
|
|
9
|
-
import type { PreparedLineData } from './line/types';
|
|
10
8
|
import type { PreparedBarYData } from './bar-y/types';
|
|
9
|
+
import type { PreparedLineData } from './line/types';
|
|
10
|
+
import type { PreparedPieData } from './pie/types';
|
|
11
|
+
import type { PreparedScatterData } from './scatter/types';
|
|
11
12
|
export type { PreparedBarXData } from './bar-x';
|
|
12
13
|
export type { PreparedScatterData } from './scatter/types';
|
|
13
|
-
import type { PreparedAreaData } from './area/types';
|
|
14
14
|
import './styles.css';
|
|
15
15
|
export type ShapeData = PreparedBarXData | PreparedBarYData | PreparedScatterData | PreparedLineData | PreparedPieData | PreparedAreaData;
|
|
16
16
|
type Args = {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { group } from 'd3';
|
|
3
3
|
import { getOnlyVisibleSeries } from '../../utils';
|
|
4
|
+
import { AreaSeriesShapes } from './area';
|
|
5
|
+
import { prepareAreaData } from './area/prepare-data';
|
|
4
6
|
import { BarXSeriesShapes, prepareBarXData } from './bar-x';
|
|
5
|
-
import {
|
|
7
|
+
import { BarYSeriesShapes, prepareBarYData } from './bar-y';
|
|
8
|
+
import { LineSeriesShapes } from './line';
|
|
9
|
+
import { prepareLineData } from './line/prepare-data';
|
|
6
10
|
import { PieSeriesShapes } from './pie';
|
|
7
11
|
import { preparePieData } from './pie/prepare-data';
|
|
8
|
-
import {
|
|
9
|
-
import { LineSeriesShapes } from './line';
|
|
10
|
-
import { BarYSeriesShapes, prepareBarYData } from './bar-y';
|
|
11
|
-
import { AreaSeriesShapes } from './area';
|
|
12
|
-
import { prepareAreaData } from './area/prepare-data';
|
|
12
|
+
import { ScatterSeriesShape, prepareScatterData } from './scatter';
|
|
13
13
|
import { TreemapSeriesShape } from './treemap';
|
|
14
14
|
import { prepareTreemapData } from './treemap/prepare-data';
|
|
15
15
|
import './styles.css';
|
|
@@ -3,8 +3,8 @@ import { color, line as lineGenerator, select } from 'd3';
|
|
|
3
3
|
import get from 'lodash/get';
|
|
4
4
|
import { block } from '../../../../../../utils/cn';
|
|
5
5
|
import { filterOverlappingLabels } from '../../../utils';
|
|
6
|
-
import { getLineDashArray, setActiveState } from '../utils';
|
|
7
6
|
import { getMarkerHaloVisibility, getMarkerVisibility, renderMarker, selectMarkerHalo, selectMarkerSymbol, setMarker, } from '../marker';
|
|
7
|
+
import { getLineDashArray, setActiveState } from '../utils';
|
|
8
8
|
const b = block('d3-line');
|
|
9
9
|
export const LineSeriesShapes = (args) => {
|
|
10
10
|
const { dispatcher, preparedData, seriesOptions } = args;
|
|
@@ -31,7 +31,8 @@ export const LineSeriesShapes = (args) => {
|
|
|
31
31
|
.attr('stroke-width', (d) => d.width)
|
|
32
32
|
.attr('stroke-linejoin', (d) => d.linecap)
|
|
33
33
|
.attr('stroke-linecap', (d) => d.linecap)
|
|
34
|
-
.attr('stroke-dasharray', (d) => getLineDashArray(d.dashStyle, d.width))
|
|
34
|
+
.attr('stroke-dasharray', (d) => getLineDashArray(d.dashStyle, d.width))
|
|
35
|
+
.attr('opacity', (d) => d.opacity);
|
|
35
36
|
let dataLabels = preparedData.reduce((acc, d) => {
|
|
36
37
|
return acc.concat(d.labels);
|
|
37
38
|
}, []);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PreparedLineSeries } from '../../useSeries/types';
|
|
2
|
-
import { PreparedAxis } from '../../useChartOptions/types';
|
|
3
1
|
import { ChartScale } from '../../useAxisScales';
|
|
2
|
+
import { PreparedAxis } from '../../useChartOptions/types';
|
|
3
|
+
import { PreparedLineSeries } from '../../useSeries/types';
|
|
4
4
|
import { PreparedLineData } from './types';
|
|
5
5
|
export declare const prepareLineData: (args: {
|
|
6
6
|
series: PreparedLineSeries[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getXValue, getYValue } from '../utils';
|
|
2
1
|
import { getLabelsSize, getLeftPosition } from '../../../utils';
|
|
2
|
+
import { getXValue, getYValue } from '../utils';
|
|
3
3
|
function getLabelData(point, series, xMax) {
|
|
4
4
|
const text = String(point.data.label || point.data.y);
|
|
5
5
|
const style = series.dataLabels.style;
|
|
@@ -63,6 +63,7 @@ export const prepareLineData = (args) => {
|
|
|
63
63
|
id: s.id,
|
|
64
64
|
dashStyle: s.dashStyle,
|
|
65
65
|
linecap: s.linecap,
|
|
66
|
+
opacity: s.opacity,
|
|
66
67
|
};
|
|
67
68
|
acc.push(result);
|
|
68
69
|
return acc;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DashStyle, LineCap } from '../../../../../../constants';
|
|
2
2
|
import { LineSeriesData } from '../../../../../../types';
|
|
3
3
|
import { LabelData } from '../../../types';
|
|
4
|
-
import {
|
|
4
|
+
import { PreparedLineSeries } from '../../useSeries/types';
|
|
5
5
|
export type PointData = {
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
|
@@ -25,4 +25,5 @@ export type PreparedLineData = {
|
|
|
25
25
|
labels: LabelData[];
|
|
26
26
|
dashStyle: DashStyle;
|
|
27
27
|
linecap: LineCap;
|
|
28
|
+
opacity: number | null;
|
|
28
29
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseType, Selection } from 'd3';
|
|
2
|
-
import { MarkerData as LineMarkerData } from './line/types';
|
|
3
2
|
import { MarkerData as AreaMarkerData } from './area/types';
|
|
3
|
+
import { MarkerData as LineMarkerData } from './line/types';
|
|
4
4
|
import { MarkerData as ScatterMarkerData } from './scatter/types';
|
|
5
5
|
type MarkerData = LineMarkerData | AreaMarkerData | ScatterMarkerData;
|
|
6
6
|
export declare function renderMarker<T extends MarkerData>(selection: Selection<BaseType | SVGGElement, T, SVGGElement, unknown>): Selection<BaseType | SVGGElement, T, SVGGElement, unknown>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { symbol } from 'd3';
|
|
2
|
-
import
|
|
2
|
+
import get from 'lodash/get';
|
|
3
3
|
import { SymbolType } from '../../../../../constants';
|
|
4
|
+
import { block } from '../../../../../utils/cn';
|
|
4
5
|
import { getSymbol } from '../../utils';
|
|
5
|
-
import get from 'lodash/get';
|
|
6
6
|
const b = block('d3-marker');
|
|
7
7
|
const haloClassName = b('halo');
|
|
8
8
|
const symbolClassName = b('symbol');
|
|
@@ -36,7 +36,14 @@ export function renderMarker(selection) {
|
|
|
36
36
|
}
|
|
37
37
|
export function getMarkerVisibility(d) {
|
|
38
38
|
const markerStates = d.point.series.marker.states;
|
|
39
|
-
|
|
39
|
+
let enabled;
|
|
40
|
+
if (d.hovered) {
|
|
41
|
+
enabled = markerStates.hover.enabled && d.hovered;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
enabled =
|
|
45
|
+
markerStates.normal.enabled || get(d.point.data, 'marker.states.normal.enabled', false);
|
|
46
|
+
}
|
|
40
47
|
return enabled ? '' : 'hidden';
|
|
41
48
|
}
|
|
42
49
|
export function getMarkerHaloVisibility(d) {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { arc, color, line as lineGenerator, pointer, select } from 'd3';
|
|
2
3
|
import get from 'lodash/get';
|
|
3
|
-
import { arc, color, pointer, select } from 'd3';
|
|
4
4
|
import { block } from '../../../../../../utils/cn';
|
|
5
|
-
import { setActiveState } from '../utils';
|
|
6
|
-
import { line as lineGenerator } from 'd3-shape';
|
|
7
5
|
import { setEllipsisForOverflowTexts } from '../../../utils';
|
|
6
|
+
import { setActiveState } from '../utils';
|
|
8
7
|
import { getCurveFactory } from './utils';
|
|
9
8
|
const b = block('d3-pie');
|
|
10
9
|
export function getHaloVisibility(d) {
|
|
@@ -69,7 +68,8 @@ export function PieSeriesShapes(args) {
|
|
|
69
68
|
return arcGenerator(d);
|
|
70
69
|
})
|
|
71
70
|
.attr('class', b('segment'))
|
|
72
|
-
.attr('fill', (d) => d.data.color)
|
|
71
|
+
.attr('fill', (d) => d.data.color)
|
|
72
|
+
.attr('opacity', (d) => d.data.opacity);
|
|
73
73
|
shapesSelection
|
|
74
74
|
.selectAll('text')
|
|
75
75
|
.data((pieData) => pieData.labels)
|
|
@@ -115,17 +115,20 @@ export function PieSeriesShapes(args) {
|
|
|
115
115
|
nodes[index].append(customShape);
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
|
+
const getSelectedSegment = (element) => {
|
|
119
|
+
const datum = select(element).datum();
|
|
120
|
+
const seriesId = get(datum, 'data.series.id', get(datum, 'series.id'));
|
|
121
|
+
return preparedData.reduce((result, pie) => {
|
|
122
|
+
var _a;
|
|
123
|
+
return result || ((_a = pie.segments.find((s) => s.data.series.id === seriesId)) === null || _a === void 0 ? void 0 : _a.data);
|
|
124
|
+
}, undefined);
|
|
125
|
+
};
|
|
118
126
|
const eventName = `hover-shape.pie`;
|
|
119
127
|
const hoverOptions = get(seriesOptions, 'pie.states.hover');
|
|
120
128
|
const inactiveOptions = get(seriesOptions, 'pie.states.inactive');
|
|
121
129
|
svgElement
|
|
122
130
|
.on('mousemove', (e) => {
|
|
123
|
-
const
|
|
124
|
-
const seriesId = get(datum, 'data.series.id', get(datum, 'series.id'));
|
|
125
|
-
const currentSegment = preparedData.reduce((result, pie) => {
|
|
126
|
-
var _a;
|
|
127
|
-
return (result || ((_a = pie.segments.find((s) => s.data.series.id === seriesId)) === null || _a === void 0 ? void 0 : _a.data));
|
|
128
|
-
}, undefined);
|
|
131
|
+
const currentSegment = getSelectedSegment(e.target);
|
|
129
132
|
if (currentSegment) {
|
|
130
133
|
const data = {
|
|
131
134
|
series: {
|
|
@@ -133,13 +136,19 @@ export function PieSeriesShapes(args) {
|
|
|
133
136
|
type: 'pie',
|
|
134
137
|
name: currentSegment.series.name,
|
|
135
138
|
},
|
|
136
|
-
data: currentSegment.series,
|
|
139
|
+
data: currentSegment.series.data,
|
|
137
140
|
};
|
|
138
141
|
dispatcher.call('hover-shape', {}, [data], pointer(e, svgContainer));
|
|
139
142
|
}
|
|
140
143
|
})
|
|
141
144
|
.on('mouseleave', () => {
|
|
142
145
|
dispatcher.call('hover-shape', {}, undefined);
|
|
146
|
+
})
|
|
147
|
+
.on('click', (e) => {
|
|
148
|
+
const selectedSegment = getSelectedSegment(e.target);
|
|
149
|
+
if (selectedSegment) {
|
|
150
|
+
dispatcher.call('click-chart', undefined, { point: selectedSegment.series.data, series: selectedSegment.series }, e);
|
|
151
|
+
}
|
|
143
152
|
});
|
|
144
153
|
dispatcher.on(eventName, (data) => {
|
|
145
154
|
const selectedSeriesId = data === null || data === void 0 ? void 0 : data[0].series.id;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { PieArcDatum } from 'd3';
|
|
2
|
-
import { PreparedPieSeries } from '../../useSeries/types';
|
|
3
|
-
import { LabelData } from '../../../types';
|
|
4
2
|
import { ConnectorCurve } from '../../../../../../types';
|
|
3
|
+
import { LabelData } from '../../../types';
|
|
4
|
+
import { PreparedPieSeries } from '../../useSeries/types';
|
|
5
5
|
export type SegmentData = {
|
|
6
6
|
value: number;
|
|
7
7
|
color: string;
|
|
8
|
+
opacity: number | null;
|
|
8
9
|
series: PreparedPieSeries;
|
|
9
10
|
hovered: boolean;
|
|
10
11
|
active: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
2
|
import { pointer, select } from 'd3';
|
|
3
|
+
import get from 'lodash/get';
|
|
4
4
|
import { block } from '../../../../../../utils/cn';
|
|
5
|
-
import { setActiveState, shapeKey } from '../utils';
|
|
6
5
|
import { getMarkerHaloVisibility, renderMarker, selectMarkerHalo, selectMarkerSymbol, setMarker, } from '../marker';
|
|
6
|
+
import { setActiveState, shapeKey } from '../utils';
|
|
7
7
|
export { prepareScatterData } from './prepare-data';
|
|
8
8
|
const b = block('d3-scatter');
|
|
9
9
|
export function ScatterSeriesShape(props) {
|
|
@@ -22,10 +22,14 @@ export function ScatterSeriesShape(props) {
|
|
|
22
22
|
.data(preparedData, shapeKey)
|
|
23
23
|
.join('g')
|
|
24
24
|
.call(renderMarker)
|
|
25
|
-
.attr('fill', (d) => d.point.data.color || d.point.series.color || '')
|
|
25
|
+
.attr('fill', (d) => d.point.data.color || d.point.series.color || '')
|
|
26
|
+
.attr('opacity', (d) => d.point.opacity);
|
|
27
|
+
const getSelectedPoint = (element) => {
|
|
28
|
+
return select(element).datum();
|
|
29
|
+
};
|
|
26
30
|
svgElement
|
|
27
31
|
.on('mousemove', (e) => {
|
|
28
|
-
const datum =
|
|
32
|
+
const datum = getSelectedPoint(e.target);
|
|
29
33
|
if (!datum) {
|
|
30
34
|
return;
|
|
31
35
|
}
|
|
@@ -42,6 +46,12 @@ export function ScatterSeriesShape(props) {
|
|
|
42
46
|
})
|
|
43
47
|
.on('mouseleave', () => {
|
|
44
48
|
dispatcher.call('hover-shape', {}, undefined);
|
|
49
|
+
})
|
|
50
|
+
.on('click', (e) => {
|
|
51
|
+
const datum = getSelectedPoint(e.target);
|
|
52
|
+
if (datum) {
|
|
53
|
+
dispatcher.call('click-chart', undefined, { point: datum.point.data, series: datum.point.series }, e);
|
|
54
|
+
}
|
|
45
55
|
});
|
|
46
56
|
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
47
57
|
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import get from 'lodash/get';
|
|
1
2
|
import { getXValue, getYValue } from '../utils';
|
|
2
3
|
const getFilteredLinearScatterData = (data) => {
|
|
3
4
|
return data.filter((d) => typeof d.x === 'number' && typeof d.y === 'number');
|
|
@@ -15,6 +16,7 @@ export const prepareScatterData = (args) => {
|
|
|
15
16
|
series: s,
|
|
16
17
|
x: getXValue({ point: d, xAxis, xScale }),
|
|
17
18
|
y: getYValue({ point: d, yAxis, yScale }),
|
|
19
|
+
opacity: get(d, 'opacity', null),
|
|
18
20
|
},
|
|
19
21
|
hovered: false,
|
|
20
22
|
active: true,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { color, pointer, select } from 'd3';
|
|
3
3
|
import get from 'lodash/get';
|
|
4
|
-
import { setEllipsisForOverflowTexts } from '../../../utils';
|
|
5
4
|
import { block } from '../../../../../../utils/cn';
|
|
5
|
+
import { setEllipsisForOverflowTexts } from '../../../utils';
|
|
6
6
|
const b = block('d3-treemap');
|
|
7
7
|
export const TreemapSeriesShape = (props) => {
|
|
8
8
|
const { dispatcher, preparedData, seriesOptions, svgContainer } = props;
|
|
@@ -44,17 +44,24 @@ export const TreemapSeriesShape = (props) => {
|
|
|
44
44
|
.style('font-weight', () => { var _a; return ((_a = series.dataLabels.style) === null || _a === void 0 ? void 0 : _a.fontWeight) || null; })
|
|
45
45
|
.style('fill', () => { var _a; return ((_a = series.dataLabels.style) === null || _a === void 0 ? void 0 : _a.fontColor) || null; })
|
|
46
46
|
.call(setEllipsisForOverflowTexts, (d) => d.width);
|
|
47
|
-
const
|
|
47
|
+
const getSelectedPart = (node) => {
|
|
48
|
+
const hoveredRect = select(node);
|
|
49
|
+
return hoveredRect.datum();
|
|
50
|
+
};
|
|
51
|
+
const eventName = `hover-shape.treemap`;
|
|
48
52
|
const hoverOptions = get(seriesOptions, 'treemap.states.hover');
|
|
49
53
|
const inactiveOptions = get(seriesOptions, 'treemap.states.inactive');
|
|
50
54
|
svgElement
|
|
51
55
|
.on('mousemove', (e) => {
|
|
52
|
-
const
|
|
53
|
-
const datum = hoveredRect.datum();
|
|
56
|
+
const datum = getSelectedPart(e.target);
|
|
54
57
|
dispatcher.call('hover-shape', {}, [{ data: datum.data, series }], pointer(e, svgContainer));
|
|
55
58
|
})
|
|
56
59
|
.on('mouseleave', () => {
|
|
57
60
|
dispatcher.call('hover-shape', {}, undefined);
|
|
61
|
+
})
|
|
62
|
+
.on('click', (e) => {
|
|
63
|
+
const datum = getSelectedPart(e.target);
|
|
64
|
+
dispatcher.call('click-chart', undefined, { point: datum.data, series }, e);
|
|
58
65
|
});
|
|
59
66
|
dispatcher.on(eventName, (data) => {
|
|
60
67
|
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BaseType } from 'd3';
|
|
2
|
+
import { DashStyle } from '../../../../../constants';
|
|
2
3
|
import type { BasicInactiveState } from '../../../../../types';
|
|
3
4
|
import type { ChartScale } from '../useAxisScales';
|
|
4
5
|
import type { PreparedAxis } from '../useChartOptions/types';
|
|
5
|
-
import { DashStyle } from '../../../../../constants';
|
|
6
6
|
export declare function getXValue(args: {
|
|
7
7
|
point: {
|
|
8
8
|
x?: number | string;
|
|
@@ -7,7 +7,7 @@ type Args = {
|
|
|
7
7
|
tooltip: PreparedTooltip;
|
|
8
8
|
};
|
|
9
9
|
export declare const useTooltip: ({ dispatcher, tooltip }: Args) => {
|
|
10
|
-
hovered: TooltipDataChunk
|
|
10
|
+
hovered: TooltipDataChunk[] | undefined;
|
|
11
11
|
pointerPosition: PointerPosition | undefined;
|
|
12
12
|
};
|
|
13
13
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { select } from 'd3';
|
|
2
2
|
import { getXAxisItems, getXAxisOffset, getXTickPosition } from '../axis';
|
|
3
|
-
import { getLabelsSize, setEllipsisForOverflowText } from '../text';
|
|
4
3
|
import { calculateCos, calculateSin } from '../math';
|
|
4
|
+
import { getLabelsSize, setEllipsisForOverflowText } from '../text';
|
|
5
5
|
function addDomain(selection, options) {
|
|
6
6
|
const { size, color } = options;
|
|
7
7
|
selection
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { dateTime } from '@gravity-ui/date-utils';
|
|
1
2
|
import { group, select } from 'd3';
|
|
2
3
|
import get from 'lodash/get';
|
|
3
4
|
import isNil from 'lodash/isNil';
|
|
4
|
-
import { dateTime } from '@gravity-ui/date-utils';
|
|
5
5
|
import { formatNumber } from '../../../shared';
|
|
6
|
-
import { DEFAULT_AXIS_LABEL_FONT_SIZE } from '../constants';
|
|
7
6
|
import { getNumberUnitRate } from '../../../shared/format-number/format-number';
|
|
8
|
-
import {
|
|
7
|
+
import { DEFAULT_AXIS_LABEL_FONT_SIZE } from '../constants';
|
|
9
8
|
import { getSeriesStackId } from '../hooks/useSeries/utils';
|
|
9
|
+
import { getDefaultDateFormat } from './time';
|
|
10
10
|
export * from './math';
|
|
11
11
|
export * from './text';
|
|
12
12
|
export * from './time';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { symbolCircle, symbolDiamond2, symbolSquare, symbolTriangle2 } from 'd3';
|
|
2
2
|
import { SymbolType } from '../../../../constants';
|
|
3
3
|
export const getSymbolType = (index) => {
|
|
4
4
|
const scatterStyles = Object.values(SymbolType);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
2
|
import isEmpty from 'lodash/isEmpty';
|
|
3
3
|
import { SeriesType } from '../../../../constants';
|
|
4
|
-
import { ChartKitError, CHARTKIT_ERROR_CODE } from '../../../../libs';
|
|
5
4
|
import { i18n } from '../../../../i18n';
|
|
5
|
+
import { CHARTKIT_ERROR_CODE, ChartKitError } from '../../../../libs';
|
|
6
6
|
import { DEFAULT_AXIS_TYPE } from '../constants';
|
|
7
7
|
const AVAILABLE_SERIES_TYPES = Object.values(SeriesType);
|
|
8
8
|
const validateXYSeries = (args) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Highcharts, { ChartCallbackFunction, Options
|
|
2
|
+
import Highcharts, { Chart, ChartCallbackFunction, Options } from 'highcharts';
|
|
3
3
|
import type { ChartKitProps } from '../../../../types';
|
|
4
4
|
import type { HighchartsWidgetData, StringParams } from '../../types';
|
|
5
5
|
import './HighchartsComponent.css';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Highcharts from 'highcharts';
|
|
3
|
-
import HighchartsReact from './HighchartsReact';
|
|
4
3
|
import get from 'lodash/get';
|
|
5
4
|
import { settings } from '../../../../libs';
|
|
6
5
|
import { settingsEventEmitter } from '../../../../libs/settings/settings';
|
|
7
|
-
import {
|
|
6
|
+
import { getChartPerformanceDuration, getRandomCKId, markChartPerformance } from '../../../../utils';
|
|
8
7
|
import { getGraph } from '../helpers/graph';
|
|
9
8
|
import { initHighchartsLangOptions } from '../helpers/highcharts/highcharts';
|
|
9
|
+
import HighchartsReact from './HighchartsReact';
|
|
10
10
|
import { withSplitPane } from './withSplitPane/withSplitPane';
|
|
11
11
|
import './HighchartsComponent.css';
|
|
12
12
|
const HighcharsReactWithSplitPane = withSplitPane(HighchartsReact);
|
|
@@ -26,7 +26,13 @@ export const HighchartsReact = React.memo(React.forwardRef(function HighchartsRe
|
|
|
26
26
|
if (!chartRef.current) {
|
|
27
27
|
createChart();
|
|
28
28
|
}
|
|
29
|
-
}, [
|
|
29
|
+
}, [
|
|
30
|
+
props.options,
|
|
31
|
+
props.allowChartUpdate,
|
|
32
|
+
props.containerProps,
|
|
33
|
+
props.highcharts,
|
|
34
|
+
props.constructorType,
|
|
35
|
+
]);
|
|
30
36
|
useIsomorphicLayoutEffect(() => {
|
|
31
37
|
return () => {
|
|
32
38
|
if (chartRef.current) {
|