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

Stacked columns change width when showing or hiding series #5959

Closed
mattmacleod opened this Issue Nov 10, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@mattmacleod
Contributor

mattmacleod commented Nov 10, 2016

Expected behaviour

Showing or hiding series in a stacked column stock chart does not cause the width of the columns to drastically change.

Actual behaviour

A stacked column stock chart containing a hidden series displays extremely thin bars, ignoring ay configuration options.

Live demo with steps to reproduce

http://jsfiddle.net/z924q2jg/ (toggle a series to see this effect).

Affected browser(s)

All.

@mattmacleod

This comment has been minimized.

Show comment
Hide comment
@mattmacleod

mattmacleod Nov 10, 2016

Contributor

Just to provide a bit more context on this – this appears to be a regression introduced in 4.2.7, related to changes to data grouping, though I'm not sure exactly where.

The closestPointRange of the axis is derived from the closestPointRange of all series (

getClosest: function () {
), even those which are not visible.

However, data grouping is skipped when a series is not visible (

!groupingEnabled || !visible;
).

This causes the axis' closestPointRange to take the value of the lowest distance in any invisible series; in cases like the attached, this causes data grouping to be essentially disabled.

I'd be happy to raise a PR to fix this, but I'm not sure if it's more appropriate to remove the conditional !visible in dataGrouping.js or explicitly skip invisible series in Axis.js. Or if there's another, entirely better solution!

Contributor

mattmacleod commented Nov 10, 2016

Just to provide a bit more context on this – this appears to be a regression introduced in 4.2.7, related to changes to data grouping, though I'm not sure exactly where.

The closestPointRange of the axis is derived from the closestPointRange of all series (

getClosest: function () {
), even those which are not visible.

However, data grouping is skipped when a series is not visible (

!groupingEnabled || !visible;
).

This causes the axis' closestPointRange to take the value of the lowest distance in any invisible series; in cases like the attached, this causes data grouping to be essentially disabled.

I'd be happy to raise a PR to fix this, but I'm not sure if it's more appropriate to remove the conditional !visible in dataGrouping.js or explicitly skip invisible series in Axis.js. Or if there's another, entirely better solution!

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Nov 10, 2016

Collaborator

Yes, we should filter out hidden series in the getClosest function, but also take ignoreHiddenSeries into acccount. See

if (series.visible || !chart.options.chart.ignoreHiddenSeries) {
for a typical test.

Collaborator

TorsteinHonsi commented Nov 10, 2016

Yes, we should filter out hidden series in the getClosest function, but also take ignoreHiddenSeries into acccount. See

if (series.visible || !chart.options.chart.ignoreHiddenSeries) {
for a typical test.

TorsteinHonsi added a commit that referenced this issue Nov 11, 2016

Merge pull request #5961 from mattmacleod/master
Fixed #5959, hidden series affecting axis closest point calculation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment