Skip to content

Commit

Permalink
Fixed issue with hiding series in right-hand y-axis
Browse files Browse the repository at this point in the history
If you clicked on the legend to hide the series that is in the right-hand y-axis, the domain-match function would actually break the left-hand domain, causing a load of console errors (and the left-hand series wouldn't display).
  • Loading branch information
andy-lee-eng committed May 20, 2019
1 parent caa5da1 commit 4140828
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default (domain1, domain2) => {
if (!isNumeric(domain1) || !isNumeric(domain2)) return;
if (!isMatchable(domain1) || !isMatchable(domain2)) return;

const ratio1 = originRatio(domain1);
const ratio2 = originRatio(domain2);
Expand All @@ -11,6 +11,6 @@ export default (domain1, domain2) => {
}
};

const isNumeric = domain => domain.length === 2 && !isNaN(domain[0]) && !isNaN(domain[1]);
const isMatchable = domain => domain.length === 2 && !isNaN(domain[0]) && !isNaN(domain[1]) && domain[0] !== domain[1];
const originRatio = domain => (0 - domain[0]) / (domain[1] - domain[0]);
const adjustLowerBound = (domain, ratio) => (ratio * domain[1]) / (ratio - 1);

0 comments on commit 4140828

Please sign in to comment.