javascript - Chart.js unable to display data -


i have here code of chart, trying display chart getting values on label function (the output of function var label3, if use label3 labels on chart not work, if use format label2 work. question how can make label3 format of label2?

var ctx = document.getelementbyid('mychart').getcontext('2d');  var label2 = ['28 dec','29 dec','30 dec']; var label3 = '28 dec,29 dec,30 dec';  var data1 = '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0';  var linechartdata = {     labels: label2,     datasets: [{         label: ' no. of clicks',         backgroundcolor: "lightblue",         data: data1     }] } var mychart = new chart(ctx, {       type: 'line',       data: linechartdata  }); 

i have made code check here

there small mistake made, data variable should array. this.

var data1 = [10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; 

Comments

Popular posts from this blog

4x4 Matrix in Python -

python - String indices must be integers and while issue -

python - PyInstaller UAC not working in onefile mode -