Victory: How to hide the labels representing the x-value at the bottom on VictoryCharts?

Created on 8 Oct 2017  路  9Comments  路  Source: FormidableLabs/victory

How to hide the labels representing the x-value at the bottom on VictoryCharts?

Most helpful comment

You should be able to do something along the lines of <VictoryAxis tickFormat={() => ''} />

All 9 comments

You should be able to do something along the lines of <VictoryAxis tickFormat={() => ''} />

By default VictoryChart will include two axis, so you will have to explicitly include VictoryAxis within VictoryChart so that you can pass props to it.

Gotcha. Works. Thanks. Is there any way to format the Y axis labels?

Let's say i have 3 numbers in the Y axis: 0.2, 0.4, 0.6.

1) How i can i make them display 0.20, 0.40, 0.50
2) How can I show more numbers? I tried using the range prop, but couldn't get it to work. Eg. I want to display 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90 1.0 instead of just 0.20, 0.4 and 0.60?
3) Is it possible to set a fixed amount of X labels displayed? Say I have 20 data points for X, but i only want to show 7 labels but still show 18 x values on the chart? In my case I have 18 data points for a 7 day period.

  1. Same way as hiding the x-axis, on the y-axis component, you can use the tickFormat prop, tickFormat={(datum) => datum.y.toFixed(2)}
  2. Check out the tickCount and tickValues props on VictoryAxis
  3. I think 2 might help with this. Also could do something with tickFormat as well.

@NgoKnows Thanks for jumping in on this. I'm going to close this issue now.

Thanks for the help :)

Thanks for help, too.

How can I hide the values/label showing data on line chart ?

How to represent minute values for x axis which can also adjusts as per the current hour

Was this page helpful?
0 / 5 - 0 ratings