@cryptotaxi247 / netdata-1 / commits / 26330d676

ensure common-units can only be applied to charts with the same units

Costa Tsaousis (ktsaou) committed Oct 8, 2017 at 13:16 UTC 26330d6769745197ad516ec44b3e7996af9ad5d8
1 file changed +8 -6
web/dashboard.js
+8 -6
@@ -1642,11 +1642,13 @@ var NETDATA = window.NETDATA || {};
1642 // the caller wants several charts to have the same units
1643 // data-common-units
1644
1645 + var common_units_key = common_units_name + '-' + units;
1646 +
1647 // add our divider into the list of keys
1646 - var t = this.keys[common_units_name];
1648 + var t = this.keys[common_units_key];
1649 if(typeof t === 'undefined') {
1648 - this.keys[common_units_name] = {};
1649 - t = this.keys[common_units_name];
1650 + this.keys[common_units_key] = {};
1651 + t = this.keys[common_units_key];
1652 }
1653 t[uuid] = {
1654 units: tunits,
@@ -1661,10 +1663,10 @@ var NETDATA = window.NETDATA || {};
1663 }
1664
1665 // save our common_max to the latest keys
1664 - var latest = this.latest[common_units_name];
1666 + var latest = this.latest[common_units_key];
1667 if(typeof latest === 'undefined') {
1666 - this.latest[common_units_name] = {};
1667 - latest = this.latest[common_units_name];
1668 + this.latest[common_units_key] = {};
1669 + latest = this.latest[common_units_key];
1670 }
1671 latest.units = common_units.units;
1672 latest.divider = common_units.divider;