@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.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/components/Tooltip/ChartTooltipContent.d.ts +2 -2
  3. package/dist/cjs/components/Tooltip/index.js +5 -5
  4. package/dist/cjs/components/Tooltip/styles.css +2 -15
  5. package/dist/cjs/components/index.d.ts +10 -9
  6. package/dist/cjs/hooks/useSeries/prepare-area.d.ts +1 -1
  7. package/dist/cjs/hooks/useSeries/prepare-line.d.ts +1 -1
  8. package/dist/cjs/types/chart/area.d.ts +6 -6
  9. package/dist/cjs/types/chart/axis.d.ts +8 -7
  10. package/dist/cjs/types/chart/bar-x.d.ts +4 -4
  11. package/dist/cjs/types/chart/bar-y.d.ts +5 -6
  12. package/dist/cjs/types/chart/base.d.ts +6 -6
  13. package/dist/cjs/types/chart/chart.d.ts +4 -4
  14. package/dist/cjs/types/chart/halo.d.ts +2 -2
  15. package/dist/cjs/types/chart/legend.d.ts +10 -10
  16. package/dist/cjs/types/chart/line.d.ts +4 -4
  17. package/dist/cjs/types/chart/marker.d.ts +2 -2
  18. package/dist/cjs/types/chart/pie.d.ts +4 -4
  19. package/dist/cjs/types/chart/scatter.d.ts +4 -4
  20. package/dist/cjs/types/chart/series.d.ts +8 -8
  21. package/dist/cjs/types/chart/split.d.ts +4 -4
  22. package/dist/cjs/types/chart/title.d.ts +2 -2
  23. package/dist/cjs/types/chart/tooltip.d.ts +20 -20
  24. package/dist/cjs/types/chart/treemap.d.ts +4 -4
  25. package/dist/cjs/types/chart/waterfall.d.ts +4 -4
  26. package/dist/cjs/types/chart-ui.d.ts +6 -6
  27. package/dist/cjs/types/formatter.d.ts +4 -4
  28. package/dist/cjs/types/index.d.ts +34 -4
  29. package/dist/esm/components/Tooltip/ChartTooltipContent.d.ts +2 -2
  30. package/dist/esm/components/Tooltip/index.js +5 -5
  31. package/dist/esm/components/Tooltip/styles.css +2 -15
  32. package/dist/esm/components/index.d.ts +10 -9
  33. package/dist/esm/hooks/useSeries/prepare-area.d.ts +1 -1
  34. package/dist/esm/hooks/useSeries/prepare-line.d.ts +1 -1
  35. package/dist/esm/types/chart/area.d.ts +6 -6
  36. package/dist/esm/types/chart/axis.d.ts +8 -7
  37. package/dist/esm/types/chart/bar-x.d.ts +4 -4
  38. package/dist/esm/types/chart/bar-y.d.ts +5 -6
  39. package/dist/esm/types/chart/base.d.ts +6 -6
  40. package/dist/esm/types/chart/chart.d.ts +4 -4
  41. package/dist/esm/types/chart/halo.d.ts +2 -2
  42. package/dist/esm/types/chart/legend.d.ts +10 -10
  43. package/dist/esm/types/chart/line.d.ts +4 -4
  44. package/dist/esm/types/chart/marker.d.ts +2 -2
  45. package/dist/esm/types/chart/pie.d.ts +4 -4
  46. package/dist/esm/types/chart/scatter.d.ts +4 -4
  47. package/dist/esm/types/chart/series.d.ts +8 -8
  48. package/dist/esm/types/chart/split.d.ts +4 -4
  49. package/dist/esm/types/chart/title.d.ts +2 -2
  50. package/dist/esm/types/chart/tooltip.d.ts +20 -20
  51. package/dist/esm/types/chart/treemap.d.ts +4 -4
  52. package/dist/esm/types/chart/waterfall.d.ts +4 -4
  53. package/dist/esm/types/chart-ui.d.ts +6 -6
  54. package/dist/esm/types/formatter.d.ts +4 -4
  55. package/dist/esm/types/index.d.ts +34 -4
  56. package/package.json +7 -4
