I have this graph with 2 series (NFe, CTe). The x-axis data is grouped by type.
However, one of these data has a much greater value than the others. Example: 17000 and the other 150.
Problem
I would like to click on the x-axis value (as the arrow points), and remove it from the graph or have some way that I can show and hide a specific series value as it exists to show and hide the entire series.
My Code
$.ajax({
url: '/Data',
type: 'GET',
success: function (data) {
$(data.dados).each(function (index, item) {
var labels = [];
var dadosNFe = [];
var dadosCTe = [];
$(data.dados).each(function (index, item) {
if (jQuery.inArray(item.Rotulo, rotulos) == -1) {
rotulos.push(item.Rotulo);
}
if (item.Grupo == "NFe") {
dadosNFe.push({ x: item.Rotulo, y: item.Valor });
}
if (item.Grupo == "CTe") {
dadosCTe.push({ x: item.Rotulo, y: item.Valor });
}
});
const chartTotal = document.getElementById('totalDocumentosSEFAZ').getContext('2d');
if (chart1) {
chart1.destroy();
}
chart1 = new Chart(chartTotal , {
type: tipo,
data: {
labels: rotulos,
datasets: [
{
label: 'NFe',
fill: false,
data: dadosNFe,
borderColor: '#6666FF',
backgroundColor: '#6666FF',
tension: 0.1
},
{
label: 'CTe',
fill: false,
data: dadosCTe,
borderColor: '#FF6666',
backgroundColor: '#FF6666'
}
]
}
});
});
}
});