xanderdeseyn / react-native-responsive-linechart

A customizable and responsive line or area chart for react-native
https://react-native-responsive-linechart.surge.sh
MIT License
202 stars 46 forks source link

Set horizontal axis in be in time (not number) #70

Closed benjaminle9x closed 3 years ago

benjaminle9x commented 3 years ago

How do I set the horizontal axis to be in time (E.g hh:mm)?

forevernggg commented 3 years ago

i want the same feature

BlackWild commented 3 years ago

In your <HorizontalAxis /> component you can use a label formatter like this:

<HorizontalAxis theme={{
  labels: { formatter: (v) => moment(v).format("H:mm") },
}} />

I use Moment.js for formatting but you can use anything you want!

xanderdeseyn commented 3 years ago

Like BlackWild explained, use any date lib to format your value to a date :)