Skip to content

Instantly share code, notes, and snippets.

@apertureless
Last active February 5, 2018 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apertureless/bc973fe1b2ea7803a195a5d282ae1827 to your computer and use it in GitHub Desktop.
Save apertureless/bc973fe1b2ea7803a195a5d282ae1827 to your computer and use it in GitHub Desktop.
medium-api-vue-01
<script>
import { Line } from 'vue-chartjs'
export default {
extends: Line,
props: {
chartData: {
type: Array | Object,
required: false
},
chartLabels: {
type: Array,
required: true
}
},
data () {
return {
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
},
gridLines: {
display: true
}
}],
xAxes: [ {
gridLines: {
display: false
}
}]
},
legend: {
display: false
},
responsive: true,
maintainAspectRatio: false
}
}
},
mounted () {
this.renderChart({
labels: this.chartLabels,
datasets: [
{
label: 'downloads',
borderColor: '#249EBF',
pointBackgroundColor: 'white',
borderWidth: 1,
pointBorderColor: '#249EBF',
backgroundColor: 'transparent',
data: this.chartData
}
]
}, this.options)
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment