Skip to content

Commit

Permalink
plot: store new axis id when automatically deduced
Browse files Browse the repository at this point in the history
Also, remove useless `_dirty` variable from `mvPlotAxisConfig` struct
  • Loading branch information
SamuMazzi authored and hoffstadt committed Nov 6, 2024
1 parent b177705 commit 65c2620
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/mvPlotting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,16 +446,15 @@ DearPyGui::draw_plot(ImDrawList* drawlist, mvAppItem& item, mvPlotConfig& config
{
id_axis = static_cast<ImAxis_>(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());

Expand Down
1 change: 0 additions & 1 deletion src/mvPlotting.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ struct mvPlotAxisConfig
std::vector<std::string> labels;
std::vector<double> labelLocations;
std::vector<const char*> clabels; // to prevent conversion from string to char* every frame
bool _dirty = false;
};

struct mvPlotConfig
Expand Down

0 comments on commit 65c2620

Please sign in to comment.