| 2171 | //----------------------------------------------------------------------------- |
| 2172 | |
| 2173 | void SetupAxis(ImAxis idx, const char* label, ImPlotAxisFlags flags) { |
| 2174 | ImPlotContext& gp = *GImPlot; |
| 2175 | IM_ASSERT_USER_ERROR(gp.CurrentPlot != nullptr && !gp.CurrentPlot->SetupLocked, |
| 2176 | "Setup needs to be called after BeginPlot and before any setup locking functions (e.g. PlotX)!"); |
| 2177 | // get plot and axis |
| 2178 | ImPlotPlot& plot = *gp.CurrentPlot; |
| 2179 | ImPlotAxis& axis = plot.Axes[idx]; |
| 2180 | // set ID |
| 2181 | axis.ID = plot.ID + idx + 1; |
| 2182 | // check and set flags |
| 2183 | if (plot.JustCreated || flags != axis.PreviousFlags) |
| 2184 | axis.Flags = flags; |
| 2185 | axis.PreviousFlags = flags; |
| 2186 | // enable axis |
| 2187 | axis.Enabled = true; |
| 2188 | // set label |
| 2189 | plot.SetAxisLabel(axis,label); |
| 2190 | // cache colors |
| 2191 | UpdateAxisColors(axis); |
| 2192 | } |
| 2193 | |
| 2194 | void SetupAxisLimits(ImAxis idx, double min_lim, double max_lim, ImPlotCond cond) { |
| 2195 | ImPlotContext& gp = *GImPlot; |
no test coverage detected