Browse Source

null when battery is unknown makes the line break instead of jump to -1

pull/5/head
Aaron Parecki 8 years ago
parent
commit
bd32a8930d
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      compass/public/assets/battery.js

+ 6
- 6
compass/public/assets/battery.js View File

@ -5,12 +5,12 @@ function pointFromGeoJSON(geo) {
}
function showBatteryGraph(response) {
var data = response.linestring;
var batteryStateBands = [];
var buckets = data.properties.map(function(d){return d.battery_state}).findRanges();
for(var i in buckets) {
for(var j=0; j<buckets[i].length; j++) {
switch(i) {
@ -32,7 +32,7 @@ function showBatteryGraph(response) {
batteryStateBands.push(buckets[i][j]);
}
}
$('#battery-chart').highcharts({
chart: {
height: 160,
@ -94,8 +94,8 @@ function showBatteryGraph(response) {
yAxis: 0,
data: data.properties.map(function(d,i){
return {
x: new Date(d.unixtime*1000), // i,
y: ('battery_level' in d ? Math.round(d.battery_level * 100) : -1),
x: new Date(d.unixtime*1000), // i,
y: ('battery_level' in d ? Math.round(d.battery_level * 100) : null),
state: d.battery_state,
location: data.coordinates[i]
}

Loading…
Cancel
Save