Closed olivier-gerard closed 11 months ago
Hi, Here is my fix, not creating a pull request for a 2-lines change.
In implot_internal.h, replace
void PullLinks() {
if (LinkedMin) { SetMin(*LinkedMin,true); }
if (LinkedMax) { SetMax(*LinkedMax,true); }
}
by
void PullLinks() {
if (LinkedMin && LinkedMax) { SetRange(*LinkedMin, *LinkedMax); }
else if (LinkedMin) { SetMin(*LinkedMin,true); }
else if (LinkedMax) { SetMax(*LinkedMax,true); }
}
It would be nice if you could incorporate it br Olivier
Hello, I am using SetupAxisLinks() to change the type of physical quantity used for an axis (my data can be plot against time or distance, with mathematical conversion between both X axis). At each frame I multiply the X axis data by the correct factor to scale it to the selected physical quantity. If the graph is zoomed on a specific area I keep it when changing of X axis unit (eg let's say I zoomed on a peak at 49mm, when changing of unit the plot remains centered on the same peak, which is now located at 68 us). To do this I store the limits of the plot and when changing of physical quantity I multiply it by the correct factor and SetupAxisLinks() does the job.
This works pretty well, but fails in one case. When changing axis limits from eg [20, 30] to [35, 70] the min change is refused. This is due to the sequential checking in ImPlotAxis::PullLinks and the new min being larger than the old max (35 > 30 so Range.Max - _min is negative). Would it be possible to have PullLinks() applying both min and max values at the same time, if both are defined ?
Regards Olivier