apexcharts.js
apexcharts.js copied to clipboard
xaxis labels formatter inconsistent arguments
Description
When options.xaxis.labels.formatter is provided, the arguments passed to the function are inconsistent. This is causing crashes when attempting to access "opts.w".
Steps to Reproduce
- https://codepen.io/andrewg_oz/pen/MWZeEaW
- View browser console log
Expected Behavior
The formatter is documented as having the arguments "value, timestamp, opts". I expect all calls to that function to be with arguments that are consistent on a per-chart basis. I expect value to be sensible for all calls, timestamp to be either undefined for all calls or sensible for all calls (not both), and opts to be the same for all calls (depending on what "i" is supposed to be).
Actual Behavior
The example exhibits five(!) different calls with varying arguments to the formatter:
- value is defined with an expected value, timestamp undefined, opts undefined
- value is defined, but a strange value, timestamp undefined, opts undefined
- value is defined with an expected value, timestamp defined, opts defined as an Object with i undefined, w defined, and dateFormatter defined
- value is defined with an expected value, timestamp defined, opts defined as an Object with i defined, w defined, and dateFormatter defined
- when hovering over the chart, value is defined, timestamp is defined as an Object - not a number - with properties "series, seriesIndex, dataPointIndex, and w", and opts is undefined
In short, calls to this formatter are a complete mess.
Reproduction Link
https://codepen.io/andrewg_oz/pen/MWZeEaW