|
|
@ -62,10 +62,6 @@ ChartInternal.prototype.zoomTransform = function (range) { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
ChartInternal.prototype.initDragZoom = function () { |
|
|
|
ChartInternal.prototype.initDragZoom = function () { |
|
|
|
if (!(this.config.zoom_type === 'drag' && this.config.zoom_enabled)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const $$ = this; |
|
|
|
const $$ = this; |
|
|
|
const d3 = $$.d3; |
|
|
|
const d3 = $$.d3; |
|
|
|
const config = $$.config; |
|
|
|
const config = $$.config; |
|
|
@ -73,6 +69,10 @@ ChartInternal.prototype.initDragZoom = function () { |
|
|
|
const brushXPos = $$.margin.left + 20.5; |
|
|
|
const brushXPos = $$.margin.left + 20.5; |
|
|
|
const brushYPos = $$.margin.top + 0.5; |
|
|
|
const brushYPos = $$.margin.top + 0.5; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!(config.zoom_type === 'drag' && config.zoom_enabled)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const brush = $$.dragZoomBrush = d3.brushX() |
|
|
|
const brush = $$.dragZoomBrush = d3.brushX() |
|
|
|
.on("start", () => { |
|
|
|
.on("start", () => { |
|
|
|
$$.api.unzoom(); |
|
|
|
$$.api.unzoom(); |
|
|
@ -88,16 +88,12 @@ ChartInternal.prototype.initDragZoom = function () { |
|
|
|
}) |
|
|
|
}) |
|
|
|
.on("end", () => { |
|
|
|
.on("end", () => { |
|
|
|
if (d3.event.selection == null) { |
|
|
|
if (d3.event.selection == null) { |
|
|
|
return |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const [x0, x1] = d3.event.selection; |
|
|
|
const [x0, x1] = d3.event.selection; |
|
|
|
|
|
|
|
|
|
|
|
if (!config.zoom_disableDefaultBehavior) { |
|
|
|
|
|
|
|
$$.api.zoom([$$.x.invert(x0), $$.x.invert(x1)]); |
|
|
|
$$.api.zoom([$$.x.invert(x0), $$.x.invert(x1)]); |
|
|
|
} else { |
|
|
|
|
|
|
|
$$.api.zoom([$$.x.invert(x0), $$.x.invert(x1)]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$$.svg |
|
|
|
$$.svg |
|
|
|
.select("." + CLASS.dragZoom) |
|
|
|
.select("." + CLASS.dragZoom) |
|
|
|