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 1 year, 6 months ago.

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



    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.


    Sunil Urs


    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.

    Sunil Urs

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

You must be logged in to reply to this topic.