};
/**
-// This is a convenience function for working with the Closure Compiler.
+ * This is a convenience function for working with the Closure Compiler.
* @param {string} name The name of the option (e.g. 'strokeWidth')
* @param {string=} opt_seriesName Series name to get per-series values.
* @return {number} The value of the option.
}
/**
-// This is a convenience function for working with the Closure Compiler.
+ * This is a convenience function for working with the Closure Compiler.
* @param {string} name The name of the option (e.g. 'strokeWidth')
* @param {string=} opt_seriesName Series name to get per-series values.
* @return {string} The value of the option.
}
/**
-// This is a convenience function for working with the Closure Compiler.
+ * This is a convenience function for working with the Closure Compiler.
* @param {string} name The name of the option (e.g. 'strokeWidth')
* @param {string=} opt_seriesName Series name to get per-series values.
* @return {boolean} The value of the option.
}
/**
+ * This is a convenience function for working with the Closure Compiler.
+ * @param {string} name The name of the option (e.g. 'strokeWidth')
+ * @param {string=} opt_seriesName Series name to get per-series values.
+ * @return {function(...)} The value of the option.
+ */
+Dygraph.prototype.getFunctionOption = function(name, opt_seriesName) {
+ return /** @type{function(...)} */(this.getOption(name, opt_seriesName));
+}
+
+/**
* @private
* @param {string} axis The name of the axis (i.e. 'x', 'y' or 'y2')
* @return {function(string)} A function mapping string -> option value
selectionChanged = this.setSelection(idx);
}
- var callback = /**@type{?function(...)}*/(this.attr_("highlightCallback"));
+ var callback = this.getFunctionOption("highlightCallback");
if (callback && selectionChanged) {
callback(event,
this.lastx_,
if (!Dygraph.isOK(pt.canvasy)) continue;
var circleSize = this.getNumericOption('highlightCircleSize', pt.name);
- var callback = /**@type{function(...)}*/(this.attr_("drawHighlightPointCallback", pt.name));
+ var callback = this.getFunctionOption("drawHighlightPointCallback", pt.name);
var color = this.plotter_.colors[pt.name];
if (!callback) {
callback = Dygraph.Circles.DEFAULT;
* @private
*/
Dygraph.prototype.mouseOut_ = function(event) {
- var unhighlightCallback = /**@type{function(...)}*/(this.attr_('unhighlightCallback'));
+ var unhighlightCallback = this.getFunctionOption('unhighlightCallback');
if (unhighlightCallback) {
unhighlightCallback(event);
}
if (this.attr_('underlayCallback')) {
// NOTE: we pass the dygraph object to this callback twice to avoid breaking
// users who expect a deprecated form of this callback.
- this.attr_('underlayCallback')(
+ this.getFunctionOption('underlayCallback')(
this.hidden_ctx_, this.layout_.getPlotArea(), this, this);
}
this.canvas_.height);
if (this.attr_("drawCallback") !== null) {
- this.attr_("drawCallback")(this, is_initial_draw);
+ this.getFunctionOption("drawCallback")(this, is_initial_draw);
}
if (is_initial_draw) {
this.readyFired_ = true;
var fields = [];
if (!defaultParserSet) {
this.detectTypeFromString_(inFields[0]);
- xParser = this.attr_("xValueParser");
+ xParser = this.getFunctionOption("xValueParser");
defaultParserSet = true;
}
fields[0] = xParser(inFields[0], this);