Home Forums Chart Support How can i get access to a canvasJS chart through a DOM-Container

How can i get access to a canvasJS chart through a DOM-Container

Viewing 15 posts - 1 through 15 (of 17 total)
  • #17327

    When i render a canvasJS-chart to a div container, how can i get access to the chart object through the div-Container? i dont want to make the chart variable global.

    I want to use it as: var chart=$(“#container”).canvasJS();

    Ayny ideas please.

    #17347

    @donwey,

    You can get access to the chart object using $("#container").CanvasJS().

    ——-
    Sanjoy Debnath,
    Team CanvasJS

    • This reply was modified 6 years, 8 months ago by Vishwas R.
    #19796

    It is not workin @Sanjoy

    #19810

    @merajahmed,

    $("#container").CanvasJS() will work with jQuery Charts. In case you have some other requirement please create a jsfiddle so that we can understand your requirement better and help you out.

    ___________
    Indranil Deo,
    Team CanvasJS

    #19811

    See this link jsfiddle
    See the console. It says $(…).CanvasJS is not a function

    #19812

    @merajahmed,

    Please use var c = $("#chartContainer").CanvasJSChart();. Also take a look at this updated jsfiddle.

    And please use the jQuery plugin (https://cdn.canvasjs.com/jquery.canvasjs.min.js) instead of Javascript.

    ___________
    Indranil Deo,
    Team CanvasJS

    #20451

    @Indranil Deo,

    I have used your described code but still not not working. Using the same canvasjs.min.js library you provide.

    #20454

    @vipinrana,

    Since you are using the jQuery selector var c = $("#chartContainer").CanvasJSChart();, please use the jQuery plugin (https://cdn.canvasjs.com/jquery.canvasjs.min.js) instead of Javascript.

    ___________
    Indranil Deo,
    Team CanvasJS

    #32371

    Same thing I would like to access with the angular js version of canvas js library I would like to access the CanvasJS object from DOM elmenet using angular js.

    #32386

    @darshanjain,

    It’s not possible to access chart based on the DOM element in angular. However if you are using jQuery plugin, you can do so using jQuery selector var c = $("#chartContainer").CanvasJSChart();.

    ___________
    Indranil Deo
    Team CanvasJS

    #32388

    @Indranil,
    Then what is the other way to do it in angular with (canvas.min.js)?

    #32419

    @darshanjain,

    It’s not possible to access chart based on the DOM element in angular, as of now.

    ___________
    Indranil Deo
    Team CanvasJS

    #32424

    @Indranil Deo
    How to create feature request for it(to access chart based on the DOM element in angular)?
    and what is best way to track the progress on it?

    #32443

    Hello guys any update on
    How to create feature request for it(to access chart based on the DOM element in angular)?

    #32446

    @rupeshelimu2021,

    You can use CanvasJS jQuery plugin in Angular to access the chart based on DOM element. Please download this sample project for an example.

    ___________
    Indranil Deo
    Team CanvasJS

Viewing 15 posts - 1 through 15 (of 17 total)

You must be logged in to reply to this topic.