mirror of
https://github.com/beestat/app.git
synced 2025-05-31 12:16:39 -04:00
Fixed #270 - Make Runtime Summary plot scale configurable
This commit is contained in:
parent
d0ce15606b
commit
3946366997
@ -401,6 +401,8 @@ a.inverted:active {
|
|||||||
.icon.weather_hazy:before { content: "\FF4D"; }
|
.icon.weather_hazy:before { content: "\FF4D"; }
|
||||||
.icon.weather_tornado:before { content: "\FF55"; }
|
.icon.weather_tornado:before { content: "\FF55"; }
|
||||||
.icon.cloud_question:before { content: "\FA38"; }
|
.icon.cloud_question:before { content: "\FA38"; }
|
||||||
|
.icon.network_strength_4:before { content: "\F8F9"; }
|
||||||
|
.icon.network_strength_off:before { content: "\F8FB"; }
|
||||||
|
|
||||||
.icon.f16:before { font-size: 16px; }
|
.icon.f16:before { font-size: 16px; }
|
||||||
.icon.f24:before { font-size: 24px; }
|
.icon.f24:before { font-size: 24px; }
|
||||||
|
@ -30,6 +30,7 @@ beestat.setting = function(key, opt_value, opt_callback) {
|
|||||||
'runtime_thermostat_summary_time_period': 'all',
|
'runtime_thermostat_summary_time_period': 'all',
|
||||||
'runtime_thermostat_summary_group_by': 'month',
|
'runtime_thermostat_summary_group_by': 'month',
|
||||||
'runtime_thermostat_summary_gap_fill': true,
|
'runtime_thermostat_summary_gap_fill': true,
|
||||||
|
'runtime_thermostat_summary_smart_scale': true,
|
||||||
|
|
||||||
'comparison_region': 'global',
|
'comparison_region': 'global',
|
||||||
'comparison_property_type': 'similar',
|
'comparison_property_type': 'similar',
|
||||||
|
@ -34,6 +34,7 @@ beestat.component.card.runtime_thermostat_summary = function(thermostat_id) {
|
|||||||
'setting.runtime_thermostat_summary_time_period',
|
'setting.runtime_thermostat_summary_time_period',
|
||||||
'setting.runtime_thermostat_summary_group_by',
|
'setting.runtime_thermostat_summary_group_by',
|
||||||
'setting.runtime_thermostat_summary_gap_fill',
|
'setting.runtime_thermostat_summary_gap_fill',
|
||||||
|
'setting.runtime_thermostat_summary_smart_scale',
|
||||||
'cache.runtime_thermostat_summary'
|
'cache.runtime_thermostat_summary'
|
||||||
],
|
],
|
||||||
change_function
|
change_function
|
||||||
@ -262,8 +263,8 @@ beestat.component.card.runtime_thermostat_summary.prototype.get_data_ = function
|
|||||||
var value = (bucket !== undefined) ? bucket[key] : null;
|
var value = (bucket !== undefined) ? bucket[key] : null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If Gap-fill is on, and it's a Gap-fillable value, and it's not the
|
* If Gap Fill is on, and it's a gap fillable value, and it's not the
|
||||||
* last bucket, gap-fill it.
|
* last bucket, gap fill it.
|
||||||
*/
|
*/
|
||||||
if (
|
if (
|
||||||
beestat.setting('runtime_thermostat_summary_gap_fill') === true &&
|
beestat.setting('runtime_thermostat_summary_gap_fill') === true &&
|
||||||
@ -435,7 +436,7 @@ beestat.component.card.runtime_thermostat_summary.prototype.get_buckets_combined
|
|||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a really good spot for Gap-fill to happen but it doesn't work
|
* This is a really good spot for Gap Fill to happen but it doesn't work
|
||||||
* here because there's no order to the buckets so I can't ignore the
|
* here because there's no order to the buckets so I can't ignore the
|
||||||
* last bucket.
|
* last bucket.
|
||||||
*/
|
*/
|
||||||
@ -453,12 +454,12 @@ beestat.component.card.runtime_thermostat_summary.prototype.get_buckets_combined
|
|||||||
/**
|
/**
|
||||||
* Try to account for missing data based on how much is missing from the series.
|
* Try to account for missing data based on how much is missing from the series.
|
||||||
*
|
*
|
||||||
* @param {number} value The sum to gap-fill.
|
* @param {number} value The sum to gap fill.
|
||||||
* @param {number} count The number of values in the sum.
|
* @param {number} count The number of values in the sum.
|
||||||
* @param {string} group_by How the data is grouped.
|
* @param {string} group_by How the data is grouped.
|
||||||
* @param {string} bucket_key Which group this is in.
|
* @param {string} bucket_key Which group this is in.
|
||||||
*
|
*
|
||||||
* @return {number} The gap-filled sum.
|
* @return {number} The gap filled sum.
|
||||||
*/
|
*/
|
||||||
beestat.component.card.runtime_thermostat_summary.prototype.gap_fill_ = function(value, count, group_by, bucket_key) {
|
beestat.component.card.runtime_thermostat_summary.prototype.gap_fill_ = function(value, count, group_by, bucket_key) {
|
||||||
var adjustment_factor;
|
var adjustment_factor;
|
||||||
@ -582,19 +583,35 @@ beestat.component.card.runtime_thermostat_summary.prototype.decorate_top_right_
|
|||||||
|
|
||||||
if (beestat.setting('runtime_thermostat_summary_gap_fill') === true) {
|
if (beestat.setting('runtime_thermostat_summary_gap_fill') === true) {
|
||||||
menu.add_menu_item(new beestat.component.menu_item()
|
menu.add_menu_item(new beestat.component.menu_item()
|
||||||
.set_text('Disable Gap-Fill')
|
.set_text('Disable Gap Fill')
|
||||||
.set_icon('basket_unfill')
|
.set_icon('basket_unfill')
|
||||||
.set_callback(function() {
|
.set_callback(function() {
|
||||||
beestat.setting('runtime_thermostat_summary_gap_fill', false);
|
beestat.setting('runtime_thermostat_summary_gap_fill', false);
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
menu.add_menu_item(new beestat.component.menu_item()
|
menu.add_menu_item(new beestat.component.menu_item()
|
||||||
.set_text('Enable Gap-Fill')
|
.set_text('Enable Gap Fill')
|
||||||
.set_icon('basket_fill')
|
.set_icon('basket_fill')
|
||||||
.set_callback(function() {
|
.set_callback(function() {
|
||||||
beestat.setting('runtime_thermostat_summary_gap_fill', true);
|
beestat.setting('runtime_thermostat_summary_gap_fill', true);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (beestat.setting('runtime_thermostat_summary_smart_scale') === true) {
|
||||||
|
menu.add_menu_item(new beestat.component.menu_item()
|
||||||
|
.set_text('Disable Smart Scale')
|
||||||
|
.set_icon('network_strength_off')
|
||||||
|
.set_callback(function() {
|
||||||
|
beestat.setting('runtime_thermostat_summary_smart_scale', false);
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
menu.add_menu_item(new beestat.component.menu_item()
|
||||||
|
.set_text('Enable Smart Scale')
|
||||||
|
.set_icon('network_strength_4')
|
||||||
|
.set_callback(function() {
|
||||||
|
beestat.setting('runtime_thermostat_summary_smart_scale', true);
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.add_menu_item(new beestat.component.menu_item()
|
menu.add_menu_item(new beestat.component.menu_item()
|
||||||
@ -629,5 +646,13 @@ beestat.component.card.runtime_thermostat_summary.prototype.get_subtitle_ = func
|
|||||||
' grouped by ' +
|
' grouped by ' +
|
||||||
beestat.setting('runtime_thermostat_summary_group_by');
|
beestat.setting('runtime_thermostat_summary_group_by');
|
||||||
|
|
||||||
|
const gap_fill_string =
|
||||||
|
beestat.setting('runtime_thermostat_summary_gap_fill') === true ? 'On' : 'Off';
|
||||||
|
|
||||||
|
const smart_scale_string =
|
||||||
|
beestat.setting('runtime_thermostat_summary_smart_scale') === true ? 'On' : 'Off';
|
||||||
|
|
||||||
|
string += ' (Gap Fill: ' + gap_fill_string + ', Smart Scale: ' + smart_scale_string + ')';
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
};
|
};
|
||||||
|
@ -154,7 +154,7 @@ beestat.component.chart.runtime_thermostat_summary.prototype.get_options_yAxis_
|
|||||||
{
|
{
|
||||||
'alignTicks': false,
|
'alignTicks': false,
|
||||||
'min': 0,
|
'min': 0,
|
||||||
'softMax': y_max_hours,
|
'softMax': (beestat.setting('runtime_thermostat_summary_smart_scale') === true) ? y_max_hours : undefined,
|
||||||
'tickInterval': tick_interval,
|
'tickInterval': tick_interval,
|
||||||
'reversedStacks': false,
|
'reversedStacks': false,
|
||||||
'gridLineColor': beestat.style.color.bluegray.light,
|
'gridLineColor': beestat.style.color.bluegray.light,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user