forked from apertureless/vue-chartjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca1d884
commit 39de419
Showing
5 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import Vue from 'vue' | ||
import Chart from 'chart.js' | ||
|
||
export default Vue.extend({ | ||
template: ` | ||
<div> | ||
<canvas id="polar-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: 'polarArea', | ||
data: data, | ||
options: options | ||
} | ||
) | ||
chart.generateLegend() | ||
} | ||
} | ||
}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import PolarAreaChart from '../BaseCharts/PolarArea' | ||
|
||
export default PolarAreaChart.extend({ | ||
ready () { | ||
this.render({ | ||
labels: ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running'], | ||
datasets: [ | ||
{ | ||
label: 'My First dataset', | ||
backgroundColor: 'rgba(179,181,198,0.2)', | ||
pointBackgroundColor: 'rgba(179,181,198,1)', | ||
pointBorderColor: '#fff', | ||
pointHoverBackgroundColor: '#fff', | ||
pointHoverBorderColor: 'rgba(179,181,198,1)', | ||
data: [65, 59, 90, 81, 56, 55, 40] | ||
}, | ||
{ | ||
label: 'My Second dataset', | ||
backgroundColor: 'rgba(255,99,132,0.2)', | ||
pointBackgroundColor: 'rgba(255,99,132,1)', | ||
pointBorderColor: '#fff', | ||
pointHoverBackgroundColor: '#fff', | ||
pointHoverBorderColor: 'rgba(255,99,132,1)', | ||
data: [28, 48, 40, 19, 96, 27, 100] | ||
} | ||
] | ||
}) | ||
} | ||
}) |