Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gauge gets drawn incorrectly when a minimum is set #536

Closed
estiens opened this issue Sep 3, 2014 · 5 comments
Closed

Gauge gets drawn incorrectly when a minimum is set #536

estiens opened this issue Sep 3, 2014 · 5 comments
Labels
C-bug Category: This is a bug resolved maybe

Comments

@estiens
Copy link

estiens commented Sep 3, 2014

See this JSFiddle

http://jsfiddle.net/8o4mqjf4/

When a positive minimum value is set that is greater than 0, the gauge gets drawn in the middle of the arc, rather than using the minimum. ie; on a gauge set from 50-100. the only way to get the guage to start at the far left is to pass in a negative value.

@estiens
Copy link
Author

estiens commented Sep 3, 2014

As an addendum, it appears to be a bug as a positive minimum and a negative minimum both do the same thing. Somehow it appears to be taking the absolute value of the minimum, applying a negative sign to it, and setting that as a minimum. Works fine for negative minimums, doesn't work correctly for positive minimums

@estiens
Copy link
Author

estiens commented Sep 3, 2014

something in this code I believe

if ($$.isGaugeType(d.data)) {
    var gMin = config.gauge_min, gMax = config.gauge_max,
        gF = Math.abs(gMin) + gMax,
        aTic = (Math.PI) / gF;
    d.startAngle = (-1 * (Math.PI / 2)) + (aTic * Math.abs(gMin));
    d.endAngle = d.startAngle + (aTic * ((d.value > gMax) ? gMax : d.value));
}
return found ? d : null;

};

@estiens
Copy link
Author

estiens commented Sep 3, 2014

this works correctly for POSITIVE values of gMin

    if ($$.isGaugeType(d.data)) {
        var gMin = config.gauge_min, gMax = config.gauge_max,
            gF = gMax - gMin,
            aTic = (Math.PI) / gF;
        d.startAngle = (-1 * (Math.PI / 2));
        d.endAngle = d.startAngle + (aTic * ((d.value > gMax) ? gMax : d.value - gMin));
    }
    return found ? d : null;
};

masayuki0812 added a commit that referenced this issue Sep 20, 2014
@masayuki0812
Copy link
Member

Hi, Thank you for your reporting. You're right and it's a bug. And I think it has been fixed by the commit above like this fiddle: http://jsfiddle.net/7kYJu/308/
Could you try the latest code again? Thanks.

@masayuki0812 masayuki0812 added C-bug Category: This is a bug resolved maybe labels Sep 20, 2014
@masayuki0812
Copy link
Member

It's been released in v0.4.0, so please let me close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug resolved maybe
Projects
None yet
Development

No branches or pull requests

2 participants