* dygraphs.
*/
-var DygraphLayout = (function() {
-
/*global Dygraph:false */
"use strict";
+import * as utils from './dygraph-utils';
+
/**
* Creates a new DygraphLayout object.
*
"annotation.icon property");
return;
}
- Dygraph.update(a, ann[i]);
+ utils.update(a, ann[i]);
if (!a.xval) a.xval = parse(a.x);
this.annotations.push(a);
}
this._xAxis.scale = (xrange !== 0 ? 1 / xrange : 1.0);
if (this.dygraph_.getOptionForAxis("logscale", 'x')) {
- this._xAxis.xlogrange = Dygraph.log10(this._xAxis.maxval) - Dygraph.log10(this._xAxis.minval);
+ this._xAxis.xlogrange = utils.log10(this._xAxis.maxval) - utils.log10(this._xAxis.minval);
this._xAxis.xlogscale = (this._xAxis.xlogrange !== 0 ? 1.0 / this._xAxis.xlogrange : 1.0);
}
for (var i = 0; i < this.yAxes_.length; i++) {
axis.yscale = (axis.yrange !== 0 ? 1.0 / axis.yrange : 1.0);
if (this.dygraph_.getOption("logscale")) {
- axis.ylogrange = Dygraph.log10(axis.maxyval) - Dygraph.log10(axis.minyval);
+ axis.ylogrange = utils.log10(axis.maxyval) - utils.log10(axis.minyval);
axis.ylogscale = (axis.ylogrange !== 0 ? 1.0 / axis.ylogrange : 1.0);
if (!isFinite(axis.ylogrange) || isNaN(axis.ylogrange)) {
console.error('axis ' + i + ' of graph at ' + axis.g +
DygraphLayout.calcXNormal_ = function(value, xAxis, logscale) {
if (logscale) {
- return ((Dygraph.log10(value) - Dygraph.log10(xAxis.minval)) * xAxis.xlogscale);
+ return ((utils.log10(value) - utils.log10(xAxis.minval)) * xAxis.xlogscale);
} else {
return (value - xAxis.minval) * xAxis.scale;
}
*/
DygraphLayout.calcYNormal_ = function(axis, value, logscale) {
if (logscale) {
- var x = 1.0 - ((Dygraph.log10(value) - Dygraph.log10(axis.minyval)) * axis.ylogscale);
+ var x = 1.0 - ((utils.log10(value) - utils.log10(axis.minyval)) * axis.ylogscale);
return isFinite(x) ? x : NaN; // shim for v8 issue; see pull request 276
} else {
return 1.0 - ((value - axis.minyval) * axis.yscale);
this.setPointsOffsets = [];
};
-return DygraphLayout;
-
-})();
+export default DygraphLayout;