Skip to content

Commit

Permalink
Improved light level formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
kallaspriit committed Aug 12, 2016
1 parent 0cb447d commit 2ac4726
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions views/components/GaugeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class GaugeComponent extends Component {
}) {
const chart = this.chart.getChart();

chart.series[0].points[0].update(value);
chart.series[0].points[0].update(this.formatValue(value));
}

shouldComponentUpdate() {
Expand Down Expand Up @@ -114,7 +114,7 @@ export default class GaugeComponent extends Component {

series: [{
name: title,
data: [value],
data: [this.formatValue(value)],
dataLabels: {
format: `<div class="gauge-value-wrap">
<span class="gauge-value-number">{y}</span><br/>
Expand All @@ -135,4 +135,8 @@ export default class GaugeComponent extends Component {
);
}

formatValue(value) {
return Math.round(value * 10) / 10;
}

}

0 comments on commit 2ac4726

Please sign in to comment.