question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect number of ticks after setting tickCount

See original GitHub issue

Do you want to request a feature or report a bug?

Possible bug?

What is the current behavior?

Not the right number of ticks

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: http://jsfiddle.net/qbmg1567/).

<XAxis
  dataKey="time"
  tickFormatter={formatShortDate}
  type="number"
  domain={['dataMin', 'dataMax']}
  tickCount={3}
  interval={0}
  padding={20}
/>

image

What is the expected behavior?

Expected 3 ticks but only have 2. From reading the docs, by setting interval to 0, it should show all 3 ticks.

Which versions of Recharts, and which browser / OS are affected by this issue? Did this work in previous versions of Recharts?

Mac OSX 10.12.6 Chrome Recharts: v1.0.0-alpha.6

Would be great if there was some deeper explanation of how ticks work.

Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

21reactions
genbitcommented, Jul 21, 2019

you need to have the following condition:

  • not set scale property
  • domain={[‘auto’, ‘auto’]}
  • type=“number”

than tickCount will work, as per:

https://github.com/recharts/recharts/blob/1fa433b89e67ea816c8dda11202d4c8cead25935/src/util/ChartUtils.js#L758

11reactions
ghostcommented, May 5, 2018

its not working for category axis, https://github.com/recharts/recharts/issues/50

try to use interval instead, <XAxis dataKey="date" interval={5} />

Read more comments on GitHub >

github_iconTop Results From Across the Web

recharts missing ticks or ticks are displayed wrong
I'm using the brush component of the library to zoom in on the chart and the problem with this implementation is that when...
Read more >
TickCount and Diagnostic.Stopwatch.Elapsed Return Wrong ...
But when we ran it on device with a 1 minute power off setting, TickCount and StopWatch returned incorrect(?) values after device comes...
Read more >
Tick count overflow - FreeRTOS
The tick count will eventually overflow and return to zero. This will not effect the internal operation of the kernel for example, ...
Read more >
QValueAxis Class | Qt Charts 6.4.1
This signal is emitted when the number of tick marks on the axis, specified by tickCount, changes. Note: Notifier signal for property tickCount....
Read more >
Tick Removal | Ticks - CDC
After removing the tick, thoroughly clean the bite area and your hands ... Putting it in alcohol,; Placing it in a sealed bag/container, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found