Skip to content

Commit 047292d

Browse files
authored
style: apply format (#735)
1 parent e8b1ee7 commit 047292d

38 files changed

+289
-280
lines changed

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"tabWidth": 2,
66
"bracketSpacing": true,
77
"arrowParens": "avoid",
8-
"trailingComma": "es5"
8+
"trailingComma": "none"
99
}

src/BaseCharts.js

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
import Chart from 'chart.js'
22

3-
export function generateChart (chartId, chartType) {
3+
export function generateChart(chartId, chartType) {
44
return {
55
render: function (createElement) {
66
return createElement(
7-
'div', {
7+
'div',
8+
{
89
style: this.styles,
910
class: this.cssClasses
1011
},
1112
[
12-
createElement(
13-
'canvas', {
14-
attrs: {
15-
id: this.chartId,
16-
width: this.width,
17-
height: this.height
18-
},
19-
ref: 'canvas'
20-
}
21-
)
13+
createElement('canvas', {
14+
attrs: {
15+
id: this.chartId,
16+
width: this.width,
17+
height: this.height
18+
},
19+
ref: 'canvas'
20+
})
2221
]
2322
)
2423
},
@@ -45,42 +44,43 @@ export function generateChart (chartId, chartType) {
4544
},
4645
plugins: {
4746
type: Array,
48-
default () {
47+
default() {
4948
return []
5049
}
5150
}
5251
},
5352

54-
data () {
53+
data() {
5554
return {
5655
_chart: null,
5756
_plugins: this.plugins
5857
}
5958
},
6059

6160
methods: {
62-
addPlugin (plugin) {
61+
addPlugin(plugin) {
6362
this.$data._plugins.push(plugin)
6463
},
65-
generateLegend () {
64+
generateLegend() {
6665
if (this.$data._chart) {
6766
return this.$data._chart.generateLegend()
6867
}
6968
},
70-
renderChart (data, options) {
69+
renderChart(data, options) {
7170
if (this.$data._chart) this.$data._chart.destroy()
72-
if (!this.$refs.canvas) throw new Error('Please remove the <template></template> tags from your chart component. See https://vue-chartjs.org/guide/#vue-single-file-components')
73-
this.$data._chart = new Chart(
74-
this.$refs.canvas.getContext('2d'), {
75-
type: chartType,
76-
data: data,
77-
options: options,
78-
plugins: this.$data._plugins
79-
}
80-
)
71+
if (!this.$refs.canvas)
72+
throw new Error(
73+
'Please remove the <template></template> tags from your chart component. See https://vue-chartjs.org/guide/#vue-single-file-components'
74+
)
75+
this.$data._chart = new Chart(this.$refs.canvas.getContext('2d'), {
76+
type: chartType,
77+
data: data,
78+
options: options,
79+
plugins: this.$data._plugins
80+
})
8181
}
8282
},
83-
beforeDestroy () {
83+
beforeDestroy() {
8484
if (this.$data._chart) {
8585
this.$data._chart.destroy()
8686
}
@@ -89,7 +89,10 @@ export function generateChart (chartId, chartType) {
8989
}
9090

9191
export const Bar = generateChart('bar-chart', 'bar')
92-
export const HorizontalBar = generateChart('horizontalbar-chart', 'horizontalBar')
92+
export const HorizontalBar = generateChart(
93+
'horizontalbar-chart',
94+
'horizontalBar'
95+
)
9396
export const Doughnut = generateChart('doughnut-chart', 'doughnut')
9497
export const Line = generateChart('line-chart', 'line')
9598
export const Pie = generateChart('pie-chart', 'pie')

src/examples/App.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,21 @@ export default {
9393
ReactiveExample,
9494
ReactivePropExample,
9595
ScatterExample,
96-
HorizontalBarExample,
96+
HorizontalBarExample
9797
},
9898
data() {
9999
return {
100100
dataPoints: {},
101-
height: 20,
101+
height: 20
102102
}
103103
},
104104
computed: {
105105
myStyles() {
106106
return {
107107
height: `${this.height}px`,
108-
position: 'relative',
108+
position: 'relative'
109109
}
110-
},
110+
}
111111
},
112112
mounted() {
113113
setInterval(() => {
@@ -135,7 +135,7 @@ export default {
135135
'September',
136136
'October',
137137
'November',
138-
'December',
138+
'December'
139139
],
140140
datasets: [
141141
{
@@ -153,13 +153,13 @@ export default {
153153
this.getRandomInt(),
154154
this.getRandomInt(),
155155
this.getRandomInt(),
156-
this.getRandomInt(),
157-
],
158-
},
159-
],
156+
this.getRandomInt()
157+
]
158+
}
159+
]
160160
}
161-
},
162-
},
161+
}
162+
}
163163
}
164164
</script>
165165

src/examples/components/bar/BarExample.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ export default {
1717
'September',
1818
'October',
1919
'November',
20-
'December',
20+
'December'
2121
],
2222
datasets: [
2323
{
2424
label: 'Data One',
2525
backgroundColor: '#f87979',
26-
data: [40, 20, 12, 39, 10, 40, 39, 80, 40, 20, 12, 11],
27-
},
28-
],
26+
data: [40, 20, 12, 39, 10, 40, 39, 80, 40, 20, 12, 11]
27+
}
28+
]
2929
},
3030
{ responsive: true, maintainAspectRatio: false }
3131
)
32-
},
32+
}
3333
}

