Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed interactive gridlines to take into account brush when drawing points on stacked area chart #2154

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SpencerWie
Copy link

Currently the drawn points on the interactive grid line of a Stacked Area Chart do no take into account when using brush on a StackedAreaWithFocusChart. The line chart does not have this issue, the code that corrects this in the line chart is absent for stacked area chart.

This change simply adds the logic that was done for the line chart:

var extent = focus.brush.extent() !== null ? (focus.brush.empty() ? focus.xScale().domain() : focus.brush.extent()) : x.domain();
var currentValues = series.values.filter(function(d,i) {
// Checks if the x point is between the extents, handling case where extent[0] is greater than extent[1]
// (e.g. x domain is manually set to reverse the x-axis)
if(extent[0] <= extent[1]) {
return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1];
} else {
return lines.x()(d,i) >= extent[1] && lines.x()(d,i) <= extent[0];
}
});

Into the StackedAreaChart.

To see this issue go to the example:

https://rawgit.com/novus/nvd3/master/examples/stackedAreaWithFocusChart.html

Then move the pan to all the way to the left. The dots on the grid line will match up, panning to the right will cause an ever growing offset of the drawn dots.

To check that the issue is fixed build this version and go to the same example: /nvd3/master/examples/stackedAreaWithFocusChart.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant