*/
-// Polyfills
-import 'core-js/es6/symbol';
-import 'core-js/fn/symbol/iterator';
-
import DygraphLayout from './dygraph-layout';
import DygraphCanvasRenderer from './dygraph-canvas';
import DygraphOptions from './dygraph-options';
// TODO(danvk): merge this block w/ the code below.
if (!animatedZooms) {
this.dateWindow_ = null;
- for (const axis of this.axes_) {
+ this.axes_.forEach(axis => {
if (axis.valueRange) delete axis.valueRange;
- }
+ });
this.drawGraph_();
if (zoomCallback) {
this.doAnimatedZoom(oldWindow, newWindow, oldValueRanges, newValueRanges,
() => {
this.dateWindow_ = null;
- for (const axis of this.axes_) {
+ this.axes_.forEach(axis => {
if (axis.valueRange) delete axis.valueRange;
- }
+ });
if (zoomCallback) {
zoomCallback.call(this, minDate, maxDate, this.yAxisRanges());
}
if (layout.yticks && layout.yticks.length > 0) {
var num_axes = g.numAxes();
var getOptions = [makeOptionGetter('y'), makeOptionGetter('y2')];
- for (var tick of layout.yticks) {
- if (tick.label === undefined) continue; // this tick only has a grid line.
+ layout.yticks.forEach(tick => {
+ if (tick.label === undefined) return; // this tick only has a grid line.
x = area.x;
var sgn = 1;
var prec_axis = 'y1';
label.style.width = getAxisOption('axisLabelWidth') + 'px';
containerDiv.appendChild(label);
this.ylabels_.push(label);
- }
+ });
// The lowest tick on the y-axis often overlaps with the leftmost
// tick on the x-axis. Shift the bottom tick up a little bit to
if (g.getOptionForAxis('drawAxis', 'x')) {
if (layout.xticks) {
var getAxisOption = makeOptionGetter('x');
- for (var tick of layout.xticks) {
- if (tick.label === undefined) continue; // this tick only has a grid line.
+ layout.xticks.forEach(tick => {
+ if (tick.label === undefined) return; // this tick only has a grid line.
x = area.x + tick.pos * area.w;
y = area.y + area.h;
label.style.width = getAxisOption('axisLabelWidth') + 'px';
containerDiv.appendChild(label);
this.xlabels_.push(label);
- }
+ });
}
context.strokeStyle = g.getOptionForAxis('axisLineColor', 'x');
"use strict";
-
/**
* Draws the gridlines, i.e. the gray horizontal & vertical lines running the
* length of the chart.
ticks = layout.yticks;
ctx.save();
// draw grids for the different y axes
- for (var tick of ticks) {
- if (!tick.has_tick) continue;
+ ticks.forEach(tick => {
+ if (!tick.has_tick) return;
var axis = tick.axis;
if (drawGrid[axis]) {
ctx.save();
ctx.restore();
}
- }
+ });
ctx.restore();
}
}
ctx.strokeStyle = g.getOptionForAxis('gridLineColor', 'x');
ctx.lineWidth = g.getOptionForAxis('gridLineWidth', 'x');
- for (var tick of ticks) {
- if (!tick.has_tick) continue;
+ ticks.forEach(tick => {
+ if (!tick.has_tick) return;
x = halfUp(area.x + tick.pos * area.w);
y = halfDown(area.y + area.h);
ctx.beginPath();
ctx.lineTo(x, area.y);
ctx.closePath();
ctx.stroke();
- }
+ });
if (stroking) {
if (ctx.setLineDash) ctx.setLineDash([]);
}