Skip to content

Commit f241613

Browse files
committed
✨ Add canvas id as prop
1 parent af373cf commit f241613

File tree

6 files changed

+30
-6
lines changed

6 files changed

+30
-6
lines changed

src/BaseCharts/Bar.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ import { mergeOptions } from '../helpers/options'
55
export default Vue.extend({
66
template: `
77
<div>
8-
<canvas id="bar-chart" width="{{width}}" height="{{height}}" v-el:canvas></canvas>
8+
<canvas id="{{chartId}}" width="{{width}}" height="{{height}}" v-el:canvas></canvas>
99
</div>
1010
`,
1111

1212
props: {
13+
chartId: {
14+
default: 'bar-chart',
15+
type: String
16+
},
1317
width: {
1418
default: 400,
1519
type: Number

src/BaseCharts/Doughnut.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ import { mergeOptions } from '../helpers/options'
55
export default Vue.extend({
66
template: `
77
<div>
8-
<canvas id="doughnut-chart" width={{width}} height={{height}} v-el:canvas></canvas>
8+
<canvas id="{{chartId}}" width={{width}} height={{height}} v-el:canvas></canvas>
99
</div>
1010
`,
1111

1212
props: {
13+
chartId: {
14+
default: 'doughnut-chart',
15+
type: String
16+
},
1317
width: {
1418
default: 400,
1519
type: Number

src/BaseCharts/Line.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ import { mergeOptions } from '../helpers/options'
55
export default Vue.extend({
66
template: `
77
<div>
8-
<canvas id="line-chart" width={{width}} height={{height}} v-el:canvas></canvas>
8+
<canvas id="{{chartId}}" width={{width}} height={{height}} v-el:canvas></canvas>
99
</div>
1010
`,
1111

1212
props: {
13+
chartId: {
14+
default: 'line-chart',
15+
type: String
16+
},
1317
width: {
1418
default: 400,
1519
type: Number

src/BaseCharts/Pie.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ import { mergeOptions } from '../helpers/options'
55
export default Vue.extend({
66
template: `
77
<div>
8-
<canvas id="pie-chart" width={{width}} height={{height}} v-el:canvas></canvas>
8+
<canvas id="{{chartId}}" width={{width}} height={{height}} v-el:canvas></canvas>
99
</div>
1010
`,
1111

1212
props: {
13+
chartId: {
14+
default: 'pie-chart',
15+
type: String
16+
},
1317
width: {
1418
default: 400,
1519
type: Number

src/BaseCharts/PolarArea.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ import { mergeOptions } from '../helpers/options'
55
export default Vue.extend({
66
template: `
77
<div>
8-
<canvas id="polar-chart" width={{width}} height={{height}} v-el:canvas></canvas>
8+
<canvas id="{{chartId}}" width={{width}} height={{height}} v-el:canvas></canvas>
99
</div>
1010
`,
1111

1212
props: {
13+
chartId: {
14+
default: 'polar-chart',
15+
type: String
16+
},
1317
width: {
1418
default: 400,
1519
type: Number

src/BaseCharts/Radar.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ import { mergeOptions } from '../helpers/options'
55
export default Vue.extend({
66
template: `
77
<div>
8-
<canvas id="radar-chart" width={{width}} height={{height}} v-el:canvas></canvas>
8+
<canvas id="{{chartId}}" width={{width}} height={{height}} v-el:canvas></canvas>
99
</div>
1010
`,
1111

1212
props: {
13+
chartId: {
14+
default: 'radar-chart',
15+
type: String
16+
},
1317
width: {
1418
default: 400,
1519
type: Number

0 commit comments

Comments
 (0)