src/examples/components/bar/bar.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,33 @@ import BarExample from './BarExample'
1515
export default {
1616
name: 'BarChart',
1717
components: {
18-
BarExample,
18+
BarExample
1919
},
2020
props: {
2121
chartId: {
2222
type: String,
23-
default: 'bar-chart',
23+
default: 'bar-chart'
2424
},
2525
width: {
2626
type: Number,
27-
default: 400,
27+
default: 400
2828
},
2929
height: {
3030
type: Number,
31-
default: 400,
31+
default: 400
3232
},
3333
cssClasses: {
3434
default: '',
35-
type: String,
35+
type: String
3636
},
3737
styles: {
3838
type: Object,
39-
default: () => {},
39+
default: () => {}
4040
},
4141
plugins: {
4242
type: Array,
43-
default: () => {},
44-
},
45-
},
43+
default: () => {}
44+
}
45+
}
4646
}
4747
</script>

src/examples/components/bubble/BubbleExample.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ export default {
1313
{
1414
x: 20,
1515
y: 25,
16-
r: 5,
16+
r: 5
1717
},
1818
{
1919
x: 40,
2020
y: 10,
21-
r: 10,
21+
r: 10
2222
},
2323
{
2424
x: 30,
2525
y: 22,
26-
r: 30,
27-
},
28-
],
26+
r: 30
27+
}
28+
]
2929
},
3030
{
3131
label: 'Data Two',
@@ -34,23 +34,23 @@ export default {
3434
{
3535
x: 10,
3636
y: 30,
37-
r: 15,
37+
r: 15
3838
},
3939
{
4040
x: 20,
4141
y: 20,
42-
r: 10,
42+
r: 10
4343
},
4444
{
4545
x: 15,
4646
y: 8,
47-
r: 30,
48-
},
49-
],
50-
},
51-
],
47+
r: 30
48+
}
49+
]
50+
}
51+
]
5252
},
5353
{ responsive: true, maintainAspectRatio: false }
5454
)
55-
},
55+
}
5656
}

src/examples/components/bubble/bubble.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,33 @@ import BubbleExample from './BubbleExample'
1515
export default {
1616
name: 'BubbleChart',
1717
components: {
18-
BubbleExample,
18+
BubbleExample
1919
},
2020
props: {
2121
chartId: {
2222
type: String,
23-
default: 'bubble-chart',
23+
default: 'bubble-chart'
2424
},
2525
width: {
2626
type: Number,
27-
default: 400,
27+
default: 400
2828
},
2929
height: {
3030
type: Number,
31-
default: 400,
31+
default: 400
3232
},
3333
cssClasses: {
3434
default: '',
35-
type: String,
35+
type: String
3636
},
3737
styles: {
3838
type: Object,
39-
default: () => {},
39+
default: () => {}
4040
},
4141
plugins: {
4242
type: Array,
43-
default: () => {},
44-
},
45-
},
43+
default: () => {}
44+
}
45+
}
4646
}
4747
</script>

src/examples/components/custom/CustomExample.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Chart.controllers.LineWithLine = Chart.controllers.line.extend({
2323
ctx.stroke()
2424
ctx.restore()
2525
}
26-
},
26+
}
2727
})
2828

2929
const LineWithLine = generateChart('line-with-chart', 'LineWithLine')
@@ -40,23 +40,23 @@ export default {
4040
'April',
4141
'May',
4242
'June',
43-
'July',
43+
'July'
4444
],
4545
datasets: [
4646
{
4747
label: 'Data One',
4848
backgroundColor: '#f87979',
49-
data: [40, 39, 10, 40, 39, 80, 40],
50-
},
51-
],
49+
data: [40, 39, 10, 40, 39, 80, 40]
50+
}
51+
]
5252
},
5353
{
5454
responsive: true,
5555
maintainAspectRatio: false,
5656
tooltips: {
57-
intersect: false,
58-
},
57+
intersect: false
58+
}
5959
}
6060
)
61-
},
61+
}
6262
}

0 commit comments

Comments
 (0)