Как убрать заголовки значений графика chart.js.
const DATA_COUNT = 10;
const NUMBER_CFG = {count: DATA_COUNT, min: 0, max: 100};
const data = {
labels: Utils.months({count: DATA_COUNT}),
datasets: [{
label: 'Dataset 1',
borderColor: Utils.randomColor(0.7),
backgroundColor: Utils.randomColor(0.5),
data: Utils.numbers(NUMBER_CFG),
}, {
label: 'Dataset 2',
borderColor: Utils.randomColor(0.7),
backgroundColor: Utils.randomColor(0.5),
data: Utils.numbers(NUMBER_CFG),
}, {
label: 'Dataset 3',
borderColor: Utils.randomColor(0.7),
backgroundColor: Utils.randomColor(0.5),
data: Utils.numbers(NUMBER_CFG),
}]
};
const scaleOpts = {
grid: {
borderColor: Utils.randomColor(1),
color: 'rgba( 0, 0, 0, 0.1)',
},
title: {
display: false,
text: (ctx) => ctx.scale.axis + ' axis',
}
};
const scales = {
x: {
type: 'category',
min: 5,
max: 11,
},
y: {
type: 'linear',
max: 100,
ticks: {
callback: function(value){return value+ "%"}
},
},
};
Object.keys(scales).forEach(scale => Object.assign(scales[scale], scaleOpts));
const zoomOptions = {
pan: {
enabled: true,
mode: 'x',
threshold: 5,
},
zoom: {
wheel: {
enabled: true,
},
pinch: {
enabled: true
},
mode: 'x',
}
}
new Chart(document.getElementById("bar-chart-grouped"), {
type: 'bar',
data: {
labels: ['август','сентябрь','октябрь','ноябрь','декабрь','январь','февраль','март','апрель','май','июнь','июль','август','сентябрь'],
datasets: [
{
label: 'Продажи наличные',
backgroundColor: "#F88587",
data: [51,36,74,37,73,37,75,37,37,27,75,27,71,47],
barPercentage: .8,
categoryPercentage: .3,
}, {
label: 'Продажи безнал',
backgroundColor: "#5BADAB",
data: [71,31,77,26,83,93,27,83,94,26,38,72,45,84],
barPercentage: .8,
categoryPercentage: .3,
},
]
},
options: {
responsive: true,
maintainAspectRatio: false,
title: {
display: true,
text: 'Population growth (millions)'
},
scales: scales,
plugins: {
zoom: zoomOptions
},
animations: {
tension: {
duration: 1000,
easing: 'easeInBack',
from: 1,
to: 0,
loop: true
}
},
animation: true
},
});
const actions = [
{
name: 'Reset zoom',
handler(chart) {
chart.resetZoom();
}
}
];