@gravity-ui/chartkit 4.14.0 → 4.15.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 (61) hide show
  1. package/build/constants/index.d.ts +1 -0
  2. package/build/constants/index.js +1 -0
  3. package/build/constants/widget-data.d.ts +27 -0
  4. package/build/constants/widget-data.js +29 -0
  5. package/build/plugins/d3/examples/ExampleWrapper.d.ts +7 -0
  6. package/build/plugins/d3/examples/ExampleWrapper.js +5 -0
  7. package/build/plugins/d3/examples/area/Basic.js +3 -4
  8. package/build/plugins/d3/examples/area/StackedArea.js +3 -4
  9. package/build/plugins/d3/examples/bar-x/Basic.js +8 -4
  10. package/build/plugins/d3/examples/bar-x/DataLabels.js +4 -2
  11. package/build/plugins/d3/examples/bar-x/GroupedColumns.js +4 -2
  12. package/build/plugins/d3/examples/bar-x/StackedColumns.js +4 -2
  13. package/build/plugins/d3/examples/bar-y/Basic.js +4 -2
  14. package/build/plugins/d3/examples/bar-y/GroupedColumns.js +4 -2
  15. package/build/plugins/d3/examples/bar-y/StackedColumns.js +4 -2
  16. package/build/plugins/d3/examples/combined/LineAndBarX.js +5 -3
  17. package/build/plugins/d3/examples/line/Basic.js +4 -2
  18. package/build/plugins/d3/examples/line/DataLabels.js +4 -2
  19. package/build/plugins/d3/examples/line/LineWithMarkers.js +4 -2
  20. package/build/plugins/d3/examples/line/Shapes.d.ts +2 -0
  21. package/build/plugins/d3/examples/line/Shapes.js +93 -0
  22. package/build/plugins/d3/examples/pie/Basic.js +4 -2
  23. package/build/plugins/d3/examples/pie/Donut.js +4 -2
  24. package/build/plugins/d3/examples/scatter/Basic.js +4 -2
  25. package/build/plugins/d3/renderer/components/Legend.js +4 -0
  26. package/build/plugins/d3/renderer/hooks/useSeries/constants.d.ts +2 -3
  27. package/build/plugins/d3/renderer/hooks/useSeries/constants.js +1 -1
  28. package/build/plugins/d3/renderer/hooks/useSeries/prepare-line-series.d.ts +2 -0
  29. package/build/plugins/d3/renderer/hooks/useSeries/prepare-line-series.js +11 -0
  30. package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.d.ts +2 -1
  31. package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.js +11 -1
  32. package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.js +1 -1
  33. package/build/plugins/d3/renderer/hooks/useSeries/types.d.ts +16 -10
  34. package/build/plugins/d3/renderer/hooks/useShapes/area/index.js +5 -62
  35. package/build/plugins/d3/renderer/hooks/useShapes/line/index.js +9 -65
  36. package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.js +5 -2
  37. package/build/plugins/d3/renderer/hooks/useShapes/line/types.d.ts +3 -0
  38. package/build/plugins/d3/renderer/hooks/useShapes/marker.d.ts +12 -0
  39. package/build/plugins/d3/renderer/hooks/useShapes/marker.js +70 -0
  40. package/build/plugins/d3/renderer/hooks/useShapes/pie/index.d.ts +3 -2
  41. package/build/plugins/d3/renderer/hooks/useShapes/pie/index.js +28 -0
  42. package/build/plugins/d3/renderer/hooks/useShapes/pie/prepare-data.js +9 -3
  43. package/build/plugins/d3/renderer/hooks/useShapes/pie/types.d.ts +5 -0
  44. package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.js +1 -1
  45. package/build/plugins/d3/renderer/hooks/useShapes/utils.d.ts +2 -0
  46. package/build/plugins/d3/renderer/hooks/useShapes/utils.js +17 -0
  47. package/build/plugins/d3/renderer/validation/index.js +2 -8
  48. package/build/plugins/highcharts/renderer/helpers/config/config.js +0 -3
  49. package/build/types/widget-data/area.d.ts +2 -1
  50. package/build/types/widget-data/bar-x.d.ts +2 -1
  51. package/build/types/widget-data/bar-y.d.ts +2 -1
  52. package/build/types/widget-data/halo.d.ts +9 -0
  53. package/build/types/widget-data/halo.js +1 -0
  54. package/build/types/widget-data/index.d.ts +1 -0
  55. package/build/types/widget-data/index.js +1 -0
  56. package/build/types/widget-data/line.d.ts +6 -1
  57. package/build/types/widget-data/marker.d.ts +0 -8
  58. package/build/types/widget-data/pie.d.ts +2 -1
  59. package/build/types/widget-data/scatter.d.ts +2 -1
  60. package/build/types/widget-data/series.d.ts +19 -4
  61. package/package.json +6 -1
