code cleanup and commenting
Costa Tsaousis (ktsaou) committed
Dec 6, 2015 at 22:41 UTC
14111d3b441dc45f2a272a75aec199158fe62f9e
1 file changed
+225
-109
web/dashboard.js
+225
-109
@@ -1,11 +1,11 @@
1
// You can set the following variables before loading this script:
2
//
3
-// var netdataStopDygraph = 1; // do not use dygraph
4
-// var netdataStopSparkline = 1; // do not use sparkline
5
-// var netdataStopPeity = 1; // do not use peity
6
-// var netdataStopGoogleCharts = 1; // do not use google
7
-// var netdataStopMorris = 1; // do not use morris
8
-// var netdataDontInit = 1; // do not start the thread to process the charts
3
+// var netdataNoDygraphs = true; // do not use dygraph
4
+// var netdataNoSparklines = true; // do not use sparkline
5
+// var netdataNoPeitys = true; // do not use peity
6
+// var netdataNoGoogleCharts = true; // do not use google
7
+// var netdataNoMorris = true; // do not use morris
8
+// var netdataDontStart = true; // do not start the thread to process the charts
9
//
10
// You can also set the default netdata server, using the following.
11
// When this variable is not set, we assume the page is hosted on your
@@ -56,10 +56,16 @@
56
};
57
58
if(typeof netdataServer != 'undefined')
59
- NETDATA.serverDefault = netdataServer + "/";
59
+ NETDATA.serverDefault = netdataServer;
60
else
61
NETDATA.serverDefault = NETDATA._scriptSource();
62
63
+ if(NETDATA.serverDefault.slice(-1) != '/')
64
+ NETDATA.serverDefault += '/';
65
+
66
+ // default URLs for all the external files we need
67
+ // make them RELATIVE so that the whole thing can also be
68
+ // installed under a web server
69
NETDATA.jQuery = NETDATA.serverDefault + 'lib/jquery-1.11.3.min.js';
70
NETDATA.peity_js = NETDATA.serverDefault + 'lib/jquery.peity.min.js';
71
NETDATA.sparkline_js = NETDATA.serverDefault + 'lib/jquery.sparkline.min.js';
@@ -69,41 +75,93 @@
75
NETDATA.morris_css = NETDATA.serverDefault + 'css/morris.css';
76
NETDATA.dashboard_css = NETDATA.serverDefault + 'dashboard.css';
77
NETDATA.google_js = 'https://www.google.com/jsapi';
78
+
79
+ // these are the colors Google Charts are using
80
+ // we have them here to attempt emulate their look and feel on the other chart libraries
81
+ // http://there4.io/2012/05/02/google-chart-color-list/
82
NETDATA.colors = [ '#3366CC', '#DC3912', '#FF9900', '#109618', '#990099', '#3B3EAC', '#0099C6',
83
'#DD4477', '#66AA00', '#B82E2E', '#316395', '#994499', '#22AA99', '#AAAA11',
84
'#6633CC', '#E67300', '#8B0707', '#329262', '#5574A6', '#3B3EAC' ];
85
86
+ // an alternative set
87
+ // http://www.mulinblog.com/a-color-palette-optimized-for-data-visualization/
88
+ // (blue) (red) (orange) (green) (pink) (brown) (purple) (yellow) (gray)
89
+ //NETDATA.colors = [ '#5DA5DA', '#F15854', '#FAA43A', '#60BD68', '#F17CB0', '#B2912F', '#B276B2', '#DECF3F', '#4D4D4D' ];
90
+
91
// ----------------------------------------------------------------------------------------------------------------
92
// the defaults for all charts
93
94
+ // if the user does not specify any of these, the following will be used
95
+
96
NETDATA.chartDefaults = {
97
host: NETDATA.serverDefault, // the server to get data from
81
- width: '100%', // the chart width
82
- height: '100%', // the chart height
83
- min_width: 240, //
98
+ width: '100%', // the chart width - can be null
99
+ height: '100%', // the chart height - can be null
100
+ min_width: null, // the chart minimum width - can be null
101
library: 'dygraph', // the graphing library to use
102
method: 'average', // the grouping method
103
before: 0, // panning
104
after: -600, // panning
88
- pixels_per_point: 1 // the detail of the chart
105
+ pixels_per_point: 1, // the detail of the chart
106
+ fill_luminance: 0.8 // luminance of colors in solit areas
107
}
108
109
+ // ----------------------------------------------------------------------------------------------------------------
110
+ // global options
111
+
112
NETDATA.options = {
92
- targets: null,
93
- updated_dom: 1,
94
- auto_refresher_fast_weight: 0,
95
- page_is_visible: 1,
96
- double_click_ms: 100,
97
- auto_refresher_stop_until: 0,
113
+ targets: null, // an array of all the DOM elements that are
114
+ // currently visible (independently of their
115
+ // viewport visibility)
116
+
117
+ updated_dom: true, // when true, the DOM has been updated with
118
+ // new elements we have to check.
119
120
+ auto_refresher_fast_weight: 0, // this is the current time in ms, spent
121
+ // rendering charts continiously.
122
+ // used with .current.fast_render_timeframe
123
+
124
+ page_is_visible: true, // when true, this page is visible
125
+
126
+ auto_refresher_stop_until: 0, // timestamp in ms - used internaly, to stop the
127
+ // auto-refresher for some time (when a chart is
128
+ // performing pan or zoom, we need to stop refreshing
129
+ // all other charts, to have the maximum speed for
130
+ // rendering the chart that is panned or zoomed).
131
+ // Used with .current.global_pan_sync_time
132
+
133
+ // the current profile
134
+ // we may have many...
135
current: {
100
- pixels_per_point: 1,
101
- idle_between_charts: 50,
102
- idle_between_loops: 200,
103
- idle_lost_focus: 500,
104
- global_pan_sync_time: 500,
105
- fast_render_timeframe: 200, // render continously for these many ms
106
- sync_delay: 1500 // how much time after an operation to setup synced selections?
136
+ pixels_per_point: 1, // the minimum pixels per point for all charts
137
+ // increase this to speed javascript up
138
+ // each chart library has its own limit too
139
+ // the max of this and the chart library is used
140
+ // the final is calculated every time, so a change
141
+ // here will have immediate effect on the next chart
142
+ // update
143
+
144
+ idle_between_charts: 50, // ms - how much time to wait between chart updates
145
+
146
+ fast_render_timeframe: 200, // ms - render continously until this time of continious
147
+ // rendering has been reached
148
+ // this setting is used to make it render e.g. 10
149
+ // charts at once, sleep idle_between_charts time
150
+ // and continue for another 10 charts.
151
+
152
+ idle_between_loops: 200, // ms - if all charts have been updated, wait this
153
+ // time before starting again.
154
+
155
+ idle_lost_focus: 500, // ms - when the window does not have focus, check
156
+ // if focus has been regained, every this time
157
+
158
+ global_pan_sync_time: 500, // ms - when you pan or zoon a chart, the background
159
+ // autorefreshing of charts is paused for this amount
160
+ // of time
161
+
162
+ sync_delay: 1500 // ms - when you pan or zoom a chart, wait this amount
163
+ // of time before setting up synchronized selections
164
+ // on hover.
165
},
166
167
debug: {
@@ -115,6 +173,7 @@
173
chart_errors: 0,
174
chart_timing: 0,
175
chart_calls: 0,
176
+ libraries: 0,
177
dygraph: 0
178
}
179
}
@@ -156,6 +215,14 @@
215
};
216
217
// ----------------------------------------------------------------------------------------------------------------
218
+ // Chart Registry
219
+
220
+ // When multiple charts need the same chart, we avoid downloading it
221
+ // multiple times (and having it in browser memory multiple time)
222
+ // by using this registry.
223
+
224
+ // Every time we download a chart definition, we save it here with .add()
225
+ // Then we try to get it back with .get(). If that fails, we download it.
226
227
NETDATA.chartRegistry = {
228
charts: {},
@@ -185,38 +252,72 @@
252
};
253
254
// ----------------------------------------------------------------------------------------------------------------
255
+ // Global Pan and Zoom on charts
256
+
257
+ // Using this structure are synchronize all the charts, so that
258
+ // when you pan or zoom one, all others are automatically refreshed
259
+ // to the same timespan.
260
261
NETDATA.globalPanAndZoom = {
190
- seq: 0,
191
- state: null,
192
- before_ms: null,
193
- after_ms: null,
194
- force_before_ms: null,
262
+ seq: 0, // timestamp ms
263
+ // every time a chart is panned or zoomed
264
+ // we set the timestamp here
265
+ // then we use it as a sequence number
266
+ // to find if other charts are syncronized
267
+ // to this timerange
268
+
269
+ master: null, // the master chart (state), to which all others
270
+ // are synchronized
271
+
272
+ force_before_ms: null, // the timespan to sync all other charts
273
force_after_ms: null,
274
275
+ // set a new master
276
setMaster: function(state, after, before) {
198
- if(this.state && this.state != state) this.state.resetChart();
277
+ if(this.master && this.master != state)
278
+ this.master.resetChart();
279
200
- this.state = state;
280
+ this.master = state;
281
this.seq = new Date().getTime();
282
this.force_after_ms = after;
283
this.force_before_ms = before;
284
},
285
+
286
+ // clear the master
287
clearMaster: function() {
206
- if(this.state) {
207
- var state = this.state;
208
- this.state = null; // prevent infinite recursion
288
+ if(this.master) {
289
+ var state = this.master;
290
+ this.master = null; // prevent infinite recursion
291
this.seq = 0;
292
state.resetChart();
293
NETDATA.options.auto_refresher_stop_until = 0;
294
}
213
- else {
214
- this.state = null;
215
- this.seq = 0;
216
- }
295
+
296
+ this.master = null;
297
+ this.seq = 0;
298
+ this.after_ms = 0;
299
+ this.before_ms = 0;
300
+ this.force_after_ms = 0;
301
+ this.force_before_ms = 0;
302
+ },
303
+
304
+ // is the given state the master of the global
305
+ // pan and zoom sync?
306
+ isMaster: function(state) {
307
+ if(this.master == state) return true;
308
+ return false;
309
},
310
+
311
+ // are we currently have a global pan and zoom sync?
312
+ isActive: function() {
313
+ if(this.master) return true;
314
+ return false;
315
+ },
316
+
317
+ // check if a chart, other than the master
318
+ // needs to be refreshed, due to the global pan and zoom
319
shouldBeAutoRefreshed: function(state) {
219
- if(!this.state || !this.seq)
320
+ if(!this.master || !this.seq)
321
return false;
322
323
if(state.follows_global == this.seq)
@@ -265,7 +366,7 @@
366
library_name: self.data('chart-library') || NETDATA.chartDefaults.library,
367
library: null, // object - the chart library used
368
268
- element: element, // the element it is linked to
369
+ element: element, // the element this chart appears in
370
371
chart_url: null, // string - the url to download chart info
372
chart: null, // object - the chart as downloaded from the server
@@ -276,12 +377,16 @@
377
enabled: true, // boolean - is the chart enabled for refresh?
378
paused: false, // boolean - is the chart paused for any reason?
379
selected: false, // boolean - is the chart shown a selection?
279
- debug: false,
380
+ debug: false, // boolena - console.log() debug info about this chart
381
updates_counter: 0, // numeric - the number of refreshes made so far
382
282
- follows_global: 0,
383
+ follows_global: 0, // the sequence number of the global synchronization
384
+ // between chart.
385
+ // Used with NETDATA.globalPanAndZoom.seq
386
387
mode: null, // auto, pan, zoom
388
+ // this is a pointer to one of the sub-classes below
389
+
390
auto: {
391
name: 'auto',
392
autorefresh: true,
@@ -333,6 +438,7 @@
438
first_entry_ms: null,
439
last_entry_ms: null,
440
},
441
+
442
refresh_dt_ms: 0, // milliseconds - the time the last refresh took
443
refresh_dt_element_name: self.data('dt-element-name') || null, // string - the element to print refresh_dt_ms
444
refresh_dt_element: null,
@@ -401,7 +507,7 @@
507
},
508
509
resetChart: function() {
404
- if(NETDATA.globalPanAndZoom.state == this)
510
+ if(NETDATA.globalPanAndZoom.isMaster(this))
511
NETDATA.globalPanAndZoom.clearMaster();
512
513
if(state.mode.name != 'auto')
@@ -416,6 +522,10 @@
522
this.enabled = true;
523
this.debug = false;
524
525
+ // do not update the chart here
526
+ // or the chart will flip-flop when it is the master
527
+ // of a selection sync and another chart becomes
528
+ // the new master
529
// state.updateChart();
530
},
531
@@ -656,7 +766,7 @@
766
767
var before;
768
var after;
659
- if(NETDATA.globalPanAndZoom.state) {
769
+ if(NETDATA.globalPanAndZoom.isActive()) {
770
after = Math.round(NETDATA.globalPanAndZoom.force_after_ms / 1000);
771
before = Math.round(NETDATA.globalPanAndZoom.force_before_ms / 1000);
772
this.follows_global = NETDATA.globalPanAndZoom.seq;
@@ -721,7 +831,7 @@
831
832
// options valid only for autoRefresh()
833
if(NETDATA.options.auto_refresher_stop_until == 0 || NETDATA.options.auto_refresher_stop_until < now) {
724
- if(NETDATA.globalPanAndZoom.state) {
834
+ if(NETDATA.globalPanAndZoom.isActive()) {
835
if(NETDATA.globalPanAndZoom.shouldBeAutoRefreshed(this)) {
836
if(this.debug) this.log('canBeAutoRefreshed(): global panning: I need an update.');
837
return true;
@@ -799,10 +909,16 @@
909
element.className += "netdata-container";
910
911
if(this.debug) this.log('sizing element');
802
- self.css('width', this.width)
803
- .css('height', this.height);
804
- //.css('display', 'inline-block')
805
- //.css('overflow', 'hidden');
912
+
913
+ if(this.width)
914
+ self.css('width', this.width);
915
+
916
+ if(this.height)
917
+ self.css('height', this.height);
918
+
919
+ // these should be left to css
920
+ //self.css('display', 'inline-block')
921
+ //self.css('overflow', 'hidden');
922
923
if(NETDATA.chartDefaults.min_width)
924
self.css('min-width', NETDATA.chartDefaults.min_width);
@@ -829,31 +945,45 @@
945
// show a message indicating the chart is loading
946
info: function(msg) {
947
this.message('info', this.id + ': ' + msg);
832
- }
833
- };
834
-
835
- if(state.debug) state.log('created');
836
- state.sizeChart();
837
- state.info("loading...");
948
+ },
949
839
- if(typeof NETDATA.chartLibraries[state.library_name] == 'undefined') {
840
- NETDATA.error(402, state.library_name);
841
- state.error('chart library "' + state.library_name + '" is not found');
842
- }
843
- else if(!NETDATA.chartLibraries[state.library_name].enabled) {
844
- NETDATA.error(403, state.library_name);
845
- state.error('chart library "' + state.library_name + '" is not enabled');
846
- }
847
- else {
848
- state.library = NETDATA.chartLibraries[state.library_name];
849
- state.pixels_per_point = self.data('pixels-per-point') || state.library.pixels_per_point;
850
- }
950
+ init: function() {
951
+ if(this.debug) this.log('created');
952
+ this.sizeChart();
953
+ this.info("loading...");
954
+
955
+ // make sure the host does not end with /
956
+ // all netdata API requests use absolute paths
957
+ while(this.host.slice(-1) == '/')
958
+ this.host = this.host.substring(0, this.host.length - 1);
959
+
960
+ // check the requested library is available
961
+ // we don't initialize it here - it will be initialized when
962
+ // this chart will be first used
963
+ if(typeof NETDATA.chartLibraries[this.library_name] == 'undefined') {
964
+ NETDATA.error(402, this.library_name);
965
+ this.error('chart library "' + this.library_name + '" is not found');
966
+ }
967
+ else if(!NETDATA.chartLibraries[this.library_name].enabled) {
968
+ NETDATA.error(403, this.library_name);
969
+ this.error('chart library "' + this.library_name + '" is not enabled');
970
+ }
971
+ else {
972
+ this.library = NETDATA.chartLibraries[this.library_name];
973
+ this.pixels_per_point = self.data('pixels-per-point') || this.library.pixels_per_point;
974
+ }
975
852
- if(state.refresh_dt_element_name)
853
- state.refresh_dt_element = document.getElementById(state.refresh_dt_element_name) || null;
976
+ // if we need to report the rendering speed
977
+ // find the element that needs to be updated
978
+ if(this.refresh_dt_element_name)
979
+ this.refresh_dt_element = document.getElementById(this.refresh_dt_element_name) || null;
980
855
- state.setMode('auto');
981
+ // the default mode for all charts
982
+ this.setMode('auto');
983
+ }
984
+ };
985
986
+ state.init();
987
return state;
988
}
989
@@ -934,7 +1064,7 @@
1064
// user function to signal us the DOM has been
1065
// updated.
1066
NETDATA.updatedDom = function() {
937
- NETDATA.options.updated_dom = 1;
1067
+ NETDATA.options.updated_dom = true;
1068
}
1069
1070
// ----------------------------------------------------------------------------------------------------------------
@@ -985,7 +1115,7 @@
1115
}
1116
1117
NETDATA.getDomCharts = function(callback) {
988
- NETDATA.options.updated_dom = 0;
1118
+ NETDATA.options.updated_dom = false;
1119
1120
NETDATA.options.targets = $('div[data-netdata]').filter(':visible');
1121
@@ -1004,23 +1134,23 @@
1134
}
1135
1136
// this is the main function - where everything starts
1007
- NETDATA.init = function() {
1137
+ NETDATA.start = function() {
1138
// this should be called only once
1139
1010
- NETDATA.options.page_is_visible = 1;
1140
+ NETDATA.options.page_is_visible = true;
1141
1142
$(window).blur(function() {
1013
- NETDATA.options.page_is_visible = 0;
1143
+ NETDATA.options.page_is_visible = false;
1144
if(NETDATA.options.debug.focus) console.log('Lost Focus!');
1145
});
1146
1147
$(window).focus(function() {
1018
- NETDATA.options.page_is_visible = 1;
1148
+ NETDATA.options.page_is_visible = true;
1149
if(NETDATA.options.debug.focus) console.log('Focus restored!');
1150
});
1151
1152
if(typeof document.hasFocus == 'function' && !document.hasFocus()) {
1023
- NETDATA.options.page_is_visible = 0;
1153
+ NETDATA.options.page_is_visible = false;
1154
if(NETDATA.options.debug.focus) console.log('Document has no focus!');
1155
}
1156
@@ -1029,23 +1159,11 @@
1159
});
1160
}
1161
1032
- // ----------------------------------------------------------------------------------------------------------------
1033
-
1034
- //var chart = function() {
1035
- //}
1036
-
1037
- //chart.prototype.color = function() {
1038
- // return 'red';
1039
- //}
1040
-
1041
- //var c = new chart();
1042
- //c.color();
1043
-
1162
// ----------------------------------------------------------------------------------------------------------------
1163
// peity
1164
1165
NETDATA.peityInitialize = function(callback) {
1048
- if(typeof netdataStopPeity == 'undefined') {
1166
+ if(typeof netdataNoPeitys == 'undefined' || !netdataNoPeitys) {
1167
$.getScript(NETDATA.peity_js)
1168
.done(function() {
1169
NETDATA.registerChartLibrary('peity', NETDATA.peity_js);
@@ -1086,7 +1204,7 @@
1204
// sparkline
1205
1206
NETDATA.sparklineInitialize = function(callback) {
1089
- if(typeof netdataStopSparkline == 'undefined') {
1207
+ if(typeof netdataNoSparklines == 'undefined' || !netdataNoSparklines) {
1208
$.getScript(NETDATA.sparkline_js)
1209
.done(function() {
1210
NETDATA.registerChartLibrary('sparkline', NETDATA.sparkline_js);
@@ -1118,7 +1236,7 @@
1236
var self = $(element);
1237
var type = self.data('sparkline-type') || 'line';
1238
var lineColor = self.data('sparkline-linecolor') || NETDATA.colors[0];
1121
- var fillColor = self.data('sparkline-fillcolor') || (data.state.chart.chart_type == 'line')?'#FFF':NETDATA.ColorLuminance(lineColor, 0.8);
1239
+ var fillColor = self.data('sparkline-fillcolor') || (data.state.chart.chart_type == 'line')?'#FFF':NETDATA.ColorLuminance(lineColor, NETDATA.chartDefaults.fill_luminance);
1240
var chartRangeMin = self.data('sparkline-chartrangemin') || undefined;
1241
var chartRangeMax = self.data('sparkline-chartrangemax') || undefined;
1242
var composite = self.data('sparkline-composite') || undefined;
@@ -1349,7 +1467,7 @@
1467
}
1468
1469
NETDATA.dygraphInitialize = function(callback) {
1352
- if(typeof netdataStopDygraph == 'undefined') {
1470
+ if(typeof netdataNoDygraphs == 'undefined' || !netdataNoDygraphs) {
1471
$.getScript(NETDATA.dygraph_js)
1472
.done(function() {
1473
NETDATA.registerChartLibrary('dygraph', NETDATA.dygraph_js);
@@ -1413,7 +1531,7 @@
1531
var labelsSeparateLines = self.data('dygraph-labelsseparatelines') || false;
1532
var labelsShowZeroValues = self.data('dygraph-labelsshowzerovalues') || true;
1533
var legend = self.data('dygraph-legend') || 'onmouseover';
1416
- var showLabelsOnHighlight = self.data('dygraph-showlabelsonhighlight') || true; // true FIXME
1534
+ var showLabelsOnHighlight = self.data('dygraph-showlabelsonhighlight') || true;
1535
var gridLineColor = self.data('dygraph-gridlinecolor') || '#EEE';
1536
var axisLineColor = self.data('dygraph-axislinecolor') || '#EEE';
1537
var maxNumberWidth = self.data('dygraph-maxnumberwidth') || 8;
@@ -1428,11 +1546,11 @@
1546
var pointSize = self.data('dygraph-pointsize') || 1;
1547
var stepPlot = self.data('dygraph-stepplot') || false;
1548
var strokeBorderColor = self.data('dygraph-strokebordercolor') || 'white';
1431
- var strokeBorderWidth = self.data('dygraph-strokeborderwidth') || (data.state.chart.chart_type == 'stacked')?1.0:0.0;
1549
+ var strokeBorderWidth = self.data('dygraph-strokeborderwidth') || (data.state.chart.chart_type == 'stacked')?0.1:0.0;
1550
var strokePattern = self.data('dygraph-strokepattern') || undefined;
1551
var highlightCircleSize = self.data('dygraph-highlightcirclesize') || 3;
1434
- var highlightSeriesOpts = self.data('dygraph-highlightseriesopts') || null; // FIXME { strokeWidth: 1.5 };
1435
- var highlightSeriesBackgroundAlpha = self.data('dygraph-highlightseriesbackgroundalpha') || null; // FIXME (data.state.chart.chart_type == 'stacked')?0.7:0.5;
1552
+ var highlightSeriesOpts = self.data('dygraph-highlightseriesopts') || null; // TOO SLOW: { strokeWidth: 1.5 };
1553
+ var highlightSeriesBackgroundAlpha = self.data('dygraph-highlightseriesbackgroundalpha') || null; // TOO SLOW: (data.state.chart.chart_type == 'stacked')?0.7:0.5;
1554
var pointClickCallback = self.data('dygraph-pointclickcallback') || undefined;
1555
var showRangeSelector = self.data('dygraph-showrangeselector') || false;
1556
var showRoller = self.data('dygraph-showroller') || false;
@@ -1669,7 +1787,7 @@
1787
// morris
1788
1789
NETDATA.morrisInitialize = function(callback) {
1672
- if(typeof netdataStopMorris == 'undefined') {
1790
+ if(typeof netdataNoMorris == 'undefined' || !netdataNoMorris) {
1791
1792
// morris requires raphael
1793
if(!NETDATA.chartLibraries.raphael.initialized) {
@@ -1722,7 +1840,7 @@
1840
ykeys: data.dimension_names,
1841
labels: data.dimension_names,
1842
lineWidth: 2,
1725
- pointSize: 2,
1843
+ pointSize: 3,
1844
smooth: true,
1845
hideHover: 'auto',
1846
parseTime: true,
@@ -1791,7 +1909,7 @@
1909
// google charts
1910
1911
NETDATA.googleInitialize = function(callback) {
1794
- if(typeof netdataStopGoogleCharts == 'undefined') {
1912
+ if(typeof netdataNoGoogleCharts == 'undefined' || !netdataNoGoogleCharts) {
1913
$.getScript(NETDATA.google_js)
1914
.done(function() {
1915
NETDATA.registerChartLibrary('google', NETDATA.google_js);
@@ -1970,7 +2088,7 @@
2088
format: 'json',
2089
options: 'objectrows|ms',
2090
jsonWrapper: true,
1973
- pixels_per_point: 10,
2091
+ pixels_per_point: 15,
2092
detects_dimensions_on_update: false
2093
},
2094
"google": {
@@ -1984,7 +2102,7 @@
2102
format: 'datatable',
2103
options: '',
2104
jsonWrapper: true,
1987
- pixels_per_point: 2,
2105
+ pixels_per_point: 4,
2106
detects_dimensions_on_update: true
2107
},
2108
"raphael": {
@@ -2004,26 +2122,24 @@
2122
};
2123
2124
NETDATA.registerChartLibrary = function(library, url) {
2007
- console.log("registering chart library: " + library);
2125
+ if(NETDATA.options.debug.libraries)
2126
+ console.log("registering chart library: " + library);
2127
2128
NETDATA.chartLibraries[library].url = url;
2129
NETDATA.chartLibraries[library].initialized = true;
2130
NETDATA.chartLibraries[library].enabled = true;
2012
-
2013
- // console.log(NETDATA.chartLibraries);
2131
}
2132
2133
// ----------------------------------------------------------------------------------------------------------------
2017
- // load all libraries and initialize
2134
+ // Start up
2135
2136
NETDATA.errorReset();
2020
-
2137
NETDATA._loadjQuery(function() {
2138
$.getScript(NETDATA.serverDefault + 'lib/visible.js').then(function() {
2139
NETDATA._loadCSS(NETDATA.dashboard_css);
2140
2025
- if(typeof netdataDontInit == 'undefined')
2026
- NETDATA.init();
2141
+ if(typeof netdataDontStart == 'undefined' || !netdataDontStart)
2142
+ NETDATA.start();
2143
})
2144
});
2145