1
0
mirror of https://github.com/beestat/app.git synced 2025-07-09 03:04:07 -04:00

Fixed #253 - Add comfort profile to Sensor Detail tooltip

This commit is contained in:
Jon Ziebell 2020-02-22 12:11:59 -05:00
parent f59fee7827
commit a84417b8d4

View File

@ -165,7 +165,10 @@ beestat.component.chart.runtime_sensor_detail_temperature.prototype.get_options_
var x = this.x; var x = this.x;
var sections = []; var sections = [];
var group = []; var groups = {
'mode': [],
'data': []
};
var visible_series = []; var visible_series = [];
self.get_chart().series.forEach(function(series) { self.get_chart().series.forEach(function(series) {
@ -191,6 +194,31 @@ beestat.component.chart.runtime_sensor_detail_temperature.prototype.get_options_
} }
}); });
// Add some other stuff.
[
'calendar_event_smartrecovery',
'calendar_event_home',
'calendar_event_away',
'calendar_event_sleep',
'calendar_event_smarthome',
'calendar_event_smartaway',
'calendar_event_hold',
'calendar_event_vacation',
'calendar_event_quicksave',
'calendar_event_other',
'calendar_event_custom'
].forEach(function(series_code) {
if (
self.data_.metadata.series[series_code].data[x.valueOf()] !== undefined
) {
points.push({
'series_code': series_code,
'value': self.data_.metadata.series[series_code].data[x.valueOf()],
'color': beestat.series[series_code].color
});
}
});
var occupancy = {}; var occupancy = {};
self.get_chart().series.forEach(function(series) { self.get_chart().series.forEach(function(series) {
if (series.name.substring(0, 12) === 'temperature_') { if (series.name.substring(0, 12) === 'temperature_') {
@ -208,39 +236,56 @@ beestat.component.chart.runtime_sensor_detail_temperature.prototype.get_options_
points.forEach(function(point) { points.forEach(function(point) {
var label; var label;
var value; var value;
var group;
var color;
label = self.data_.metadata.series[point.series_code].name; if (
if (point.value === undefined) { point.series_code.includes('calendar_event')
value = '-'; ) {
group = 'mode';
label = 'Comfort Profile';
color = beestat.series[point.series_code].color;
value = self.data_.metadata.series.calendar_event_name[x.valueOf()];
} else { } else {
value = beestat.temperature({ group = 'data';
'temperature': point.value, label = self.data_.metadata.series[point.series_code].name;
'convert': false, color = point.color;
'units': true if (point.value === undefined) {
}); value = '-';
} else {
value = beestat.temperature({
'temperature': point.value,
'convert': false,
'units': true
});
}
var occupancy_key = point.series_code.replace('temperature', 'occupancy');
if (occupancy[occupancy_key] === true) {
value += ' ●';
}
} }
var occupancy_key = point.series_code.replace('temperature', 'occupancy'); groups[group].push({
if (occupancy[occupancy_key] === true) {
value += ' ●';
}
group.push({
'label': label, 'label': label,
'value': value, 'value': value,
'color': point.color 'color': color
}); });
}); });
if (group.length === 0) { if (
group.push({ groups.mode.length === 0 &&
groups.data.length === 0
) {
groups.mode.push({
'label': 'No data', 'label': 'No data',
'value': '', 'value': '',
'color': beestat.style.color.gray.base 'color': beestat.style.color.gray.base
}); });
} }
sections.push(group); sections.push(groups.mode);
sections.push(groups.data);
var title = this.x.format('ddd, MMM D @ h:mma'); var title = this.x.format('ddd, MMM D @ h:mma');