You must be logged in to post your query.
Home › Forums › Chart Support › not importing canvasjs in assets folder
import { Component, OnInit } from ‘@angular/core’; import * as CanvasJS from “src/assets/canvasjs.min.js”; //here not importing
@Component({ selector: ‘app-dash’, templateUrl: ‘./dash.component.html’, styleUrls: [‘./dash.component.css’] }) export class DashComponent implements OnInit {
constructor() { }
ngOnInit(): void { let chart = new CanvasJS.Chart(“chartContainer”, { animationEnabled: true, exportEnabled: true, title: { text: “Basic Column Chart in Angular” }, data: [{ type: “column”, dataPoints: [ { y: 71, label: “Apple” }, { y: 55, label: “Mango” }, { y: 50, label: “Orange” }, { y: 65, label: “Banana” }, { y: 95, label: “Pineapple” }, { y: 68, label: “Pears” }, { y: 28, label: “Grapes” }, { y: 34, label: “Lychee” }, { y: 14, label: “Jackfruit” } ] }] });
chart.render(); }
}
@nikhil41425,
Please follow the below steps to import CanvasJS in your Angular project.
1. Download the trial version of CanvasJS library package from the download page – https://canvasjs.com/download-html5-charting-graphing-library/?f=chart 2. Extract the files, and copy canvasjs.min.js. 3. Paste canvasjs.min.js in your angular_project/src/assets file.
In case you are still facing the issue please create a sample project reproducing the issue you are facing and share it with us over Google-Drive or Onedrive along with sample data so that we can look into your code, run it locally at our end, and help you out.
___________ Indranil Deo Team CanvasJS
You must be logged in to reply to this topic. Login/Register