I'm trying to solve a problem with my web page. Here is some information about it:
app.controller('GraphCtrl', function ($scope) {
$scope.changeGraph = function () {
$('#graphs').empty();
$scope.init($scope.graphType)
}
$scope.init = function (type) {
$.getJSON('/data/data4.json', function (json) {
Morris[type]({
pointSize: 2,
element: 'graphs',
data: json,
xkey: 'y',
ykeys: ['a','b','c', 'd', 'e'],
ymax: 345,
gridTextColor: ['black'],
gridTextSize: 14,
//legendTextSize: [50],
//legend: { fontSize: [30]},
//legend:{fontSize: 20},
lineColors:['red','green','purple','orange','blue'],
labels: ['CPU (% utilização)', 'Memória (% utilização)', 'Power (W)', 'CPU Temp0 (ºC)', 'CPU Temp1 (ºC)']
});
}); } });
What I'm trying to do to use chartjs looks like this:
$scope.init = function (type) {
$.getJSON('/data/data4.json', function (json) {
var ctx = document.getElementById(["graphs"]).GetContext("2d");
var graphs = new Chart(ctx)[type](data, options); }); } });
But I think there's something wrong, because it's not working. I am now learning to work with web programming. If someone can help me thank you