3 Replies Latest reply on Jul 16, 2013 6:38 AM by Aldebaran47

    How to reverse HSlider values?

    BaileyBurger Level 1

      Greetings!

       

      I've got a panel that contains 5 different sliders allowing the user to set various thresholds. I'd like to convey to the user that moving sliders to the right will always yield a greater result, to the left a lesser result. But to do so, one of the sliders has to offer reversed / decreasing values. Is there a way to do this? In other words, can I have the slider values reading from left to right 50,40,30,20,10,0?

       

      Thanks,

        • 1. Re: How to reverse HSlider values?
          Barna Biro Level 3

          Hi there,

           

          I don't think there's a built in feature for what you want. My best hint would be to create your own component and make it function the way you want. You could try extending the HScroller and see if the method that control the measurement and the placement of data can be overriddent. If they can be overridden then all you need to do is reverse the way it calculates the values when you move the scroll head.

           

          With best regards,

          Barna Biro

          Blog: http://blog.wisebisoft.com

           

          EDIT: I just took a look and it seems that most of the stuff can be overridden so you should be able to replace the existing calculations with your own. I can't think of a better way to do this.

          • 2. Re: How to reverse HSlider values?
            _Natasha_ Level 4

            Hi,

             

            as a workaround for your task can set negative value and get abs from the value.

            So you need to inverse data: set minimum to -50 and max to 0.

            Also you need to set function dataTipFormatFunction and others to show user only positive values.

             

            Also you can create your own extendedSlider to reverse all data this way.

            • 3. Re: How to reverse HSlider values?
              Aldebaran47

              Hey there,

               

              I know it has been a long time since this issue has been posted. But since I found a workaround, I thought it could be nice for eventual people encoutering the same problem to come here finding the answer...

               

              Using the spark slider classes, HSlider for instance, the solution is utterly simple : just use layout mirroring with the layoutDirection property, and set it to rtl for "right to left" or ltr for "left to right" according to your needs.

               

              Cheers!