Home forums Using CanvasJS Typescript converts CanvaJS.Chart to undefined when building

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26888

    I am trying to display a chart using TypeScript/Angular, using the following:

    
        var chart = new CanvasJS.Chart("chartContainer", {
          animationEnabled: true,
          zoomEnabled: true,
          title:{
            text: "Parity",
            fontFamily: "Roboto",
            fontSize: 36,
          },
          axisX: {
            title:"X Axis",
            titleFontSize: 20,
          },
          axisY:{
            title: "Y Axis",
            titleFontSize: 20,
          },
          data: [{
            type: "scatter",
            toolTipContent: "<b>X: </b>{x}<br/><b>Y: </b>{y}",
            dataPoints: [
              { x: 800, y: 350 },
              { x: 900, y: 450 },
              { x: 850, y: 450 },
              { x: 1250, y: 700 },
              { x: 1100, y: 650 }
            ]
          }]
        });

    After I build, the first line in the above code gets converted to this:

    var chart = new undefined("chartContainer", {

    How can I prevent CanvasJS.Chart from being converted to undefined? I am already importing the canvasjs.min file

    #26900

    @user12947,

    Please take a look at this sample project to integrate CanvasJS with Angular.

    In case you are still facing the issue, kindly share sample project reproducing the issue over google-drive or Onedrive so that we can run sample locally at our end, understand the scenario better and help you out.

    —-
    Manoj Mohan
    Team CanvasJS

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

You must be logged in to reply to this topic.