Skip to content

Commit

Permalink
do not apply y axis domain unless elasticY or new
Browse files Browse the repository at this point in the history
specifically, when resizing we were applying domain+range
this is not appropriate when !elasticY

fixes #1056
  • Loading branch information
gordonwoodhull committed Dec 4, 2015
1 parent 7930bdd commit d1c087d
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/composite-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,16 @@ dc.compositeChart = function (parent, chartGroup) {
}

function prepareRightYAxis (ranges) {
if (_chart.rightY() === undefined || _chart.elasticY() || _chart.resizing()) {
if (_chart.rightY() === undefined) {
_chart.rightY(d3.scale.linear());
}
_chart.rightY().domain([ranges.ryAxisMin, ranges.ryAxisMax]).rangeRound([_chart.yAxisHeight(), 0]);
var needDomain = _chart.rightY() === undefined || _chart.elasticY(),
needRange = needDomain || _chart.resizing();
if (_chart.rightY() === undefined) {
_chart.rightY(d3.scale.linear());
}
if (needDomain) {
_chart.rightY().domain([ranges.ryAxisMin, ranges.ryAxisMax]);
}
if (needRange) {
_chart.rightY().rangeRound([_chart.yAxisHeight(), 0]);
}

_chart.rightY().range([_chart.yAxisHeight(), 0]);
Expand All @@ -166,11 +171,16 @@ dc.compositeChart = function (parent, chartGroup) {
}

function prepareLeftYAxis (ranges) {
if (_chart.y() === undefined || _chart.elasticY() || _chart.resizing()) {
if (_chart.y() === undefined) {
_chart.y(d3.scale.linear());
}
_chart.y().domain([ranges.lyAxisMin, ranges.lyAxisMax]).rangeRound([_chart.yAxisHeight(), 0]);
var needDomain = _chart.y() === undefined || _chart.elasticY(),
needRange = needDomain || _chart.resizing();
if (_chart.y() === undefined) {
_chart.y(d3.scale.linear());
}
if (needDomain) {
_chart.y().domain([ranges.lyAxisMin, ranges.lyAxisMax]);
}
if (needRange) {
_chart.y().rangeRound([_chart.yAxisHeight(), 0]);
}

_chart.y().range([_chart.yAxisHeight(), 0]);
Expand Down

0 comments on commit d1c087d

Please sign in to comment.