@gravity-ui/charts 0.6.1 → 0.7.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/README.md +1 -1
- package/dist/cjs/components/Tooltip/ChartTooltipContent.d.ts +2 -2
- package/dist/cjs/components/Tooltip/index.js +5 -5
- package/dist/cjs/components/Tooltip/styles.css +2 -15
- package/dist/cjs/components/index.d.ts +10 -9
- package/dist/cjs/hooks/useSeries/prepare-area.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-line.d.ts +1 -1
- package/dist/cjs/types/chart/area.d.ts +6 -6
- package/dist/cjs/types/chart/axis.d.ts +8 -7
- package/dist/cjs/types/chart/bar-x.d.ts +4 -4
- package/dist/cjs/types/chart/bar-y.d.ts +5 -6
- package/dist/cjs/types/chart/base.d.ts +6 -6
- package/dist/cjs/types/chart/chart.d.ts +4 -4
- package/dist/cjs/types/chart/halo.d.ts +2 -2
- package/dist/cjs/types/chart/legend.d.ts +10 -10
- package/dist/cjs/types/chart/line.d.ts +4 -4
- package/dist/cjs/types/chart/marker.d.ts +2 -2
- package/dist/cjs/types/chart/pie.d.ts +4 -4
- package/dist/cjs/types/chart/scatter.d.ts +4 -4
- package/dist/cjs/types/chart/series.d.ts +8 -8
- package/dist/cjs/types/chart/split.d.ts +4 -4
- package/dist/cjs/types/chart/title.d.ts +2 -2
- package/dist/cjs/types/chart/tooltip.d.ts +20 -20
- package/dist/cjs/types/chart/treemap.d.ts +4 -4
- package/dist/cjs/types/chart/waterfall.d.ts +4 -4
- package/dist/cjs/types/chart-ui.d.ts +6 -6
- package/dist/cjs/types/formatter.d.ts +4 -4
- package/dist/cjs/types/index.d.ts +34 -4
- package/dist/esm/components/Tooltip/ChartTooltipContent.d.ts +2 -2
- package/dist/esm/components/Tooltip/index.js +5 -5
- package/dist/esm/components/Tooltip/styles.css +2 -15
- package/dist/esm/components/index.d.ts +10 -9
- package/dist/esm/hooks/useSeries/prepare-area.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-line.d.ts +1 -1
- package/dist/esm/types/chart/area.d.ts +6 -6
- package/dist/esm/types/chart/axis.d.ts +8 -7
- package/dist/esm/types/chart/bar-x.d.ts +4 -4
- package/dist/esm/types/chart/bar-y.d.ts +5 -6
- package/dist/esm/types/chart/base.d.ts +6 -6
- package/dist/esm/types/chart/chart.d.ts +4 -4
- package/dist/esm/types/chart/halo.d.ts +2 -2
- package/dist/esm/types/chart/legend.d.ts +10 -10
- package/dist/esm/types/chart/line.d.ts +4 -4
- package/dist/esm/types/chart/marker.d.ts +2 -2
- package/dist/esm/types/chart/pie.d.ts +4 -4
- package/dist/esm/types/chart/scatter.d.ts +4 -4
- package/dist/esm/types/chart/series.d.ts +8 -8
- package/dist/esm/types/chart/split.d.ts +4 -4
- package/dist/esm/types/chart/title.d.ts +2 -2
- package/dist/esm/types/chart/tooltip.d.ts +20 -20
- package/dist/esm/types/chart/treemap.d.ts +4 -4
- package/dist/esm/types/chart/waterfall.d.ts +4 -4
- package/dist/esm/types/chart-ui.d.ts +6 -6
- package/dist/esm/types/formatter.d.ts +4 -4
- package/dist/esm/types/index.d.ts +34 -4
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ChartTooltip, ChartXAxis, ChartYAxis, TooltipDataChunk } from '../../types';
|
|
3
|
-
export
|
|
3
|
+
export interface ChartTooltipContentProps {
|
|
4
4
|
hovered?: TooltipDataChunk[];
|
|
5
5
|
xAxis?: ChartXAxis;
|
|
6
6
|
yAxis?: ChartYAxis;
|
|
7
7
|
renderer?: ChartTooltip['renderer'];
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
export declare const ChartTooltipContent: (props: ChartTooltipContentProps) => React.JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Popup,
|
|
2
|
+
import { Popup, useVirtualElement } from '@gravity-ui/uikit';
|
|
3
3
|
import { useTooltip } from '../../hooks';
|
|
4
4
|
import { block } from '../../utils';
|
|
5
5
|
import { ChartTooltipContent } from './ChartTooltipContent';
|
|
@@ -11,9 +11,9 @@ export const Tooltip = (props) => {
|
|
|
11
11
|
const containerRect = (svgContainer === null || svgContainer === void 0 ? void 0 : svgContainer.getBoundingClientRect()) || { left: 0, top: 0 };
|
|
12
12
|
const left = ((pointerPosition === null || pointerPosition === void 0 ? void 0 : pointerPosition[0]) || 0) + containerRect.left;
|
|
13
13
|
const top = ((pointerPosition === null || pointerPosition === void 0 ? void 0 : pointerPosition[1]) || 0) + containerRect.top;
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
if (svgContainer === null || svgContainer === void 0 ? void 0 : svgContainer.contains(e.target)) {
|
|
14
|
+
const { anchor } = useVirtualElement({ left, top });
|
|
15
|
+
const handleOnOpenChange = (_open, e) => {
|
|
16
|
+
if (svgContainer === null || svgContainer === void 0 ? void 0 : svgContainer.contains(e === null || e === void 0 ? void 0 : e.target)) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
onOutsideClick === null || onOutsideClick === void 0 ? void 0 : onOutsideClick();
|
|
@@ -21,7 +21,7 @@ export const Tooltip = (props) => {
|
|
|
21
21
|
React.useEffect(() => {
|
|
22
22
|
window.dispatchEvent(new CustomEvent('scroll'));
|
|
23
23
|
}, [left, top]);
|
|
24
|
-
return (hovered === null || hovered === void 0 ? void 0 : hovered.length) ? (React.createElement(Popup, { className: b({ pinned: tooltipPinned }),
|
|
24
|
+
return (hovered === null || hovered === void 0 ? void 0 : hovered.length) ? (React.createElement(Popup, { anchorElement: anchor, className: b({ pinned: tooltipPinned }), disableTransition: true, floatingStyles: tooltipPinned ? undefined : { pointerEvents: 'none' }, offset: { mainAxis: 20 }, onOpenChange: tooltipPinned ? handleOnOpenChange : undefined, open: true, placement: ['right', 'left', 'top', 'bottom'] },
|
|
25
25
|
React.createElement("div", { className: b('content') },
|
|
26
26
|
React.createElement(ChartTooltipContent, { hovered: hovered, xAxis: xAxis, yAxis: yAxis, renderer: tooltip.renderer })))) : null;
|
|
27
27
|
};
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
.gcharts-tooltip
|
|
2
|
-
--g-
|
|
3
|
-
pointer-events: none;
|
|
4
|
-
}
|
|
5
|
-
.gcharts-tooltip[class] > div {
|
|
6
|
-
animation-duration: unset;
|
|
7
|
-
animation-timing-function: unset;
|
|
8
|
-
animation-fill-mode: unset;
|
|
9
|
-
}
|
|
10
|
-
.gcharts-tooltip[class].gcharts-tooltip_pinned {
|
|
11
|
-
pointer-events: inherit;
|
|
12
|
-
}
|
|
13
|
-
.gcharts-tooltip__popup-content {
|
|
14
|
-
box-shadow: none;
|
|
1
|
+
.gcharts-tooltip {
|
|
2
|
+
box-shadow: 0 2px 12px var(--g-color-sfx-shadow);
|
|
15
3
|
}
|
|
16
4
|
.gcharts-tooltip__content {
|
|
17
5
|
padding: 8px 14px;
|
|
18
6
|
text-wrap: nowrap;
|
|
19
7
|
border-radius: 4px;
|
|
20
8
|
background-color: var(--g-color-infographics-tooltip-bg);
|
|
21
|
-
box-shadow: 0 2px 12px var(--g-color-sfx-shadow);
|
|
22
9
|
}
|
|
23
10
|
.gcharts-tooltip__content-row {
|
|
24
11
|
display: flex;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ChartData } from '../types';
|
|
3
3
|
export * from './Tooltip/ChartTooltipContent';
|
|
4
|
-
export
|
|
4
|
+
export interface ChartRef {
|
|
5
5
|
reflow: () => void;
|
|
6
|
-
}
|
|
7
|
-
|
|
6
|
+
}
|
|
7
|
+
export interface ChartDimentions {
|
|
8
8
|
height: number;
|
|
9
9
|
width: number;
|
|
10
|
-
}
|
|
11
|
-
export type
|
|
10
|
+
}
|
|
11
|
+
export type ChartOnResize = (args: {
|
|
12
|
+
dimensions?: ChartDimentions;
|
|
13
|
+
}) => void;
|
|
14
|
+
export interface ChartProps {
|
|
12
15
|
data: ChartData;
|
|
13
16
|
lang?: string;
|
|
14
|
-
onResize?:
|
|
15
|
-
|
|
16
|
-
}) => void;
|
|
17
|
-
};
|
|
17
|
+
onResize?: ChartOnResize;
|
|
18
|
+
}
|
|
18
19
|
export declare const Chart: React.ForwardRefExoticComponent<ChartProps & React.RefAttributes<ChartRef>>;
|
|
@@ -5,9 +5,9 @@ export declare const DEFAULT_LINE_WIDTH = 1;
|
|
|
5
5
|
export declare const DEFAULT_MARKER: {
|
|
6
6
|
enabled: boolean;
|
|
7
7
|
symbol: `${import("../../constants").SymbolType}`;
|
|
8
|
+
radius: number;
|
|
8
9
|
borderColor: string;
|
|
9
10
|
borderWidth: number;
|
|
10
|
-
radius: number;
|
|
11
11
|
};
|
|
12
12
|
type PrepareAreaSeriesArgs = {
|
|
13
13
|
colorScale: ScaleOrdinal<string, string>;
|
|
@@ -8,9 +8,9 @@ export declare const DEFAULT_DASH_STYLE = DashStyle.Solid;
|
|
|
8
8
|
export declare const DEFAULT_MARKER: {
|
|
9
9
|
enabled: boolean;
|
|
10
10
|
symbol: `${import("../../constants").SymbolType}`;
|
|
11
|
+
radius: number;
|
|
11
12
|
borderColor: string;
|
|
12
13
|
borderWidth: number;
|
|
13
|
-
radius: number;
|
|
14
14
|
};
|
|
15
15
|
type PrepareLineSeriesArgs = {
|
|
16
16
|
colorScale: ScaleOrdinal<string, string>;
|
|
@@ -3,7 +3,7 @@ import type { MeaningfulAny } from '../misc';
|
|
|
3
3
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
4
4
|
import type { ChartLegend, RectLegendSymbolOptions } from './legend';
|
|
5
5
|
import type { PointMarkerOptions } from './marker';
|
|
6
|
-
export
|
|
6
|
+
export interface AreaSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
7
7
|
/**
|
|
8
8
|
* The `x` value of the point. Depending on the context , it may represents:
|
|
9
9
|
* - numeric value (for `linear` x axis)
|
|
@@ -35,12 +35,12 @@ export type AreaSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
export type AreaMarkerSymbol = 'circle' | 'square';
|
|
40
|
-
export
|
|
40
|
+
export interface AreaMarkerOptions extends PointMarkerOptions {
|
|
41
41
|
symbol?: AreaMarkerSymbol;
|
|
42
|
-
}
|
|
43
|
-
export
|
|
42
|
+
}
|
|
43
|
+
export interface AreaSeries<T = MeaningfulAny> extends BaseSeries {
|
|
44
44
|
type: typeof SeriesType.Area;
|
|
45
45
|
data: AreaSeriesData<T>[];
|
|
46
46
|
/** The name of the series (used in legend, tooltip etc) */
|
|
@@ -73,4 +73,4 @@ export type AreaSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
73
73
|
marker?: AreaMarkerOptions;
|
|
74
74
|
/** Y-axis index (when using two axes) */
|
|
75
75
|
yAxis?: number;
|
|
76
|
-
}
|
|
76
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { FormatNumberOptions } from '../formatter';
|
|
|
2
2
|
import type { BaseTextStyle } from './base';
|
|
3
3
|
export type ChartAxisType = 'category' | 'datetime' | 'linear' | 'logarithmic';
|
|
4
4
|
export type ChartAxisTitleAlignment = 'left' | 'center' | 'right';
|
|
5
|
-
export
|
|
5
|
+
export interface ChartAxisLabels {
|
|
6
6
|
/** Enable or disable the axis labels. */
|
|
7
7
|
enabled?: boolean;
|
|
8
8
|
/** The label's pixel distance from the perimeter of the plot area.
|
|
@@ -27,8 +27,8 @@ export type ChartAxisLabels = {
|
|
|
27
27
|
* @default: 0
|
|
28
28
|
*/
|
|
29
29
|
rotation?: number;
|
|
30
|
-
}
|
|
31
|
-
export
|
|
30
|
+
}
|
|
31
|
+
export interface ChartAxis {
|
|
32
32
|
categories?: string[];
|
|
33
33
|
timestamps?: number[];
|
|
34
34
|
type?: ChartAxisType;
|
|
@@ -72,9 +72,10 @@ export type ChartAxis = {
|
|
|
72
72
|
* Defaults to 0.05 for Y axis and to 0.01 for X axis.
|
|
73
73
|
* */
|
|
74
74
|
maxPadding?: number;
|
|
75
|
-
}
|
|
76
|
-
export
|
|
77
|
-
|
|
75
|
+
}
|
|
76
|
+
export interface ChartXAxis extends ChartAxis {
|
|
77
|
+
}
|
|
78
|
+
export interface ChartYAxis extends ChartAxis {
|
|
78
79
|
/** Axis location.
|
|
79
80
|
* Possible values - 'left' and 'right'.
|
|
80
81
|
* */
|
|
@@ -82,4 +83,4 @@ export type ChartYAxis = ChartAxis & {
|
|
|
82
83
|
/** Property for splitting charts. Determines which area the axis is located in.
|
|
83
84
|
* */
|
|
84
85
|
plotIndex?: number;
|
|
85
|
-
}
|
|
86
|
+
}
|
|
@@ -3,7 +3,7 @@ import type { MeaningfulAny } from '../misc';
|
|
|
3
3
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
4
4
|
import type { ChartLegend, RectLegendSymbolOptions } from './legend';
|
|
5
5
|
import type { ChartSeriesOptions } from './series';
|
|
6
|
-
export
|
|
6
|
+
export interface BarXSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
7
7
|
/**
|
|
8
8
|
* The `x` value of the bar. Depending on the context , it may represents:
|
|
9
9
|
* - numeric value (for `linear` x axis)
|
|
@@ -28,8 +28,8 @@ export type BarXSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
28
28
|
label?: string | number;
|
|
29
29
|
/** Individual opacity for the bar-x column. */
|
|
30
30
|
opacity?: number;
|
|
31
|
-
}
|
|
32
|
-
export
|
|
31
|
+
}
|
|
32
|
+
export interface BarXSeries<T = MeaningfulAny> extends BaseSeries {
|
|
33
33
|
type: typeof SeriesType.BarX;
|
|
34
34
|
data: BarXSeriesData<T>[];
|
|
35
35
|
/** The name of the series (used in legend, tooltip etc) */
|
|
@@ -64,4 +64,4 @@ export type BarXSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
64
64
|
};
|
|
65
65
|
/** Y-axis index (when using two axes) */
|
|
66
66
|
yAxis?: number;
|
|
67
|
-
}
|
|
67
|
+
}
|
|
@@ -2,8 +2,7 @@ import type { SeriesType } from '../../constants';
|
|
|
2
2
|
import type { MeaningfulAny } from '../misc';
|
|
3
3
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
4
4
|
import type { ChartLegend, RectLegendSymbolOptions } from './legend';
|
|
5
|
-
|
|
6
|
-
export type BarYSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
5
|
+
export interface BarYSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
7
6
|
/**
|
|
8
7
|
* The `x` value of the bar. Depending on the context , it may represents:
|
|
9
8
|
* - numeric value (for `linear` x axis)
|
|
@@ -22,8 +21,8 @@ export type BarYSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
22
21
|
label?: string | number;
|
|
23
22
|
/** Individual opacity for the bar. */
|
|
24
23
|
opacity?: number;
|
|
25
|
-
}
|
|
26
|
-
export
|
|
24
|
+
}
|
|
25
|
+
export interface BarYSeries<T = MeaningfulAny> extends BaseSeries {
|
|
27
26
|
type: typeof SeriesType.BarY;
|
|
28
27
|
data: BarYSeriesData<T>[];
|
|
29
28
|
/** The name of the series (used in legend, tooltip etc) */
|
|
@@ -44,7 +43,7 @@ export type BarYSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
44
43
|
* @default true
|
|
45
44
|
* */
|
|
46
45
|
grouping?: boolean;
|
|
47
|
-
dataLabels?:
|
|
46
|
+
dataLabels?: BaseSeries['dataLabels'] & {
|
|
48
47
|
/**
|
|
49
48
|
* Whether to align the data label inside or outside the box.
|
|
50
49
|
* For charts with a percentage stack, it is always true.
|
|
@@ -57,4 +56,4 @@ export type BarYSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
57
56
|
legend?: ChartLegend & {
|
|
58
57
|
symbol?: RectLegendSymbolOptions;
|
|
59
58
|
};
|
|
60
|
-
}
|
|
59
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MeaningfulAny } from '../misc';
|
|
2
|
-
export
|
|
2
|
+
export interface BaseSeries {
|
|
3
3
|
/** Initial visibility of the series */
|
|
4
4
|
visible?: boolean;
|
|
5
5
|
/**
|
|
@@ -30,8 +30,8 @@ export type BaseSeries = {
|
|
|
30
30
|
};
|
|
31
31
|
/** You can set the cursor to "pointer" if you have click events attached to the series, to signal to the user that the points and lines can be clicked. */
|
|
32
32
|
cursor?: string;
|
|
33
|
-
}
|
|
34
|
-
export
|
|
33
|
+
}
|
|
34
|
+
export interface BaseSeriesData<T = MeaningfulAny> {
|
|
35
35
|
/**
|
|
36
36
|
* A reserved subspace to store options and values for customized functionality
|
|
37
37
|
*
|
|
@@ -40,9 +40,9 @@ export type BaseSeriesData<T = MeaningfulAny> = {
|
|
|
40
40
|
custom?: T;
|
|
41
41
|
/** Individual color for the data chunk (point in scatter, segment in pie, bar etc) */
|
|
42
42
|
color?: string;
|
|
43
|
-
}
|
|
44
|
-
export
|
|
43
|
+
}
|
|
44
|
+
export interface BaseTextStyle {
|
|
45
45
|
fontSize: string;
|
|
46
46
|
fontWeight?: string;
|
|
47
47
|
fontColor?: string;
|
|
48
|
-
}
|
|
48
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { MeaningfulAny } from '../misc';
|
|
2
2
|
import type { ChartTooltipRendererArgs } from './tooltip';
|
|
3
|
-
export
|
|
3
|
+
export interface ChartMargin {
|
|
4
4
|
top: number;
|
|
5
5
|
right: number;
|
|
6
6
|
bottom: number;
|
|
7
7
|
left: number;
|
|
8
|
-
}
|
|
9
|
-
export
|
|
8
|
+
}
|
|
9
|
+
export interface ChartOptions {
|
|
10
10
|
margin?: Partial<ChartMargin>;
|
|
11
11
|
events?: {
|
|
12
12
|
click?: (data: {
|
|
@@ -15,4 +15,4 @@ export type ChartOptions = {
|
|
|
15
15
|
}, event: PointerEvent) => void;
|
|
16
16
|
pointermove?: (data: ChartTooltipRendererArgs | undefined, event: PointerEvent) => void;
|
|
17
17
|
};
|
|
18
|
-
}
|
|
18
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** The halo appearing around the hovered part of series(point in line-type series or slice in pie charts) */
|
|
2
|
-
export
|
|
2
|
+
export interface Halo {
|
|
3
3
|
/** Enable or disable the halo */
|
|
4
4
|
enabled?: boolean;
|
|
5
5
|
/** The opacity of halo */
|
|
6
6
|
opacity?: number;
|
|
7
7
|
/** The pixel size of the halo. Radius for point markers or width of the outside slice in pie charts. */
|
|
8
8
|
size?: number;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseTextStyle } from './base';
|
|
2
|
-
export
|
|
2
|
+
export interface ChartLegend {
|
|
3
3
|
enabled?: boolean;
|
|
4
4
|
/**
|
|
5
5
|
* Different types for different color schemes.
|
|
@@ -47,16 +47,16 @@ export type ChartLegend = {
|
|
|
47
47
|
domain?: number[];
|
|
48
48
|
};
|
|
49
49
|
width?: number;
|
|
50
|
-
}
|
|
51
|
-
export
|
|
50
|
+
}
|
|
51
|
+
export interface BaseLegendSymbol {
|
|
52
52
|
/**
|
|
53
53
|
* The pixel padding between the legend item symbol and the legend item text.
|
|
54
54
|
*
|
|
55
55
|
* @default 5
|
|
56
56
|
* */
|
|
57
57
|
padding?: number;
|
|
58
|
-
}
|
|
59
|
-
export
|
|
58
|
+
}
|
|
59
|
+
export interface RectLegendSymbolOptions extends BaseLegendSymbol {
|
|
60
60
|
/**
|
|
61
61
|
* The pixel width of the symbol for series types that use a rectangle in the legend
|
|
62
62
|
*
|
|
@@ -75,20 +75,20 @@ export type RectLegendSymbolOptions = BaseLegendSymbol & {
|
|
|
75
75
|
* Defaults to half the symbolHeight, effectively creating a circle.
|
|
76
76
|
*/
|
|
77
77
|
radius?: number;
|
|
78
|
-
}
|
|
79
|
-
export
|
|
78
|
+
}
|
|
79
|
+
export interface PathLegendSymbolOptions extends BaseLegendSymbol {
|
|
80
80
|
/**
|
|
81
81
|
* The pixel width of the symbol for series types that use a path in the legend
|
|
82
82
|
*
|
|
83
83
|
* @default 16
|
|
84
84
|
* */
|
|
85
85
|
width?: number;
|
|
86
|
-
}
|
|
87
|
-
export
|
|
86
|
+
}
|
|
87
|
+
export interface SymbolLegendSymbolOptions extends BaseLegendSymbol {
|
|
88
88
|
/**
|
|
89
89
|
* The pixel width of the symbol for series types that use a symbol in the legend
|
|
90
90
|
*
|
|
91
91
|
* @default 8
|
|
92
92
|
* */
|
|
93
93
|
width?: number;
|
|
94
|
-
}
|
|
94
|
+
}
|
|
@@ -3,7 +3,7 @@ import type { MeaningfulAny } from '../misc';
|
|
|
3
3
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
4
4
|
import type { ChartLegend, RectLegendSymbolOptions } from './legend';
|
|
5
5
|
import type { PointMarkerOptions } from './marker';
|
|
6
|
-
export
|
|
6
|
+
export interface LineSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
7
7
|
/**
|
|
8
8
|
* The `x` value of the point. Depending on the context , it may represents:
|
|
9
9
|
* - numeric value (for `linear` x axis)
|
|
@@ -27,8 +27,8 @@ export type LineSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
}
|
|
31
|
-
export
|
|
30
|
+
}
|
|
31
|
+
export interface LineSeries<T = MeaningfulAny> extends BaseSeries {
|
|
32
32
|
type: typeof SeriesType.Line;
|
|
33
33
|
data: LineSeriesData<T>[];
|
|
34
34
|
/** The name of the series (used in legend, tooltip etc) */
|
|
@@ -54,4 +54,4 @@ export type LineSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
54
54
|
opacity?: number;
|
|
55
55
|
/** Y-axis index (when using two axes) */
|
|
56
56
|
yAxis?: number;
|
|
57
|
-
}
|
|
57
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SymbolType } from '../../constants';
|
|
2
|
-
export
|
|
2
|
+
export interface PointMarkerOptions {
|
|
3
3
|
/** Enable or disable the point marker */
|
|
4
4
|
enabled?: boolean;
|
|
5
5
|
/** The radius of the point marker */
|
|
@@ -9,4 +9,4 @@ export type PointMarkerOptions = {
|
|
|
9
9
|
/** The width of the point marker's border */
|
|
10
10
|
borderWidth?: number;
|
|
11
11
|
symbol?: `${SymbolType}`;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
@@ -3,7 +3,7 @@ import type { SeriesType } from '../../constants';
|
|
|
3
3
|
import type { MeaningfulAny } from '../misc';
|
|
4
4
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
5
5
|
import type { ChartLegend, RectLegendSymbolOptions } from './legend';
|
|
6
|
-
export
|
|
6
|
+
export interface PieSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
7
7
|
/** The value of the pie segment. */
|
|
8
8
|
value: number;
|
|
9
9
|
/** The name of the pie segment (used in legend, tooltip etc). */
|
|
@@ -14,10 +14,10 @@ export type PieSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
14
14
|
label?: string;
|
|
15
15
|
/** Individual opacity for the pie segment. */
|
|
16
16
|
opacity?: number;
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
export type ConnectorShape = 'straight-line' | 'polyline';
|
|
19
19
|
export type ConnectorCurve = 'linear' | 'basic';
|
|
20
|
-
export
|
|
20
|
+
export interface PieSeries<T = MeaningfulAny> extends BaseSeries {
|
|
21
21
|
type: typeof SeriesType.Pie;
|
|
22
22
|
data: PieSeriesData<T>[];
|
|
23
23
|
/**
|
|
@@ -85,4 +85,4 @@ export type PieSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
85
85
|
innerRadius: number;
|
|
86
86
|
};
|
|
87
87
|
}) => BaseType;
|
|
88
|
-
}
|
|
88
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { SeriesType, SymbolType } from '../../constants';
|
|
|
2
2
|
import type { MeaningfulAny } from '../misc';
|
|
3
3
|
import type { BaseSeries, BaseSeriesData } from './base';
|
|
4
4
|
import type { ChartLegend, RectLegendSymbolOptions } from './legend';
|
|
5
|
-
export
|
|
5
|
+
export interface ScatterSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
|
|
6
6
|
/**
|
|
7
7
|
* The `x` value of the point. Depending on the context , it may represents:
|
|
8
8
|
* - numeric value (for `linear` x axis)
|
|
@@ -27,8 +27,8 @@ export type ScatterSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
|
|
|
27
27
|
radius?: number;
|
|
28
28
|
/** Individual opacity for the point. */
|
|
29
29
|
opacity?: number;
|
|
30
|
-
}
|
|
31
|
-
export
|
|
30
|
+
}
|
|
31
|
+
export interface ScatterSeries<T = MeaningfulAny> extends BaseSeries {
|
|
32
32
|
type: typeof SeriesType.Scatter;
|
|
33
33
|
data: ScatterSeriesData<T>[];
|
|
34
34
|
/** The name of the series (used in legend, tooltip etc) */
|
|
@@ -43,4 +43,4 @@ export type ScatterSeries<T = MeaningfulAny> = BaseSeries & {
|
|
|
43
43
|
};
|
|
44
44
|
/** Y-axis index (when using two axes) */
|
|
45
45
|
yAxis?: number;
|
|
46
|
-
}
|
|
46
|
+
}
|
|
@@ -13,10 +13,10 @@ import type { TreemapSeries, TreemapSeriesData } from './treemap';
|
|
|
13
13
|
import type { WaterfallSeries, WaterfallSeriesData } from './waterfall';
|
|
14
14
|
export type ChartSeries<T = MeaningfulAny> = ScatterSeries<T> | PieSeries<T> | BarXSeries<T> | BarYSeries<T> | LineSeries<T> | AreaSeries<T> | TreemapSeries<T> | WaterfallSeries<T>;
|
|
15
15
|
export type ChartSeriesData<T = MeaningfulAny> = ScatterSeriesData<T> | PieSeriesData<T> | BarXSeriesData<T> | BarYSeriesData<T> | LineSeriesData<T> | AreaSeriesData<T> | TreemapSeriesData<T> | WaterfallSeriesData<T>;
|
|
16
|
-
export
|
|
16
|
+
export interface DataLabelRendererData<T = MeaningfulAny> {
|
|
17
17
|
data: ChartSeriesData<T>;
|
|
18
|
-
}
|
|
19
|
-
export
|
|
18
|
+
}
|
|
19
|
+
export interface BasicHoverState {
|
|
20
20
|
/**
|
|
21
21
|
* Enable separate styles for the hovered series.
|
|
22
22
|
*
|
|
@@ -32,8 +32,8 @@ export type BasicHoverState = {
|
|
|
32
32
|
* @default 0.3
|
|
33
33
|
*/
|
|
34
34
|
brightness?: number;
|
|
35
|
-
}
|
|
36
|
-
export
|
|
35
|
+
}
|
|
36
|
+
export interface BasicInactiveState {
|
|
37
37
|
/**
|
|
38
38
|
* Enable separate styles for the inactive series.
|
|
39
39
|
*
|
|
@@ -46,8 +46,8 @@ export type BasicInactiveState = {
|
|
|
46
46
|
* @default 0.5
|
|
47
47
|
* */
|
|
48
48
|
opacity?: number;
|
|
49
|
-
}
|
|
50
|
-
export
|
|
49
|
+
}
|
|
50
|
+
export interface ChartSeriesOptions {
|
|
51
51
|
/** Individual data label for each point. */
|
|
52
52
|
dataLabels?: {
|
|
53
53
|
/** Enable or disable the data labels */
|
|
@@ -222,4 +222,4 @@ export type ChartSeriesOptions = {
|
|
|
222
222
|
inactive?: BasicInactiveState;
|
|
223
223
|
};
|
|
224
224
|
};
|
|
225
|
-
}
|
|
225
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { BaseTextStyle } from './base';
|
|
2
|
-
export
|
|
2
|
+
export interface SplitPlotOptions {
|
|
3
3
|
title?: {
|
|
4
4
|
text: string;
|
|
5
5
|
style?: Partial<BaseTextStyle>;
|
|
6
6
|
};
|
|
7
|
-
}
|
|
8
|
-
export
|
|
7
|
+
}
|
|
8
|
+
export interface ChartSplit {
|
|
9
9
|
enable: boolean;
|
|
10
10
|
layout?: 'vertical';
|
|
11
11
|
gap?: string | number;
|
|
12
12
|
plots?: SplitPlotOptions[];
|
|
13
|
-
}
|
|
13
|
+
}
|
|
@@ -8,63 +8,63 @@ import type { PieSeries, PieSeriesData } from './pie';
|
|
|
8
8
|
import type { ScatterSeries, ScatterSeriesData } from './scatter';
|
|
9
9
|
import type { TreemapSeries, TreemapSeriesData } from './treemap';
|
|
10
10
|
import type { WaterfallSeries, WaterfallSeriesData } from './waterfall';
|
|
11
|
-
export
|
|
11
|
+
export interface TooltipDataChunkBarX<T = MeaningfulAny> {
|
|
12
12
|
data: BarXSeriesData<T>;
|
|
13
13
|
series: BarXSeries<T>;
|
|
14
|
-
}
|
|
15
|
-
export
|
|
14
|
+
}
|
|
15
|
+
export interface TooltipDataChunkBarY<T = MeaningfulAny> {
|
|
16
16
|
data: BarYSeriesData<T>;
|
|
17
17
|
series: BarYSeries<T>;
|
|
18
|
-
}
|
|
19
|
-
export
|
|
18
|
+
}
|
|
19
|
+
export interface TooltipDataChunkPie<T = MeaningfulAny> {
|
|
20
20
|
data: PieSeriesData<T>;
|
|
21
21
|
series: {
|
|
22
22
|
type: PieSeries['type'];
|
|
23
23
|
id: string;
|
|
24
24
|
name: string;
|
|
25
25
|
};
|
|
26
|
-
}
|
|
27
|
-
export
|
|
26
|
+
}
|
|
27
|
+
export interface TooltipDataChunkScatter<T = MeaningfulAny> {
|
|
28
28
|
data: ScatterSeriesData<T>;
|
|
29
29
|
series: {
|
|
30
30
|
type: ScatterSeries['type'];
|
|
31
31
|
id: string;
|
|
32
32
|
name: string;
|
|
33
33
|
};
|
|
34
|
-
}
|
|
35
|
-
export
|
|
34
|
+
}
|
|
35
|
+
export interface TooltipDataChunkLine<T = MeaningfulAny> {
|
|
36
36
|
data: LineSeriesData<T>;
|
|
37
37
|
series: {
|
|
38
38
|
type: LineSeries['type'];
|
|
39
39
|
id: string;
|
|
40
40
|
name: string;
|
|
41
41
|
};
|
|
42
|
-
}
|
|
43
|
-
export
|
|
42
|
+
}
|
|
43
|
+
export interface TooltipDataChunkArea<T = MeaningfulAny> {
|
|
44
44
|
data: AreaSeriesData<T>;
|
|
45
45
|
series: {
|
|
46
46
|
type: AreaSeries['type'];
|
|
47
47
|
id: string;
|
|
48
48
|
name: string;
|
|
49
49
|
};
|
|
50
|
-
}
|
|
51
|
-
export
|
|
50
|
+
}
|
|
51
|
+
export interface TooltipDataChunkTreemap<T = MeaningfulAny> {
|
|
52
52
|
data: TreemapSeriesData<T>;
|
|
53
53
|
series: TreemapSeries<T>;
|
|
54
|
-
}
|
|
55
|
-
export
|
|
54
|
+
}
|
|
55
|
+
export interface TooltipDataChunkWaterfall<T = MeaningfulAny> {
|
|
56
56
|
data: WaterfallSeriesData<T>;
|
|
57
57
|
series: WaterfallSeries<T>;
|
|
58
|
-
}
|
|
58
|
+
}
|
|
59
59
|
export type TooltipDataChunk<T = MeaningfulAny> = (TooltipDataChunkBarX<T> | TooltipDataChunkBarY<T> | TooltipDataChunkPie<T> | TooltipDataChunkScatter<T> | TooltipDataChunkLine<T> | TooltipDataChunkArea<T> | TooltipDataChunkTreemap<T> | TooltipDataChunkWaterfall<T>) & {
|
|
60
60
|
closest?: boolean;
|
|
61
61
|
};
|
|
62
|
-
export
|
|
62
|
+
export interface ChartTooltipRendererArgs<T = MeaningfulAny> {
|
|
63
63
|
hovered: TooltipDataChunk<T>[];
|
|
64
64
|
xAxis?: ChartXAxis;
|
|
65
65
|
yAxis?: ChartYAxis;
|
|
66
|
-
}
|
|
67
|
-
export
|
|
66
|
+
}
|
|
67
|
+
export interface ChartTooltip<T = MeaningfulAny> {
|
|
68
68
|
enabled?: boolean;
|
|
69
69
|
/** Specifies the renderer for the tooltip. If returned null default tooltip renderer will be used. */
|
|
70
70
|
renderer?: (args: ChartTooltipRendererArgs<T>) => React.ReactElement | null;
|
|
@@ -72,4 +72,4 @@ export type ChartTooltip<T = MeaningfulAny> = {
|
|
|
72
72
|
enabled?: boolean;
|
|
73
73
|
modifierKey?: 'altKey' | 'metaKey';
|
|
74
74
|
};
|
|
75
|
-
}
|
|
75
|
+
}
|