javascript - Chart.js ignoring canvas height & width -


following chart.js documentation trying draw small chart:

<canvas id="mychart" width="400" height="400"></canvas> <script> var ctx = document.getelementbyid("mychart"); var mychart = new chart(ctx, {   type: 'line',   data: {     labels:['15-2016','16-2016','17-2016',],     datasets:[       {         label:'yes',         data:[3.4884,1.1628,1.3514,],         backgroundcolor:'rgba(75,192,192,1)',         bordercolor:'rgba(75,192,192,1)',         pointradius:0       },       {         label:'maybe',         data:[0.5571,1.3298,0.791,],         backgroundcolor:'rgba(255,206,86,1)',         bordercolor:'rgba(255,206,86,1)',         pointradius:0       },       {         label:'no',         data:[0,0,0,],         backgroundcolor:'rgba(255,99,132,1)',         bordercolor:'rgba(255,99,132,1)',         pointradius:0       }     ]   }         }); </script> 

however, when page rendered canvas somehow becomes

<canvas style="height: 929px; width: 929px;" id="mychart" width="1858" height="1858"></canvas> 

which waaaaay big needs. how can set width , height of canvas want?

i able hardcode size of graph turning off responsiveness:

options: {   responsive: false } 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo