diff --git a/implot.cpp b/implot.cpp index 24e613b..f9b3fe4 100644 --- a/implot.cpp +++ b/implot.cpp @@ -1171,12 +1171,10 @@ void EndPlot() { // AXIS STATES ------------------------------------------------------------ - const bool flip_x = HasFlag(plot.XAxis.Flags, ImAxisFlags_Invert); const bool lock_x_min = HasFlag(plot.XAxis.Flags, ImAxisFlags_LockMin); const bool lock_x_max = HasFlag(plot.XAxis.Flags, ImAxisFlags_LockMax); const bool lock_x = (lock_x_min && lock_x_max) || (gp.NextPlotData.HasXRange && gp.NextPlotData.XRangeCond == ImGuiCond_Always); - const bool flip_y = HasFlag(plot.YAxis.Flags, ImAxisFlags_Invert); const bool lock_y_min = HasFlag(plot.YAxis.Flags, ImAxisFlags_LockMin); const bool lock_y_max = HasFlag(plot.YAxis.Flags, ImAxisFlags_LockMax); const bool lock_y = (lock_y_min && lock_y_max) || (gp.NextPlotData.HasYRange && gp.NextPlotData.YRangeCond == ImGuiCond_Always); @@ -2151,7 +2149,7 @@ inline void DrawPieSlice(ImDrawList& DrawList, const ImVec2& center, float radiu } -void PlotPieChart(char** label_ids, float* values, int count, const ImVec2& center, float radius, bool show_percents, float angle0) { +void PlotPieChart(const char** label_ids, float* values, int count, const ImVec2& center, float radius, bool show_percents, float angle0) { IM_ASSERT_USER_ERROR(gp.CurrentPlot != NULL, "PlotPieChart() Needs to be called between BeginPlot() and EndPlot()!"); ImDrawList & DrawList = *GetWindowDrawList(); diff --git a/implot.h b/implot.h index 83af945..b5ceeb5 100644 --- a/implot.h +++ b/implot.h @@ -170,7 +170,7 @@ void PlotErrorBars(const char* label_id, const float* xs, const float* ys, const void PlotErrorBars(const char* label_id, const float* xs, const float* ys, const float* neg, const float* pos, int count, int offset = 0, int stride = sizeof(float)); void PlotErrorBars(const char* label_id, ImVec4 (*getter)(void* data, int idx), void* data, int count, int offset = 0); // Plots a pie chart. If the sum of values > 1, each value will be normalized. Center and radius are in plot coordinates. -void PlotPieChart(char** label_ids, float* values, int count, const ImVec2& center, float radius, bool show_percents = true, float angle0 = 90); +void PlotPieChart(const char** label_ids, float* values, int count, const ImVec2& center, float radius, bool show_percents = true, float angle0 = 90); // Plots a text label at point x,y. void PlotLabel(const char* text, float x, float y, bool vertical = false, const ImVec2& pixel_offset = ImVec2(0,0)); diff --git a/implot_demo.cpp b/implot_demo.cpp index c200541..6ea85b3 100644 --- a/implot_demo.cpp +++ b/implot_demo.cpp @@ -212,7 +212,7 @@ void ShowImPlotDemoWindow(bool* p_open) { } //------------------------------------------------------------------------- if (ImGui::CollapsingHeader("Pie Charts")) { - static char* labels1[] = {"Frogs","Hogs","Dogs","Logs"}; + static const char* labels1[] = {"Frogs","Hogs","Dogs","Logs"}; static float pre_normalized[] = {0.15f, 0.30f, 0.45f, 0.10f}; ImVec2 center(0.5f,0.5f); // in plot units, not pixels float radius = 0.4f; // in plot units, not pixels @@ -233,7 +233,7 @@ void ShowImPlotDemoWindow(bool* p_open) { }; ImGui::SetPlotPalette(YlOrRd, 5); SetNextPlotRange(0,1,0,1,ImGuiCond_Always); - static char* labels2[] = {"One","Two","Three","Four","Five"}; + static const char* labels2[] = {"One","Two","Three","Four","Five"}; static float not_normalized[] = {1,2,3,4,5}; if (ImGui::BeginPlot("##Pie2", NULL, NULL, ImVec2(250,250), ImPlotFlags_Legend, 0, 0)) { ImGui::PlotPieChart(labels2, not_normalized, 5, center, radius);