From 1f3ac41fe11ec577d15e82eb67210e543945c875 Mon Sep 17 00:00:00 2001 From: Jon Ziebell Date: Sun, 23 Feb 2020 05:37:04 -0500 Subject: [PATCH] Fixed latent issue related to #244 --- js/beestat/runtime_sensor.js | 5 +--- .../chart/runtime_sensor_detail_occupancy.js | 23 ++++++++++++------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/js/beestat/runtime_sensor.js b/js/beestat/runtime_sensor.js index 04aeac8..971afb6 100644 --- a/js/beestat/runtime_sensor.js +++ b/js/beestat/runtime_sensor.js @@ -94,10 +94,7 @@ beestat.runtime_sensor.get_data = function(thermostat_id, range) { // Loop. var current_m = begin_m; - while ( - // beestat.cache.runtime_sensor.length > 0 && - current_m.isSameOrAfter(end_m) === false - ) { + while (current_m.isSameOrAfter(end_m) === false) { data.x.push(current_m.clone()); // Without this series the chart will jump to the nearest value if there is a chunk of missing data. diff --git a/js/component/chart/runtime_sensor_detail_occupancy.js b/js/component/chart/runtime_sensor_detail_occupancy.js index 8d86d48..5e2fb99 100644 --- a/js/component/chart/runtime_sensor_detail_occupancy.js +++ b/js/component/chart/runtime_sensor_detail_occupancy.js @@ -57,6 +57,21 @@ beestat.component.chart.runtime_sensor_detail_occupancy.prototype.get_options_se beestat.style.color.lightblue.dark ]; + /** + * This chart does not need the entire dummy series, but it does need the + * first series to have *some* non-null data or Highcharts does not find a + * valid point to reference when trying to sync the crosshair between + * series. The easiest way to fix that seems to be throwing a mostly-empty + * series up top. + */ + series.push({ + 'name': '', + 'data': [0], + 'yAxis': 0, + 'type': 'line', + 'lineWidth': 0 + }); + // Sensors this.data_.metadata.sensors.forEach(function(sensor, i) { series.push({ @@ -71,14 +86,6 @@ beestat.component.chart.runtime_sensor_detail_occupancy.prototype.get_options_se }); }); - series.push({ - 'name': '', - 'data': self.data_.series.dummy, - 'yAxis': 0, - 'type': 'line', - 'lineWidth': 0 - }); - return series; };