toorshia / justgage

JustGage is a handy JavaScript plugin for generating and animating nice & clean dashboard gauges. It is based on Raphaël library for vector drawing.
MIT License
1.82k stars 461 forks source link

Method Refresh doesn't work with Value zero. #359

Closed louagej closed 3 years ago

louagej commented 3 years ago

Hi,

When the Gauge has a minimum value different from 0 and you simply want to set the min value back to zero, it just seem to be ignored. I started from the example in the repository (docs\examples\refresh-minimum-maximum.html) and added an extra button to refresh the min value.

document.getElementById('g1_setmin0').addEventListener('click', function () {
                g1.refresh(g1.originalValue, 100, 0);
                return false;
            });

Watch the result below and you can see the min doesn't change. ezgif-3-a6a5d9baebd3

Is there another way to achieve the minimum value back to zero?

Regards, Job

robertsLando commented 3 years ago

@louagej Seems the problem is here: https://github.com/toorshia/justgage/blob/master/justgage.js#L842

This line should check if min/max are numbers, when min or max are 0 that will set them to null. WOuld you like to send a PR for that?

louagej commented 3 years ago

Hi @robertsLando, I just created a pull request. I hope I did the right thing, never created a pull request for this repo