Skip to content

Commit

Permalink
enable elasticX only for render, if mouseZoomable or focusChart
Browse files Browse the repository at this point in the history
elasticX can reasonably be interpreteted as "just calculate the domain for me, unless it's forced by something else"
so ignore it during redraw if this is a focus chart or mouseZoomable is active
fixes #1623, #987
  • Loading branch information
gordonwoodhull committed Dec 16, 2019
1 parent 2024635 commit cb1918b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/coordinate-grid-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ dc.coordinateGridMixin = function (_chart) {

function prepareXAxis (g, render) {
if (!_chart.isOrdinal()) {
if (_chart.elasticX()) {
if (_chart.elasticX() && (render || (!_chart.mouseZoomable() && !_rangeChart))) {
_x.domain([_chart.xAxisMin(), _chart.xAxisMax()]);
}
} else { // _chart.isOrdinal()
Expand All @@ -500,6 +500,9 @@ dc.coordinateGridMixin = function (_chart) {
_x.domain(_chart._ordinalXDomain());
}
}
if(render && _chart.elasticX()) {
_xOriginalDomain = _chart.x().domain();
}

// has the domain changed?
var xdom = _x.domain();
Expand Down Expand Up @@ -1236,7 +1239,7 @@ dc.coordinateGridMixin = function (_chart) {

_chart.plotData();

if (_chart.elasticX() || _resizing || render) {
if (_chart.elasticX() && (!_chart.mouseZoomable() && !_rangeChart) || _resizing || render) {
_chart.renderXAxis(_chart.g());
}

Expand Down

0 comments on commit cb1918b

Please sign in to comment.