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

Heatmap cell borders disappear on hover (inconsistent with documentation) #17856

Closed
neillrobson opened this issue Oct 17, 2022 · 2 comments · Fixed by #17896
Closed

Heatmap cell borders disappear on hover (inconsistent with documentation) #17856

neillrobson opened this issue Oct 17, 2022 · 2 comments · Fixed by #17896

Comments

@neillrobson
Copy link

Expected behaviour

When a heatmap chart's series.heatmap.marker.states.hover.lineColor is left unset/unspecified, the hover state of a given cell should have the same line (border) color as the normal/default state.

I assume this behavior is expected based on the documentation:

Actual behaviour

When lineColor for the heatmap chart's hover state is left unspecified, the hovered cells on a heatmap lose their border altogether.

Live demo with steps to reproduce

https://jsfiddle.net/jm7huncp/

  • Note that, by default, hovering over the cells causes that cell's border to disappear
  • A workaround is to add lineColor explicitly to the hover state (uncomment that line in the code)
  • Back before Highcharts 8.1, when using borderColor, the color inheritance across states worked in a manner consistent with the documentation

Product version

Highcharts v10.2.1 (current as of writing)

Affected browser(s)

  • Chrome (at least: this is the only browser I tested so far)
@raf18seb
Copy link
Contributor

Hi @neillrobson, thank you for reporting the issue!

lineColor is reset on hover in the pointAttribs method (the stroke is undefined so the color is set to 'none').

Workaround: if no marker states options are found, use stroke for a normal state.
Demo: https://jsfiddle.net/BlackLabel/e0qwLtyu/

@neillrobson
Copy link
Author

Ah, that makes a lot of sense!

It looks like, based on your demo JSFiddle, the relevant line of code in the library that needs to be updated is here. Does that look correct to you?

If so, I may have the bandwidth in the next few days to create a pull request with this fix (alongside unit test updates & whatever else may be necessary). Let me know if that would be helpful and I can try to make time for contributing.

neillrobson added a commit to neillrobson/highcharts that referenced this issue Oct 19, 2022
…ained unset in state config.

Previously, when the `lineColor` for a given heatmap marker state was
left undefined, the stroke got reset entirely rather than retaining the
default value. For example, if `lineColor` was not specified in the
heatmap's hover state (when other fields for that state were defined),
then the cell borders would disappear upon hovering on a given data
point.

This patch adds a null check on the state option object's `lineColor`
field, and only assigns it to the point's stroke attribute if it is
defined. Consequently, when undefined, the stroke retains its default
(normal state) value, in accordance with the documented behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants