mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-14 16:59:54 +02:00
PlotHistogram: Fixed zero-line position when manually specifying min<0 and max>0. (#4349)
+ amended demo tweaks by ocornut
This commit is contained in:
committed by
ocornut
parent
03ce17f0a5
commit
eb6c16d3dd
@ -6471,7 +6471,7 @@ int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_get
|
||||
float v0 = values_getter(data, (0 + values_offset) % values_count);
|
||||
float t0 = 0.0f;
|
||||
ImVec2 tp0 = ImVec2( t0, 1.0f - ImSaturate((v0 - scale_min) * inv_scale) ); // Point in the normalized space of our target rectangle
|
||||
float histogram_zero_line_t = (scale_min * scale_max < 0.0f) ? (-scale_min * inv_scale) : (scale_min < 0.0f ? 0.0f : 1.0f); // Where does the zero line stands
|
||||
float histogram_zero_line_t = (scale_min * scale_max < 0.0f) ? (1 + scale_min * inv_scale) : (scale_min < 0.0f ? 0.0f : 1.0f); // Where does the zero line stands
|
||||
|
||||
const ImU32 col_base = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLines : ImGuiCol_PlotHistogram);
|
||||
const ImU32 col_hovered = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLinesHovered : ImGuiCol_PlotHistogramHovered);
|
||||
|
Reference in New Issue
Block a user