Home › forums › Using CanvasJS › How can i get access to a canvasJS chart through a DOM-Container
This topic contains 6 replies, has 5 voices, and was last updated by vipinrana 5 hours ago.
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.
You can get access to the chart object using $("#container").CanvasJS().
It is not workin @sanjoy
$("#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.
See this link jsfiddle
See the console. It says $(…).CanvasJS is not a function
Please use var c = $("#chartContainer").CanvasJSChart();. Also take a look at this updated jsfiddle.
var c = $("#chartContainer").CanvasJSChart();
I have used your described code but still not not working. Using the same canvasjs.min.js library you provide.
You must be logged in to reply to this topic.