refactor(charts): add CustomTooltips, add chartId prop

This commit is contained in:
xidedix
2018-05-25 17:47:07 +02:00
parent 4aa02846e3
commit c4d5ff886c
16 changed files with 371 additions and 229 deletions
+39 -32
View File
@@ -1,46 +1,53 @@
<script>
import { Line } from 'vue-chartjs'
const datasets = [
{
label: 'My First dataset',
backgroundColor: 'rgba(255,255,255,.2)',
borderColor: 'rgba(255,255,255,.55)',
data: [78, 81, 80, 45, 34, 12, 40]
}
]
import { CustomTooltips } from '@coreui/coreui-plugin-chartjs-custom-tooltips'
export default {
extends: Line,
props: ['height', 'width'],
mounted () {
this.renderChart({
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: datasets
}, {
maintainAspectRatio: false,
legend: {
display: false
const datasets3 = [
{
label: 'My First dataset',
backgroundColor: 'rgba(255,255,255,.2)',
borderColor: 'rgba(255,255,255,.55)',
data: [78, 81, 80, 45, 34, 12, 40]
}
]
this.renderChart(
{
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: datasets3
},
scales: {
xAxes: [{
display: false
}],
yAxes: [{
display: false
}]
},
elements: {
line: {
borderWidth: 2
{
tooltips: {
enabled: false,
custom: CustomTooltips
},
point: {
radius: 0,
hitRadius: 10,
hoverRadius: 4
maintainAspectRatio: false,
legend: {
display: false
},
scales: {
xAxes: [{
display: false
}],
yAxes: [{
display: false
}]
},
elements: {
line: {
borderWidth: 2
},
point: {
radius: 0,
hitRadius: 10,
hoverRadius: 4
}
}
}
})
)
}
}
</script>