// double-click to unzoom. This sets that delay period.
var CLICK_DELAY_MS = 300;
-var hairlines = function() {
+var hairlines = function(opt_options) {
/* @type {!Array.<!Hairline>} */
this.hairlines_ = [];
this.dygraph_ = null;
this.addTimer_ = null;
+ opt_options = opt_options || {};
+
+ this.divFiller_ = opt_options['divFiller'] || null;
};
hairlines.prototype.toString = function() {
var g = this.dygraph_;
var xRange = g.xAxisRange();
+ var that = this;
$.each(this.hairlines_, function(idx, h) {
var row = null;
if (mode == 'closest') {
});
}
- var html = Dygraph.Plugins.Legend.generateLegendHTML(g, h.xval, selPoints, 10);
- $('.hairline-legend', h.infoDiv).html(html);
+ if (that.divFiller_) {
+ that.divFiller_(h.infoDiv, {
+ closestRow: row,
+ points: selPoints,
+ hairline: h,
+ dygraph: g
+ });
+ } else {
+ var html = Dygraph.Plugins.Legend.generateLegendHTML(g, h.xval, selPoints, 10);
+ $('.hairline-legend', h.infoDiv).html(html);
+ }
});
};
data.push([last_t, fn(last_t)]);
}
- hairlines = new Dygraph.Plugins.Hairlines();
+ hairlines = new Dygraph.Plugins.Hairlines({
+ divFiller: function(div, data) {
+ // This behavior is identical to what you'd get if you didn't set
+ // this option. It illustrates how to write a 'divFiller'.
+ var html = Dygraph.Plugins.Legend.generateLegendHTML(
+ data.dygraph, data.hairline.xval, data.points, 10);
+ $('.hairline-legend', div).html(html);
+ }
+ });
annotations = new Dygraph.Plugins.SuperAnnotations({
defaultAnnotationProperties: {
'text': 'Annotation Description'