Custom ticks of XAxis fixed
See original GitHub issueDo you want to request a feature or report a bug?
It’s more of an implementation problem
What is the current behavior?
I tried <XAxis type="number" ticks={['09:00', '10:00', '11:00']} />
but both graph and the xaxis disappear
What is the expected behavior?
I want the XAxis to display fixed ticks like different hour in a day, and each coming new data will represent a seconds of it (much like of an stock chart)
Which versions of Recharts, and which browser / OS are affected by this issue? Did this work in previous versions of Recharts?
I am using "recharts": "^1.0.0-alpha.6"
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:13 (1 by maintainers)
Top Results From Across the Web
ggplot2 axis ticks : A guide to customize tick marks and labels
ggplot2 axis ticks : A guide to customize tick marks and labels · Data · Example of plots · Change the appearance of...
Read more >Add custom tick marks to a SAS graph - The DO Loop
Specify custom labels for the ticks, including symbols such as π. You can accomplish these tasks by using options on the XAXIS and...
Read more >Specify Axis Tick Values and Labels - MATLAB & Simulink
Customize the tick values and labels along an axis, such as editing the tick value placement or modifying the tick label text and...
Read more >Chart.js - add custom, finite set of ticks at specific positions ...
I am trying to create a Chart.js line chart with a set number of ticks at fixed positions on the Y-axis. The Y-axis...
Read more >Customizing Ticks | Python Data Science Handbook
The tick marks are no exception. Each axes has attributes xaxis and yaxis , which in turn have attributes that contain all the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@TuanDSE62171 I read some other tickets and found a way to do this. The idea is to treat time as
number
(as you have specified in XAxis’s type) and to explicitly supplydomain
,ticks
andtickFormatter
. Working example:Then define
XAxis
like this:Using
interval
didn’t work for me - I got an empty axis whatever I did. Also, addingscale="time"
led to empty axis.Result:
As far as I’m concerned, my issue is solved. Hope it helps.
@dreamsparkx @veddermatic did you guys try setting the interval to 0?
http://recharts.org/en-US/api/XAxis#interval