@gitlab/ui 36.7.1 → 37.0.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.
- package/CHANGELOG.md +18 -0
- package/dist/components/base/alert/alert.js +1 -11
- package/dist/components/base/card/card.js +1 -1
- package/dist/components/charts/area/area.documentation.js +1 -7
- package/dist/components/charts/line/line.documentation.js +2 -5
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utils/stories_utils.js +13 -1
- package/documentation/documented_stories.js +2 -0
- package/package.json +2 -2
- package/src/components/base/accordion/accordion.stories.js +2 -1
- package/src/components/base/alert/alert.scss +0 -38
- package/src/components/base/alert/alert.spec.js +0 -1
- package/src/components/base/alert/alert.stories.js +0 -8
- package/src/components/base/alert/alert.vue +30 -41
- package/src/components/base/badge/badge.stories.js +4 -24
- package/src/components/base/card/card.vue +2 -2
- package/src/components/base/daterange_picker/daterange_picker.stories.js +10 -35
- package/src/components/base/icon/icon.stories.js +2 -5
- package/src/components/base/toggle/toggle.stories.js +2 -3
- package/src/components/charts/area/area.documentation.js +0 -5
- package/src/components/charts/area/area.stories.js +127 -127
- package/src/components/charts/bar/bar.stories.js +8 -5
- package/src/components/charts/heatmap/heatmap.stories.js +13 -16
- package/src/components/charts/line/line.documentation.js +0 -2
- package/src/components/charts/line/line.md +0 -2
- package/src/components/charts/line/line.stories.js +124 -113
- package/src/utils/stories_utils.js +6 -0
- package/src/utils/stories_utils.spec.js +18 -0
- package/dist/components/charts/area/examples/area.basic.example.js +0 -45
- package/dist/components/charts/area/examples/area.basic_plus.example.js +0 -53
- package/dist/components/charts/area/examples/index.js +0 -19
- package/dist/components/charts/line/examples/index.js +0 -19
- package/dist/components/charts/line/examples/line.basic.example.js +0 -45
- package/dist/components/charts/line/examples/line.series.example.js +0 -53
- package/src/components/charts/area/area.md +0 -1
- package/src/components/charts/area/examples/area.basic.example.vue +0 -14
- package/src/components/charts/area/examples/area.basic_plus.example.vue +0 -25
- package/src/components/charts/area/examples/index.js +0 -22
- package/src/components/charts/line/examples/index.js +0 -22
- package/src/components/charts/line/examples/line.basic.example.vue +0 -14
- package/src/components/charts/line/examples/line.series.example.vue +0 -25
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { withKnobs, object, array, boolean } from '@storybook/addon-knobs';
|
|
2
1
|
import { times } from 'lodash';
|
|
3
2
|
import { GlAreaChart } from '../../../charts';
|
|
4
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
5
3
|
import { mockAnnotationsSeries, mockAnnotationsConfigs } from '../../../utils/charts/mock_data';
|
|
6
4
|
import { toolbox } from '../../../utils/charts/story_config';
|
|
7
5
|
import { timeSeriesDateFormatter } from '../../../utils/charts/utils';
|
|
8
6
|
import { generateTimeSeries } from '../../../utils/data_utils';
|
|
9
|
-
import
|
|
7
|
+
import { disableControls } from '../../../utils/stories_utils';
|
|
10
8
|
|
|
11
|
-
const components = {
|
|
12
|
-
GlAreaChart,
|
|
13
|
-
};
|
|
14
9
|
const defaultData = [
|
|
15
10
|
{
|
|
16
11
|
name: 'First Series',
|
|
@@ -32,6 +27,7 @@ const defaultOptions = {
|
|
|
32
27
|
type: 'category',
|
|
33
28
|
},
|
|
34
29
|
};
|
|
30
|
+
|
|
35
31
|
const template = `<gl-area-chart
|
|
36
32
|
:data="data"
|
|
37
33
|
:option="option"
|
|
@@ -40,136 +36,140 @@ const template = `<gl-area-chart
|
|
|
40
36
|
:includeLegendAvgMax="includeLegendAvgMax"
|
|
41
37
|
/>`;
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
const generateProps = ({
|
|
44
40
|
data = defaultData,
|
|
45
41
|
option = defaultOptions,
|
|
46
42
|
thresholds = [],
|
|
47
43
|
annotations = [],
|
|
48
44
|
includeLegendAvgMax = true,
|
|
49
|
-
} = {}) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
} = {}) => ({
|
|
46
|
+
data,
|
|
47
|
+
option,
|
|
48
|
+
thresholds,
|
|
49
|
+
annotations,
|
|
50
|
+
includeLegendAvgMax,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const Template = (args, { argTypes }) => ({
|
|
54
|
+
components: {
|
|
55
|
+
GlAreaChart,
|
|
56
|
+
},
|
|
57
|
+
props: Object.keys(argTypes),
|
|
58
|
+
template,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const Default = Template.bind({});
|
|
62
|
+
Default.args = generateProps();
|
|
63
|
+
|
|
64
|
+
export const WithThreshold = Template.bind({});
|
|
65
|
+
WithThreshold.args = generateProps({
|
|
66
|
+
thresholds: [{ threshold: 1200, operator: '>' }],
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export const WithAnnotationsAsProps = Template.bind({});
|
|
70
|
+
WithAnnotationsAsProps.storyName = 'With annotations as props (recommended)';
|
|
71
|
+
WithAnnotationsAsProps.args = generateProps({
|
|
72
|
+
...mockAnnotationsConfigs,
|
|
73
|
+
data: [
|
|
74
|
+
{
|
|
75
|
+
name: 'Time Series',
|
|
76
|
+
data: generateTimeSeries(),
|
|
56
77
|
},
|
|
57
|
-
|
|
58
|
-
|
|
78
|
+
],
|
|
79
|
+
option: {
|
|
80
|
+
xAxis: {
|
|
81
|
+
type: 'time',
|
|
82
|
+
name: 'Time',
|
|
83
|
+
axisLabel: {
|
|
84
|
+
formatter: timeSeriesDateFormatter,
|
|
85
|
+
},
|
|
59
86
|
},
|
|
60
|
-
|
|
61
|
-
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export const WithAnnotationsAsOptionSeries = Template.bind({});
|
|
91
|
+
WithAnnotationsAsOptionSeries.args = generateProps({
|
|
92
|
+
data: [
|
|
93
|
+
{
|
|
94
|
+
name: 'Time Series',
|
|
95
|
+
data: generateTimeSeries(),
|
|
62
96
|
},
|
|
63
|
-
|
|
64
|
-
|
|
97
|
+
],
|
|
98
|
+
option: {
|
|
99
|
+
...mockAnnotationsSeries,
|
|
100
|
+
xAxis: {
|
|
101
|
+
type: 'time',
|
|
102
|
+
name: 'Time',
|
|
103
|
+
axisLabel: {
|
|
104
|
+
formatter: timeSeriesDateFormatter,
|
|
105
|
+
},
|
|
65
106
|
},
|
|
66
|
-
}
|
|
67
|
-
}
|
|
107
|
+
},
|
|
108
|
+
});
|
|
68
109
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
.add('with annotations as props (recommended)', () => ({
|
|
84
|
-
props: generateProps({
|
|
85
|
-
...mockAnnotationsConfigs,
|
|
86
|
-
data: [
|
|
87
|
-
{
|
|
88
|
-
name: 'Time Series',
|
|
89
|
-
data: generateTimeSeries(),
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
option: {
|
|
93
|
-
xAxis: {
|
|
94
|
-
type: 'time',
|
|
95
|
-
name: 'Time',
|
|
96
|
-
axisLabel: {
|
|
97
|
-
formatter: timeSeriesDateFormatter,
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
}),
|
|
102
|
-
components,
|
|
103
|
-
template,
|
|
104
|
-
}))
|
|
105
|
-
.add('with annotations as option series', () => ({
|
|
106
|
-
props: generateProps({
|
|
107
|
-
data: [
|
|
108
|
-
{
|
|
109
|
-
name: 'Time Series',
|
|
110
|
-
data: generateTimeSeries(),
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
option: {
|
|
114
|
-
...mockAnnotationsSeries,
|
|
115
|
-
xAxis: {
|
|
116
|
-
type: 'time',
|
|
117
|
-
name: 'Time',
|
|
118
|
-
axisLabel: {
|
|
119
|
-
formatter: timeSeriesDateFormatter,
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
}),
|
|
124
|
-
components,
|
|
125
|
-
template,
|
|
126
|
-
}))
|
|
127
|
-
.add('with zoom and scroll', () => ({
|
|
128
|
-
props: generateProps({
|
|
129
|
-
data: [
|
|
130
|
-
{
|
|
131
|
-
name: 'Time Series',
|
|
132
|
-
data: generateTimeSeries(),
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
option: {
|
|
136
|
-
xAxis: {
|
|
137
|
-
type: 'time',
|
|
138
|
-
name: 'Time',
|
|
139
|
-
axisLabel: {
|
|
140
|
-
formatter: timeSeriesDateFormatter,
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
dataZoom: [
|
|
144
|
-
{
|
|
145
|
-
startValue: '2018-03-01T00:00:00.000',
|
|
146
|
-
},
|
|
147
|
-
],
|
|
110
|
+
export const WithZoomAndScroll = Template.bind({});
|
|
111
|
+
WithZoomAndScroll.args = generateProps({
|
|
112
|
+
data: [
|
|
113
|
+
{
|
|
114
|
+
name: 'Time Series',
|
|
115
|
+
data: generateTimeSeries(),
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
option: {
|
|
119
|
+
xAxis: {
|
|
120
|
+
type: 'time',
|
|
121
|
+
name: 'Time',
|
|
122
|
+
axisLabel: {
|
|
123
|
+
formatter: timeSeriesDateFormatter,
|
|
148
124
|
},
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
.add('with toolbox', () => ({
|
|
154
|
-
props: generateProps({
|
|
155
|
-
option: {
|
|
156
|
-
xAxis: {
|
|
157
|
-
name: 'Time',
|
|
158
|
-
type: 'category',
|
|
159
|
-
},
|
|
160
|
-
toolbox,
|
|
125
|
+
},
|
|
126
|
+
dataZoom: [
|
|
127
|
+
{
|
|
128
|
+
startValue: '2018-03-01T00:00:00.000',
|
|
161
129
|
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
export const WithToolbox = Template.bind({});
|
|
135
|
+
WithToolbox.args = generateProps({
|
|
136
|
+
option: {
|
|
137
|
+
xAxis: {
|
|
138
|
+
name: 'Time',
|
|
139
|
+
type: 'category',
|
|
140
|
+
},
|
|
141
|
+
toolbox,
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
export const MultSeries = Template.bind({});
|
|
146
|
+
MultSeries.args = generateProps({
|
|
147
|
+
data: times(10, (index) => ({
|
|
148
|
+
name: index,
|
|
149
|
+
data: defaultData[0].data.map(([label, value]) => [label, value * index]),
|
|
150
|
+
})),
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
export default {
|
|
154
|
+
title: 'charts/area-chart',
|
|
155
|
+
component: GlAreaChart,
|
|
156
|
+
parameters: {
|
|
157
|
+
knobs: { disable: true },
|
|
158
|
+
},
|
|
159
|
+
argTypes: {
|
|
160
|
+
...disableControls([
|
|
161
|
+
'showToolbox',
|
|
162
|
+
'toolboxZoomIconPath',
|
|
163
|
+
'toolboxBackIconPath',
|
|
164
|
+
'toolboxRestoreIconPath',
|
|
165
|
+
'toolboxSaveAsImageIconPath',
|
|
166
|
+
'dataSeries',
|
|
167
|
+
'formatTooltipText',
|
|
168
|
+
'legendAverageText',
|
|
169
|
+
'legendMaxText',
|
|
170
|
+
'legendMinText',
|
|
171
|
+
'legendCurrentText',
|
|
172
|
+
'legendLayout',
|
|
173
|
+
]),
|
|
174
|
+
},
|
|
175
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GlBarChart } from '../../../charts';
|
|
2
|
+
import { disableControls } from '../../../utils/stories_utils';
|
|
2
3
|
import readme from './bar.md';
|
|
3
4
|
|
|
4
5
|
const Template = (args, { argTypes }) => ({
|
|
@@ -49,11 +50,13 @@ export default {
|
|
|
49
50
|
title: 'charts/bar-chart',
|
|
50
51
|
component: GlBarChart,
|
|
51
52
|
argTypes: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
...disableControls([
|
|
54
|
+
'showToolbox',
|
|
55
|
+
'toolboxZoomIconPath',
|
|
56
|
+
'toolboxBackIconPath',
|
|
57
|
+
'toolboxRestoreIconPath',
|
|
58
|
+
'toolboxSaveAsImageIconPath',
|
|
59
|
+
]),
|
|
57
60
|
},
|
|
58
61
|
parameters: {
|
|
59
62
|
knobs: { disable: true },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlHeatmap } from '../../../charts';
|
|
2
2
|
import { toolbox } from '../../../utils/charts/story_config';
|
|
3
|
-
import
|
|
3
|
+
import { disableControls } from '../../../utils/stories_utils';
|
|
4
4
|
|
|
5
5
|
function generateData() {
|
|
6
6
|
let data = [
|
|
@@ -62,22 +62,19 @@ export default {
|
|
|
62
62
|
component: GlHeatmap,
|
|
63
63
|
parameters: {
|
|
64
64
|
knobs: { disable: true },
|
|
65
|
-
docs: {
|
|
66
|
-
description: {
|
|
67
|
-
component: readme,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
65
|
},
|
|
71
66
|
argTypes: {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
...disableControls([
|
|
68
|
+
'showToolbox',
|
|
69
|
+
'toolboxZoomIconPath',
|
|
70
|
+
'toolboxBackIconPath',
|
|
71
|
+
'toolboxRestoreIconPath',
|
|
72
|
+
'toolboxSaveAsImageIconPath',
|
|
73
|
+
'dataSeries',
|
|
74
|
+
'formatTooltipText',
|
|
75
|
+
'legendAverageText',
|
|
76
|
+
'legendMaxText',
|
|
77
|
+
'responsive',
|
|
78
|
+
]),
|
|
82
79
|
},
|
|
83
80
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { withKnobs, object, boolean, array } from '@storybook/addon-knobs';
|
|
2
1
|
import { GlLineChart } from '../../../charts';
|
|
3
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
4
2
|
import { mockAnnotationsSeries, mockAnnotationsConfigs } from '../../../utils/charts/mock_data';
|
|
5
3
|
import { toolbox } from '../../../utils/charts/story_config';
|
|
6
4
|
import { timeSeriesDateFormatter } from '../../../utils/charts/utils';
|
|
7
5
|
import { generateTimeSeries } from '../../../utils/data_utils';
|
|
6
|
+
import { disableControls } from '../../../utils/stories_utils';
|
|
8
7
|
import readme from './line.md';
|
|
9
8
|
|
|
10
9
|
const components = {
|
|
@@ -50,6 +49,7 @@ const defaultData = [
|
|
|
50
49
|
];
|
|
51
50
|
|
|
52
51
|
const defaultOptions = {
|
|
52
|
+
animation: false,
|
|
53
53
|
xAxis: {
|
|
54
54
|
name: 'Time',
|
|
55
55
|
type: 'category',
|
|
@@ -64,127 +64,138 @@ const template = `<gl-line-chart
|
|
|
64
64
|
:includeLegendAvgMax="includeLegendAvgMax"
|
|
65
65
|
/>`;
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
const generateProps = ({
|
|
68
68
|
data = defaultData,
|
|
69
69
|
option = defaultOptions,
|
|
70
70
|
thresholds = [],
|
|
71
71
|
annotations = [],
|
|
72
72
|
includeLegendAvgMax = true,
|
|
73
|
-
} = {}) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
} = {}) => ({
|
|
74
|
+
includeLegendAvgMax,
|
|
75
|
+
option,
|
|
76
|
+
thresholds,
|
|
77
|
+
annotations,
|
|
78
|
+
data,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const Template = (_args, { argTypes }) => ({
|
|
82
|
+
props: Object.keys(argTypes),
|
|
83
|
+
components,
|
|
84
|
+
template,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export const Default = Template.bind({});
|
|
88
|
+
Default.args = generateProps();
|
|
89
|
+
|
|
90
|
+
export const WithThreshold = Template.bind({});
|
|
91
|
+
WithThreshold.args = generateProps({
|
|
92
|
+
thresholds: [{ threshold: 1350, operator: '>' }],
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export const WithAnnotationsAsProps = Template.bind({});
|
|
96
|
+
WithAnnotationsAsProps.storyNane = 'with annotations as props (recommended)';
|
|
97
|
+
WithAnnotationsAsProps.args = generateProps({
|
|
98
|
+
...mockAnnotationsConfigs,
|
|
99
|
+
data: [
|
|
100
|
+
{
|
|
101
|
+
name: 'Time Series',
|
|
102
|
+
data: generateTimeSeries(),
|
|
80
103
|
},
|
|
81
|
-
|
|
82
|
-
|
|
104
|
+
],
|
|
105
|
+
option: {
|
|
106
|
+
animation: false,
|
|
107
|
+
xAxis: {
|
|
108
|
+
type: 'time',
|
|
109
|
+
name: 'Time',
|
|
110
|
+
axisLabel: {
|
|
111
|
+
formatter: timeSeriesDateFormatter,
|
|
112
|
+
},
|
|
83
113
|
},
|
|
84
|
-
|
|
85
|
-
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
export const WithAnnotationsAsOptionSeries = Template.bind({});
|
|
118
|
+
WithAnnotationsAsOptionSeries.args = generateProps({
|
|
119
|
+
data: [
|
|
120
|
+
{
|
|
121
|
+
name: 'Time Series',
|
|
122
|
+
data: generateTimeSeries(),
|
|
86
123
|
},
|
|
87
|
-
|
|
88
|
-
|
|
124
|
+
],
|
|
125
|
+
option: {
|
|
126
|
+
...mockAnnotationsSeries,
|
|
127
|
+
animation: false,
|
|
128
|
+
xAxis: {
|
|
129
|
+
type: 'time',
|
|
130
|
+
name: 'Time',
|
|
131
|
+
axisLabel: {
|
|
132
|
+
formatter: timeSeriesDateFormatter,
|
|
133
|
+
},
|
|
89
134
|
},
|
|
90
|
-
}
|
|
91
|
-
}
|
|
135
|
+
},
|
|
136
|
+
});
|
|
92
137
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
props: generateProps({
|
|
109
|
-
...mockAnnotationsConfigs,
|
|
110
|
-
data: [
|
|
111
|
-
{
|
|
112
|
-
name: 'Time Series',
|
|
113
|
-
data: generateTimeSeries(),
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
option: {
|
|
117
|
-
xAxis: {
|
|
118
|
-
type: 'time',
|
|
119
|
-
name: 'Time',
|
|
120
|
-
axisLabel: {
|
|
121
|
-
formatter: timeSeriesDateFormatter,
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
}),
|
|
126
|
-
components,
|
|
127
|
-
template,
|
|
128
|
-
}))
|
|
129
|
-
.add('with annotations as option series', () => ({
|
|
130
|
-
props: generateProps({
|
|
131
|
-
data: [
|
|
132
|
-
{
|
|
133
|
-
name: 'Time Series',
|
|
134
|
-
data: generateTimeSeries(),
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
option: {
|
|
138
|
-
...mockAnnotationsSeries,
|
|
139
|
-
xAxis: {
|
|
140
|
-
type: 'time',
|
|
141
|
-
name: 'Time',
|
|
142
|
-
axisLabel: {
|
|
143
|
-
formatter: timeSeriesDateFormatter,
|
|
144
|
-
},
|
|
145
|
-
},
|
|
138
|
+
export const WithZoomAndScroll = Template.bind({});
|
|
139
|
+
WithZoomAndScroll.args = generateProps({
|
|
140
|
+
data: [
|
|
141
|
+
{
|
|
142
|
+
name: 'Time Series',
|
|
143
|
+
data: generateTimeSeries(),
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
option: {
|
|
147
|
+
animation: false,
|
|
148
|
+
xAxis: {
|
|
149
|
+
type: 'time',
|
|
150
|
+
name: 'Time',
|
|
151
|
+
axisLabel: {
|
|
152
|
+
formatter: timeSeriesDateFormatter,
|
|
146
153
|
},
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
props: generateProps({
|
|
153
|
-
data: [
|
|
154
|
-
{
|
|
155
|
-
name: 'Time Series',
|
|
156
|
-
data: generateTimeSeries(),
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
option: {
|
|
160
|
-
xAxis: {
|
|
161
|
-
type: 'time',
|
|
162
|
-
name: 'Time',
|
|
163
|
-
axisLabel: {
|
|
164
|
-
formatter: timeSeriesDateFormatter,
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
dataZoom: [
|
|
168
|
-
{
|
|
169
|
-
type: 'slider',
|
|
170
|
-
startValue: '2018-03-01T00:00:00.000',
|
|
171
|
-
},
|
|
172
|
-
],
|
|
154
|
+
},
|
|
155
|
+
dataZoom: [
|
|
156
|
+
{
|
|
157
|
+
type: 'slider',
|
|
158
|
+
startValue: '2018-03-01T00:00:00.000',
|
|
173
159
|
},
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
160
|
+
],
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
export const WithToolbox = Template.bind({});
|
|
165
|
+
WithToolbox.args = generateProps({
|
|
166
|
+
option: {
|
|
167
|
+
animation: false,
|
|
168
|
+
xAxis: {
|
|
169
|
+
name: 'Time',
|
|
170
|
+
type: 'category',
|
|
171
|
+
},
|
|
172
|
+
toolbox,
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
export default {
|
|
177
|
+
title: 'charts/line-chart',
|
|
178
|
+
component: GlLineChart,
|
|
179
|
+
parameters: {
|
|
180
|
+
docs: {
|
|
181
|
+
description: {
|
|
182
|
+
component: readme,
|
|
186
183
|
},
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
argTypes: {
|
|
187
|
+
...disableControls([
|
|
188
|
+
'showToolbox',
|
|
189
|
+
'toolboxZoomIconPath',
|
|
190
|
+
'toolboxBackIconPath',
|
|
191
|
+
'toolboxRestoreIconPath',
|
|
192
|
+
'toolboxSaveAsImageIconPath',
|
|
193
|
+
'formatTooltipText',
|
|
194
|
+
'legendAverageText',
|
|
195
|
+
'legendMaxText',
|
|
196
|
+
'legendMinText',
|
|
197
|
+
'legendCurrentText',
|
|
198
|
+
'legendLayout',
|
|
199
|
+
]),
|
|
200
|
+
},
|
|
201
|
+
};
|
|
@@ -12,3 +12,9 @@ export const SERIES_NAME = {
|
|
|
12
12
|
[SERIES_NAME_LONG_WITHOUT_SPACES]:
|
|
13
13
|
'Series_name_long._Lorem_ipsum_dolor_sit_amet,_consectetur_adipiscing_elit._Sed_tincidunt_interdum_sapien_ut_blandit._Nulla_fermentum_nisi_id_euismod_vulputate._END',
|
|
14
14
|
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Builds the parameters object disable one or multiple controls.
|
|
18
|
+
*/
|
|
19
|
+
export const disableControls = (controls = []) =>
|
|
20
|
+
Object.fromEntries(controls.map((control) => [control, { control: { disable: true } }]));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { disableControls } from './stories_utils';
|
|
2
|
+
|
|
3
|
+
describe('stories utils', () => {
|
|
4
|
+
describe('disableControls', () => {
|
|
5
|
+
const DISABLE_CONTROL_PARAMETER = { control: { disable: true } };
|
|
6
|
+
|
|
7
|
+
it('returns an empty object if no argument is given', () => {
|
|
8
|
+
expect(disableControls()).toEqual({});
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('returns parameters object when given an array of strings', () => {
|
|
12
|
+
expect(disableControls(['foo', 'bar'])).toEqual({
|
|
13
|
+
foo: DISABLE_CONTROL_PARAMETER,
|
|
14
|
+
bar: DISABLE_CONTROL_PARAMETER,
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|