esnet / react-timeseries-charts

Declarative and modular timeseries charting components for React
http://software.es.net/react-timeseries-charts
Other
865 stars 285 forks source link

Remove the time from the tracker/tooltip? #440

Open acomito opened 4 years ago

acomito commented 4 years ago

❔Question

I'm looking to format the time on the tooltip. Right now I'm using a scatter plot on top of a line chart

Screen Shot 2020-03-25 at 12 31 15 PM

I see a few props but none seemed to work... trackerShowTime, showTime, etc... I tried passing them into ScatterChart, CartRow, and ChartContainer but they didn't seem to effect the tooltip's datetime format.

Your Environment

"react-timeseries-charts": "^0.15.5",

acomito commented 4 years ago

Maybe related to this

https://github.com/esnet/react-timeseries-charts/issues/286

brandly commented 4 years ago

this doesn't appear possible. TimeMarker has a showTime prop

https://github.com/esnet/react-timeseries-charts/blob/aa9c9b368100d78337b562d9e2833f2d90d9de3d/src/components/TimeMarker.js#L183-L186

which defaults to true.

https://github.com/esnet/react-timeseries-charts/blob/aa9c9b368100d78337b562d9e2833f2d90d9de3d/src/components/TimeMarker.js#L213

when it's rendered by ChartContainer, no prop is passed thru, so we're locked into the default value:

https://github.com/esnet/react-timeseries-charts/blob/aa9c9b368100d78337b562d9e2833f2d90d9de3d/src/components/ChartContainer.js#L424-L435

brandly commented 4 years ago

i guess it might be possible to not specify a tracker on the ChartContainer, and then render your own TimeMarker with showTime=false. the official TimeMarker is rendered with this surrounding transform, so i'm not sure if there would be alignment issues:

https://github.com/esnet/react-timeseries-charts/blob/aa9c9b368100d78337b562d9e2833f2d90d9de3d/src/components/ChartContainer.js#L419-L424

i'll try to loop back if i go down this route, but it's not a high priority at the moment.