Skip to content

Commit

Permalink
fix gauge for when value is above/below max/min
Browse files Browse the repository at this point in the history
  • Loading branch information
optama committed May 26, 2019
1 parent c27416b commit 48b42c6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dual-gauge-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class DualGaugeCard extends HTMLElement {
}

_calculateRotation(value, gaugeConfig) {
return (180 - (value - gaugeConfig.min) / (gaugeConfig.max - gaugeConfig.min) * -180) + 'deg';
const maxTurnValue = Math.min(Math.max(value, gaugeConfig.min), gaugeConfig.max);
return (180 + (5 * (maxTurnValue - gaugeConfig.min)) / (gaugeConfig.max - gaugeConfig.min) / 10 * 360) + 'deg';
}

_findColor(value, gaugeConfig) {
Expand Down

0 comments on commit 48b42c6

Please sign in to comment.