From 625dcdbc892fe4e958950ab6326d47dff1a3acf9 Mon Sep 17 00:00:00 2001 From: Samuele Mazzi Date: Wed, 6 Nov 2024 11:20:15 +0100 Subject: [PATCH] plot: store new axis id when automatically deduced Also, remove useless `_dirty` variable from `mvPlotAxisConfig` struct --- src/mvPlotting.cpp | 7 +++---- src/mvPlotting.h | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mvPlotting.cpp b/src/mvPlotting.cpp index cf5156bd4..2dae5b92c 100644 --- a/src/mvPlotting.cpp +++ b/src/mvPlotting.cpp @@ -446,16 +446,15 @@ DearPyGui::draw_plot(ImDrawList* drawlist, mvAppItem& item, mvPlotConfig& config { id_axis = static_cast(next_y_axis); flags |= ImPlotAxisFlags_Opposite; + axis->configData.axis = next_y_axis; } ++next_y_axis; } ImPlot::SetupAxis(id_axis, axis->config.specifiedLabel.c_str(), flags); - if (axis->configData.setLimits || axis->configData._dirty) - { + if (axis->configData.setLimits) ImPlot::SetupAxisLimits(id_axis, axis->configData.limits.x, axis->configData.limits.y, ImGuiCond_Always); - axis->configData._dirty = false; // TODO: Check if this is it really useful - } + if (!axis->configData.formatter.empty()) ImPlot::SetupAxisFormat(id_axis, axis->configData.formatter.c_str()); diff --git a/src/mvPlotting.h b/src/mvPlotting.h index e7fa0559a..9d35d90cb 100644 --- a/src/mvPlotting.h +++ b/src/mvPlotting.h @@ -401,7 +401,6 @@ struct mvPlotAxisConfig std::vector labels; std::vector labelLocations; std::vector clabels; // to prevent conversion from string to char* every frame - bool _dirty = false; }; struct mvPlotConfig