I have a strange issue with chart-js that whenever my page loads legend didn't show up but whenever I force refreshes the page using
ctrl+F5
legend show up.Legends perfectly worked on mozilla but not on chrome
function RefreshMediaTypeChart(fields, colorCodes, dataValues) {
var ctx = document.getElementById("chartuser");
ctx.height=160;
var data = {
labels:
fields,
datasets: [{
data: dataValues,
backgroundColor: colorCodes,
hoverBackgroundColor:colorCodes
}]
};
var canvasDoughnut = new Chart(ctx, {
type: 'doughnut',
tooltipFillColor: "rgba(51, 51, 51, 0.55)",
data: data,
otpions: {
legend:{
display:true
}
}
});
var legend =canvasDoughnut.generateLegend();
}
can someone figure it out why?