Slider between positive and negative values - flutter

I'm using syncfusion_flutter_sliders package. Is it possible to display a slider where you choose a value between positive and negative? E.g. the default value is 0 - we can go left on the slider and select a value between 0 and -1, or we can go right and select a value between 0 and 1.
I would like the tack to highlight only the left or right side of the thumb.
An example in the screenshot below:
EDIT:
The best answer for this question is here: https://stackoverflow.com/a/75114671/6942599

Related

How to hide Pivot Points HL if outside a range of candles count

I am trying to modify the TradingView "Pivot Points HL" indicator code to hide pivots if the Right value (count of new candles to the right) is outside a range. For example, If I set it to "10/15" now it just prints the Pivot as soon as 15 candles appeared and they are all lower (for pivot high). I want to make it basically go back and hide it if that count say becomes "30".. so "10/30" will hide the pivot (so a Pivot will be shown as long as the right count of candles is >= 10 and <= 30). Is there a way to do that in Pinescript? What modifications to make on the Pivot Points HL source code to achieve that? Thanks.

How to make the set of possible values for UISlider an open interval?

I am using a UISlider to allow a user to choose among four options. I ask the user a question of the form "how much do you like this thing?", they respond by moving the slider, and then behind the scenes I map the value of the slider to one of four elements of an array. I want the first quarter of the slider to correspond to the first element of the array, the second quarter of the slider to correspond to the second element of the array, and so on.
By default, the range of a slider is [0,1], so one natural way to do what I want is:
let index = Int(rangedSlider.value * Float(currentAnswers.count) )
assuming that rangedSlider is the name of the outlet connected to the UISlider in question, and currentAnswers is the array of answers I'm mapping to. The issue with this is that if the user moves the slider all the way to the right, that sets the value of the slider to 1, which maps to index 4 by the formula above (assuming there are four answers). I can always add an additional line of code that takes care of that case separately,
if rangedSlider.value == 1 { index = currentAnswers.count - 1 }
but I prefer a one line solution.
I can also set the max value of the slider to 0.99 in the Storyboard and stick with the first line of code I wrote, but I want to know: is there a built-in way to make the range of UISlider values an open interval? Is there a better way to get the behavior I want?
Is this any more complicated than:
let index = Int(rangedSlider.value * Float(currentAnswers.count - 1))
Or have I misunderstood the problem you're having?
That way your index will be returned as a number between 0 and 3 with 0 corresponding to the first answer and 3 corresponding to the fourth answer.

How to convert axis from nanometer to angstrom in xmgrace?

I have plotted the graph in which the x-axis values are in nanometer. But i want to the x-axis in angstroms.
How can i do this? From axis transform in Xmgrace?
Any suggestions are appreciated.
I think you are asking how to rescale the values of your x data series by a multiplication factor. In your case, in order to convert nm to angstrom you would multiply the x data by 10, e.g. 0.1 nm would become 1 Angstrom.
In the xmgrace GUI menu click Data > Transformations > Evaluate Expression
Method 1: Modifying the original set
In both the "Source" and "Destination" panes select the same set you want to convert so it is highlighted.
In the Formula box type X = X*10 then click Apply.
Method 2: Creating a new set first
On either the "Source" or "Destination" pane right-click on the existing set and Duplicate it.
Now select the original set on the left, and the new set on the right.
In the Formula box type X = X*10 then click Apply.
You can now select either the original or transformed set and hide the other one.
Finally...
In both Methods, now you can set your x axis label to display the updated units.

Interface variables - sliders affecting sliders

Let's say I have two sliders on my interface. Slider one goes from 0-500 and slider two goes from 0-100.
Is there anyway of setting it so that the value of slider one influences the possible values for slider two. So if I set slider one to 500, slider two can only be values from 0-30, for example.
Alternatively it would not necessarily have to be a slider affecting another slier, it could be a button. So if I have buttons A and B, if I select A the slider can be 0-10 but if I select B only 20-50.
Bit of a strange query I admit, I've just been tasked with making an interactive "model" for kids to try out different systems.
Thanks for taking the time to read this.
Yes, you can do this. Example: make 3 sliders: test0, test1, test2. Let the min and max values of test0 be test1 and test2. Let the min and max values of test1 be 0 and 5, and set a value of 1. Let the min and max values of test2 be 95 and 100, and set a value of 99. Your test0 slider will now work as hoped.
BUT what happens if you make the min and max values of test0 to test2 and test1? OK, you get odd behavior, which is likely to look broken to your "kids". So ... this arrangement is not a good one. If you describe your goals in more details, maybe we can find a better solution.

how to fix interval on UISlider,iphone

I have Slider,which works perfect.
But what i am trying to do is,
for ex, min =0 and max=50 and x=0
every time i slide or use buttons to change the value of slider, the interval should be of 5 only.
i.e x should be equal to only 0,5,10,15.....50
Suggestions.
Thanks
In the callback (value changed) - read the value, round it up or down to the nearest increment of 5, then set the slider to your preferred value. That way, it will 'jump' between your preferred values.