bernii / gauge.js

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

Add support for static zones #81

Closed rsreimer closed 7 years ago

rsreimer commented 9 years ago

I have a customer who required static zones on the gauge as shown below: gauge

I have added this feature and made it configurable with the staticZones option:

var gauge = new Gauge(canvas)
    .setOptions({
        staticZones: [
            {strokeStyle: "#30B32D", span: 2/3}, // Green
            {strokeStyle: "#FFDD00", span: 1/6}, // Yellow
            {strokeStyle: "#F03E3E", span: 1/6}  // Red
        ]});

The order of the array matters as the zones are added from left to right. The sum of all spans should be 1.

sondrele commented 9 years ago

Awesome, was looking after the same thing.

+1 for this

eblancart commented 8 years ago

I was looking for that as well ! Perfect !

bernii commented 8 years ago

That's awesome. @rsreimer I've given you push access to the repo. Do you mind merging?

kplindegaard commented 7 years ago

@rsreimer: I was very inspired by what you had done and used your fork in a small project together with a couple of other modifications. The net result of that is in the recent commit 364a42b7efaad94bc36de9196155e12c69886074.

Unfortunately and due to my lack of GitHub skills this pull request is now redundant. I propose to close this. Sorry about that, but thanks a bunch and kudos to you for your contibution.

kplindegaard commented 7 years ago

@rsreimer I am closing your pull request. Sorry that I messed up. Your code still lives on, though :+1: