Missing X ticks for time series plot with gaps between data
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
See codesandbox example. Even trying the nebulous attributes tickInterval and tickCount you can’t get x axis tick marks to show up during the time of missing data. Huge gaps on the axis and it looks wrong and users would still like to interpolate data between collected data points, and need a timestamp (ie x axis tick).
What is expected?
Equally spaced tick marks between the first and last.
What is actually happening?
No tick marks when there are no data points
Environment | Info |
---|---|
Recharts | v1.8.5 |
React | 16.8.6 |
System | Ubuntu 18.04 |
Browser | chrome |
IF and ONLY IF you set domain={[‘dataMin’, ‘dataMax’]}, which you have to with a timeseries. If plot a non-time series you get the same issue but playing with tickInterval and tickCount you can get something OK, but that’s not useful in a reusable component.
const data = [
{ x: 5, y: 10 },
{ x: 8, y: 8 },
{ x: 10, y: 5 },
{ x: 12, y: 7 },
{ x: 15, y: 15 },
{ x: 40, y: 10 }
];
const SampleChart = props => {
return (
<LineChart width={500} height={400} data={data}>
<XAxis
dataKey="x"
type="number"
// tickInterval={0} tickCount={10}
domain={["dataMin", "dataMax"]}
/>
<YAxis />
<Line dataKey="y" type="monotoneX" stroke="red" />
</LineChart>
);
};
Tried it with latest v2 beta and same issue.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:7
Top Results From Across the Web
How to plot a time-series scatterplot showing missing y-axis ...
Essentially I would like to see the above scatterplot with gaps representing the periods without salinity data so that the date/time scale is ......
Read more >Gallery: Times Series Missing Data Visualizations
There are multiple different plots for (univarate) time series missing data available in the imputeTS package. These can be grouped in the ......
Read more >How to deal with missing data in line charts
Sometimes, missing values in a line chart will create a gap in the line. In this tutorial, you'll learn how to draw an...
Read more >Query on time-series plot - tidyverse - RStudio Community
It did remove missing days but, the x-axis date is not appropriate. Please see below photo of a graph. I might did some...
Read more >Missing dates in time series are not showing blanks in x-axis
I have gaps in the date, but want my chart to reflect the gap. ... How do I show the x-axis with missing...
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
@ashin-krj @shibjo @ferrao @fstephany
the workaround here is to explicitly set ticks property like
ticks={[195, 255,315,375,425]}
but I want to calculate it automatically, not manuallyHi All, Did anyone found any workaround for this problem? I am also facing the same issue. The ticks render correctly if the domain is set to [‘auto’,‘auto’], otherwise not.