i am trying to truncating the x-axis label in chart.js but i m getting error(value.substr is not a function) and don't know how to solve this. i also used getLabelForValue function but still getting error... anybody can help me? here is my code
const gridConfig = {
display: false,
borderWidth: 0,
}
const xAxis = {
barPercentage: 0.4,
ticks: {
callback:function(value){
return value.substr(0,6)
},
color: '#313640',
padding: 9,
font: {
size: 12,
weight: 600
}
},
grid:gridConfig,
};
const timeManagmentData = {
labels: MeetingsAdjusted,
datasets: [{
barThickness: 10,
borderRadius: 100,
backgroundColor: gradientBg2,
borderColor: gradientBg2,
label: 'Meetings Score',
data: avgAnswerFeedback,
}]
}
const timeManagmentConfig = {
type: 'bar',
data: timeManagmentData,
options: {
scales: {
y: {
ticks: yAxisTicks_stepSize20,
grid:gridConfig
},
x: xAxis,
},
plugins: {
tooltip,
legend,
},
animation,
},
}
const myChart = new Chart(
ctx3,
timeManagmentConfig,
);