I am woriking with ionic and try to building a simple pie with Chart.js. I have tried a lot of things but the pie never shows up.
Here is my code:
HTML:
<canvas id="myChart" width="400" height="400" />
JS:
var ctx = document.getElementById("myChart").getContext("2d");
console.log('ctx', ctx)
window.myDoughnut = new Chart(ctx).Doughnut(doughnutData, {responsive : true});
If you are using the Ionic Framework then you should also be using AngularJS. If that is so then you would need to include the dependency in your controller. I used ChartJS in my project very easily. Post your controller javascript code and I can help you setup. Take a look at this link first:
https://github.com/gonewandering/angles
You need to include the files in your index.html file first:
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.10/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.1-beta.2/Chart.min.js"></script>
<script src="angles.js"></script>
Then include "angles" as a dependency:
var app = angular.module("anglesExample", ["angles"]);
Everything else appears to be okay.
Best of luck!
I suggest you to use another chart generator, something like:
This was built to work with angular...as Ionic was.