// TODO(danvk): Check if there's any performance impact of just calling
// getOption() inside of drawStyledLine_. Passing in so many parameters makes
// this code a bit nasty.
- var borderWidth = g.getOption("strokeBorderWidth", setName);
+ var borderWidth = g.getNumericOption("strokeBorderWidth", setName);
var drawPointCallback = g.getOption("drawPointCallback", setName) ||
Dygraph.Circles.DEFAULT;
var strokePattern = g.getOption("strokePattern", setName);
- var drawPoints = g.getOption("drawPoints", setName);
- var pointSize = g.getOption("pointSize", setName);
+ var drawPoints = g.getBooleanOption("drawPoints", setName);
+ var pointSize = g.getNumericOption("pointSize", setName);
if (borderWidth && strokeWidth) {
drawStyledLine_(e,
};
/**
+// 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.
+ */
+Dygraph.prototype.getNumericOption = function(name, opt_seriesName) {
+ return /** @type{number} */(this.getOption(name, opt_seriesName));
+}
+
+/**
+// 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.
+ */
+Dygraph.prototype.getStringOption = function(name, opt_seriesName) {
+ return /** @type{string} */(this.getOption(name, opt_seriesName));
+}
+
+/**
+// 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.
+ */
+Dygraph.prototype.getBoolOption = function(name, opt_seriesName) {
+ return /** @type{boolean} */(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
/**
* Returns the number of y-axes on the chart.
- * @return {Number} the number of axes.
+ * @return {number} the number of axes.
*/
Dygraph.prototype.numAxes = function() {
return this.attributes_.numAxes();
/**
* @private
* Returns axis properties for the given series.
- * @param { String } setName The name of the series for which to get axis
+ * @param {string} setName The name of the series for which to get axis
* properties, e.g. 'Y1'.
- * @return { Object } The axis properties.
+ * @return {DygraphAxisType} The axis properties.
*/
Dygraph.prototype.axisPropertiesForSeries = function(series) {
// TODO(danvk): handle errors.