add dygraph options for fine tuning presentation on legend-less charts, but no sparklines
Costa Tsaousis (ktsaou) committed
Dec 24, 2017 at 14:03 UTC
6fa488ab57991840d62d80132d35a60f45d0f8ba
1 file changed
+6
-4
web/dashboard.js
+6
-4
@@ -4166,7 +4166,7 @@ var NETDATA = window.NETDATA || {};
4166
4167
var leg = false;
4168
if(this.library && this.library.legend(this) === 'right-side')
4169
- leg = NETDATA.dataAttributeBoolean(this.element, 'legend', true);
4169
+ leg = true;
4170
4171
this.tmp.___hasLegendCache___ = leg;
4172
return leg;
@@ -5896,15 +5896,17 @@ var NETDATA = window.NETDATA || {};
5896
5897
axes: {
5898
x: {
5899
- pixelsPerLabel: 50,
5899
+ pixelsPerLabel: NETDATA.dataAttribute(state.element, 'dygraph-xpixelsperlabel', 50),
5900
ticker: Dygraph.dateTicker,
5901
+ axisLabelWidth: NETDATA.dataAttribute(state.element, 'dygraph-xaxislabelwidth', 60),
5902
axisLabelFormatter: function (d, gran) {
5903
void(gran);
5904
return NETDATA.dateTime.xAxisTimeString(d);
5905
}
5906
},
5907
y: {
5907
- pixelsPerLabel: 15,
5908
+ pixelsPerLabel: NETDATA.dataAttribute(state.element, 'dygraph-ypixelsperlabel', 15),
5909
+ axisLabelWidth: NETDATA.dataAttribute(state.element, 'dygraph-yaxislabelwidth', 50),
5910
axisLabelFormatter: function (y) {
5911
5912
// unfortunately, we have to call this every single time
@@ -7589,7 +7591,7 @@ var NETDATA = window.NETDATA || {};
7591
format: function(state) { void(state); return 'json'; },
7592
options: function(state) { void(state); return 'ms|flip'; },
7593
legend: function(state) {
7592
- return (this.isSparkline(state) === false)?'right-side':null;
7594
+ return (this.isSparkline(state) === false && NETDATA.dataAttributeBoolean(state.element, 'legend', true) === true) ? 'right-side' : null;
7595
},
7596
autoresize: function(state) { void(state); return true; },
7597
max_updates_to_recreate: function(state) { void(state); return 5000; },