Skip to content

Commit

Permalink
Merge pull request Mikhus#43 from migeruhito/needle-bug
Browse files Browse the repository at this point in the history
Correct needle placement when minimun value in nonzero
  • Loading branch information
Mikhus committed Mar 23, 2016
2 parents 6fa466b + 7928b64 commit 18d00ba
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions gauge.js
Original file line number Diff line number Diff line change
Expand Up @@ -818,18 +818,10 @@ var Gauge = function (config) {

ctx.save();

if (fromValue < 0) {
fromValue = Math.abs(config.minValue - fromValue);
} else if (config.minValue > 0) {
fromValue -= config.minValue
} else {
fromValue = Math.abs(config.minValue) + fromValue;
}

ctx.rotate(
radians(
config.startAngle + fromValue /
((config.maxValue - config.minValue) / config.ticksAngle)
config.startAngle + (fromValue-config.minValue) /
(config.maxValue - config.minValue) * config.ticksAngle
)
);

Expand Down

0 comments on commit 18d00ba

Please sign in to comment.