Skip to content

Define array of values to be used as steps. #163

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

Closed
diegoponciano opened this issue Oct 29, 2015 · 8 comments
Closed

Define array of values to be used as steps. #163

diegoponciano opened this issue Oct 29, 2015 · 8 comments

Comments

@diegoponciano
Copy link

Sometimes I want to use a range with a non-linear list of steps.
Say I have a range from 0 to 60, and instead of equally sized steps, I want to step 5 by 5 until 30, and then 10 by 10 until 60.
I could manually define an array with these values: [5, 10, 15, 20, 25, 30, 40, 50].
There is a fork of an old version that does this, with a rz-slider-step-array option: https://github.com/hrishi1183/angular-slider-custom-rzslider-
Demo here: http://plnkr.co/edit/sUFdW4lulu2NQBvn9fq0?p=preview

@ValentinH
Copy link
Member

The fun fact is that I was actually thinking about this something like 5 hours ago :D
We can even imagine that the steps array could contain strings as step value: ['A', 'B', 'C']...
This could be added to the list of options once the refactoring of this library is merged into master (see ReadMe).

@diegoponciano
Copy link
Author

Nice!
I just subscribed to the refactoring pull-request, will be following how things go.

@ValentinH
Copy link
Member

OK, what's your opinion on it?

@diegoponciano
Copy link
Author

I agree it should be added to the list of options, after the refactoring.
About the implementation, I think there should be a separate option (maybe just step-array), where we would define a list of strings.
The fork I linked to uses a ng-repeat to show the ticks, but I don't know how that compare with the updateTicksScale approach.

@ValentinH
Copy link
Member

Actually, I was refering to your opinion abour the PR. ^^ I already have ideas for the implementation of step-array.

@ValentinH
Copy link
Member

I have started to implement it, it's pretty easy with the new version. Do you think it should be possible to give a custom translate function when providing a steps-array? As far as I think, I don't see a valid use case for it. In my current implementation, the internal translate function just returns the correct step from the array.

ValentinH pushed a commit that referenced this issue Nov 1, 2015
This is to ease to use of non linear/number steps. As suggested in #163
@ValentinH
Copy link
Member

Will be in 2.0.0 release.

ValentinH pushed a commit that referenced this issue Nov 11, 2015
This is to ease to use of non linear/number steps. As suggested in #163
@diegoponciano
Copy link
Author

Sorry for the delay.
I agree with you, it doesn't seem necessary to have a custom translate, I think steps-array will already provide enough flexibility.

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

No branches or pull requests

2 participants