This distribution extending Chart.js capability by adding responsive feature. Whole tribute and source of Chart.js can be download and update on its origin repository + documentation
i'am wrap this feature in file chartjs-option.js through function
respChart(selector,data)
-
Import Chart.js source at the first place. i recomended the head.js power to doing this
-
Import chartjs-option.js after step 1 declaration and make sure that this part only be execute after Chart.js ready.
-
Create a canvas and make sure it has container.
... <canvas class="myChart" width="800" ></canvas> ...
-
Prepare your data
<script> ... var data = { labels : ["January","February","March","April","May","June","July"], datasets : [ { fillColor : "rgba(151,187,205,0.5)", strokeColor : "rgba(151,187,205,1)", pointColor : "rgba(151,187,205,1)", pointStrokeColor : "#fff", data : [28,48,40,19,96,27,100] } ] }; ...
-
Call the extended function
respChart($(".myChart"),data);
-
Enjoy your responsive chart