|
|
|
@ -1581,9 +1581,8 @@
|
|
|
|
|
return $$.x.domain(); |
|
|
|
|
}; |
|
|
|
|
c3_chart_internal_fn.trimXDomain = function (domain) { |
|
|
|
|
var $$ = this, config = $$.config, d3 = $$.d3; |
|
|
|
|
var min = d3.min([$$.orgXDomain[0], config.zoom_x_min]); |
|
|
|
|
var max = d3.max([$$.orgXDomain[1], config.zoom_x_max]); |
|
|
|
|
var zoomDomain = this.getZoomDomain(), |
|
|
|
|
min = zoomDomain[0], max = zoomDomain[1]; |
|
|
|
|
if (domain[0] <= min) { |
|
|
|
|
domain[1] = +domain[1] + (min - domain[0]); |
|
|
|
|
domain[0] = min; |
|
|
|
@ -5522,12 +5521,18 @@
|
|
|
|
|
return [extent[0], Math.max($$.getMaxDataCount() / extent[1], extent[1])]; |
|
|
|
|
}; |
|
|
|
|
$$.zoom.updateScaleExtent = function () { |
|
|
|
|
var ratio = diffDomain($$.x.orgDomain()) / diffDomain($$.orgXDomain), |
|
|
|
|
var ratio = diffDomain($$.x.orgDomain()) / diffDomain($$.getZoomDomain()), |
|
|
|
|
extent = this.orgScaleExtent(); |
|
|
|
|
this.scaleExtent([extent[0] * ratio, extent[1] * ratio]); |
|
|
|
|
return this; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
c3_chart_internal_fn.getZoomDomain = function () { |
|
|
|
|
var $$ = this, config = $$.config, d3 = $$.d3, |
|
|
|
|
min = d3.min([$$.orgXDomain[0], config.zoom_x_min]), |
|
|
|
|
max = d3.max([$$.orgXDomain[1], config.zoom_x_max]); |
|
|
|
|
return [min, max]; |
|
|
|
|
}; |
|
|
|
|
c3_chart_internal_fn.updateZoom = function () { |
|
|
|
|
var $$ = this, z = $$.config.zoom_enabled ? $$.zoom : function () {}; |
|
|
|
|
$$.main.select('.' + CLASS.zoomRect).call(z).on("dblclick.zoom", null); |
|
|
|
|