File tree 18 files changed +6253
-258
lines changed
18 files changed +6253
-258
lines changed Original file line number Diff line number Diff line change
1
+ const path = require ( 'path' )
2
+
3
+ module . exports = {
4
+ stories : [ '../stories/*.stories.(js|ts)' ] ,
5
+ addons : [ '@storybook/addon-essentials' ] ,
6
+ framework : '@storybook/vue' ,
7
+ webpackFinal : async config => {
8
+ config . resolve . alias [ 'vue-chartjs' ] = path . resolve (
9
+ __dirname ,
10
+ '../src/index.js'
11
+ )
12
+ return config
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ import { addons } from '@storybook/addons'
2
+
3
+ import { theme } from './theme'
4
+
5
+ addons . setConfig ( {
6
+ theme,
7
+ panelPosition : 'right'
8
+ } )
Original file line number Diff line number Diff line change
1
+ import { configureActions } from '@storybook/addon-actions'
2
+
3
+ configureActions ( {
4
+ depth : 5
5
+ } )
Original file line number Diff line number Diff line change
1
+ import { create } from '@storybook/theming'
2
+
3
+ export const theme = create ( {
4
+ base : 'light' ,
5
+ brandTitle : 'vue-chartjs' ,
6
+ brandUrl : 'https://github.com/apertureless/vue-chartjs'
7
+ } )
Original file line number Diff line number Diff line change 59
59
"prepublishOnly" : " yarn run lint && yarn run test && yarn run build" ,
60
60
"docs:dev" : " vuepress dev docs" ,
61
61
"docs:build" : " vuepress build docs" ,
62
- "commit" : " cz"
62
+ "commit" : " cz" ,
63
+ "start:storybook" : " start-storybook -p 6006"
63
64
},
64
65
"peerDependencies" : {
65
66
"chart.js" : " >= 2.5"
73
74
"@babel/preset-env" : " ^7.16.5" ,
74
75
"@commitlint/cli" : " ^15.0.0" ,
75
76
"@commitlint/config-conventional" : " ^15.0.0" ,
77
+ "@storybook/addon-actions" : " ^6.4.12" ,
78
+ "@storybook/addon-essentials" : " ^6.4.13" ,
79
+ "@storybook/vue" : " ^6.4.12" ,
76
80
"@swc/core" : " ^1.2.120" ,
77
81
"@swc/jest" : " ^0.2.15" ,
78
82
"@types/chart.js" : " ^2.7.55" ,
123
127
"vue" : " 2.6.14" ,
124
128
"vue-hot-reload-api" : " 2.3.1" ,
125
129
"vue-html-loader" : " ^1.2.4" ,
126
- "vue-loader" : " ^14.2.1 " ,
130
+ "vue-loader" : " ^15.9.8 " ,
127
131
"vue-style-loader" : " 4.1.2" ,
128
132
"vue-template-compiler" : " 2.6.14" ,
129
133
"vuepress" : " ^0.14.4" ,
Original file line number Diff line number Diff line change
1
+ import BarChart from '../sandboxes/bar/src/components/barChart.vue'
2
+
3
+ export default {
4
+ title : 'BarChart' ,
5
+ component : BarChart ,
6
+ parameters : {
7
+ layout : 'centered'
8
+ }
9
+ }
10
+
11
+ const Template = ( _ , { argTypes } ) => ( {
12
+ props : Object . keys ( argTypes ) ,
13
+ components : { BarChart } ,
14
+ template : '<BarChart />'
15
+ } )
16
+
17
+ export const DefaultBar = Template . bind ( { } )
18
+
19
+ DefaultBar . args = {
20
+ chartId : 'bar-chart' ,
21
+ width : 400 ,
22
+ height : 400 ,
23
+ plugins : [ ]
24
+ }
Original file line number Diff line number Diff line change
1
+ import BubbleChart from '../sandboxes/bubble/src/components/bubbleChart.vue'
2
+
3
+ export default {
4
+ title : 'BubbleChart' ,
5
+ component : BubbleChart ,
6
+ parameters : {
7
+ layout : 'centered'
8
+ }
9
+ }
10
+
11
+ const Template = ( _ , { argTypes } ) => ( {
12
+ props : Object . keys ( argTypes ) ,
13
+ components : { BubbleChart } ,
14
+ template : '<BubbleChart />'
15
+ } )
16
+
17
+ export const DefaultBubble = Template . bind ( { } )
18
+
19
+ DefaultBubble . args = {
20
+ chartId : 'bubble-chart' ,
21
+ width : 400 ,
22
+ height : 400 ,
23
+ plugins : [ ]
24
+ }
Original file line number Diff line number Diff line change
1
+ import CustomChart from '../sandboxes/custom/src/components/customChart.vue'
2
+
3
+ export default {
4
+ title : 'CustomChart' ,
5
+ component : CustomChart ,
6
+ parameters : {
7
+ layout : 'centered'
8
+ }
9
+ }
10
+
11
+ const Template = ( _ , { argTypes } ) => ( {
12
+ props : Object . keys ( argTypes ) ,
13
+ components : { CustomChart } ,
14
+ template : '<CustomChart />'
15
+ } )
16
+
17
+ export const DefaultCustom = Template . bind ( { } )
18
+
19
+ DefaultCustom . args = {
20
+ chartId : 'custom-chart' ,
21
+ width : 400 ,
22
+ height : 400 ,
23
+ plugins : [ ]
24
+ }
Original file line number Diff line number Diff line change
1
+ import DoughnutChart from '../sandboxes/doughnut/src/components/doughnutChart.vue'
2
+
3
+ export default {
4
+ title : 'DoughnutChart' ,
5
+ component : DoughnutChart ,
6
+ parameters : {
7
+ layout : 'centered'
8
+ }
9
+ }
10
+
11
+ const Template = ( _ , { argTypes } ) => ( {
12
+ props : Object . keys ( argTypes ) ,
13
+ components : { DoughnutChart } ,
14
+ template : '<DoughnutChart />'
15
+ } )
16
+
17
+ export const DefaultDoughnut = Template . bind ( { } )
18
+
19
+ DefaultDoughnut . args = {
20
+ chartId : 'doughnut-chart' ,
21
+ width : 400 ,
22
+ height : 400 ,
23
+ plugins : [ ]
24
+ }
Original file line number Diff line number Diff line change
1
+ import HorizontalBarChart from '../sandboxes/horizontal-bar/src/components/horizontalBarChart.vue'
2
+
3
+ export default {
4
+ title : 'HorizontalBarChart' ,
5
+ component : HorizontalBarChart ,
6
+ parameters : {
7
+ layout : 'centered'
8
+ }
9
+ }
10
+
11
+ const Template = ( _ , { argTypes } ) => ( {
12
+ props : Object . keys ( argTypes ) ,
13
+ components : { HorizontalBarChart } ,
14
+ template : '<HorizontalBarChart />'
15
+ } )
16
+
17
+ export const DefaultHorizontalBar = Template . bind ( { } )
18
+
19
+ DefaultHorizontalBar . args = {
20
+ chartId : 'horizontal-bar-chart' ,
21
+ width : 400 ,
22
+ height : 400 ,
23
+ plugins : [ ]
24
+ }
Original file line number Diff line number Diff line change
1
+ import LineChart from '../sandboxes/line/src/components/lineChart.vue'
2
+
3
+ export default {
4
+ title : 'LineChart' ,
5
+ component : LineChart ,
6
+ parameters : {
7
+ layout : 'centered'
8
+ }
9
+ }
10
+
11
+ const Template = ( _ , { argTypes } ) => ( {
12
+ props : Object . keys ( argTypes ) ,
13
+ components : { LineChart } ,
14
+ template : '<LineChart />'
15
+ } )
16
+
17
+ export const DefaultLine = Template . bind ( { } )
18
+
19
+ DefaultLine . args = {
20
+ chartId : 'line-chart' ,
21
+ width : 400 ,
22
+ height : 400 ,
23
+ plugins : [ ]
24
+ }
Original file line number Diff line number Diff line change
1
+ import PieChart from '../sandboxes/pie/src/components/pieChart.vue'
2
+
3
+ export default {
4
+ title : 'PieChart' ,
5
+ component : PieChart ,
6
+ parameters : {
7
+ layout : 'centered'
8
+ }
9
+ }
10
+
11
+ const Template = ( _ , { argTypes } ) => ( {
12
+ props : Object . keys ( argTypes ) ,
13
+ components : { PieChart } ,
14
+ template : '<PieChart />'
15
+ } )
16
+
17
+ export const DefaultPie = Template . bind ( { } )
18
+
19
+ DefaultPie . args = {
20
+ chartId : 'pie-chart' ,
21
+ width : 400 ,
22
+ height : 400 ,
23
+ plugins : [ ]
24
+ }
Original file line number Diff line number Diff line change
1
+ import PolarAreaChart from '../sandboxes/polar-area/src/components/polarAreaChart.vue'
2
+
3
+ export default {
4
+ title : 'PolarAreaChart' ,
5
+ component : PolarAreaChart ,
6
+ parameters : {
7
+ layout : 'centered'
8
+ }
9
+ }
10
+
11
+ const Template = ( _ , { argTypes } ) => ( {
12
+ props : Object . keys ( argTypes ) ,
13
+ components : { PolarAreaChart } ,
14
+ template : '<PolarAreaChart />'
15
+ } )
16
+
17
+ export const DefaultPolarArea = Template . bind ( { } )
18
+
19
+ DefaultPolarArea . args = {
20
+ chartId : 'polar-area-chart' ,
21
+ width : 400 ,
22
+ height : 400 ,
23
+ plugins : [ ]
24
+ }
Original file line number Diff line number Diff line change
1
+ import RadarChart from '../sandboxes/radar/src/components/radarChart.vue'
2
+
3
+ export default {
4
+ title : 'RadarChart' ,
5
+ component : RadarChart ,
6
+ parameters : {
7
+ layout : 'centered'
8
+ }
9
+ }
10
+
11
+ const Template = ( _ , { argTypes } ) => ( {
12
+ props : Object . keys ( argTypes ) ,
13
+ components : { RadarChart } ,
14
+ template : '<RadarChart />'
15
+ } )
16
+
17
+ export const DefaultRadar = Template . bind ( { } )
18
+
19
+ DefaultRadar . args = {
20
+ chartId : 'radar-chart' ,
21
+ width : 400 ,
22
+ height : 400 ,
23
+ plugins : [ ]
24
+ }
Original file line number Diff line number Diff line change
1
+ import ReactiveChart from '../sandboxes/reactive/src/components/reactiveChart.vue'
2
+
3
+ export default {
4
+ title : 'ReactiveChart' ,
5
+ component : ReactiveChart ,
6
+ parameters : {
7
+ layout : 'centered'
8
+ }
9
+ }
10
+
11
+ const Template = ( _ , { argTypes } ) => ( {
12
+ props : Object . keys ( argTypes ) ,
13
+ components : { ReactiveChart } ,
14
+ template : '<ReactiveChart />'
15
+ } )
16
+
17
+ export const DefaultReactive = Template . bind ( { } )
18
+
19
+ DefaultReactive . args = {
20
+ chartId : 'reactive-chart' ,
21
+ width : 400 ,
22
+ height : 400 ,
23
+ plugins : [ ]
24
+ }
Original file line number Diff line number Diff line change
1
+ import ReactivePropChart from '../sandboxes/reactive-prop/src/components/reactivePropChart.vue'
2
+
3
+ export default {
4
+ title : 'ReactivePropChart' ,
5
+ component : ReactivePropChart ,
6
+ parameters : {
7
+ layout : 'centered'
8
+ }
9
+ }
10
+
11
+ const Template = ( _ , { argTypes } ) => ( {
12
+ props : Object . keys ( argTypes ) ,
13
+ components : { ReactivePropChart } ,
14
+ template : '<ReactivePropChart :chart-data="dataPoints" />' ,
15
+ data ( ) {
16
+ return {
17
+ dataPoints : { }
18
+ }
19
+ } ,
20
+ mounted ( ) {
21
+ setInterval ( ( ) => {
22
+ this . fillData ( )
23
+ } , 2000 )
24
+ } ,
25
+ methods : {
26
+ getRandomInt ( ) {
27
+ return Math . floor ( Math . random ( ) * ( 50 - 5 + 1 ) ) + 5
28
+ } ,
29
+ fillData ( ) {
30
+ this . dataPoints = {
31
+ labels : [
32
+ 'January' + this . getRandomInt ( ) ,
33
+ 'February' ,
34
+ 'March' ,
35
+ 'April' ,
36
+ 'May' ,
37
+ 'June' ,
38
+ 'July' ,
39
+ 'August' ,
40
+ 'September' ,
41
+ 'October' ,
42
+ 'November' ,
43
+ 'December'
44
+ ] ,
45
+ datasets : [
46
+ {
47
+ label : 'Data One' ,
48
+ backgroundColor : '#f87979' ,
49
+ data : [
50
+ this . getRandomInt ( ) ,
51
+ this . getRandomInt ( ) ,
52
+ this . getRandomInt ( ) ,
53
+ this . getRandomInt ( ) ,
54
+ this . getRandomInt ( ) ,
55
+ this . getRandomInt ( ) ,
56
+ this . getRandomInt ( ) ,
57
+ this . getRandomInt ( ) ,
58
+ this . getRandomInt ( ) ,
59
+ this . getRandomInt ( ) ,
60
+ this . getRandomInt ( ) ,
61
+ this . getRandomInt ( )
62
+ ]
63
+ }
64
+ ]
65
+ }
66
+ }
67
+ }
68
+ } )
69
+
70
+ export const DefaultReactiveProp = Template . bind ( { } )
71
+
72
+ DefaultReactiveProp . args = {
73
+ chartId : 'reactive-prop-chart' ,
74
+ width : 400 ,
75
+ height : 400 ,
76
+ plugins : [ ]
77
+ }
You can’t perform that action at this time.
0 commit comments