Closed tobiasht closed 1 year ago
It also struggles a lot, when you toggle between different min and max ranges. I think both of these issues can be fixed by scaling this values better. I attahced the formula i used in my code. Maybe you can implement this within the widget itself?
double normalize(
double oldMin,
double oldMax,
double? value, {
double newMin = 0,
double newMax = 100,
}) {
if (value == null) return newMin;
if (oldMax - oldMin == 0) return 0;
return (((value - oldMin) * (newMax - newMin)) / (oldMax - oldMin)) + newMin;
}
Thank you @tobiasht for that 💪🏻 I will try to make some improvements in the upcoming version.
I will post updates here.
That would be awesome. I'm in a situation where I'd need to set the max value to 0 and dynamically change the min value. The min value needs to be negative.
This was implemented/fixed by @dino-keskic in #7 and released in version 0.4.3 💪🏻.
If there are further problems, please reopen this issue.
Awesome! thank you very much! I'll test it now
The package currently does not support negative values. I would be great to add some scaling to the inputs to support this.
The example values that i used: min: -3000, max: 3000, value: -750,