K
K
Kirill Khalitov2015-03-25 17:05:48
JavaScript
Kirill Khalitov, 2015-03-25 17:05:48

What are the most preferred practices for building an interactive canvas?

Hello. I'm using the Canvas Web API to create a bar chart widget.
I analyzed this example through ChromeDevTools.
Basically, the device understood, the only question left is how is the clickable legend implemented, through the canvas context, by calling the functions of the CanvasRenderingContext2D object, or by overlaying HTML elements like "div" and "g"?
In general, what are the most preferred practices for building an interactive canvas?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SnowElephant, 2015-04-08
@Voronar

  • Check manually if the cursor is inside the rectangle.
  • Canvas Hit Regions, which is currently flagged in Chrome and Firefox.
  • But SVG is the best for this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question