@@ -2,7 +2,7 @@ import type { LayoutAlgorithm, 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
- export type TreemapSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
5
+ export interface TreemapSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
6
6
  /** The name of the node (used in legend, tooltip etc). */
7
7
  name: string | string[];
8
8
  /** The value of the node. All nodes should have this property except nodes that have children. */
@@ -14,8 +14,8 @@ export type TreemapSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
14
14
  * If no nodes has a matching id, or this option is undefined, then the parent will be set to the root.
15
15
  */
16
16
  parentId?: string;
17
- };
18
- export type TreemapSeries<T = MeaningfulAny> = BaseSeries & {
17
+ }
18
+ export interface TreemapSeries<T = MeaningfulAny> extends BaseSeries {
19
19
  type: typeof SeriesType.Treemap;
20
20
  data: TreemapSeriesData<T>[];
21
21
  /** The name of the series (used in legend, tooltip etc). */
@@ -43,4 +43,4 @@ export type TreemapSeries<T = MeaningfulAny> = BaseSeries & {
43
43
  /** Horizontal alignment of the data label inside the tile. */
44
44
  align?: 'left' | 'center' | 'right';
45
45
  };
46
- };
46
+ }
@@ -2,7 +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
- export type WaterfallSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
5
+ export interface WaterfallSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
6
6
  /**
7
7
  * The `x` value. Depending on the context , it may represents:
8
8
  * - numeric value (for `linear` x axis)
@@ -21,8 +21,8 @@ export type WaterfallSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
21
21
  opacity?: number;
22
22
  /** When this property is true, the point display the total sum across the entire series. */
23
23
  total?: boolean;
24
- };
25
- export type WaterfallSeries<T = MeaningfulAny> = BaseSeries & {
24
+ }
25
+ export interface WaterfallSeries<T = MeaningfulAny> extends BaseSeries {
26
26
  type: typeof SeriesType.Waterfall;
27
27
  data: WaterfallSeriesData<T>[];
28
28
  /** The name of the series (used in legend, tooltip etc). */
@@ -37,4 +37,4 @@ export type WaterfallSeries<T = MeaningfulAny> = BaseSeries & {
37
37
  legend?: ChartLegend & {
38
38
  symbol?: RectLegendSymbolOptions;
39
39
  };
40
- };
40
+ }
@@ -1,5 +1,5 @@
1
1
  import type { BaseTextStyle } from './chart/base';
2
- export type LabelData = {
2
+ export interface LabelData {
3
3
  text: string;
4
4
  x: number;
5
5
  y: number;
@@ -13,8 +13,8 @@ export type LabelData = {
13
13
  id: string;
14
14
  };
15
15
  active?: boolean;
16
- };
17
- export type HtmlItem = {
16
+ }
17
+ export interface HtmlItem {
18
18
  x: number;
19
19
  y: number;
20
20
  content: string;
@@ -22,7 +22,7 @@ export type HtmlItem = {
22
22
  width: number;
23
23
  height: number;
24
24
  };
25
- };
26
- export type ShapeDataWithHtmlItems = {
25
+ }
26
+ export interface ShapeDataWithHtmlItems {
27
27
  htmlElements: HtmlItem[];
28
- };
28
+ }
@@ -1,14 +1,14 @@
1
- export type FormatOptions = {
1
+ export interface FormatOptions {
2
2
  precision?: number | 'auto';
3
3
  unitRate?: number;
4
4
  showRankDelimiter?: boolean;
5
5
  lang?: string;
6
6
  labelMode?: string;
7
- };
8
- export type FormatNumberOptions = FormatOptions & {
7
+ }
8
+ export interface FormatNumberOptions extends FormatOptions {
9
9
  format?: 'number' | 'percent';
10
10
  multiplier?: number;
11
11
  prefix?: string;
12
12
  postfix?: string;
13
13
  unit?: 'auto' | 'k' | 'm' | 'b' | 't' | null;
14
- };
14
+ }
@@ -25,18 +25,48 @@ export * from './chart/tooltip';
25
25
  export * from './chart/halo';
26
26
  export * from './chart/treemap';
27
27
  export * from './chart/waterfall';
28
- export type ChartData<T = MeaningfulAny> = {
28
+ export interface ChartData<T = MeaningfulAny> {
29
+ /**
30
+ * General options for the chart.
31
+ */
29
32
  chart?: ChartOptions;
33
+ /**
34
+ * The legend displays a labeled box for each data element in the chart.
35
+ * It shows a distinctive symbol paired with a name for every series.
36
+ */
30
37
  legend?: ChartLegend;
38
+ /**
39
+ * Represents the series data and series options.
40
+ */
31
41
  series: {
42
+ /**
43
+ * Contains data points to be plotted.
44
+ */
32
45
  data: ChartSeries<T>[];
46
+ /**
47
+ * Allows for customizing the appearance and behavior of the series.
48
+ */
33
49
  options?: ChartSeriesOptions;
34
50
  };
51
+ /**
52
+ * The main title of the chart.
53
+ */
35
54
  title?: ChartTitle;
55
+ /**
56
+ * Options for the tooltip that appears when the user hovers over a series or point.
57
+ */
36
58
  tooltip?: ChartTooltip<T>;
59
+ /**
60
+ * Options for the the X axis.
61
+ */
37
62
  xAxis?: ChartXAxis;
63
+ /**
64
+ * Options for the the Y axis or multiple Y axes.
65
+ */
38
66
  yAxis?: ChartYAxis[];
39
- /** Setting for displaying charts on different plots.
40
- * It can be used to visualize related information on multiple charts. */
67
+ /**
68
+ * Setting for displaying charts on different plots.
69
+ * It can be used to visualize related information on multiple charts.
70
+ */
41
71
  split?: ChartSplit;
42
- };
72
+ }
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { ChartTooltip, ChartXAxis, ChartYAxis, TooltipDataChunk } from '../../types';
3
- export type ChartTooltipContentProps = {
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, useVirtualElementRef } from '@gravity-ui/uikit';
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 anchorRef = useVirtualElementRef({ rect: { left, top } });
15
- const handleOutsideClick = (e) => {
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 }), contentClassName: b('popup-content'), open: true, anchorRef: anchorRef, offset: [0, 20], placement: ['right', 'left', 'top', 'bottom'], modifiers: [{ name: 'preventOverflow', options: { padding: 10, altAxis: true } }], onOutsideClick: tooltipPinned ? handleOutsideClick : undefined },
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[class] {
2
- --g-popup-border-width: 0;
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 type ChartRef = {
4
+ export interface ChartRef {
5
5
  reflow: () => void;
6
- };
7
- type ChartDimentions = {
6
+ }
7
+ export interface ChartDimentions {
8
8
  height: number;
9
9
  width: number;
10
- };
11
- export type ChartProps = {
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?: (args: {
15
- dimensions?: ChartDimentions;
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 type AreaSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
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 type AreaMarkerOptions = PointMarkerOptions & {
40
+ export interface AreaMarkerOptions extends PointMarkerOptions {
41
41
  symbol?: AreaMarkerSymbol;
42
- };
43
- export type AreaSeries<T = MeaningfulAny> = BaseSeries & {
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 type ChartAxisLabels = {
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 type ChartAxis = {
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 type ChartXAxis = ChartAxis;
77
- export type ChartYAxis = ChartAxis & {
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 type BarXSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
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 type BarXSeries<T = MeaningfulAny> = BaseSeries & {
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
- import type { ChartSeriesOptions } from './series';
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 type BarYSeries<T = MeaningfulAny> = BaseSeries & {
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?: ChartSeriesOptions['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 type BaseSeries = {
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 type BaseSeriesData<T = MeaningfulAny> = {
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 type BaseTextStyle = {
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 type ChartMargin = {
3
+ export interface ChartMargin {
4
4
  top: number;
5
5
  right: number;
6
6
  bottom: number;
7
7
  left: number;
8
- };
9
- export type ChartOptions = {
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 type Halo = {
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 type ChartLegend = {
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 type BaseLegendSymbol = {
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 type RectLegendSymbolOptions = BaseLegendSymbol & {
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 type PathLegendSymbolOptions = BaseLegendSymbol & {
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 type SymbolLegendSymbolOptions = BaseLegendSymbol & {
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 type LineSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
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 type LineSeries<T = MeaningfulAny> = BaseSeries & {
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 type PointMarkerOptions = {
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 type PieSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
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 type PieSeries<T = MeaningfulAny> = BaseSeries & {
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 type ScatterSeriesData<T = MeaningfulAny> = BaseSeriesData<T> & {
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 type ScatterSeries<T = MeaningfulAny> = BaseSeries & {
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
+ }