apexcharts.js
apexcharts.js copied to clipboard
dataPointSelection > Can't seem to access x-axis or y-axis categories
Description
See screenshot below for my chart.
When I click on one of the data points, I've figured out how to access the series line and the data point clicked with this:
seriesClicked = config.w.config.series[config.seriesIndex];
valueClicked = config.w.config.series[config.seriesIndex].data[config.dataPointIndex];
I expected to be able to get the date by access the x-axis label with something like this:
dateClicked = config.w.config.xaxis.categories[config.dataPointIndex];
But the categories node is always empty. I expected to find the values I built in the chart:
xaxis: {
categories: ["Jan 14, 2024","Jan 15, 2024","Jan 16, 2024","Jan 17, 2024","Jan 18, 2024","Jan 19, 2024","Jan 20, 2024"],
Seems like a bug, or am I looking in the wrong place?
Steps to Reproduce
See above.
Expected Behavior
Set the categories in the appropriate node.
Actual Behavior
See above. The category nodes is empty.
Screenshots
Reproduction Link
https://codepen.io/KeanuTang/pen/vYPxppj
dateClicked = config.w.globals.categoryLabels[config.dataPointIndex];