README.md in chartjs-ror-2.1.3 vs README.md in chartjs-ror-2.2.0

- old
+ new

@@ -1,19 +1,18 @@ # chartjs-ror Simplifies using [Chart.js][] in Rails views. * All of Chart.js's features via one line of Ruby. -* Renders charts on page load rather than DOMContentReady ([reason][browsersupport]). * Animates unless you have Modernizr and it doesn't detect canvas support ([reason][browsersupport]). You can manually override this. * Optional alternative abscissa scale calculations (see [Chart.js#132][calculations]). * Optional utility method for filling in gaps in integer series. ## Current Chart.js version -This gem includes [Chart.js v1.0.1](https://github.com/nnnick/Chart.js/tree/v1.0.1). +This gem includes [Chart.js v1.0.2](https://github.com/nnnick/Chart.js/tree/v1.0.2). ## Installation Add this line to your application's Gemfile: @@ -163,16 +162,19 @@ var legend = chart.generateLegend(); var legendHolder = document.createElement("div"); legendHolder.innerHTML = legend; canvas.parentNode.insertBefore(legendHolder.firstChild, canvas.nextSibling); }; - if (window.addEventListener) { - window.addEventListener("load", initChart, false); - document.addEventListener("page:load", initChart, false); + if (typeof Chart !== "undefined" && Chart !== null) { + initChart(); } - else if (window.attachEvent) { - window.attachEvent("onload", initChart); - document.attachEvent("page:load", initChart); + else { + if (window.addEventListener) { + window.addEventListener("load", initChart, false); + } + else if (window.attachEvent) { + window.attachEvent("onload", initChart); + } } })(); </script> ```