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

Fixes empty getElMarkers() for all series when any series has discrete markers and a global size is set #3715

Merged
merged 1 commit into from Mar 20, 2023

Conversation

idpaterson
Copy link
Contributor

@idpaterson idpaterson commented Mar 15, 2023

New Pull Request

When the markers.size config is set and any series has discrete markers, the result of getElMarkers() was an empty NodeList for all series. This prevented all markers in all series from reacting to hover events and the tooltip from positioning relative to markers.

Codepen where you can observe the tooltip and marker effects on hover by toggling the variables enableDiscrete and/or enableMarkerSize to false to modify the chart config.

This issue was introduced in v3.33.2 by removing the .apexcharts-series-markers class name when the chart has discrete markers. That change was made in order to add padding to discrete markers on sparklines in d6ae287. The original purpose of removing this class name was for charts with null values (#1252).

The fix looks for the selector .apexcharts-series-markers-wrap > * instead of .apexcharts-series-markers since the latter is not always available. Hopefully the two references above will help to identify any breaking changes or regressions since I could not tell whether the removal of this class was specifically targeting getElMarkers().

Though it does not directly address #3475 it may be related since fixing the hover markers may well lead to the same tooltip issue. A workaround for that issue is to configure markers: { size: 0.000001 } but without this pull request that results in a far more broken chart. With the change in this pull request the size config is a successful workaround for #3475.

In my case, discrete is used to hide markers (size: 0) for zero values because the presence of zero markers obscured small nonzero values.

I normally include unit tests with pull requests but I was unable to find relevant precedent for testing this type of change so instead the change was tested in Codepen with local overrides.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

…markers

This prevented markers from reacting to hover events and the tooltip from positioning relative to markers, issue introduced in v3.33.2 by removing the .apexcharts-series-markers class name when the chart has discrete markers.
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

2 participants