@gravity-ui/chartkit 3.1.3 → 3.2.0-beta.1

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 (104) hide show
  1. package/build/plugins/d3/__stories__/bar/category.stories.d.ts +4 -0
  2. package/build/plugins/d3/__stories__/bar/category.stories.js +75 -0
  3. package/build/plugins/d3/__stories__/bar/datetime.stories.d.ts +4 -0
  4. package/build/plugins/d3/__stories__/bar/datetime.stories.js +71 -0
  5. package/build/plugins/d3/__stories__/bar/linear.stories.d.ts +4 -0
  6. package/build/plugins/d3/__stories__/bar/linear.stories.js +74 -0
  7. package/build/plugins/d3/__stories__/penguins.json +3098 -0
  8. package/build/plugins/d3/__stories__/scatter/LinearCategories.stories.d.ts +4 -0
  9. package/build/plugins/d3/__stories__/scatter/LinearCategories.stories.js +103 -0
  10. package/build/plugins/d3/__stories__/scatter/Timestamp.stories.d.ts +4 -0
  11. package/build/plugins/d3/__stories__/scatter/Timestamp.stories.js +91 -0
  12. package/build/plugins/d3/index.d.ts +7 -0
  13. package/build/plugins/d3/index.js +10 -0
  14. package/build/plugins/d3/renderer/D3Widget.d.ts +15 -0
  15. package/build/plugins/d3/renderer/D3Widget.js +40 -0
  16. package/build/plugins/d3/renderer/components/AxisX.d.ts +10 -0
  17. package/build/plugins/d3/renderer/components/AxisX.js +68 -0
  18. package/build/plugins/d3/renderer/components/AxisY.d.ts +10 -0
  19. package/build/plugins/d3/renderer/components/AxisY.js +73 -0
  20. package/build/plugins/d3/renderer/components/Chart.d.ts +10 -0
  21. package/build/plugins/d3/renderer/components/Chart.js +64 -0
  22. package/build/plugins/d3/renderer/components/Legend.d.ts +12 -0
  23. package/build/plugins/d3/renderer/components/Legend.js +66 -0
  24. package/build/plugins/d3/renderer/components/Title.d.ts +7 -0
  25. package/build/plugins/d3/renderer/components/Title.js +8 -0
  26. package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.d.ts +10 -0
  27. package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.js +21 -0
  28. package/build/plugins/d3/renderer/components/Tooltip/index.d.ts +12 -0
  29. package/build/plugins/d3/renderer/components/Tooltip/index.js +53 -0
  30. package/build/plugins/d3/renderer/components/index.d.ts +1 -0
  31. package/build/plugins/d3/renderer/components/index.js +1 -0
  32. package/build/plugins/d3/renderer/components/styles.css +61 -0
  33. package/build/plugins/d3/renderer/constants.d.ts +1 -0
  34. package/build/plugins/d3/renderer/constants.js +22 -0
  35. package/build/plugins/d3/renderer/hooks/index.d.ts +10 -0
  36. package/build/plugins/d3/renderer/hooks/index.js +10 -0
  37. package/build/plugins/d3/renderer/hooks/useChartDimensions/index.d.ts +17 -0
  38. package/build/plugins/d3/renderer/hooks/useChartDimensions/index.js +13 -0
  39. package/build/plugins/d3/renderer/hooks/useChartEvents/index.d.ts +5 -0
  40. package/build/plugins/d3/renderer/hooks/useChartEvents/index.js +15 -0
  41. package/build/plugins/d3/renderer/hooks/useChartOptions/chart.d.ts +8 -0
  42. package/build/plugins/d3/renderer/hooks/useChartOptions/chart.js +60 -0
  43. package/build/plugins/d3/renderer/hooks/useChartOptions/constants.d.ts +3 -0
  44. package/build/plugins/d3/renderer/hooks/useChartOptions/constants.js +3 -0
  45. package/build/plugins/d3/renderer/hooks/useChartOptions/index.d.ts +3 -0
  46. package/build/plugins/d3/renderer/hooks/useChartOptions/index.js +32 -0
  47. package/build/plugins/d3/renderer/hooks/useChartOptions/legend.d.ts +6 -0
  48. package/build/plugins/d3/renderer/hooks/useChartOptions/legend.js +7 -0
  49. package/build/plugins/d3/renderer/hooks/useChartOptions/title.d.ts +5 -0
  50. package/build/plugins/d3/renderer/hooks/useChartOptions/title.js +17 -0
  51. package/build/plugins/d3/renderer/hooks/useChartOptions/tooltip.d.ts +5 -0
  52. package/build/plugins/d3/renderer/hooks/useChartOptions/tooltip.js +5 -0
  53. package/build/plugins/d3/renderer/hooks/useChartOptions/types.d.ts +33 -0
  54. package/build/plugins/d3/renderer/hooks/useChartOptions/types.js +1 -0
  55. package/build/plugins/d3/renderer/hooks/useChartOptions/utils.d.ts +5 -0
  56. package/build/plugins/d3/renderer/hooks/useChartOptions/utils.js +18 -0
  57. package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.d.ts +5 -0
  58. package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.js +29 -0
  59. package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.d.ts +5 -0
  60. package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.js +35 -0
  61. package/build/plugins/d3/renderer/hooks/useLegend/index.d.ts +13 -0
  62. package/build/plugins/d3/renderer/hooks/useLegend/index.js +28 -0
  63. package/build/plugins/d3/renderer/hooks/useScales/index.d.ts +17 -0
  64. package/build/plugins/d3/renderer/hooks/useScales/index.js +106 -0
  65. package/build/plugins/d3/renderer/hooks/useSeries/index.d.ts +14 -0
  66. package/build/plugins/d3/renderer/hooks/useSeries/index.js +23 -0
  67. package/build/plugins/d3/renderer/hooks/useShapes/bar.d.ts +16 -0
  68. package/build/plugins/d3/renderer/hooks/useShapes/bar.js +75 -0
  69. package/build/plugins/d3/renderer/hooks/useShapes/index.d.ts +19 -0
  70. package/build/plugins/d3/renderer/hooks/useShapes/index.js +44 -0
  71. package/build/plugins/d3/renderer/hooks/useShapes/scatter.d.ts +18 -0
  72. package/build/plugins/d3/renderer/hooks/useShapes/scatter.js +62 -0
  73. package/build/plugins/d3/renderer/hooks/useTooltip/index.d.ts +13 -0
  74. package/build/plugins/d3/renderer/hooks/useTooltip/index.js +19 -0
  75. package/build/plugins/d3/renderer/hooks/useTooltip/types.d.ts +7 -0
  76. package/build/plugins/d3/renderer/hooks/useTooltip/types.js +1 -0
  77. package/build/plugins/d3/renderer/utils/index.d.ts +18 -0
  78. package/build/plugins/d3/renderer/utils/index.js +71 -0
  79. package/build/plugins/d3/types.d.ts +4 -0
  80. package/build/plugins/d3/types.js +1 -0
  81. package/build/types/widget-data/axis.d.ts +24 -0
  82. package/build/types/widget-data/axis.js +1 -0
  83. package/build/types/widget-data/bar.d.ts +31 -0
  84. package/build/types/widget-data/bar.js +1 -0
  85. package/build/types/widget-data/base.d.ts +15 -0
  86. package/build/types/widget-data/base.js +1 -0
  87. package/build/types/widget-data/chart.d.ts +9 -0
  88. package/build/types/widget-data/chart.js +1 -0
  89. package/build/types/widget-data/index.d.ts +28 -0
  90. package/build/types/widget-data/index.js +10 -0
  91. package/build/types/widget-data/legend.d.ts +3 -0
  92. package/build/types/widget-data/legend.js +1 -0
  93. package/build/types/widget-data/pie.d.ts +10 -0
  94. package/build/types/widget-data/pie.js +1 -0
  95. package/build/types/widget-data/scatter.d.ts +20 -0
  96. package/build/types/widget-data/scatter.js +1 -0
  97. package/build/types/widget-data/series.d.ts +18 -0
  98. package/build/types/widget-data/series.js +1 -0
  99. package/build/types/widget-data/title.d.ts +5 -0
  100. package/build/types/widget-data/title.js +1 -0
  101. package/build/types/widget-data/tooltip.d.ts +12 -0
  102. package/build/types/widget-data/tooltip.js +1 -0
  103. package/build/types/widget.d.ts +5 -0
  104. package/package.json +7 -2
@@ -0,0 +1,4 @@
1
+ import { Meta } from '@storybook/react';
2
+ export declare const CategoryXAxis: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
3
+ declare const meta: Meta;
4
+ export default meta;
@@ -0,0 +1,75 @@
1
+ import React from 'react';
2
+ import { object, withKnobs } from '@storybook/addon-knobs';
3
+ import { Button } from '@gravity-ui/uikit';
4
+ import { settings } from '../../../../libs';
5
+ import { ChartKit } from '../../../../components/ChartKit';
6
+ import { D3Plugin } from '../..';
7
+ const Template = () => {
8
+ const [shown, setShown] = React.useState(false);
9
+ const chartkitRef = React.useRef();
10
+ const data = {
11
+ legend: { enabled: true },
12
+ tooltip: { enabled: false },
13
+ yAxis: [
14
+ {
15
+ type: 'linear',
16
+ labels: { enabled: true },
17
+ min: 0,
18
+ },
19
+ ],
20
+ series: {
21
+ data: [
22
+ {
23
+ type: 'bar',
24
+ visible: true,
25
+ data: [
26
+ {
27
+ category: 'A',
28
+ x: 10,
29
+ y: 100,
30
+ },
31
+ {
32
+ category: 'B',
33
+ x: 12,
34
+ y: 80,
35
+ },
36
+ ],
37
+ name: 'AB',
38
+ },
39
+ {
40
+ type: 'bar',
41
+ visible: true,
42
+ data: [
43
+ {
44
+ category: 'C',
45
+ x: 95.5,
46
+ y: 120,
47
+ },
48
+ ],
49
+ name: 'C',
50
+ },
51
+ ],
52
+ },
53
+ title: { text: 'Category axis' },
54
+ xAxis: {
55
+ type: 'category',
56
+ categories: ['A', 'B', 'C'],
57
+ labels: { enabled: true },
58
+ },
59
+ };
60
+ if (!shown) {
61
+ settings.set({ plugins: [D3Plugin] });
62
+ return React.createElement(Button, { onClick: () => setShown(true) }, "Show chart");
63
+ }
64
+ return (React.createElement("div", { style: {
65
+ height: '80vh',
66
+ width: '100%',
67
+ } },
68
+ React.createElement(ChartKit, { ref: chartkitRef, type: "d3", data: object('data', data) })));
69
+ };
70
+ export const CategoryXAxis = Template.bind({});
71
+ const meta = {
72
+ title: 'Plugins/D3/Bar',
73
+ decorators: [withKnobs],
74
+ };
75
+ export default meta;
@@ -0,0 +1,4 @@
1
+ import { Meta } from '@storybook/react';
2
+ export declare const DatetimeXAxis: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
3
+ declare const meta: Meta;
4
+ export default meta;
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import { object, withKnobs } from '@storybook/addon-knobs';
3
+ import { Button } from '@gravity-ui/uikit';
4
+ import { settings } from '../../../../libs';
5
+ import { ChartKit } from '../../../../components/ChartKit';
6
+ import { D3Plugin } from '../..';
7
+ const Template = () => {
8
+ const [shown, setShown] = React.useState(false);
9
+ const chartkitRef = React.useRef();
10
+ const data = {
11
+ title: { text: 'DateTime axis' },
12
+ xAxis: {
13
+ type: 'datetime',
14
+ labels: { enabled: true },
15
+ },
16
+ legend: { enabled: true },
17
+ tooltip: { enabled: false },
18
+ yAxis: [
19
+ {
20
+ type: 'linear',
21
+ labels: { enabled: true },
22
+ min: 0,
23
+ },
24
+ ],
25
+ series: {
26
+ data: [
27
+ {
28
+ type: 'bar',
29
+ visible: true,
30
+ data: [
31
+ {
32
+ x: Number(new Date(2022, 10, 10)),
33
+ y: 100,
34
+ },
35
+ {
36
+ x: Number(new Date(2023, 2, 5)),
37
+ y: 80,
38
+ },
39
+ ],
40
+ name: 'AB',
41
+ },
42
+ {
43
+ type: 'bar',
44
+ visible: true,
45
+ data: [
46
+ {
47
+ x: Number(new Date(2022, 11, 25)),
48
+ y: 120,
49
+ },
50
+ ],
51
+ name: 'C',
52
+ },
53
+ ],
54
+ },
55
+ };
56
+ if (!shown) {
57
+ settings.set({ plugins: [D3Plugin] });
58
+ return React.createElement(Button, { onClick: () => setShown(true) }, "Show chart");
59
+ }
60
+ return (React.createElement("div", { style: {
61
+ height: '80vh',
62
+ width: '100%',
63
+ } },
64
+ React.createElement(ChartKit, { ref: chartkitRef, type: "d3", data: object('data', data) })));
65
+ };
66
+ export const DatetimeXAxis = Template.bind({});
67
+ const meta = {
68
+ title: 'Plugins/D3/Bar',
69
+ decorators: [withKnobs],
70
+ };
71
+ export default meta;
@@ -0,0 +1,4 @@
1
+ import { Meta } from '@storybook/react';
2
+ export declare const LinearXAxis: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
3
+ declare const meta: Meta;
4
+ export default meta;
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import { withKnobs, object } from '@storybook/addon-knobs';
3
+ import { Button } from '@gravity-ui/uikit';
4
+ import { settings } from '../../../../libs';
5
+ import { ChartKit } from '../../../../components/ChartKit';
6
+ import { D3Plugin } from '../..';
7
+ const Template = () => {
8
+ const [shown, setShown] = React.useState(false);
9
+ const chartkitRef = React.useRef();
10
+ const data = {
11
+ series: {
12
+ data: [
13
+ {
14
+ type: 'bar',
15
+ visible: true,
16
+ data: [
17
+ {
18
+ category: 'A',
19
+ x: 10,
20
+ y: 100,
21
+ },
22
+ {
23
+ category: 'B',
24
+ x: 12,
25
+ y: 80,
26
+ },
27
+ ],
28
+ name: 'AB',
29
+ },
30
+ {
31
+ type: 'bar',
32
+ visible: true,
33
+ data: [
34
+ {
35
+ category: 'C',
36
+ x: 95.5,
37
+ y: 120,
38
+ },
39
+ ],
40
+ name: 'C',
41
+ },
42
+ ],
43
+ },
44
+ title: { text: 'Linear axis' },
45
+ xAxis: {
46
+ type: 'linear',
47
+ labels: { enabled: true },
48
+ },
49
+ yAxis: [
50
+ {
51
+ type: 'linear',
52
+ labels: { enabled: true },
53
+ min: 0,
54
+ },
55
+ ],
56
+ legend: { enabled: true },
57
+ tooltip: { enabled: false },
58
+ };
59
+ if (!shown) {
60
+ settings.set({ plugins: [D3Plugin] });
61
+ return React.createElement(Button, { onClick: () => setShown(true) }, "Show chart");
62
+ }
63
+ return (React.createElement("div", { style: {
64
+ height: '80vh',
65
+ width: '100%',
66
+ } },
67
+ React.createElement(ChartKit, { ref: chartkitRef, type: "d3", data: object('data', data) })));
68
+ };
69
+ export const LinearXAxis = Template.bind({});
70
+ const meta = {
71
+ title: 'Plugins/D3/Bar',
72
+ decorators: [withKnobs],
73
+ };
74
+ export default meta;