Skip to content

Commit

Permalink
Fix error when only one state history entry. (home-assistant#1750)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeradM authored and zsarnett committed Oct 14, 2018
1 parent 96e5589 commit 5d5871f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/panels/lovelace/cards/hui-sensor-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ class HuiSensorCard extends EventsMixin(LitElement) {
const min = Math.floor(Math.min.apply(null, values) * 0.95);
const max = Math.ceil(Math.max.apply(null, values) * 1.05);

if (values.length === 1) values.push(values[0]);

const yRatio = (max - min) / height;
const xRatio = width / (values.length - 1);

Expand Down

0 comments on commit 5d5871f

Please sign in to comment.