Last active
February 5, 2018 14:18
-
-
Save apertureless/bc973fe1b2ea7803a195a5d282ae1827 to your computer and use it in GitHub Desktop.
medium-api-vue-01
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
<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