Add Radar Chart component

This commit is contained in:
Jakub Juszczak
2016-07-03 10:31:35 +02:00
parent 65251700d7
commit ca1d884074
5 changed files with 84 additions and 6 deletions

View File

@@ -0,0 +1,41 @@
import Vue from 'vue'
import Chart from 'chart.js'
export default Vue.extend({
template: `
<div>
<canvas id="radar-chart" width=width height=height v-el:canvas></canvas>
</div>
`,
props: {
width: {
default: 400,
type: Number
},
height: {
default: 400,
type: Number
}
},
data () {
return {
options: {
}
}
},
methods: {
render (data, options = this.options) {
const chart = new Chart(
this.$els.canvas.getContext('2d'), {
type: 'radar',
data: data,
options: options
}
)
chart.generateLegend()
}
}
})