+ // generate a sparkline
+ // used in the documentation
+ sparkline: function (prefix, chart, dimension, units, suffix) {
+ if(options.data === null || typeof options.data.charts === 'undefined')
+ return '';
+
+ if(typeof options.data.charts[chart] === 'undefined')
+ return '';
+
+ if(typeof options.data.charts[chart].dimensions === 'undefined')
+ return '';
+
+ if(typeof options.data.charts[chart].dimensions[dimension] === 'undefined')
+ return '';
+
+ var key = chart + '.' + dimension;
+
+ if(typeof units === 'undefined')
+ units = '';
+
+ if(typeof this.sparklines_registry[key] === 'undefined')
+ this.sparklines_registry[key] = { count: 1 };
+ else
+ this.sparklines_registry[key].count++;
+
+ key = key + '.' + this.sparklines_registry[key].count;
+
+ return prefix + '<div data-netdata="' + chart + '" data-after="-120" data-width="25%" data-height="15px" data-chart-library="dygraph" data-dygraph-theme="sparkline" data-dimensions="' + dimension + '" data-show-value-of-' + dimension + '-at="' + key + '"></div> (<span id="' + key + '" style="display: inline-block; min-width: 50px; text-align: right;">X</span>' + units + ')' + suffix;
+ },
+