javascript - ChartJS: horizontalBar Label Error -
i'm error on horizontalbar chart. when mouse hover on bar, should show me label name , value of bar. in chart shows label , label, without value.
here pic: https://i.stack.imgur.com/ngnpm.jpg should show me : "top 10 clientes , 2400 below"
this totally static code, here is:
var gerargraficodebarrashorizontal = function (name, labels, components){ var mychart = new chart(name, { type: 'horizontalbar', data: { labels: labels, datasets: components }, options: optionssemlegenda }); } // object clarify chart creation var barrashorizontal = [{ data: [2500, 5000], backgroundcolor: ['rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)'], bordercolor: ['rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)'], borderwidth: 1 }]; // create chart gerargraficodebarrashorizontal('topdezclientesxfaturamentototal', ["top 10 clientes", "faturamento total"], barrashorizontal);
thanks lot!!
@edit #1
var optionssemlegenda = new object(); optionssemlegenda = { scales: { yaxes: [{ ticks: { beginatzero: true } }], xaxes: [{ ticks: { beginatzero: true } }] }, legend: { display: false }, tooltips: { callbacks: { label: function (tooltipitem) { return tooltipitem.ylabel; } } } }
Comments
Post a Comment