react-vis icon indicating copy to clipboard operation
react-vis copied to clipboard

Non linear Y-axis ticks

Open simonnilsson opened this issue 7 years ago • 7 comments

Hi, I want to have an axis display ticks in a non-linear way i.e. 0, 20, 40, 60, 80 ,100, 150, 200. I can kind of accomplish this by setting the tickValues manually on the YAxis but the ticks still display where they would normally display, I want them to display with equal spacing and that chart takes this into account. Is this possible?

This is what I get now:

simonnilsson avatar Jul 04 '18 07:07 simonnilsson

I think what you are looking for is a log scale! Try setting yType="log" on the XYPlot component

mcnuttandrew avatar Jul 05 '18 19:07 mcnuttandrew

Hello Andrew, thanks for your response.

Setting the yType='log' did not work very well for me, it broke the rendering of the chart. I did however manage to get what I was after by setting yDomain=[0, 100, 200] and yRange=[350, 100, 0]. The downside to this is that yRange is dependent on the height of the chart, 400px in this case.

image

simonnilsson avatar Jul 08 '18 21:07 simonnilsson

I am pretty surprised by that, can you provide some more details on how doing a log scale broke your chart?

mcnuttandrew avatar Jul 10 '18 16:07 mcnuttandrew

I've just read this and seems exactly what you are doing @simonnilsson https://twitter.com/_Kcnarf/status/1019977425940344832

markov00 avatar Jul 20 '18 08:07 markov00

We don't really support that type of scale work (or at least i don't think we do? maybe try it and see, that has happened to me a few times (see the labeled-heatmap example)).

We've been very casually listing out version 2 features across various issues for a while, and in that vein I wonder if a total rewrite of the scales is necessary so that everything is brought closer to the d3 standard and there is less obfuscation around our internal representation of scales. Like i think there are enough tests now where that could probably happen without destroying everything? Doesn't really solve this issue, but thinkin thinkin

mcnuttandrew avatar Jul 20 '18 22:07 mcnuttandrew

the yType also broke mine, i have big gap range : [0,10,100,1000,10000]

dellwatson avatar Nov 02 '20 02:11 dellwatson

I am experiencing the same problem, here is simple reproduction snippet https://codesandbox.io/s/busy-pine-riy1f?file=/src/App.js

I don't know how to force the chart to display properly for logarithmic scale.

jwiewiorabsg avatar Jun 09 '21 07:06 jwiewiorabsg