MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / SetupAxisScale

Function SetupAxisScale

Source/3rdParty/implot/implot.cpp:2269–2309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2267}
2268
2269void SetupAxisScale(ImAxis idx, ImPlotScale scale) {
2270 ImPlotContext& gp = *GImPlot;
2271 IM_ASSERT_USER_ERROR(gp.CurrentPlot != nullptr && !gp.CurrentPlot->SetupLocked,
2272 "Setup needs to be called after BeginPlot and before any setup locking functions (e.g. PlotX)!");
2273 ImPlotPlot& plot = *gp.CurrentPlot;
2274 ImPlotAxis& axis = plot.Axes[idx];
2275 IM_ASSERT_USER_ERROR(axis.Enabled, "Axis is not enabled! Did you forget to call SetupAxis()?");
2276 axis.Scale = scale;
2277 switch (scale)
2278 {
2279 case ImPlotScale_Time:
2280 axis.TransformForward = nullptr;
2281 axis.TransformInverse = nullptr;
2282 axis.TransformData = nullptr;
2283 axis.Locator = Locator_Time;
2284 axis.ConstraintRange = ImPlotRange(IMPLOT_MIN_TIME, IMPLOT_MAX_TIME);
2285 axis.Ticker.Levels = 2;
2286 break;
2287 case ImPlotScale_Log10:
2288 axis.TransformForward = TransformForward_Log10;
2289 axis.TransformInverse = TransformInverse_Log10;
2290 axis.TransformData = nullptr;
2291 axis.Locator = Locator_Log10;
2292 axis.ConstraintRange = ImPlotRange(DBL_MIN, INFINITY);
2293 break;
2294 case ImPlotScale_SymLog:
2295 axis.TransformForward = TransformForward_SymLog;
2296 axis.TransformInverse = TransformInverse_SymLog;
2297 axis.TransformData = nullptr;
2298 axis.Locator = Locator_SymLog;
2299 axis.ConstraintRange = ImPlotRange(-INFINITY, INFINITY);
2300 break;
2301 default:
2302 axis.TransformForward = nullptr;
2303 axis.TransformInverse = nullptr;
2304 axis.TransformData = nullptr;
2305 axis.Locator = nullptr;
2306 axis.ConstraintRange = ImPlotRange(-INFINITY, INFINITY);
2307 break;
2308 }
2309}
2310
2311void SetupAxisScale(ImAxis idx, ImPlotTransform fwd, ImPlotTransform inv, void* data) {
2312 ImPlotContext& gp = *GImPlot;

Callers 6

Demo_ConfigFunction · 0.85
Demo_LogScaleFunction · 0.85
Demo_SymmetricLogScaleFunction · 0.85
Demo_TimeScaleFunction · 0.85
Demo_CustomScaleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected