@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.
- package/build/plugins/d3/__stories__/bar/category.stories.d.ts +4 -0
- package/build/plugins/d3/__stories__/bar/category.stories.js +75 -0
- package/build/plugins/d3/__stories__/bar/datetime.stories.d.ts +4 -0
- package/build/plugins/d3/__stories__/bar/datetime.stories.js +71 -0
- package/build/plugins/d3/__stories__/bar/linear.stories.d.ts +4 -0
- package/build/plugins/d3/__stories__/bar/linear.stories.js +74 -0
- package/build/plugins/d3/__stories__/penguins.json +3098 -0
- package/build/plugins/d3/__stories__/scatter/LinearCategories.stories.d.ts +4 -0
- package/build/plugins/d3/__stories__/scatter/LinearCategories.stories.js +103 -0
- package/build/plugins/d3/__stories__/scatter/Timestamp.stories.d.ts +4 -0
- package/build/plugins/d3/__stories__/scatter/Timestamp.stories.js +91 -0
- package/build/plugins/d3/index.d.ts +7 -0
- package/build/plugins/d3/index.js +10 -0
- package/build/plugins/d3/renderer/D3Widget.d.ts +15 -0
- package/build/plugins/d3/renderer/D3Widget.js +40 -0
- package/build/plugins/d3/renderer/components/AxisX.d.ts +10 -0
- package/build/plugins/d3/renderer/components/AxisX.js +68 -0
- package/build/plugins/d3/renderer/components/AxisY.d.ts +10 -0
- package/build/plugins/d3/renderer/components/AxisY.js +73 -0
- package/build/plugins/d3/renderer/components/Chart.d.ts +10 -0
- package/build/plugins/d3/renderer/components/Chart.js +64 -0
- package/build/plugins/d3/renderer/components/Legend.d.ts +12 -0
- package/build/plugins/d3/renderer/components/Legend.js +66 -0
- package/build/plugins/d3/renderer/components/Title.d.ts +7 -0
- package/build/plugins/d3/renderer/components/Title.js +8 -0
- package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.d.ts +10 -0
- package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.js +21 -0
- package/build/plugins/d3/renderer/components/Tooltip/index.d.ts +12 -0
- package/build/plugins/d3/renderer/components/Tooltip/index.js +53 -0
- package/build/plugins/d3/renderer/components/index.d.ts +1 -0
- package/build/plugins/d3/renderer/components/index.js +1 -0
- package/build/plugins/d3/renderer/components/styles.css +61 -0
- package/build/plugins/d3/renderer/constants.d.ts +1 -0
- package/build/plugins/d3/renderer/constants.js +22 -0
- package/build/plugins/d3/renderer/hooks/index.d.ts +10 -0
- package/build/plugins/d3/renderer/hooks/index.js +10 -0
- package/build/plugins/d3/renderer/hooks/useChartDimensions/index.d.ts +17 -0
- package/build/plugins/d3/renderer/hooks/useChartDimensions/index.js +13 -0
- package/build/plugins/d3/renderer/hooks/useChartEvents/index.d.ts +5 -0
- package/build/plugins/d3/renderer/hooks/useChartEvents/index.js +15 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/chart.d.ts +8 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/chart.js +60 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/constants.d.ts +3 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/constants.js +3 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/index.d.ts +3 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/index.js +32 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/legend.d.ts +6 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/legend.js +7 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/title.d.ts +5 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/title.js +17 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/tooltip.d.ts +5 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/tooltip.js +5 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/types.d.ts +33 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/types.js +1 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/utils.d.ts +5 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/utils.js +18 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.d.ts +5 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.js +29 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.d.ts +5 -0
- package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.js +35 -0
- package/build/plugins/d3/renderer/hooks/useLegend/index.d.ts +13 -0
- package/build/plugins/d3/renderer/hooks/useLegend/index.js +28 -0
- package/build/plugins/d3/renderer/hooks/useScales/index.d.ts +17 -0
- package/build/plugins/d3/renderer/hooks/useScales/index.js +106 -0
- package/build/plugins/d3/renderer/hooks/useSeries/index.d.ts +14 -0
- package/build/plugins/d3/renderer/hooks/useSeries/index.js +23 -0
- package/build/plugins/d3/renderer/hooks/useShapes/bar.d.ts +16 -0
- package/build/plugins/d3/renderer/hooks/useShapes/bar.js +75 -0
- package/build/plugins/d3/renderer/hooks/useShapes/index.d.ts +19 -0
- package/build/plugins/d3/renderer/hooks/useShapes/index.js +44 -0
- package/build/plugins/d3/renderer/hooks/useShapes/scatter.d.ts +18 -0
- package/build/plugins/d3/renderer/hooks/useShapes/scatter.js +62 -0
- package/build/plugins/d3/renderer/hooks/useTooltip/index.d.ts +13 -0
- package/build/plugins/d3/renderer/hooks/useTooltip/index.js +19 -0
- package/build/plugins/d3/renderer/hooks/useTooltip/types.d.ts +7 -0
- package/build/plugins/d3/renderer/hooks/useTooltip/types.js +1 -0
- package/build/plugins/d3/renderer/utils/index.d.ts +18 -0
- package/build/plugins/d3/renderer/utils/index.js +71 -0
- package/build/plugins/d3/types.d.ts +4 -0
- package/build/plugins/d3/types.js +1 -0
- package/build/types/widget-data/axis.d.ts +24 -0
- package/build/types/widget-data/axis.js +1 -0
- package/build/types/widget-data/bar.d.ts +31 -0
- package/build/types/widget-data/bar.js +1 -0
- package/build/types/widget-data/base.d.ts +15 -0
- package/build/types/widget-data/base.js +1 -0
- package/build/types/widget-data/chart.d.ts +9 -0
- package/build/types/widget-data/chart.js +1 -0
- package/build/types/widget-data/index.d.ts +28 -0
- package/build/types/widget-data/index.js +10 -0
- package/build/types/widget-data/legend.d.ts +3 -0
- package/build/types/widget-data/legend.js +1 -0
- package/build/types/widget-data/pie.d.ts +10 -0
- package/build/types/widget-data/pie.js +1 -0
- package/build/types/widget-data/scatter.d.ts +20 -0
- package/build/types/widget-data/scatter.js +1 -0
- package/build/types/widget-data/series.d.ts +18 -0
- package/build/types/widget-data/series.js +1 -0
- package/build/types/widget-data/title.d.ts +5 -0
- package/build/types/widget-data/title.js +1 -0
- package/build/types/widget-data/tooltip.d.ts +12 -0
- package/build/types/widget-data/tooltip.js +1 -0
- package/build/types/widget.d.ts +5 -0
- package/package.json +7 -2
|
@@ -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,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,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;
|