I’m facing an issue with the APEX Line Chart (V1.0.18) regarding data export. Despite configuring the categoryFormatter option as per the APEX documentation, the exported .csv file does not reflect the desired date format.
Current Export Format: Dates are formatted using .toDateString() (e.g., Tue Nov 26 2024).
Expected Export Format: I need the format dd/mm/yyyy HH:mm:ss in the .csv file.
Configured categoryFormatter in the chart options to format the date as dd/mm/yyyy HH:mm:ss.
{return new Date(x).toLocaleTimeString()}
or
{return new Date(x).toLocaleDateString()}
However, the .csv export still defaults to .toDateString()
It seems you are misunderstanding what is happening.
The docs ofc the perspective module showed only a sample. The fuction in the does not work on a different property.
for your csv properties the function should probably follow this:
valueFormatter : function (y) { return y }
categoryFormatter: function (x) { return new Date(x).toDateString() }
However note that for dates this might be different, since it seems igntion might send the formated date as X which might need a more elaborate new Date function to parse the string to a valid date object.
For debugging purposes i wonder if you see something inthe inspector log in the browser if you put in some logging.
categoryFormatter: function (x) { console.log(x); return new Date(x).toDateString() }
disclaimer i dont have the module, but i know something about javascript:)
Tried this: valueFormatter: function (y) { return y; }, categoryFormatter: function (x) { return new Date(x).toDateString(); } earlier, but Apex is not picking up the configs, and the console.logs function (x) { console.log(x); return new Date(x).toDateString() } are not getting generated.