@@ -1,6 +1,7 @@
1
1
  import type { BaseSeries, BaseSeriesData } from './base';
2
2
  import type { ChartKitWidgetLegend, RectLegendSymbolOptions } from './legend';
3
3
  import type { PointMarkerOptions } from './marker';
4
+ import { DashStyle, LineCap, SeriesType } from '../../constants';
4
5
  export type LineSeriesData<T = any> = BaseSeriesData<T> & {
5
6
  /**
6
7
  * The `x` value of the point. Depending on the context , it may represents:
@@ -24,7 +25,7 @@ export type LineMarkerOptions = PointMarkerOptions & {
24
25
  symbol?: LineMarkerSymbol;
25
26
  };
26
27
  export type LineSeries<T = any> = BaseSeries & {
27
- type: 'line';
28
+ type: typeof SeriesType.Line;
28
29
  data: LineSeriesData<T>[];
29
30
  /** The name of the series (used in legend, tooltip etc) */
30
31
  name: string;
@@ -41,4 +42,8 @@ export type LineSeries<T = any> = BaseSeries & {
41
42
  };
42
43
  /** Options for the point markers of line series */
43
44
  marker?: LineMarkerOptions;
45
+ /** Option for line stroke style */
46
+ dashStyle?: `${DashStyle}`;
47
+ /** Option for line cap style */
48
+ linecap?: `${LineCap}`;
44
49
  };
@@ -8,11 +8,3 @@ export type PointMarkerOptions = {
8
8
  /** The width of the point marker's border */
9
9
  borderWidth?: number;
10
10
  };
11
- export type PointMarkerHalo = {
12
- /** Enable or disable the halo appearing around the point */
13
- enabled?: boolean;
14
- /** The Opacity of the point halo */
15
- opacity?: number;
16
- /** The radius of the point halo */
17
- radius?: number;
18
- };
@@ -1,3 +1,4 @@
1
+ import { SeriesType } from '../../constants';
1
2
  import type { BaseSeries, BaseSeriesData } from './base';
2
3
  import { ChartKitWidgetLegend, RectLegendSymbolOptions } from './legend';
