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

How to use two values? #761

Open
rjsnh1522 opened this issue Aug 19, 2021 · 4 comments
Open

How to use two values? #761

rjsnh1522 opened this issue Aug 19, 2021 · 4 comments
Assignees
Labels
Help wanted Person asking for help

Comments

@rjsnh1522
Copy link

rjsnh1522 commented Aug 19, 2021

I have one array with count of users and other array with cost of that user.
example:
var users = [20, 50, 100, 250, 500]
var cost = [5, 15, 30, 50, 90]
It means when someone selects 20 users the label at the top should show 5, when someone selects 100 the top small icon should show 50.
the horizontal x would the users and the top small icon place should show the cost, I have used prettify and passed it a function but somehow it is changing the horizontal values to the cost.

I can directly change the text inside the html using On change method. but i m looking for some cleaner way of doing this.

Urgent help is required.

@IonDen
Copy link
Owner

IonDen commented Aug 20, 2021

Hi, it is impossible to have 2 different set of values at the same time, but instead you could use "custom marks" technique to show additional line of values at the bottom. Example: http://ionden.com/a/plugins/ion.rangeSlider/showcase.html#a_marks

@IonDen IonDen self-assigned this Aug 20, 2021
@IonDen IonDen added the Help wanted Person asking for help label Aug 20, 2021
@rjsnh1522
Copy link
Author

Thanks for response,
I will try that link but just to make my question more clear I posting an image and trying to explain again what I want.
slider

In this image, u can see that below the slider grid is there and have some values. [0, 250, 500, 750, 100]
and when u slide the slider the value in the blue HTML changes, but the value is from that range only.
I want to put something else there.

Please check the image. Please pardon the handwriting I m not used to iPad and have zero editing skills.

@rjsnh1522
Copy link
Author

Hi,

Somehow I managed to change your code and made it work like how I wanted.
I have only changed it for single slider

in ionRangeSlider I am passing one more option top_labels which is the array of the top labels in my case I want to show the price of the number of users. and I made changes in two places.

  1. when setting min max value in setMinMax there I checked if top_labels is not undefined. and its length is greater than zero. and inside that I set this.$cache.min.html(this.decorate(top_labels[0])); for min value
    this.$cache.max.html(this.decorate(top_labels[top_labels.length - 1])); for max value andit worked.

  2. In drawLabels i did almost same thing in type is single. and values_num is present. I did
    text_single = this.decorate(top_labels[this.result.from])
    this.$cache.single.html(text_single);
    else your code would work.

It is not a very clean way to do things, it's just a hack to make it work.
you can add this feature probably.

### Thanks for this awesome plugin.

@IonDen
Copy link
Owner

IonDen commented Aug 22, 2021

Great that you figured it out. 2.x branch will not receive any new features. I'm slowly working on 3.x and it will have plenty of them.

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

No branches or pull requests

2 participants