victory icon indicating copy to clipboard operation
victory copied to clipboard

Unable to display only one Tick on Victory Axis

Open kmasila00 opened this issue 9 years ago • 5 comments

The scenario I would like to solve is when i have only one data point on a time scale for a scatter chart (or even a line chart), i want to be able to display just one tick on the x axis. I tried using tickValues and passing it an array of one value, but that didnt work. Any suggestions?

screen shot 2017-10-11 at 11 10 22 am

kmasila00 avatar Oct 11 '17 15:10 kmasila00

@kmasila00 I will look into why using just a single tickValue is failing. In the meantime, you can style your ticks so that only one is displayed like style={{ tickLabels: { fill: (tick) -> tick === myData[0].x ? "black" : "transparent" } }}

boygirl avatar Oct 11 '17 20:10 boygirl

@kmasila00 Actually, I'm not able to reproduce the issue you're seeing with single element tickValue arrays not working.

Working single value arrays https://jsfiddle.net/boygirl/shpfoyjw/1/

With Dates: https://jsfiddle.net/boygirl/shpfoyjw/2/

I'm going to close this issue for now, but I'm happy to re-open it if you can provide more details to reproduce the error you're seeing.

boygirl avatar Oct 11 '17 20:10 boygirl

Hey thanks for getting back to me so quickly. I appreciate the help. The conditional style was actually is more useful for my scenario.

kmasila00 avatar Oct 13 '17 16:10 kmasila00

@boygirl I'm able to reproduce. If there is no data and the only tickValue is greater than 1 it crashes with Uncaught TypeError: Cannot read property 'axis' of undefined.

https://jsfiddle.net/o11mos48/

If you put tickValues={[1, 2]} it works, or tickValues={[1]} it works. Sounds like a bug.

Should you reopen or I file another issue?

Kerumen avatar Nov 08 '17 16:11 Kerumen

Im experiencing the same issue

adamabeshouse avatar May 16 '18 19:05 adamabeshouse