Open Devanshu008 opened 3 years ago
I had to use moment.unix(v).format("MMM DD") to work.
Hello friends, Thanks @pillaedu, your solution helped me a lot. But I encontered other problem. My data is in daily form and string format (Easily I can convert string to unix, this is not problem). But when I use my daily dates (for example 13 dates) to plot, it does not show entire and inside the width of the plot. This stretches infinitely towards the positive x-axis. I think two posible parameter ar involved; first maybe unix shows seconda by second in the plot or maybe I have to define well the x-domain parameter. Look the picture below (Whit numeric data en x-axis works well, even if I don't configure teh x-domain parameter). Could you tell me What I am doing wrong? or tell me some tips. Thank you.
Hello again, I have found the solution to my problem before. First at all i am working whit horizontal scroll graph. So it can not show day by day because when I use unix (method proposed by @pillaedu), react-native-responsive-linechart takes dates second by second. In my case dates are day by day, then the line extended to positive infinity until the next day was found. You only have to set in the "viewport" parameter the number of seconds that elapse in one day (86400) and then multiple by the number of grids in the horizontal axis that you want the graph show. Thats all. Then you get as I show below.
I want to Get X-axis data in Date Format. I used "formatter: (v) => moment(v).format("MMM DD") }" in Horizontal Axis but it didn't work.