fix: x-axis annotations missing on line/area/scatter charts (5.10.4 regression)#5201
Merged
Merged
Conversation
…5198) In 5.10.4, getStringX() changed from indexOf(x) to indexOf(String(x)) which breaks when categoryLabels contains numbers (e.g. line/area/scatter charts with convertedCatToNumeric=true and auto-generated integer labels). Fix by using findIndex with String() comparison on both sides, which correctly handles all type combinations (number labels + number x, string labels + string x, number labels + string x, string labels + number x). Agent-Logs-Url: https://github.com/apexcharts/apexcharts.js/sessions/86796618-e73e-43c6-a6b4-237395ba6ad1 Co-authored-by: junedchhipa <17950663+junedchhipa@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix line chart x-axis annotations in version 5.10.4
fix: x-axis annotations missing on line/area/scatter charts (5.10.4 regression)
Apr 5, 2026
junedchhipa
approved these changes
Apr 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In 5.10.4, a type-safety change in
getStringX()broke x-axis annotations on line, area, and scatter charts that use simple array series data — annotations were silently not rendered.Root cause
Config.jsautomatically setsconvertedCatToNumeric = truefor line/area/scatter charts. This causes_generateExternalLabelsto produce numericcategoryLabels(e.g.[1, 2, 3, 4, 5]via the defaultMath.floorformatter). The 5.10.4 change converted the search value to a string before theindexOflookup:indexOf('2')returns-1in a number array, so the annotation position resolves to index0, the DOM lookup fails, andgetStringXreturns the raw annotation value (e.g.2) as a pixel offset — placing the line at the far left edge or causing it to be clipped entirely.Fix
Convert both sides to strings before comparing, which correctly handles all type combinations (number labels + number x, string labels + string x, cross-type):
Test
Added a regression test verifying that an
xaxisannotation with a numericxvalue renders on a line chart with simple array data.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
jsfiddle.net/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)registry.npmmirror.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install --legacy-peer-deps(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install --prefer-offline conf�� get --global rgo/bin/git credential.helpegrep(dns block)If you need me to access, download, or install something from one of these locations, you can either: