MCPcopy
hub / github.com/danvk/dygraphs / zoom

Function zoom

auto_tests/tests/range_tests.js:122–140  ·  view source on GitHub ↗
(g, xRange, yRange)

Source from the content-addressed store, hash-verified

120 * updateOptions doesn't change the displayed ranges.
121 */
122var zoom = function(g, xRange, yRange) {
123 var originalXRange = g.xAxisRange();
124 var originalYRange = g.yAxisRange(0);
125
126 DygraphOps.dispatchMouseDown(g, xRange[0], yRange[0]);
127 DygraphOps.dispatchMouseMove(g, xRange[1], yRange[0]); // this is really necessary.
128 DygraphOps.dispatchMouseUp(g, xRange[1], yRange[0]);
129
130 assertDeepCloseTo(xRange, g.xAxisRange(), 0.2);
131 // assert.closeTo(originalYRange, g.yAxisRange(0), 0.2); // Not true, it's something in the middle.
132
133 var midX = (xRange[1] - xRange[0]) / 2;
134 DygraphOps.dispatchMouseDown(g, midX, yRange[0]);
135 DygraphOps.dispatchMouseMove(g, midX, yRange[1]); // this is really necessary.
136 DygraphOps.dispatchMouseUp(g, midX, yRange[1]);
137
138 assertDeepCloseTo(xRange, g.xAxisRange(), 0.2);
139 assertDeepCloseTo(yRange, g.yAxisRange(0), 0.2);
140}
141
142/**
143 * Verify that when zoomed in by mouse operations, an empty call to

Callers 1

range_tests.jsFile · 0.70

Calls 1

assertDeepCloseToFunction · 0.90

Tested by

no test coverage detected