After updating the Blazing Charts plugin with the latest version of Chart.js, 2.2.2, I had to update these snippets. This is because everything is changed with that charting library.
If you are going to use the new version of Chart.js, be prepared to rewrite your scripts.
To draw two or more charts in one page, we have to consider a few points:
- Javascript window.onload can be used only once. So if you want to run the scripts inside this function, you can collect all the scripts in one “chart snippet” and run it inside that function. Then introduce the chart divs for those charts in other chart snippets, and place it whenever the chart should goes.
- Or you can use jQuery(document).ready(function() {…}); for each snippet
- All the chart snippets will be included in one page. So if you repeat the same variable name in another snippet, it will override the last value you assigned to it. I recommend to use unique variable names in each snippet.
- DIV id that you introduce to each script to draw a chart on, should be unique.
Continue reading Chart.js Sample: Two Doughnut Charts