3
4
  export type PieSeriesData<T = any> = BaseSeriesData<T> & {
@@ -13,7 +14,7 @@ export type PieSeriesData<T = any> = BaseSeriesData<T> & {
13
14
  export type ConnectorShape = 'straight-line' | 'polyline';
14
15
  export type ConnectorCurve = 'linear' | 'basic';
15
16
  export type PieSeries<T = any> = BaseSeries & {
16
- type: 'pie';
17
+ type: typeof SeriesType.Pie;
17
18
  data: PieSeriesData<T>[];
18
19
  /**
19
20
  * The color of the border surrounding each segment.
@@ -1,3 +1,4 @@
1
+ import { SeriesType } from '../../constants';
1
2
  import type { BaseSeries, BaseSeriesData } from './base';
2
3
  import type { ChartKitWidgetLegend, RectLegendSymbolOptions } from './legend';
3
4
  export type ScatterSeriesData<T = any> = BaseSeriesData<T> & {
@@ -24,7 +25,7 @@ export type ScatterSeriesData<T = any> = BaseSeriesData<T> & {
24
25
  radius?: number;
25
26
  };
26
27
  export type ScatterSeries<T = any> = BaseSeries & {
27
- type: 'scatter';
28
+ type: typeof SeriesType.Scatter;
28
29
  data: ScatterSeriesData<T>[];
29
30
  /** The name of the series (used in legend, tooltip etc) */
30
31
  name: string;
@@ -4,8 +4,10 @@ import type { ScatterSeries, ScatterSeriesData } from './scatter';
4
4
  import type { BarXSeries, BarXSeriesData } from './bar-x';
5
5
  import type { LineSeries, LineSeriesData, LineMarkerOptions } from './line';
6
6
  import type { BarYSeries, BarYSeriesData } from './bar-y';
7
- import type { PointMarkerOptions, PointMarkerHalo } from './marker';
7
+ import type { PointMarkerOptions } from './marker';
8
8
  import type { AreaSeries, AreaSeriesData } from './area';
9
+ import type { Halo } from './halo';
10
+ import { DashStyle, LineCap } from '../../constants';
9
11
  export type ChartKitWidgetSeries<T = any> = ScatterSeries<T> | PieSeries<T> | BarXSeries<T> | BarYSeries<T> | LineSeries<T> | AreaSeries<T>;
10
12
  export type ChartKitWidgetSeriesData<T = any> = ScatterSeriesData<T> | PieSeriesData<T> | BarXSeriesData<T> | BarYSeriesData<T> | LineSeriesData<T> | AreaSeriesData<T>;
11
13
  export type DataLabelRendererData<T = any> = {
@@ -125,7 +127,10 @@ export type ChartKitWidgetSeriesOptions = {
125
127
  pie?: {
126
128
  /** Options for the series states that provide additional styling information to the series. */
127
129
  states?: {
128
- hover?: BasicHoverState;
130
+ hover?: BasicHoverState & {
131
+ /** Options for the halo appearing outside the hovered slice */
132
+ halo?: Halo;
133
+ };
129
134
  inactive?: BasicInactiveState;
130
135
  };
131
136
  };
@@ -147,13 +152,23 @@ export type ChartKitWidgetSeriesOptions = {
147
152
  hover?: BasicHoverState & {
148
153
  marker?: PointMarkerOptions & {
149
154
  /** Options for the halo appearing around the hovered point */
150
- halo?: PointMarkerHalo;
155
+ halo?: Halo;
151
156
  };
152
157
  };
153
158
  inactive?: BasicInactiveState;
154
159
  };
155
160
  /** Options for the point markers of line series */
156
161
  marker?: LineMarkerOptions;
162
+ /** Options for line style
163
+ *
164
+ * @default 'Solid'
165
+ * */
166
+ dashStyle?: `${DashStyle}`;
167
+ /** Options for line cap style
168
+ *
169
+ * @default 'round' when dashStyle is not 'solid', 'none' when dashStyle is not 'solid'
170
+ * */
171
+ linecap?: `${LineCap}`;
157
172
  };
158
173
  area?: {
159
174
  /** Pixel width of the graph line.
@@ -166,7 +181,7 @@ export type ChartKitWidgetSeriesOptions = {
166
181
  hover?: BasicHoverState & {
167
182
  marker?: PointMarkerOptions & {
168
183
  /** Options for the halo appearing around the hovered point */
169
- halo?: PointMarkerHalo;
184
+ halo?: Halo;
170
185
  };
171
186
  };
172
187
  inactive?: BasicInactiveState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/chartkit",
3
- "version": "4.14.0",
3
+ "version": "4.15.0",
4
4
  "description": "React component used to render charts based on any sources you need",
5
5
  "license": "MIT",
6
6
  "repository": "git@github.com:gravity-ui/ChartKit.git",
@@ -120,6 +120,11 @@
120
120
  "lint:prettier": "prettier --check --loglevel=error '**/*.{js,jsx,ts,tsx,scss}'",
121
121
  "lint": "run-p lint:*",
122
122
  "typecheck": "tsc --noEmit",
123
+ "docs:deps": "cd ./documentation && npm ci",
124
+ "docs:start": "cd ./documentation && npm run start",
125
+ "docs:start:ru": "cd ./documentation && npm run start:ru",
126
+ "docs:build": "cd ./documentation && npm run build",
127
+ "docs:serve": "cd ./documentation && npm run serve",
123
128
  "prepublishOnly": "npm run build"
124
129
  },
125
130
  "husky": {