Skip to content

Instantly share code, notes, and snippets.

@mercyikpe
Created October 10, 2019 13:23
Show Gist options
  • Save mercyikpe/d70e9a47b8dbc410ab81a439bc0001e9 to your computer and use it in GitHub Desktop.
Save mercyikpe/d70e9a47b8dbc410ab81a439bc0001e9 to your computer and use it in GitHub Desktop.
barChart Component
<template>
<div>
<canvas ref="canvas" width="900" height="400"></canvas>
</div>
</template>
<script>
// CommitChart.js
import { Bar } from 'vue-chartjs'
export default {
extends: Bar,
mounted () {
// Overwriting base render method with actual data.
this.renderChart({
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
datasets: [
{
label: 'GitHub Commits',
backgroundColor: '#f87979',
data: [40, 20, 12, 39, 10, 40, 39, 80, 40, 20, 12, 11]
}
]
})
}
}
</script>
<style scoped>
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment