Skip to content
This repository was archived by the owner on Dec 10, 2021. It is now read-only.

Commit dbd84f2

Browse files
authored
feat(preset-chart-nvd3): migration from plugins repo (#399)
1 parent 672e02d commit dbd84f2

File tree

125 files changed

+3627
-435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+3627
-435
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { AreaChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
2+
3+
new AreaChartPlugin().configure({ key: 'area' }).register();
4+
5+
export default {
6+
title: 'Legacy Chart Plugins|legacy-preset-chart-nvd3/Area',
7+
};
8+
9+
export { stacked } from './stories/stacked';
10+
export { stackedWithYAxisBounds, stackedWithYAxisBoundsMinOnly } from './stories/stackedWithBounds';
11+
export { expanded } from './stories/expanded';
12+
export { controlsShown } from './stories/controlsShown';
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react';
2+
import { SuperChart } from '@superset-ui/chart';
3+
import dummyDatasource from '../../../../../shared/dummyDatasource';
4+
import data from '../data';
5+
6+
export const controlsShown = () => (
7+
<SuperChart
8+
chartType="area"
9+
datasource={dummyDatasource}
10+
width={400}
11+
height={400}
12+
queryData={{ data }}
13+
formData={{
14+
bottomMargin: 'auto',
15+
colorCcheme: 'd3Category10',
16+
contribution: false,
17+
groupby: ['region'],
18+
lineInterpolation: 'linear',
19+
metrics: ['sum__SP_POP_TOTL'],
20+
richTooltip: true,
21+
showBrush: 'auto',
22+
showControls: true,
23+
showLegend: true,
24+
stackedStyle: 'stack',
25+
vizType: 'area',
26+
xAxisFormat: '%Y',
27+
xAxisLabel: '',
28+
xAxisShowminmax: false,
29+
xTicksLayout: 'auto',
30+
yAxisBounds: [null, null],
31+
yAxisFormat: '.3s',
32+
yLogScale: false,
33+
}}
34+
/>
35+
);
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react';
2+
import { SuperChart } from '@superset-ui/chart';
3+
import dummyDatasource from '../../../../../shared/dummyDatasource';
4+
import data from '../data';
5+
6+
export const expanded = () => (
7+
<SuperChart
8+
chartType="area"
9+
datasource={dummyDatasource}
10+
width={400}
11+
height={400}
12+
queryData={{ data }}
13+
formData={{
14+
bottomMargin: 'auto',
15+
colorCcheme: 'd3Category10',
16+
contribution: false,
17+
groupby: ['region'],
18+
lineInterpolation: 'linear',
19+
metrics: ['sum__SP_POP_TOTL'],
20+
richTooltip: true,
21+
showBrush: 'auto',
22+
showControls: false,
23+
showLegend: true,
24+
stackedStyle: 'expand',
25+
vizType: 'area',
26+
xAxisFormat: '%Y',
27+
xAxisLabel: '',
28+
xAxisShowminmax: false,
29+
xTicksLayout: 'auto',
30+
yAxisBounds: [null, null],
31+
yAxisFormat: '.3s',
32+
yLogScale: false,
33+
}}
34+
/>
35+
);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import React from 'react';
2+
import { SuperChart } from '@superset-ui/chart';
3+
import dummyDatasource from '../../../../../shared/dummyDatasource';
4+
import data from '../data';
5+
6+
export const stacked = () => (
7+
<SuperChart
8+
id="stacked-area-chart"
9+
chartType="area"
10+
datasource={dummyDatasource}
11+
width={400}
12+
height={400}
13+
queryData={{ data }}
14+
formData={{
15+
bottomMargin: 'auto',
16+
colorScheme: 'd3Category10',
17+
contribution: false,
18+
groupby: ['region'],
19+
lineInterpolation: 'linear',
20+
metrics: ['sum__SP_POP_TOTL'],
21+
richTooltip: true,
22+
showBrush: 'auto',
23+
showControls: false,
24+
showLegend: true,
25+
stackedStyle: 'stack',
26+
vizType: 'area',
27+
xAxisFormat: '%Y',
28+
xAxisLabel: '',
29+
xAxisShowminmax: false,
30+
xTicksLayout: 'auto',
31+
yAxisBounds: [null, null],
32+
yAxisFormat: '.3s',
33+
yLogScale: false,
34+
}}
35+
/>
36+
);
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import React from 'react';
2+
import { SuperChart } from '@superset-ui/chart';
3+
import dummyDatasource from '../../../../../shared/dummyDatasource';
4+
import data from '../data';
5+
6+
export const stackedWithYAxisBounds = () => (
7+
<SuperChart
8+
chartType="area"
9+
datasource={dummyDatasource}
10+
width={400}
11+
height={400}
12+
queryData={{ data }}
13+
formData={{
14+
bottomMargin: 'auto',
15+
colorCcheme: 'd3Category10',
16+
contribution: false,
17+
groupby: ['region'],
18+
lineInterpolation: 'linear',
19+
metrics: ['sum__SP_POP_TOTL'],
20+
richTooltip: true,
21+
showBrush: 'auto',
22+
showControls: false,
23+
showLegend: true,
24+
stackedStyle: 'stack',
25+
vizType: 'area',
26+
xAxisFormat: '%Y',
27+
xAxisLabel: '',
28+
xAxisShowminmax: false,
29+
xTicksLayout: 'auto',
30+
yAxisBounds: [0, 3000000000],
31+
yAxisFormat: '.3s',
32+
yLogScale: false,
33+
}}
34+
/>
35+
);
36+
37+
stackedWithYAxisBounds.story = {
38+
name: 'Stacked with yAxisBounds',
39+
};
40+
41+
export const stackedWithYAxisBoundsMinOnly = () => (
42+
<SuperChart
43+
chartType="area"
44+
datasource={dummyDatasource}
45+
width={400}
46+
height={400}
47+
queryData={{ data }}
48+
formData={{
49+
bottomMargin: 'auto',
50+
colorCcheme: 'd3Category10',
51+
contribution: false,
52+
groupby: ['region'],
53+
lineInterpolation: 'linear',
54+
metrics: ['sum__SP_POP_TOTL'],
55+
richTooltip: true,
56+
showBrush: 'auto',
57+
showControls: true,
58+
showLegend: true,
59+
stackedStyle: 'stack',
60+
vizType: 'area',
61+
xAxisFormat: '%Y',
62+
xAxisLabel: '',
63+
xAxisShowminmax: false,
64+
xTicksLayout: 'auto',
65+
yAxisBounds: [1000000000, null],
66+
yAxisFormat: '.3s',
67+
yLogScale: false,
68+
}}
69+
/>
70+
);
71+
72+
stackedWithYAxisBoundsMinOnly.story = {
73+
name: 'Stacked with yAxisBounds min only',
74+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { BarChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
2+
3+
new BarChartPlugin().configure({ key: 'bar' }).register();
4+
5+
export default {
6+
title: 'Legacy Chart Plugins|legacy-preset-chart-nvd3/Bar',
7+
};
8+
9+
export { basic } from './stories/basic';
10+
export { barWithValues } from './stories/barWithValues';
11+
export { barWithPositiveAndNegativeValues } from './stories/barWithPositiveAndNegativeValues';
12+
export { stackedBarWithValues } from './stories/stackedBarWithValues';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from 'react';
2+
import { SuperChart } from '@superset-ui/chart';
3+
import dummyDatasource from '../../../../../shared/dummyDatasource';
4+
import data from '../data';
5+
6+
export const barWithPositiveAndNegativeValues = () => (
7+
<SuperChart
8+
chartType="bar"
9+
width={400}
10+
height={400}
11+
datasource={dummyDatasource}
12+
queryData={{
13+
data: data.map((group, i) => ({
14+
...group,
15+
values: group.values.map(pair => ({ ...pair, y: (i % 2 === 0 ? 1 : -1) * pair.y })),
16+
})),
17+
}}
18+
formData={{
19+
bottomMargin: 'auto',
20+
colorScheme: 'd3Category10',
21+
contribution: false,
22+
groupby: ['region'],
23+
lineInterpolation: 'linear',
24+
metrics: ['sum__SP_POP_TOTL'],
25+
richTooltip: true,
26+
showBarValue: true,
27+
showBrush: 'auto',
28+
showControls: false,
29+
showLegend: true,
30+
stackedStyle: 'stack',
31+
vizType: 'bar',
32+
xAxisFormat: '%Y',
33+
xAxisLabel: '',
34+
xAxisShowminmax: false,
35+
xTicksLayout: 'auto',
36+
yAxisBounds: [null, null],
37+
yAxisFormat: '.3s',
38+
yLogScale: false,
39+
}}
40+
/>
41+
);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import React from 'react';
2+
import { SuperChart } from '@superset-ui/chart';
3+
import dummyDatasource from '../../../../../shared/dummyDatasource';
4+
import data from '../data';
5+
6+
export const barWithValues = () => (
7+
<SuperChart
8+
chartType="bar"
9+
width={400}
10+
height={400}
11+
datasource={dummyDatasource}
12+
queryData={{ data }}
13+
formData={{
14+
bottomMargin: 'auto',
15+
colorScheme: 'd3Category10',
16+
contribution: false,
17+
groupby: ['region'],
18+
lineInterpolation: 'linear',
19+
metrics: ['sum__SP_POP_TOTL'],
20+
richTooltip: true,
21+
showBarValue: false,
22+
showBrush: 'auto',
23+
showControls: false,
24+
showLegend: true,
25+
stackedStyle: 'stack',
26+
vizType: 'bar',
27+
xAxisFormat: '%Y',
28+
xAxisLabel: '',
29+
xAxisShowminmax: false,
30+
xTicksLayout: 'auto',
31+
yAxisBounds: [null, null],
32+
yAxisFormat: '.3s',
33+
yLogScale: false,
34+
}}
35+
/>
36+
);

0 commit comments

Comments
 (0)