roundSlider icon indicating copy to clipboard operation
roundSlider copied to clipboard

Support for multiple ranges in same slider

Open soundar24 opened this issue 7 years ago • 8 comments

Need to provide multiple range support in a single slider, and each range should be work independent. Check the below screenshot for reference: image Note: with the current version its difficult to achieve this. In the SVG version we can easily add multiple ranges.

Requested from here: http://roundsliderui.com/#comment-3128662149

soundar24 avatar Feb 02 '17 18:02 soundar24

Just checking, if there was any progress on this feature request... I want to use four handles to divide a circle into four portions... wonder if this is possible with the current version.

The default portions would be 25% each.. and the user will use the four handles to re-size each portion on the same slider.. Thanks in advance.

This is close to what I had in mind, just replace the slices with percentages.

https://www.taoeffect.com/blog/wp-content/uploads/2010/06/PerfectTestMachine.png

CryptoZorro avatar Jul 26 '20 14:07 CryptoZorro

@CryptoZorro I suspect you are expecting the multiple handles support like the below ticket (#44). Can you check the below demos and confirm: Demo 1: http://jsfiddle.net/soundar24/utqgufx0/6/ Demo 2: https://jsfiddle.net/soundar24/69np4Lcn/

Also if you want the partition kind of scenario then, recently I have provided the similar demo (ref). Can you check the below:

https://jsfiddle.net/soundar24/b2zt7yvf/

I believe the combination of both demos might be your requirement, can you please check and update me your comments.

soundar24 avatar Jul 26 '20 19:07 soundar24

@soundar24 Thank you very very much.. Yours is an amazing and unique plugin...

Had some hiccups, but managed to refer to the jsfiddle samples, and worked it out...

Here is the modified version: https://jsfiddle.net/akayy/x0z7fwk3

Again, thanks a ton for your help :-)

CryptoZorro avatar Jul 27 '20 07:07 CryptoZorro

@CryptoZorro great, you perfectly combined the samples.. here the only problem I can see is, the handles can crossed each other. but I believe for this scenario it shouldn't.

So I just updated the sample to restrict the handles with the adjacent handles, you can check this demo:

https://jsfiddle.net/soundar24/19snfxy8/

Also you can replace with any pie chart which fulfils your requirement. Cheers 👍

soundar24 avatar Jul 27 '20 09:07 soundar24

@soundar24 Thanks a ton, that was a big bonus... It's just perfect now :-) Hoorayyy

CryptoZorro avatar Jul 27 '20 14:07 CryptoZorro

Hi @soundar24 ,

Just one last hurdle. As the pie is dynamically generated with different slice counts, I'm trying to re-initialise the whole thing on a button click.

It works the first time, but when I click the button a second time (without touching the handles), something weird is happening.. I know I'm missing something w.r.t the destroy function, but spent hours and didn't really crack it..

In this jsfiddle snippet, I have thrown all the previous code into a button click - https://jsfiddle.net/akayy/fk6y1gh9/

Are you able to help here? Thanks again!

CryptoZorro avatar Jul 28 '20 03:07 CryptoZorro

@CryptoZorro yes you need to destroy the slider also, otherwise the slider keeps the same value and it won't trigger the valueChange event in the second time (since nothing was changed). So the chart won't re-plot properly.

Here I have updated the demo where it works fine:

https://jsfiddle.net/soundar24/ryjca8gf/

soundar24 avatar Jul 28 '20 10:07 soundar24

Awesome.. Yes, I think this is what I missed, so I can destroy this object when reinitializing.. Thanks a bunch bro!

sliderObj = $("#slider1").data("roundSlider");

CryptoZorro avatar Jul 28 '20 12:07 CryptoZorro