Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vertical slider has tick values the wrong way #28

Open
wahlatlas opened this issue Feb 21, 2015 · 5 comments
Open

Vertical slider has tick values the wrong way #28

wahlatlas opened this issue Feb 21, 2015 · 5 comments

Comments

@wahlatlas
Copy link

Using the slider vertically you have the min-Value at the bottom and the max-Value at the top, however using an axis, even a custom one, results in the lowest tickValue at the top and highest tick-Value at the bottom, thus not corresponding to the data.

For my individual project I could fix this with changing to

axisScale = scale.copy().range([sliderLength, 0]);

but maybe this can be solved more universally to make that great slider even more awesome.

@PabloFerGon
Copy link

Sorry, but I don`t understand what you did. I have the same problem you had with the piece of code show below:
var slider = d3.slider().min(0).max(0.10).value(0.5).orientation("vertical").axis(d3.svg.axis().orient("right").ticks(6));
What would I need to add to get the right direction of the axis??
Thanks.

@wahlatlas
Copy link
Author

If you only use vertical sliders in your project you can change d3.slider.js
What is currently in line 163 there, you would change to

axisScale = scale.copy().range([sliderLength, 0]);

@PabloFerGon
Copy link

Many thanks.

@Naishav
Copy link

Naishav commented Jan 10, 2017

If condition to handle both horizontal & vertical sliders

if(orientation ==="vertical") // Copy slider scale to move from percentages to pixels axisScale = scale.ticks ? scale.copy().range([sliderLength, 0]) : scale.copy().rangePoints([0,sliderLength], 0.5); else axisScale = scale.ticks ? scale.copy().range([0, sliderLength]) : scale.copy().rangePoints([0,sliderLength], 0.5);

@CrystalSNS
Copy link

Thank you so much Naishav

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants