mirror of
https://github.com/gwm17/implot.git
synced 2024-11-22 18:28:53 -05:00
add quick fix for fitting data when data is a flat line (see #50)
This commit is contained in:
parent
bb2ff2aea7
commit
70f56d8a40
20
implot.cpp
20
implot.cpp
|
@ -161,14 +161,14 @@ const char* GetMarkerName(ImPlotMarker marker) {
|
|||
case ImPlotMarker_None: return "None";
|
||||
case ImPlotMarker_Circle: return "Circle";
|
||||
case ImPlotMarker_Square: return "Square";
|
||||
case ImPlotMarker_Diamond: return "Diamond";
|
||||
case ImPlotMarker_Up: return "Up";
|
||||
case ImPlotMarker_Down: return "Down";
|
||||
case ImPlotMarker_Left: return "Left";
|
||||
case ImPlotMarker_Right: return "Right";
|
||||
case ImPlotMarker_Cross: return "Cross";
|
||||
case ImPlotMarker_Plus: return "Plus";
|
||||
case ImPlotMarker_Asterisk: return "Asterisk";
|
||||
case ImPlotMarker_Diamond: return "Diamond";
|
||||
case ImPlotMarker_Up: return "Up";
|
||||
case ImPlotMarker_Down: return "Down";
|
||||
case ImPlotMarker_Left: return "Left";
|
||||
case ImPlotMarker_Right: return "Right";
|
||||
case ImPlotMarker_Cross: return "Cross";
|
||||
case ImPlotMarker_Plus: return "Plus";
|
||||
case ImPlotMarker_Asterisk: return "Asterisk";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
@ -1604,6 +1604,10 @@ void EndPlot() {
|
|||
if (gp.FitY[i] && !ImHasFlag(plot.YAxis[i].Flags, ImPlotAxisFlags_LockMax) && !NanOrInf(gp.ExtentsY[i].Max)) {
|
||||
plot.YAxis[i].Range.Max = gp.ExtentsY[i].Max;
|
||||
}
|
||||
if ((plot.YAxis[i].Range.Max - plot.YAxis[i].Range.Min) <= (2.0 * FLT_EPSILON)) {
|
||||
plot.YAxis[i].Range.Max += FLT_EPSILON;
|
||||
plot.YAxis[i].Range.Min -= FLT_EPSILON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user