ticks() is a D3 continuous-scale method that returns representative values across a scale’s domain. Pass a desired tick count, then use the returned array to render labels and tick marks. section 8.6.1
Use the result to construct an axis:
- Estimate a tick count from available chart space, such as innerWidth divided by 100 pixels. section 8.6.1
- Call props.scale.ticks(numberOfTicks) to obtain domain values. section 8.6.1
- Map over the values, position each group with scale(tick), and display the value as text. section 8.6.1
Bottom-axis example
With a 300-pixel inner width, requesting one tick per 100 pixels produces [0, 5000, 10000]. Each value becomes a labeled mark on the axis. section 8.6.1
<ScatterplotReactControlled
margin={margin}
data={props.data.experience}
colorScale={colorScale}
/>
See ticks() used inside a React scatterplot whose axes and marks are rendered from scale-driven components. section 8.6.1
