`SetupAxisLimitsConstraints()`'s strange behavior?
- Dominant language
- C++
- Stars
- 6.2k
- Forks
- 693
- PR merge metrics
- No merged PRs in 30d
Description
I'm having trouble figuring out the behavior of `SetupAxisLimitsConstraints()`. As I understood, which may well be entirely wrong, calling `SetupAxisLimitsConstraints(...)` was roughly equivalent to calling `SetupAxisLimits(..., ImPlotCond_Always)`. However, this does not seem to be the case, at least for the very first frame: using `SetupAxisLimits()` with the `_Always` condition is instantly taken into account, while the `*Constraints()` version needs another frame to work as expected.
```cpp
const double maxValCount = 4.0;
if (ImPlot::BeginPlot("Overlay", ImVec2(-1, -1), ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect)) {
ImPlot::SetupAxes("X", "Y");
// Testing either of the following lines:
ImPlot::SetupAxisLimits(ImAxis_X1, 0.0, maxValCount, ImPlotCond_Always);
ImPlot::SetupAxisLimitsConstraints(ImAxis_X1, 0.0, maxValCount);
ImPlot::SetupAxisLimits(ImAxis_Y1, 0.0, 100.0, ImPlotCond_Once);
ImPlot::SetupMouseText(ImPlotLocation_NorthEast);
// Plotting 50, 75, 25, 10 & 50 with lines
// Plotting 15, 30, 0, 60 & 40 in shaded
ImPlot::EndPlot();
}
```
---
With `ImPlot::SetupAxisLimits(ImAxis_X1, 0.0, maxValCount, ImPlotCond_Always);`, on the very first frame:

---
With `ImPlot::SetupAxisLimitsConstraints(ImAxis_X1, 0.0, maxValCount);`, still on the very first frame:

Rendering another frame, we get the expected result:

---
While it's not critical, it was not something I expected. Is it a bug, or am I missing something?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.