carbon-charts
carbon-charts copied to clipboard
[Question]: Export Time series data from line chart
Question for Carbon
I am currently trying to export the data that I am graphing on the carbon design line chart. However, when I export the data, instead of exporting the timestamp value such as '2022-06-23T17:50:00' it instead exports as 'June 24, 2022'. Is there any way to change this?
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Any update on this?
I can confirm this is the case for me as well. Also when one hovers over the time series line chart the tooltip only shows the day even if the granularity of the data is minute, hour, etc.
The behavior can be seen on the demo page here: https://codesandbox.io/s/5v1s9b?file=/App.svelte
After a bit more digging it appears the problem lies in two places:
For the tabular data modal / export feature referenced by @jmarenin the following line needs to be fixed: https://github.com/carbon-design-system/carbon-charts/blob/master/packages/core/src/model/cartesian-charts.ts#L75
For the issue with the tooltip: https://github.com/carbon-design-system/carbon-charts/blob/master/packages/core/src/components/essentials/tooltip.ts#L253
and
https://github.com/carbon-design-system/carbon-charts/blob/master/packages/core/src/components/essentials/tooltip.ts#L259
I will see if I have some bandwidth this week to submit a PR.
If anyone has any thoughts as to the proper representation of the date please let me know. ScaleType is called "TIME" so rationally it should probably reflect an actual date + time format such as :
'MMM d, yyyy HH:mm:ss'
While the above is nicely formatted for humans it isn't a great datetime format for machines as say epoch or
yyyy-MM-dd'T'HH:mm:ss*SSSZZZZ
@theiliad This issue is approaching 1 year and we still don't have TIME level precision in chart tooltips or tabular data modal / csv exports making carbon charts meaningless for time series data. If carbon charts should only ever be used to represent day level data without time precision I think we should update the Carbon Design System documentation and tutorial and be explicit about it.
I'm interested in this too.
This'll soon be address by our locale
interface
You can also use tabularRepModal
configs to customize values
https://charts.carbondesignsystem.com/documentation/interfaces/interfaces.BaseChartOptions.html#tabularRepModal