-
Notifications
You must be signed in to change notification settings - Fork 12k
Closed
Labels
Milestone
Description
Expected Behavior
I want to display a bar chart of 158 values,
Current Behavior
But a cut occurs at 110.
Possible Solution
Steps to Reproduce
<template>
<div>
<canvas id="myChart"></canvas>
</div>
</template>
<script>
import { Chart, registerables } from 'chart.js3'
import ChartJsPluginDataLabels from 'chartjs-plugin-datalabels';
export default {
props: ['items'],
mounted() {
var ctx = document.getElementById('myChart');
const dataGraph = {
labels: this.items.map(item => item['date']),
datasets: [
{
data: this.items.map(item => item['actual'] || item['forecast'] || 0),
backgroundColor: '#698ED1'
}
]
};
const optionsGraph = {
maintainAspectRatio: false,
animation: {
duration: 0
},
legend: {
display: false,
},
scales: {
x: {
grid: {
color: '#000'
}
},
y: {
ticks: {
display: false
},
grid: {
color: function(context) {
return '#000';
}
}
}
},
// plugins: {
// datalabels: {
// color: '#768CB7',
// font: {
// family: 'Roboto',
// size: '11',
// weight: '700'
// },
// anchor: 'end',
// align: 'top',
// textAlign: 'center',
// offset: '-3',
// }
// }
};
Chart.register(...registerables);
//Chart.register(ChartJsPluginDataLabels);
var myChart = new Chart(ctx, {
type: 'bar',
data: dataGraph,
options: optionsGraph
});
}
}
</script>
Context
I tried the same with the second version but got the same error.
When I use ChartJsPluginDataLabels, I have error: Cannot read property 'skip' of undefined
Environment
- Chart.js version: 3.5.1
- Browser name and version: Chrome
- Demo - https://codesandbox.io/s/broken-star-1yyjf?file=/pages/index.vue
