Chartjs-Chart.js addData breaks function v1.0.2

0๐Ÿ‘

โœ…

I misunderstood how the addData function worked.

My drawSegmentValues uses an external array rather than an array that is used by chart.js itself.

When addData increased the length of myChart.segments, the data array did not increase and thus there was no index in data at mychart.segments max index.

I changed my adding of the data to include an array.push so both arrays are updated and kept aligned.

Data.push({value: 500, color:"#F7464A", url:"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/d8/d85a3b326846fa2b0f6e59acdbaa0cfef307bd87_full.jpg"});
myChart.addData({value: 500, color:"#F7464A", url:"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/d8/d85a3b326846fa2b0f6e59acdbaa0cfef307bd87_full.jpg"});

Leave a comment