bernii / gauge.js

100% native and cool looking JavaScript gauge
MIT License
1.42k stars 391 forks source link

Configuration option for rotating gauge? #222

Open jdgamble opened 4 years ago

jdgamble commented 4 years ago

I like the capabilities of gauge.js and would like to use it in my application. However, I would like to be able to rotate the canvas element at an arbitrary angle prior to creating the gauge, so I can create top/bottom or left/right style gauges. Unfortunately, just calling the rotate() method on the canvas context prior to instantiating the new Gauge does not seem to work. Are there any additional configuration options to accomplish this or examples you could share on how to do this?

wposner commented 4 years ago

Add a transform to your canvas <canvas style="transform: rotate(' + this.getProperty("GaugeRotation") + 'deg);'">