Fixes empty getElMarkers() for all series when any series has discrete markers and a global size is set #3715
+4
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New Pull Request
When the
markers.size
config is set and any series has discrete markers, the result ofgetElMarkers()
was an emptyNodeList
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/orenableMarkerSize
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 targetinggetElMarkers()
.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
Checklist: