carbon-charts icon indicating copy to clipboard operation
carbon-charts copied to clipboard

[Question]: Export Time series data from line chart

Open jmarenin opened this issue 2 years ago • 1 comments

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

jmarenin avatar Jun 24 '22 15:06 jmarenin

Any update on this?

jmarenin avatar Aug 24 '22 21:08 jmarenin

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

naegelin avatar Nov 16 '22 23:11 naegelin

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.

naegelin avatar Nov 17 '22 00:11 naegelin

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

naegelin avatar Nov 17 '22 00:11 naegelin

@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.

naegelin avatar Jun 14 '23 10:06 naegelin

I'm interested in this too.

Sheco avatar Jun 15 '23 00:06 Sheco

This'll soon be address by our locale interface

theiliad avatar Dec 09 '23 16:12 theiliad

You can also use tabularRepModal configs to customize values

https://charts.carbondesignsystem.com/documentation/interfaces/interfaces.BaseChartOptions.html#tabularRepModal

theiliad avatar Jan 18 '24 01:01 theiliad