Commit 5ad04957 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Add zoom.privileged option

parent a81ca11f
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
__size_height = getConfig(['size','height'], null); __size_height = getConfig(['size','height'], null);
var __zoom_enabled = getConfig(['zoom','enabled'], false), var __zoom_enabled = getConfig(['zoom','enabled'], false),
__zoom_extent = getConfig(['zoom','extent'], null); __zoom_extent = getConfig(['zoom','extent'], null),
__zoom_privileged = getConfig(['zoom','privileged'], false);
// data - data configuration // data - data configuration
checkConfig('data', 'data is required in config'); checkConfig('data', 'data is required in config');
...@@ -924,16 +925,6 @@ ...@@ -924,16 +925,6 @@
.call(yAxis2); .call(yAxis2);
} }
if (__zoom_enabled) {
main.append('rect')
.attr('class', 'zoom-rect')
.attr('width', width)
.attr('height', height)
.style('opacity', 0)
.style('cursor', 'ew-resize')
.call(zoom).on("dblclick.zoom", null);
}
// Grids // Grids
grid = main.append('g') grid = main.append('g')
.attr("clip-path", clipPath) .attr("clip-path", clipPath)
...@@ -1193,6 +1184,17 @@ ...@@ -1193,6 +1184,17 @@
main.select(".chart").append("g") main.select(".chart").append("g")
.attr("class", "chart-lines"); .attr("class", "chart-lines");
if (__zoom_enabled) {
// if zoom privileged, insert rect to forefront
main.insert('rect', __zoom_privileged ? null : 'g.grid')
.attr('class', 'zoom-rect')
.attr('width', width)
.attr('height', height)
.style('opacity', 0)
.style('cursor', 'ew-resize')
.call(zoom).on("dblclick.zoom", null);
}
// Set default extent if defined // Set default extent if defined
if (__axis_x_default !== null) { if (__axis_x_default !== null) {
brush.extent(typeof __axis_x_default !== 'function' ? __axis_x_default : (isTimeSeries ? __axis_x_default(firstDate,lastDate) : __axis_x_default(0,maxDataCount()-1))); brush.extent(typeof __axis_x_default !== 'function' ? __axis_x_default : (isTimeSeries ? __axis_x_default(firstDate,lastDate) : __axis_x_default(0,maxDataCount()-1)));
......
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