Commit ad468b67 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix zoom.enable = false

parent 925e106e
...@@ -838,7 +838,7 @@ ...@@ -838,7 +838,7 @@
/*-- Define brush --*/ /*-- Define brush --*/
var brush = d3.svg.brush().on("brush", redrawForBrush); var brush = d3.svg.brush().on("brush", redrawForBrush);
var zoom = d3.behavior.zoom().on("zoom", redrawForZoom); var zoom = d3.behavior.zoom().on("zoom", __zoom_enabled ? redrawForZoom : null);
/*-- Draw Chart --*/ /*-- Draw Chart --*/
...@@ -877,7 +877,7 @@ ...@@ -877,7 +877,7 @@
// MEMO: must set x here for timeseries data // MEMO: must set x here for timeseries data
brush.x(subX); brush.x(subX);
zoom.x(x); if (__zoom_enabled) zoom.x(x);
/*-- Main Region --*/ /*-- Main Region --*/
...@@ -905,12 +905,14 @@ ...@@ -905,12 +905,14 @@
.call(yAxis2); .call(yAxis2);
} }
main.append('rect') if (__zoom_enabled) {
.attr('class', 'zoom-rect') main.append('rect')
.attr('width', width) .attr('class', 'zoom-rect')
.attr('height', height) .attr('width', width)
.style('opacity', 0) .attr('height', height)
.call(zoom).on("dblclick.zoom", null); .style('opacity', 0)
.call(zoom).on("dblclick.zoom", null);
}
// Grids // Grids
grid = main.append('g') grid = main.append('g')
...@@ -1255,7 +1257,7 @@ ...@@ -1255,7 +1257,7 @@
// ATTENTION: call here to update tickOffset // ATTENTION: call here to update tickOffset
if (withUpdateXDomain) { if (withUpdateXDomain) {
x.domain(brush.empty() ? subX.domain() : brush.extent()); x.domain(brush.empty() ? subX.domain() : brush.extent());
zoom.x(x); if (__zoom_enabled) zoom.x(x);
} }
y.domain(getYDomain(c3.data.targets, 'y')); y.domain(getYDomain(c3.data.targets, 'y'));
y2.domain(getYDomain(c3.data.targets, 'y2')); y2.domain(getYDomain(c3.data.targets, 'y2'));
...@@ -1455,7 +1457,7 @@ ...@@ -1455,7 +1457,7 @@
updateSizes(); updateSizes();
updateScales(); updateScales();
// Set x for zoom again because of scale update // Set x for zoom again because of scale update
zoom.x(x); if (__zoom_enabled) zoom.x(x);
// Resize svg // Resize svg
d3.select('svg').attr('width', width + margin.left + margin.right); d3.select('svg').attr('width', width + margin.left + margin.right);
d3.select('#'+clipId).select('rect').attr('width', width); d3.select('#'+clipId).select('rect').attr('width', width);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment