gauge.js icon indicating copy to clipboard operation
gauge.js copied to clipboard

Line pointer rectangular

Open maverick42 opened this issue 7 years ago • 1 comments

Hi,

It is possible to have a line pointer like this ?

image

Best Fréderik

maverick42 avatar Mar 06 '17 03:03 maverick42

That's definitely doable. The GaugePointer class is responsible for drawing the pointer, and today it does that roughly like this:

  1. Draw circle of radius options.pointer.strokeWidth at the center.
  2. Make a rotated, filled rectangle from center+strokewidth to pointer length and back to center-strokewidth.

Right now the GaugePointer.render() function is hardcoded to do just that. One option could be to generalize this so user can supply their own optional rendering function. This is probably the most flexible alternative. Another approach is to extend the set of options gauge.js has today and let the user choose between different types of pointers (today's triangular shape, rectangular, or others). Personally, I would be in favor of the first approach, though.

kplindegaard avatar Apr 09 '17 10:04 kplindegaard