Home Forums Chart Support ReferenceError: CanvasJS is not defined

ReferenceError: CanvasJS is not defined

Viewing 2 posts - 1 through 2 (of 2 total)
  • #24862

    Hi,

    I’m using canvasJs in my angularjs project (v 1.5), but its not working, please help any one to fix the issue.

    #24864

    @karthicksivan,

    You can integrate CanvasJS with AngularJS by rendering the chart inside a controller as shown in the code snippet below –

    myapp.controller("adminDashboardController", ["$scope",function($scope){
      var dps = [{x: 1, y: 10}, {x: 2, y: 13}, {x: 3, y: 18}, {x: 4, y: 20}, {x: 5, y: 17},{x: 6, y: 10}, {x: 7, y: 13}, {x: 8, y: 18}, {x: 9, y: 20}, {x: 10, y: 17}];
      var chartOptions ={  
        title: {
        	text: "Line Chart in AngularJS v1"
        },         
        data: [{
          type: "line",
          dataPoints : dps
        }]
      };
      var chart = new CanvasJS.Chart("chartContainer", chartOptions);
      chart.render(); 
    }]);

    Please take a look at this JSFiddle for an example.

    line chart in AngularJS v1

    ___________
    Indranil Deo
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.