Home › forums › Using CanvasJS › Drawing a graph on a pre-existing canvas
This topic contains 1 reply, has 2 voices, and was last updated by Sunil Urs 4 years, 5 months ago.
I was wondering if was possible to draw a graph on a pre-existing canvas. From the docs I’ve seen, you’re not required to specify a canvas element beforehand. I’m making an application that runs a simulation on canvas and then shows the results, and I would prefer to have those results appear in the same area.
As of now it requires a div element inside which the chart is rendered. This is because chart includes various other DOM elements like menu button, etc.
I would suggest rendering chart inside a hidden div element and then copying the content of chart into your canvas using drawImage method.
You must be logged in to reply to this topic.