vsgImGui  0.0.0
VulkanSceneGraph 3rd party data integration library
implot.h
1 // MIT License
2 
3 // Copyright (c) 2022 Evan Pezent
4 
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 
12 // The above copyright notice and this permission notice shall be included in all
13 // copies or substantial portions of the Software.
14 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 // SOFTWARE.
22 
23 // ImPlot v0.14
24 
25 // Table of Contents:
26 //
27 // [SECTION] Macros and Defines
28 // [SECTION] Enums and Types
29 // [SECTION] Callbacks
30 // [SECTION] Contexts
31 // [SECTION] Begin/End Plot
32 // [SECTION] Begin/End Subplot
33 // [SECTION] Setup
34 // [SECTION] SetNext
35 // [SECTION] Plot Items
36 // [SECTION] Plot Tools
37 // [SECTION] Plot Utils
38 // [SECTION] Legend Utils
39 // [SECTION] Drag and Drop
40 // [SECTION] Styling
41 // [SECTION] Colormaps
42 // [SECTION] Input Mapping
43 // [SECTION] Miscellaneous
44 // [SECTION] Demo
45 // [SECTION] Obsolete API
46 
47 #pragma once
48 #include "imgui.h"
49 
50 //-----------------------------------------------------------------------------
51 // [SECTION] Macros and Defines
52 //-----------------------------------------------------------------------------
53 
54 // Define attributes of all API symbols declarations (e.g. for DLL under Windows)
55 // Using ImPlot via a shared library is not recommended, because we don't guarantee
56 // backward nor forward ABI compatibility and also function call overhead. If you
57 // do use ImPlot as a DLL, be sure to call SetImGuiContext (see Miscellanous section).
58 #ifndef IMPLOT_API
59 #define IMPLOT_API
60 #endif
61 
62 // ImPlot version string.
63 #define IMPLOT_VERSION "0.14"
64 // Indicates variable should deduced automatically.
65 #define IMPLOT_AUTO -1
66 // Special color used to indicate that a color should be deduced automatically.
67 #define IMPLOT_AUTO_COL ImVec4(0,0,0,-1)
68 // Macro for templated plotting functions; keeps header clean.
69 #define IMPLOT_TMP template <typename T> IMPLOT_API
70 
71 //-----------------------------------------------------------------------------
72 // [SECTION] Enums and Types
73 //-----------------------------------------------------------------------------
74 
75 // Forward declarations
76 struct ImPlotContext; // ImPlot context (opaque struct, see implot_internal.h)
77 
78 // Enums/Flags
79 typedef int ImAxis; // -> enum ImAxis_
80 typedef int ImPlotFlags; // -> enum ImPlotFlags_
81 typedef int ImPlotAxisFlags; // -> enum ImPlotAxisFlags_
82 typedef int ImPlotSubplotFlags; // -> enum ImPlotSubplotFlags_
83 typedef int ImPlotLegendFlags; // -> enum ImPlotLegendFlags_
84 typedef int ImPlotMouseTextFlags; // -> enum ImPlotMouseTextFlags_
85 typedef int ImPlotDragToolFlags; // -> ImPlotDragToolFlags_
86 typedef int ImPlotColormapScaleFlags; // -> ImPlotColormapScaleFlags_
87 
88 typedef int ImPlotItemFlags; // -> ImPlotItemFlags_
89 typedef int ImPlotLineFlags; // -> ImPlotLineFlags_
90 typedef int ImPlotScatterFlags; // -> ImPlotScatterFlags
91 typedef int ImPlotStairsFlags; // -> ImPlotStairsFlags_
92 typedef int ImPlotShadedFlags; // -> ImPlotShadedFlags_
93 typedef int ImPlotBarsFlags; // -> ImPlotBarsFlags_
94 typedef int ImPlotBarGroupsFlags; // -> ImPlotBarGroupsFlags_
95 typedef int ImPlotErrorBarsFlags; // -> ImPlotErrorBarsFlags_
96 typedef int ImPlotStemsFlags; // -> ImPlotStemsFlags_
97 typedef int ImPlotInfLinesFlags; // -> ImPlotInfLinesFlags_
98 typedef int ImPlotPieChartFlags; // -> ImPlotPieChartFlags_
99 typedef int ImPlotHeatmapFlags; // -> ImPlotHeatmapFlags_
100 typedef int ImPlotHistogramFlags; // -> ImPlotHistogramFlags_
101 typedef int ImPlotDigitalFlags; // -> ImPlotDigitalFlags_
102 typedef int ImPlotImageFlags; // -> ImPlotImageFlags_
103 typedef int ImPlotTextFlags; // -> ImPlotTextFlags_
104 typedef int ImPlotDummyFlags; // -> ImPlotDummyFlags_
105 
106 typedef int ImPlotCond; // -> enum ImPlotCond_
107 typedef int ImPlotCol; // -> enum ImPlotCol_
108 typedef int ImPlotStyleVar; // -> enum ImPlotStyleVar_
109 typedef int ImPlotScale; // -> enum ImPlotScale_
110 typedef int ImPlotMarker; // -> enum ImPlotMarker_
111 typedef int ImPlotColormap; // -> enum ImPlotColormap_
112 typedef int ImPlotLocation; // -> enum ImPlotLocation_
113 typedef int ImPlotBin; // -> enum ImPlotBin_
114 
115 // Axis indices. The values assigned may change; NEVER hardcode these.
116 enum ImAxis_ {
117  // horizontal axes
118  ImAxis_X1 = 0, // enabled by default
119  ImAxis_X2, // disabled by default
120  ImAxis_X3, // disabled by default
121  // vertical axes
122  ImAxis_Y1, // enabled by default
123  ImAxis_Y2, // disabled by default
124  ImAxis_Y3, // disabled by default
125  // bookeeping
126  ImAxis_COUNT
127 };
128 
129 // Options for plots (see BeginPlot).
130 enum ImPlotFlags_ {
131  ImPlotFlags_None = 0, // default
132  ImPlotFlags_NoTitle = 1 << 0, // the plot title will not be displayed (titles are also hidden if preceeded by double hashes, e.g. "##MyPlot")
133  ImPlotFlags_NoLegend = 1 << 1, // the legend will not be displayed
134  ImPlotFlags_NoMouseText = 1 << 2, // the mouse position, in plot coordinates, will not be displayed inside of the plot
135  ImPlotFlags_NoInputs = 1 << 3, // the user will not be able to interact with the plot
136  ImPlotFlags_NoMenus = 1 << 4, // the user will not be able to open context menus
137  ImPlotFlags_NoBoxSelect = 1 << 5, // the user will not be able to box-select
138  ImPlotFlags_NoChild = 1 << 6, // a child window region will not be used to capture mouse scroll (can boost performance for single ImGui window applications)
139  ImPlotFlags_NoFrame = 1 << 7, // the ImGui frame will not be rendered
140  ImPlotFlags_Equal = 1 << 8, // x and y axes pairs will be constrained to have the same units/pixel
141  ImPlotFlags_Crosshairs = 1 << 9, // the default mouse cursor will be replaced with a crosshair when hovered
142  ImPlotFlags_CanvasOnly = ImPlotFlags_NoTitle | ImPlotFlags_NoLegend | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect | ImPlotFlags_NoMouseText
143 };
144 
145 // Options for plot axes (see SetupAxis).
146 enum ImPlotAxisFlags_ {
147  ImPlotAxisFlags_None = 0, // default
148  ImPlotAxisFlags_NoLabel = 1 << 0, // the axis label will not be displayed (axis labels are also hidden if the supplied string name is NULL)
149  ImPlotAxisFlags_NoGridLines = 1 << 1, // no grid lines will be displayed
150  ImPlotAxisFlags_NoTickMarks = 1 << 2, // no tick marks will be displayed
151  ImPlotAxisFlags_NoTickLabels = 1 << 3, // no text labels will be displayed
152  ImPlotAxisFlags_NoInitialFit = 1 << 4, // axis will not be initially fit to data extents on the first rendered frame
153  ImPlotAxisFlags_NoMenus = 1 << 5, // the user will not be able to open context menus with right-click
154  ImPlotAxisFlags_NoSideSwitch = 1 << 6, // the user will not be able to switch the axis side by dragging it
155  ImPlotAxisFlags_NoHighlight = 1 << 7, // the axis will not have its background highlighted when hovered or held
156  ImPlotAxisFlags_Opposite = 1 << 8, // axis ticks and labels will be rendered on the conventionally opposite side (i.e, right or top)
157  ImPlotAxisFlags_Foreground = 1 << 9, // grid lines will be displayed in the foreground (i.e. on top of data) instead of the background
158  ImPlotAxisFlags_Invert = 1 << 10, // the axis will be inverted
159  ImPlotAxisFlags_AutoFit = 1 << 11, // axis will be auto-fitting to data extents
160  ImPlotAxisFlags_RangeFit = 1 << 12, // axis will only fit points if the point is in the visible range of the **orthogonal** axis
161  ImPlotAxisFlags_PanStretch = 1 << 13, // panning in a locked or constrained state will cause the axis to stretch if possible
162  ImPlotAxisFlags_LockMin = 1 << 14, // the axis minimum value will be locked when panning/zooming
163  ImPlotAxisFlags_LockMax = 1 << 15, // the axis maximum value will be locked when panning/zooming
164  ImPlotAxisFlags_Lock = ImPlotAxisFlags_LockMin | ImPlotAxisFlags_LockMax,
165  ImPlotAxisFlags_NoDecorations = ImPlotAxisFlags_NoLabel | ImPlotAxisFlags_NoGridLines | ImPlotAxisFlags_NoTickMarks | ImPlotAxisFlags_NoTickLabels,
166  ImPlotAxisFlags_AuxDefault = ImPlotAxisFlags_NoGridLines | ImPlotAxisFlags_Opposite
167 };
168 
169 // Options for subplots (see BeginSubplot)
170 enum ImPlotSubplotFlags_ {
171  ImPlotSubplotFlags_None = 0, // default
172  ImPlotSubplotFlags_NoTitle = 1 << 0, // the subplot title will not be displayed (titles are also hidden if preceeded by double hashes, e.g. "##MySubplot")
173  ImPlotSubplotFlags_NoLegend = 1 << 1, // the legend will not be displayed (only applicable if ImPlotSubplotFlags_ShareItems is enabled)
174  ImPlotSubplotFlags_NoMenus = 1 << 2, // the user will not be able to open context menus with right-click
175  ImPlotSubplotFlags_NoResize = 1 << 3, // resize splitters between subplot cells will be not be provided
176  ImPlotSubplotFlags_NoAlign = 1 << 4, // subplot edges will not be aligned vertically or horizontally
177  ImPlotSubplotFlags_ShareItems = 1 << 5, // items across all subplots will be shared and rendered into a single legend entry
178  ImPlotSubplotFlags_LinkRows = 1 << 6, // link the y-axis limits of all plots in each row (does not apply to auxiliary axes)
179  ImPlotSubplotFlags_LinkCols = 1 << 7, // link the x-axis limits of all plots in each column (does not apply to auxiliary axes)
180  ImPlotSubplotFlags_LinkAllX = 1 << 8, // link the x-axis limits in every plot in the subplot (does not apply to auxiliary axes)
181  ImPlotSubplotFlags_LinkAllY = 1 << 9, // link the y-axis limits in every plot in the subplot (does not apply to auxiliary axes)
182  ImPlotSubplotFlags_ColMajor = 1 << 10 // subplots are added in column major order instead of the default row major order
183 };
184 
185 // Options for legends (see SetupLegend)
186 enum ImPlotLegendFlags_ {
187  ImPlotLegendFlags_None = 0, // default
188  ImPlotLegendFlags_NoButtons = 1 << 0, // legend icons will not function as hide/show buttons
189  ImPlotLegendFlags_NoHighlightItem = 1 << 1, // plot items will not be highlighted when their legend entry is hovered
190  ImPlotLegendFlags_NoHighlightAxis = 1 << 2, // axes will not be highlighted when legend entries are hovered (only relevant if x/y-axis count > 1)
191  ImPlotLegendFlags_NoMenus = 1 << 3, // the user will not be able to open context menus with right-click
192  ImPlotLegendFlags_Outside = 1 << 4, // legend will be rendered outside of the plot area
193  ImPlotLegendFlags_Horizontal = 1 << 5, // legend entries will be displayed horizontally
194  ImPlotLegendFlags_Sort = 1 << 6, // legend entries will be displayed in alphabetical order
195 };
196 
197 // Options for mouse hover text (see SetupMouseText)
198 enum ImPlotMouseTextFlags_ {
199  ImPlotMouseTextFlags_None = 0, // default
200  ImPlotMouseTextFlags_NoAuxAxes = 1 << 0, // only show the mouse position for primary axes
201  ImPlotMouseTextFlags_NoFormat = 1 << 1, // axes label formatters won't be used to render text
202  ImPlotMouseTextFlags_ShowAlways = 1 << 2, // always display mouse position even if plot not hovered
203 };
204 
205 // Options for DragPoint, DragLine, DragRect
206 enum ImPlotDragToolFlags_ {
207  ImPlotDragToolFlags_None = 0, // default
208  ImPlotDragToolFlags_NoCursors = 1 << 0, // drag tools won't change cursor icons when hovered or held
209  ImPlotDragToolFlags_NoFit = 1 << 1, // the drag tool won't be considered for plot fits
210  ImPlotDragToolFlags_NoInputs = 1 << 2, // lock the tool from user inputs
211  ImPlotDragToolFlags_Delayed = 1 << 3, // tool rendering will be delayed one frame; useful when applying position-constraints
212 };
213 
214 // Flags for ColormapScale
215 enum ImPlotColormapScaleFlags_ {
216  ImPlotColormapScaleFlags_None = 0, // default
217  ImPlotColormapScaleFlags_NoLabel = 1 << 0, // the colormap axis label will not be displayed
218  ImPlotColormapScaleFlags_Opposite = 1 << 1, // render the colormap label and tick labels on the opposite side
219  ImPlotColormapScaleFlags_Invert = 1 << 2, // invert the colormap bar and axis scale (this only affects rendering; if you only want to reverse the scale mapping, make scale_min > scale_max)
220 };
221 
222 // Flags for ANY PlotX function
223 enum ImPlotItemFlags_ {
224  ImPlotItemFlags_None = 0,
225  ImPlotItemFlags_NoLegend = 1 << 0, // the item won't have a legend entry displayed
226  ImPlotItemFlags_NoFit = 1 << 1, // the item won't be considered for plot fits
227 };
228 
229 // Flags for PlotLine
230 enum ImPlotLineFlags_ {
231  ImPlotLineFlags_None = 0, // default
232  ImPlotLineFlags_Segments = 1 << 10, // a line segment will be rendered from every two consecutive points
233  ImPlotLineFlags_Loop = 1 << 11, // the last and first point will be connected to form a closed loop
234  ImPlotLineFlags_SkipNaN = 1 << 12, // NaNs values will be skipped instead of rendered as missing data
235  ImPlotLineFlags_NoClip = 1 << 13, // markers (if displayed) on the edge of a plot will not be clipped
236  ImPlotLineFlags_Shaded = 1 << 14, // a filled region between the line and horizontal origin will be rendered; use PlotShaded for more advanced cases
237 };
238 
239 // Flags for PlotScatter
240 enum ImPlotScatterFlags_ {
241  ImPlotScatterFlags_None = 0, // default
242  ImPlotScatterFlags_NoClip = 1 << 10, // markers on the edge of a plot will not be clipped
243 };
244 
245 // Flags for PlotStairs
246 enum ImPlotStairsFlags_ {
247  ImPlotStairsFlags_None = 0, // default
248  ImPlotStairsFlags_PreStep = 1 << 10, // the y value is continued constantly to the left from every x position, i.e. the interval (x[i-1], x[i]] has the value y[i]
249  ImPlotStairsFlags_Shaded = 1 << 11 // a filled region between the stairs and horizontal origin will be rendered; use PlotShaded for more advanced cases
250 };
251 
252 // Flags for PlotShaded (placeholder)
253 enum ImPlotShadedFlags_ {
254  ImPlotShadedFlags_None = 0 // default
255 };
256 
257 // Flags for PlotBars
258 enum ImPlotBarsFlags_ {
259  ImPlotBarsFlags_None = 0, // default
260  ImPlotBarsFlags_Horizontal = 1 << 10, // bars will be rendered horizontally on the current y-axis
261 };
262 
263 // Flags for PlotBarGroups
264 enum ImPlotBarGroupsFlags_ {
265  ImPlotBarGroupsFlags_None = 0, // default
266  ImPlotBarGroupsFlags_Horizontal = 1 << 10, // bar groups will be rendered horizontally on the current y-axis
267  ImPlotBarGroupsFlags_Stacked = 1 << 11, // items in a group will be stacked on top of each other
268 };
269 
270 // Flags for PlotErrorBars
271 enum ImPlotErrorBarsFlags_ {
272  ImPlotErrorBarsFlags_None = 0, // default
273  ImPlotErrorBarsFlags_Horizontal = 1 << 10, // error bars will be rendered horizontally on the current y-axis
274 };
275 
276 // Flags for PlotStems
277 enum ImPlotStemsFlags_ {
278  ImPlotStemsFlags_None = 0, // default
279  ImPlotStemsFlags_Horizontal = 1 << 10, // stems will be rendered horizontally on the current y-axis
280 };
281 
282 // Flags for PlotInfLines
283 enum ImPlotInfLinesFlags_ {
284  ImPlotInfLinesFlags_None = 0, // default
285  ImPlotInfLinesFlags_Horizontal = 1 << 10 // lines will be rendered horizontally on the current y-axis
286 };
287 
288 // Flags for PlotPieChart
289 enum ImPlotPieChartFlags_ {
290  ImPlotPieChartFlags_None = 0, // default
291  ImPlotPieChartFlags_Normalize = 1 << 10 // force normalization of pie chart values (i.e. always make a full circle if sum < 0)
292 };
293 
294 // Flags for PlotHeatmap
295 enum ImPlotHeatmapFlags_ {
296  ImPlotHeatmapFlags_None = 0, // default
297  ImPlotHeatmapFlags_ColMajor = 1 << 10, // data will be read in column major order
298 };
299 
300 // Flags for PlotHistogram and PlotHistogram2D
301 enum ImPlotHistogramFlags_ {
302  ImPlotHistogramFlags_None = 0, // default
303  ImPlotHistogramFlags_Horizontal = 1 << 10, // histogram bars will be rendered horizontally (not supported by PlotHistogram2D)
304  ImPlotHistogramFlags_Cumulative = 1 << 11, // each bin will contain its count plus the counts of all previous bins (not supported by PlotHistogram2D)
305  ImPlotHistogramFlags_Density = 1 << 12, // counts will be normalized, i.e. the PDF will be visualized, or the CDF will be visualized if Cumulative is also set
306  ImPlotHistogramFlags_NoOutliers = 1 << 13, // exclude values outside the specifed histogram range from the count toward normalizing and cumulative counts
307  ImPlotHistogramFlags_ColMajor = 1 << 14 // data will be read in column major order (not supported by PlotHistogram)
308 };
309 
310 // Flags for PlotDigital (placeholder)
311 enum ImPlotDigitalFlags_ {
312  ImPlotDigitalFlags_None = 0 // default
313 };
314 
315 // Flags for PlotImage (placeholder)
316 enum ImPlotImageFlags_ {
317  ImPlotImageFlags_None = 0 // default
318 };
319 
320 // Flags for PlotText
321 enum ImPlotTextFlags_ {
322  ImPlotTextFlags_None = 0, // default
323  ImPlotTextFlags_Vertical = 1 << 10 // text will be rendered vertically
324 };
325 
326 // Flags for PlotDummy (placeholder)
327 enum ImPlotDummyFlags_ {
328  ImPlotDummyFlags_None = 0 // default
329 };
330 
331 // Represents a condition for SetupAxisLimits etc. (same as ImGuiCond, but we only support a subset of those enums)
332 enum ImPlotCond_
333 {
334  ImPlotCond_None = ImGuiCond_None, // No condition (always set the variable), same as _Always
335  ImPlotCond_Always = ImGuiCond_Always, // No condition (always set the variable)
336  ImPlotCond_Once = ImGuiCond_Once, // Set the variable once per runtime session (only the first call will succeed)
337 };
338 
339 // Plot styling colors.
340 enum ImPlotCol_ {
341  // item styling colors
342  ImPlotCol_Line, // plot line/outline color (defaults to next unused color in current colormap)
343  ImPlotCol_Fill, // plot fill color for bars (defaults to the current line color)
344  ImPlotCol_MarkerOutline, // marker outline color (defaults to the current line color)
345  ImPlotCol_MarkerFill, // marker fill color (defaults to the current line color)
346  ImPlotCol_ErrorBar, // error bar color (defaults to ImGuiCol_Text)
347  // plot styling colors
348  ImPlotCol_FrameBg, // plot frame background color (defaults to ImGuiCol_FrameBg)
349  ImPlotCol_PlotBg, // plot area background color (defaults to ImGuiCol_WindowBg)
350  ImPlotCol_PlotBorder, // plot area border color (defaults to ImGuiCol_Border)
351  ImPlotCol_LegendBg, // legend background color (defaults to ImGuiCol_PopupBg)
352  ImPlotCol_LegendBorder, // legend border color (defaults to ImPlotCol_PlotBorder)
353  ImPlotCol_LegendText, // legend text color (defaults to ImPlotCol_InlayText)
354  ImPlotCol_TitleText, // plot title text color (defaults to ImGuiCol_Text)
355  ImPlotCol_InlayText, // color of text appearing inside of plots (defaults to ImGuiCol_Text)
356  ImPlotCol_AxisText, // axis label and tick lables color (defaults to ImGuiCol_Text)
357  ImPlotCol_AxisGrid, // axis grid color (defaults to 25% ImPlotCol_AxisText)
358  ImPlotCol_AxisTick, // axis tick color (defaults to AxisGrid)
359  ImPlotCol_AxisBg, // background color of axis hover region (defaults to transparent)
360  ImPlotCol_AxisBgHovered, // axis hover color (defaults to ImGuiCol_ButtonHovered)
361  ImPlotCol_AxisBgActive, // axis active color (defaults to ImGuiCol_ButtonActive)
362  ImPlotCol_Selection, // box-selection color (defaults to yellow)
363  ImPlotCol_Crosshairs, // crosshairs color (defaults to ImPlotCol_PlotBorder)
364  ImPlotCol_COUNT
365 };
366 
367 // Plot styling variables.
368 enum ImPlotStyleVar_ {
369  // item styling variables
370  ImPlotStyleVar_LineWeight, // float, plot item line weight in pixels
371  ImPlotStyleVar_Marker, // int, marker specification
372  ImPlotStyleVar_MarkerSize, // float, marker size in pixels (roughly the marker's "radius")
373  ImPlotStyleVar_MarkerWeight, // float, plot outline weight of markers in pixels
374  ImPlotStyleVar_FillAlpha, // float, alpha modifier applied to all plot item fills
375  ImPlotStyleVar_ErrorBarSize, // float, error bar whisker width in pixels
376  ImPlotStyleVar_ErrorBarWeight, // float, error bar whisker weight in pixels
377  ImPlotStyleVar_DigitalBitHeight, // float, digital channels bit height (at 1) in pixels
378  ImPlotStyleVar_DigitalBitGap, // float, digital channels bit padding gap in pixels
379  // plot styling variables
380  ImPlotStyleVar_PlotBorderSize, // float, thickness of border around plot area
381  ImPlotStyleVar_MinorAlpha, // float, alpha multiplier applied to minor axis grid lines
382  ImPlotStyleVar_MajorTickLen, // ImVec2, major tick lengths for X and Y axes
383  ImPlotStyleVar_MinorTickLen, // ImVec2, minor tick lengths for X and Y axes
384  ImPlotStyleVar_MajorTickSize, // ImVec2, line thickness of major ticks
385  ImPlotStyleVar_MinorTickSize, // ImVec2, line thickness of minor ticks
386  ImPlotStyleVar_MajorGridSize, // ImVec2, line thickness of major grid lines
387  ImPlotStyleVar_MinorGridSize, // ImVec2, line thickness of minor grid lines
388  ImPlotStyleVar_PlotPadding, // ImVec2, padding between widget frame and plot area, labels, or outside legends (i.e. main padding)
389  ImPlotStyleVar_LabelPadding, // ImVec2, padding between axes labels, tick labels, and plot edge
390  ImPlotStyleVar_LegendPadding, // ImVec2, legend padding from plot edges
391  ImPlotStyleVar_LegendInnerPadding, // ImVec2, legend inner padding from legend edges
392  ImPlotStyleVar_LegendSpacing, // ImVec2, spacing between legend entries
393  ImPlotStyleVar_MousePosPadding, // ImVec2, padding between plot edge and interior info text
394  ImPlotStyleVar_AnnotationPadding, // ImVec2, text padding around annotation labels
395  ImPlotStyleVar_FitPadding, // ImVec2, additional fit padding as a percentage of the fit extents (e.g. ImVec2(0.1f,0.1f) adds 10% to the fit extents of X and Y)
396  ImPlotStyleVar_PlotDefaultSize, // ImVec2, default size used when ImVec2(0,0) is passed to BeginPlot
397  ImPlotStyleVar_PlotMinSize, // ImVec2, minimum size plot frame can be when shrunk
398  ImPlotStyleVar_COUNT
399 };
400 
401 // Axis scale
402 enum ImPlotScale_ {
403  ImPlotScale_Linear = 0, // default linear scale
404  ImPlotScale_Time, // date/time scale
405  ImPlotScale_Log10, // base 10 logartithmic scale
406  ImPlotScale_SymLog, // symmetric log scale
407 };
408 
409 // Marker specifications.
410 enum ImPlotMarker_ {
411  ImPlotMarker_None = -1, // no marker
412  ImPlotMarker_Circle, // a circle marker (default)
413  ImPlotMarker_Square, // a square maker
414  ImPlotMarker_Diamond, // a diamond marker
415  ImPlotMarker_Up, // an upward-pointing triangle marker
416  ImPlotMarker_Down, // an downward-pointing triangle marker
417  ImPlotMarker_Left, // an leftward-pointing triangle marker
418  ImPlotMarker_Right, // an rightward-pointing triangle marker
419  ImPlotMarker_Cross, // a cross marker (not fillable)
420  ImPlotMarker_Plus, // a plus marker (not fillable)
421  ImPlotMarker_Asterisk, // a asterisk marker (not fillable)
422  ImPlotMarker_COUNT
423 };
424 
425 // Built-in colormaps
426 enum ImPlotColormap_ {
427  ImPlotColormap_Deep = 0, // a.k.a. seaborn deep (qual=true, n=10) (default)
428  ImPlotColormap_Dark = 1, // a.k.a. matplotlib "Set1" (qual=true, n=9 )
429  ImPlotColormap_Pastel = 2, // a.k.a. matplotlib "Pastel1" (qual=true, n=9 )
430  ImPlotColormap_Paired = 3, // a.k.a. matplotlib "Paired" (qual=true, n=12)
431  ImPlotColormap_Viridis = 4, // a.k.a. matplotlib "viridis" (qual=false, n=11)
432  ImPlotColormap_Plasma = 5, // a.k.a. matplotlib "plasma" (qual=false, n=11)
433  ImPlotColormap_Hot = 6, // a.k.a. matplotlib/MATLAB "hot" (qual=false, n=11)
434  ImPlotColormap_Cool = 7, // a.k.a. matplotlib/MATLAB "cool" (qual=false, n=11)
435  ImPlotColormap_Pink = 8, // a.k.a. matplotlib/MATLAB "pink" (qual=false, n=11)
436  ImPlotColormap_Jet = 9, // a.k.a. MATLAB "jet" (qual=false, n=11)
437  ImPlotColormap_Twilight = 10, // a.k.a. matplotlib "twilight" (qual=false, n=11)
438  ImPlotColormap_RdBu = 11, // red/blue, Color Brewer (qual=false, n=11)
439  ImPlotColormap_BrBG = 12, // brown/blue-green, Color Brewer (qual=false, n=11)
440  ImPlotColormap_PiYG = 13, // pink/yellow-green, Color Brewer (qual=false, n=11)
441  ImPlotColormap_Spectral = 14, // color spectrum, Color Brewer (qual=false, n=11)
442  ImPlotColormap_Greys = 15, // white/black (qual=false, n=2 )
443 };
444 
445 // Used to position items on a plot (e.g. legends, labels, etc.)
446 enum ImPlotLocation_ {
447  ImPlotLocation_Center = 0, // center-center
448  ImPlotLocation_North = 1 << 0, // top-center
449  ImPlotLocation_South = 1 << 1, // bottom-center
450  ImPlotLocation_West = 1 << 2, // center-left
451  ImPlotLocation_East = 1 << 3, // center-right
452  ImPlotLocation_NorthWest = ImPlotLocation_North | ImPlotLocation_West, // top-left
453  ImPlotLocation_NorthEast = ImPlotLocation_North | ImPlotLocation_East, // top-right
454  ImPlotLocation_SouthWest = ImPlotLocation_South | ImPlotLocation_West, // bottom-left
455  ImPlotLocation_SouthEast = ImPlotLocation_South | ImPlotLocation_East // bottom-right
456 };
457 
458 // Enums for different automatic histogram binning methods (k = bin count or w = bin width)
459 enum ImPlotBin_ {
460  ImPlotBin_Sqrt = -1, // k = sqrt(n)
461  ImPlotBin_Sturges = -2, // k = 1 + log2(n)
462  ImPlotBin_Rice = -3, // k = 2 * cbrt(n)
463  ImPlotBin_Scott = -4, // w = 3.49 * sigma / cbrt(n)
464 };
465 
466 // Double precision version of ImVec2 used by ImPlot. Extensible by end users.
467 struct ImPlotPoint {
468  double x, y;
469  ImPlotPoint() { x = y = 0.0; }
470  ImPlotPoint(double _x, double _y) { x = _x; y = _y; }
471  ImPlotPoint(const ImVec2& p) { x = p.x; y = p.y; }
472  double operator[] (size_t idx) const { return (&x)[idx]; }
473  double& operator[] (size_t idx) { return (&x)[idx]; }
474 #ifdef IMPLOT_POINT_CLASS_EXTRA
475  IMPLOT_POINT_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h
476  // to convert back and forth between your math types and ImPlotPoint.
477 #endif
478 };
479 
480 // Range defined by a min/max value.
481 struct ImPlotRange {
482  double Min, Max;
483  ImPlotRange() { Min = 0; Max = 0; }
484  ImPlotRange(double _min, double _max) { Min = _min; Max = _max; }
485  bool Contains(double value) const { return value >= Min && value <= Max; }
486  double Size() const { return Max - Min; }
487  double Clamp(double value) const { return (value < Min) ? Min : (value > Max) ? Max : value; }
488 };
489 
490 // Combination of two range limits for X and Y axes. Also an AABB defined by Min()/Max().
491 struct ImPlotRect {
492  ImPlotRange X, Y;
493  ImPlotRect() { }
494  ImPlotRect(double x_min, double x_max, double y_min, double y_max) { X.Min = x_min; X.Max = x_max; Y.Min = y_min; Y.Max = y_max; }
495  bool Contains(const ImPlotPoint& p) const { return Contains(p.x, p.y); }
496  bool Contains(double x, double y) const { return X.Contains(x) && Y.Contains(y); }
497  ImPlotPoint Size() const { return ImPlotPoint(X.Size(), Y.Size()); }
498  ImPlotPoint Clamp(const ImPlotPoint& p) { return Clamp(p.x, p.y); }
499  ImPlotPoint Clamp(double x, double y) { return ImPlotPoint(X.Clamp(x),Y.Clamp(y)); }
500  ImPlotPoint Min() const { return ImPlotPoint(X.Min, Y.Min); }
501  ImPlotPoint Max() const { return ImPlotPoint(X.Max, Y.Max); }
502 };
503 
504 // Plot style structure
505 struct ImPlotStyle {
506  // item styling variables
507  float LineWeight; // = 1, item line weight in pixels
508  int Marker; // = ImPlotMarker_None, marker specification
509  float MarkerSize; // = 4, marker size in pixels (roughly the marker's "radius")
510  float MarkerWeight; // = 1, outline weight of markers in pixels
511  float FillAlpha; // = 1, alpha modifier applied to plot fills
512  float ErrorBarSize; // = 5, error bar whisker width in pixels
513  float ErrorBarWeight; // = 1.5, error bar whisker weight in pixels
514  float DigitalBitHeight; // = 8, digital channels bit height (at y = 1.0f) in pixels
515  float DigitalBitGap; // = 4, digital channels bit padding gap in pixels
516  // plot styling variables
517  float PlotBorderSize; // = 1, line thickness of border around plot area
518  float MinorAlpha; // = 0.25 alpha multiplier applied to minor axis grid lines
519  ImVec2 MajorTickLen; // = 10,10 major tick lengths for X and Y axes
520  ImVec2 MinorTickLen; // = 5,5 minor tick lengths for X and Y axes
521  ImVec2 MajorTickSize; // = 1,1 line thickness of major ticks
522  ImVec2 MinorTickSize; // = 1,1 line thickness of minor ticks
523  ImVec2 MajorGridSize; // = 1,1 line thickness of major grid lines
524  ImVec2 MinorGridSize; // = 1,1 line thickness of minor grid lines
525  ImVec2 PlotPadding; // = 10,10 padding between widget frame and plot area, labels, or outside legends (i.e. main padding)
526  ImVec2 LabelPadding; // = 5,5 padding between axes labels, tick labels, and plot edge
527  ImVec2 LegendPadding; // = 10,10 legend padding from plot edges
528  ImVec2 LegendInnerPadding; // = 5,5 legend inner padding from legend edges
529  ImVec2 LegendSpacing; // = 5,0 spacing between legend entries
530  ImVec2 MousePosPadding; // = 10,10 padding between plot edge and interior mouse location text
531  ImVec2 AnnotationPadding; // = 2,2 text padding around annotation labels
532  ImVec2 FitPadding; // = 0,0 additional fit padding as a percentage of the fit extents (e.g. ImVec2(0.1f,0.1f) adds 10% to the fit extents of X and Y)
533  ImVec2 PlotDefaultSize; // = 400,300 default size used when ImVec2(0,0) is passed to BeginPlot
534  ImVec2 PlotMinSize; // = 200,150 minimum size plot frame can be when shrunk
535  // style colors
536  ImVec4 Colors[ImPlotCol_COUNT]; // Array of styling colors. Indexable with ImPlotCol_ enums.
537  // colormap
538  ImPlotColormap Colormap; // The current colormap. Set this to either an ImPlotColormap_ enum or an index returned by AddColormap.
539  // settings/flags
540  bool UseLocalTime; // = false, axis labels will be formatted for your timezone when ImPlotAxisFlag_Time is enabled
541  bool UseISO8601; // = false, dates will be formatted according to ISO 8601 where applicable (e.g. YYYY-MM-DD, YYYY-MM, --MM-DD, etc.)
542  bool Use24HourClock; // = false, times will be formatted using a 24 hour clock
543  IMPLOT_API ImPlotStyle();
544 };
545 
546 // Support for legacy versions
547 #if (IMGUI_VERSION_NUM < 18716) // Renamed in 1.88
548 #define ImGuiMod_None 0
549 #define ImGuiMod_Ctrl ImGuiKeyModFlags_Ctrl
550 #define ImGuiMod_Shift ImGuiKeyModFlags_Shift
551 #define ImGuiMod_Alt ImGuiKeyModFlags_Alt
552 #define ImGuiMod_Super ImGuiKeyModFlags_Super
553 #elif (IMGUI_VERSION_NUM < 18823) // Renamed in 1.89, sorry
554 #define ImGuiMod_None 0
555 #define ImGuiMod_Ctrl ImGuiModFlags_Ctrl
556 #define ImGuiMod_Shift ImGuiModFlags_Shift
557 #define ImGuiMod_Alt ImGuiModFlags_Alt
558 #define ImGuiMod_Super ImGuiModFlags_Super
559 #endif
560 
561 // Input mapping structure. Default values listed. See also MapInputDefault, MapInputReverse.
563  ImGuiMouseButton Pan; // LMB enables panning when held,
564  int PanMod; // none optional modifier that must be held for panning/fitting
565  ImGuiMouseButton Fit; // LMB initiates fit when double clicked
566  ImGuiMouseButton Select; // RMB begins box selection when pressed and confirms selection when released
567  ImGuiMouseButton SelectCancel; // LMB cancels active box selection when pressed; cannot be same as Select
568  int SelectMod; // none optional modifier that must be held for box selection
569  int SelectHorzMod; // Alt expands active box selection horizontally to plot edge when held
570  int SelectVertMod; // Shift expands active box selection vertically to plot edge when held
571  ImGuiMouseButton Menu; // RMB opens context menus (if enabled) when clicked
572  int OverrideMod; // Ctrl when held, all input is ignored; used to enable axis/plots as DND sources
573  int ZoomMod; // none optional modifier that must be held for scroll wheel zooming
574  float ZoomRate; // 0.1f zoom rate for scroll (e.g. 0.1f = 10% plot range every scroll click); make negative to invert
575  IMPLOT_API ImPlotInputMap();
576 };
577 
578 //-----------------------------------------------------------------------------
579 // [SECTION] Callbacks
580 //-----------------------------------------------------------------------------
581 
582 // Callback signature for axis tick label formatter.
583 typedef int (*ImPlotFormatter)(double value, char* buff, int size, void* user_data);
584 
585 // Callback signature for data getter.
586 typedef ImPlotPoint (*ImPlotGetter)(int idx, void* user_data);
587 
588 // Callback signature for axis transform.
589 typedef double (*ImPlotTransform)(double value, void* user_data);
590 
591 namespace ImPlot {
592 
593 //-----------------------------------------------------------------------------
594 // [SECTION] Contexts
595 //-----------------------------------------------------------------------------
596 
597 // Creates a new ImPlot context. Call this after ImGui::CreateContext.
598 IMPLOT_API ImPlotContext* CreateContext();
599 // Destroys an ImPlot context. Call this before ImGui::DestroyContext. NULL = destroy current context.
600 IMPLOT_API void DestroyContext(ImPlotContext* ctx = NULL);
601 // Returns the current ImPlot context. NULL if no context has ben set.
602 IMPLOT_API ImPlotContext* GetCurrentContext();
603 // Sets the current ImPlot context.
604 IMPLOT_API void SetCurrentContext(ImPlotContext* ctx);
605 
606 // Sets the current **ImGui** context. This is ONLY necessary if you are compiling
607 // ImPlot as a DLL (not recommended) separate from your ImGui compilation. It
608 // sets the global variable GImGui, which is not shared across DLL boundaries.
609 // See GImGui documentation in imgui.cpp for more details.
610 IMPLOT_API void SetImGuiContext(ImGuiContext* ctx);
611 
612 //-----------------------------------------------------------------------------
613 // [SECTION] Begin/End Plot
614 //-----------------------------------------------------------------------------
615 
616 // Starts a 2D plotting context. If this function returns true, EndPlot() MUST
617 // be called! You are encouraged to use the following convention:
618 //
619 // if (BeginPlot(...)) {
620 // PlotLine(...);
621 // ...
622 // EndPlot();
623 // }
624 //
625 // Important notes:
626 //
627 // - #title_id must be unique to the current ImGui ID scope. If you need to avoid ID
628 // collisions or don't want to display a title in the plot, use double hashes
629 // (e.g. "MyPlot##HiddenIdText" or "##NoTitle").
630 // - #size is the **frame** size of the plot widget, not the plot area. The default
631 // size of plots (i.e. when ImVec2(0,0)) can be modified in your ImPlotStyle.
632 IMPLOT_API bool BeginPlot(const char* title_id, const ImVec2& size=ImVec2(-1,0), ImPlotFlags flags=0);
633 
634 // Only call EndPlot() if BeginPlot() returns true! Typically called at the end
635 // of an if statement conditioned on BeginPlot(). See example above.
636 IMPLOT_API void EndPlot();
637 
638 //-----------------------------------------------------------------------------
639 // [SECTION] Begin/End Subplots
640 //-----------------------------------------------------------------------------
641 
642 // Starts a subdivided plotting context. If the function returns true,
643 // EndSubplots() MUST be called! Call BeginPlot/EndPlot AT MOST [rows*cols]
644 // times in between the begining and end of the subplot context. Plots are
645 // added in row major order.
646 //
647 // Example:
648 //
649 // if (BeginSubplots("My Subplot",2,3,ImVec2(800,400)) {
650 // for (int i = 0; i < 6; ++i) {
651 // if (BeginPlot(...)) {
652 // ImPlot::PlotLine(...);
653 // ...
654 // EndPlot();
655 // }
656 // }
657 // EndSubplots();
658 // }
659 //
660 // Produces:
661 //
662 // [0] | [1] | [2]
663 // ----|-----|----
664 // [3] | [4] | [5]
665 //
666 // Important notes:
667 //
668 // - #title_id must be unique to the current ImGui ID scope. If you need to avoid ID
669 // collisions or don't want to display a title in the plot, use double hashes
670 // (e.g. "MySubplot##HiddenIdText" or "##NoTitle").
671 // - #rows and #cols must be greater than 0.
672 // - #size is the size of the entire grid of subplots, not the individual plots
673 // - #row_ratios and #col_ratios must have AT LEAST #rows and #cols elements,
674 // respectively. These are the sizes of the rows and columns expressed in ratios.
675 // If the user adjusts the dimensions, the arrays are updated with new ratios.
676 //
677 // Important notes regarding BeginPlot from inside of BeginSubplots:
678 //
679 // - The #title_id parameter of _BeginPlot_ (see above) does NOT have to be
680 // unique when called inside of a subplot context. Subplot IDs are hashed
681 // for your convenience so you don't have call PushID or generate unique title
682 // strings. Simply pass an empty string to BeginPlot unless you want to title
683 // each subplot.
684 // - The #size parameter of _BeginPlot_ (see above) is ignored when inside of a
685 // subplot context. The actual size of the subplot will be based on the
686 // #size value you pass to _BeginSubplots_ and #row/#col_ratios if provided.
687 
688 IMPLOT_API bool BeginSubplots(const char* title_id,
689  int rows,
690  int cols,
691  const ImVec2& size,
692  ImPlotSubplotFlags flags = 0,
693  float* row_ratios = NULL,
694  float* col_ratios = NULL);
695 
696 // Only call EndSubplots() if BeginSubplots() returns true! Typically called at the end
697 // of an if statement conditioned on BeginSublots(). See example above.
698 IMPLOT_API void EndSubplots();
699 
700 //-----------------------------------------------------------------------------
701 // [SECTION] Setup
702 //-----------------------------------------------------------------------------
703 
704 // The following API allows you to setup and customize various aspects of the
705 // current plot. The functions should be called immediately after BeginPlot
706 // and before any other API calls. Typical usage is as follows:
707 
708 // if (BeginPlot(...)) { 1) begin a new plot
709 // SetupAxis(ImAxis_X1, "My X-Axis"); 2) make Setup calls
710 // SetupAxis(ImAxis_Y1, "My Y-Axis");
711 // SetupLegend(ImPlotLocation_North);
712 // ...
713 // SetupFinish(); 3) [optional] explicitly finish setup
714 // PlotLine(...); 4) plot items
715 // ...
716 // EndPlot(); 5) end the plot
717 // }
718 //
719 // Important notes:
720 //
721 // - Always call Setup code at the top of your BeginPlot conditional statement.
722 // - Setup is locked once you start plotting or explicitly call SetupFinish.
723 // Do NOT call Setup code after you begin plotting or after you make
724 // any non-Setup API calls (e.g. utils like PlotToPixels also lock Setup)
725 // - Calling SetupFinish is OPTIONAL, but probably good practice. If you do not
726 // call it yourself, then the first subsequent plotting or utility function will
727 // call it for you.
728 
729 // Enables an axis or sets the label and/or flags for an existing axis. Leave #label = NULL for no label.
730 IMPLOT_API void SetupAxis(ImAxis axis, const char* label=NULL, ImPlotAxisFlags flags=0);
731 // Sets an axis range limits. If ImPlotCond_Always is used, the axes limits will be locked.
732 IMPLOT_API void SetupAxisLimits(ImAxis axis, double v_min, double v_max, ImPlotCond cond = ImPlotCond_Once);
733 // Links an axis range limits to external values. Set to NULL for no linkage. The pointer data must remain valid until EndPlot.
734 IMPLOT_API void SetupAxisLinks(ImAxis axis, double* link_min, double* link_max);
735 // Sets the format of numeric axis labels via formater specifier (default="%g"). Formated values will be double (i.e. use %f).
736 IMPLOT_API void SetupAxisFormat(ImAxis axis, const char* fmt);
737 // Sets the format of numeric axis labels via formatter callback. Given #value, write a label into #buff. Optionally pass user data.
738 IMPLOT_API void SetupAxisFormat(ImAxis axis, ImPlotFormatter formatter, void* data=NULL);
739 // Sets an axis' ticks and optionally the labels. To keep the default ticks, set #keep_default=true.
740 IMPLOT_API void SetupAxisTicks(ImAxis axis, const double* values, int n_ticks, const char* const labels[]=NULL, bool keep_default=false);
741 // Sets an axis' ticks and optionally the labels for the next plot. To keep the default ticks, set #keep_default=true.
742 IMPLOT_API void SetupAxisTicks(ImAxis axis, double v_min, double v_max, int n_ticks, const char* const labels[]=NULL, bool keep_default=false);
743 // Sets an axis' scale using built-in options.
744 IMPLOT_API void SetupAxisScale(ImAxis axis, ImPlotScale scale);
745 // Sets an axis' scale using user supplied forward and inverse transfroms.
746 IMPLOT_API void SetupAxisScale(ImAxis axis, ImPlotTransform forward, ImPlotTransform inverse, void* data=NULL);
747 // Sets an axis' limits constraints.
748 IMPLOT_API void SetupAxisLimitsConstraints(ImAxis axis, double v_min, double v_max);
749 // Sets an axis' zoom constraints.
750 IMPLOT_API void SetupAxisZoomConstraints(ImAxis axis, double z_min, double z_max);
751 
752 // Sets the label and/or flags for primary X and Y axes (shorthand for two calls to SetupAxis).
753 IMPLOT_API void SetupAxes(const char* x_label, const char* y_label, ImPlotAxisFlags x_flags=0, ImPlotAxisFlags y_flags=0);
754 // Sets the primary X and Y axes range limits. If ImPlotCond_Always is used, the axes limits will be locked (shorthand for two calls to SetupAxisLimits).
755 IMPLOT_API void SetupAxesLimits(double x_min, double x_max, double y_min, double y_max, ImPlotCond cond = ImPlotCond_Once);
756 
757 // Sets up the plot legend.
758 IMPLOT_API void SetupLegend(ImPlotLocation location, ImPlotLegendFlags flags=0);
759 // Set the location of the current plot's mouse position text (default = South|East).
760 IMPLOT_API void SetupMouseText(ImPlotLocation location, ImPlotMouseTextFlags flags=0);
761 
762 // Explicitly finalize plot setup. Once you call this, you cannot make anymore Setup calls for the current plot!
763 // Note that calling this function is OPTIONAL; it will be called by the first subsequent setup-locking API call.
764 IMPLOT_API void SetupFinish();
765 
766 //-----------------------------------------------------------------------------
767 // [SECTION] SetNext
768 //-----------------------------------------------------------------------------
769 
770 // Though you should default to the `Setup` API above, there are some scenarios
771 // where (re)configuring a plot or axis before `BeginPlot` is needed (e.g. if
772 // using a preceding button or slider widget to change the plot limits). In
773 // this case, you can use the `SetNext` API below. While this is not as feature
774 // rich as the Setup API, most common needs are provided. These functions can be
775 // called anwhere except for inside of `Begin/EndPlot`. For example:
776 
777 // if (ImGui::Button("Center Plot"))
778 // ImPlot::SetNextPlotLimits(-1,1,-1,1);
779 // if (ImPlot::BeginPlot(...)) {
780 // ...
781 // ImPlot::EndPlot();
782 // }
783 //
784 // Important notes:
785 //
786 // - You must still enable non-default axes with SetupAxis for these functions
787 // to work properly.
788 
789 // Sets an upcoming axis range limits. If ImPlotCond_Always is used, the axes limits will be locked.
790 IMPLOT_API void SetNextAxisLimits(ImAxis axis, double v_min, double v_max, ImPlotCond cond = ImPlotCond_Once);
791 // Links an upcoming axis range limits to external values. Set to NULL for no linkage. The pointer data must remain valid until EndPlot!
792 IMPLOT_API void SetNextAxisLinks(ImAxis axis, double* link_min, double* link_max);
793 // Set an upcoming axis to auto fit to its data.
794 IMPLOT_API void SetNextAxisToFit(ImAxis axis);
795 
796 // Sets the upcoming primary X and Y axes range limits. If ImPlotCond_Always is used, the axes limits will be locked (shorthand for two calls to SetupAxisLimits).
797 IMPLOT_API void SetNextAxesLimits(double x_min, double x_max, double y_min, double y_max, ImPlotCond cond = ImPlotCond_Once);
798 // Sets all upcoming axes to auto fit to their data.
799 IMPLOT_API void SetNextAxesToFit();
800 
801 //-----------------------------------------------------------------------------
802 // [SECTION] Plot Items
803 //-----------------------------------------------------------------------------
804 
805 // The main plotting API is provied below. Call these functions between
806 // Begin/EndPlot and after any Setup API calls. Each plots data on the current
807 // x and y axes, which can be changed with `SetAxis/Axes`.
808 //
809 // The templated functions are explicitly instantiated in implot_items.cpp.
810 // They are not intended to be used generically with custom types. You will get
811 // a linker error if you try! All functions support the following scalar types:
812 //
813 // float, double, ImS8, ImU8, ImS16, ImU16, ImS32, ImU32, ImS64, ImU64
814 //
815 //
816 // If you need to plot custom or non-homogenous data you have a few options:
817 //
818 // 1. If your data is a simple struct/class (e.g. Vector2f), you can use striding.
819 // This is the most performant option if applicable.
820 //
821 // struct Vector2f { float X, Y; };
822 // ...
823 // Vector2f data[42];
824 // ImPlot::PlotLine("line", &data[0].x, &data[0].y, 42, 0, 0, sizeof(Vector2f));
825 //
826 // 2. Write a custom getter C function or C++ lambda and pass it and optionally your data to
827 // an ImPlot function post-fixed with a G (e.g. PlotScatterG). This has a slight performance
828 // cost, but probably not enough to worry about unless your data is very large. Examples:
829 //
830 // ImPlotPoint MyDataGetter(void* data, int idx) {
831 // MyData* my_data = (MyData*)data;
832 // ImPlotPoint p;
833 // p.x = my_data->GetTime(idx);
834 // p.y = my_data->GetValue(idx);
835 // return p
836 // }
837 // ...
838 // auto my_lambda = [](int idx, void*) {
839 // double t = idx / 999.0;
840 // return ImPlotPoint(t, 0.5+0.5*std::sin(2*PI*10*t));
841 // };
842 // ...
843 // if (ImPlot::BeginPlot("MyPlot")) {
844 // MyData my_data;
845 // ImPlot::PlotScatterG("scatter", MyDataGetter, &my_data, my_data.Size());
846 // ImPlot::PlotLineG("line", my_lambda, nullptr, 1000);
847 // ImPlot::EndPlot();
848 // }
849 //
850 // NB: All types are converted to double before plotting. You may lose information
851 // if you try plotting extremely large 64-bit integral types. Proceed with caution!
852 
853 // Plots a standard 2D line plot.
854 IMPLOT_TMP void PlotLine(const char* label_id, const T* values, int count, double xscale=1, double xstart=0, ImPlotLineFlags flags=0, int offset=0, int stride=sizeof(T));
855 IMPLOT_TMP void PlotLine(const char* label_id, const T* xs, const T* ys, int count, ImPlotLineFlags flags=0, int offset=0, int stride=sizeof(T));
856 IMPLOT_API void PlotLineG(const char* label_id, ImPlotGetter getter, void* data, int count, ImPlotLineFlags flags=0);
857 
858 // Plots a standard 2D scatter plot. Default marker is ImPlotMarker_Circle.
859 IMPLOT_TMP void PlotScatter(const char* label_id, const T* values, int count, double xscale=1, double xstart=0, ImPlotScatterFlags flags=0, int offset=0, int stride=sizeof(T));
860 IMPLOT_TMP void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, ImPlotScatterFlags flags=0, int offset=0, int stride=sizeof(T));
861 IMPLOT_API void PlotScatterG(const char* label_id, ImPlotGetter getter, void* data, int count, ImPlotScatterFlags flags=0);
862 
863 // Plots a a stairstep graph. The y value is continued constantly to the right from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i]
864 IMPLOT_TMP void PlotStairs(const char* label_id, const T* values, int count, double xscale=1, double xstart=0, ImPlotStairsFlags flags=0, int offset=0, int stride=sizeof(T));
865 IMPLOT_TMP void PlotStairs(const char* label_id, const T* xs, const T* ys, int count, ImPlotStairsFlags flags=0, int offset=0, int stride=sizeof(T));
866 IMPLOT_API void PlotStairsG(const char* label_id, ImPlotGetter getter, void* data, int count, ImPlotStairsFlags flags=0);
867 
868 // Plots a shaded (filled) region between two lines, or a line and a horizontal reference. Set yref to +/-INFINITY for infinite fill extents.
869 IMPLOT_TMP void PlotShaded(const char* label_id, const T* values, int count, double yref=0, double xscale=1, double xstart=0, ImPlotShadedFlags flags=0, int offset=0, int stride=sizeof(T));
870 IMPLOT_TMP void PlotShaded(const char* label_id, const T* xs, const T* ys, int count, double yref=0, ImPlotShadedFlags flags=0, int offset=0, int stride=sizeof(T));
871 IMPLOT_TMP void PlotShaded(const char* label_id, const T* xs, const T* ys1, const T* ys2, int count, ImPlotShadedFlags flags=0, int offset=0, int stride=sizeof(T));
872 IMPLOT_API void PlotShadedG(const char* label_id, ImPlotGetter getter1, void* data1, ImPlotGetter getter2, void* data2, int count, ImPlotShadedFlags flags=0);
873 
874 // Plots a bar graph. Vertical by default. #bar_size and #shift are in plot units.
875 IMPLOT_TMP void PlotBars(const char* label_id, const T* values, int count, double bar_size=0.67, double shift=0, ImPlotBarsFlags flags=0, int offset=0, int stride=sizeof(T));
876 IMPLOT_TMP void PlotBars(const char* label_id, const T* xs, const T* ys, int count, double bar_size, ImPlotBarsFlags flags=0, int offset=0, int stride=sizeof(T));
877 IMPLOT_API void PlotBarsG(const char* label_id, ImPlotGetter getter, void* data, int count, double bar_size, ImPlotBarsFlags flags=0);
878 
879 // Plots a group of bars. #values is a row-major matrix with #item_count rows and #group_count cols. #label_ids should have #item_count elements.
880 IMPLOT_TMP void PlotBarGroups(const char* const label_ids[], const T* values, int item_count, int group_count, double group_size=0.67, double shift=0, ImPlotBarGroupsFlags flags=0);
881 
882 // Plots vertical error bar. The label_id should be the same as the label_id of the associated line or bar plot.
883 IMPLOT_TMP void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* err, int count, ImPlotErrorBarsFlags flags=0, int offset=0, int stride=sizeof(T));
884 IMPLOT_TMP void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* neg, const T* pos, int count, ImPlotErrorBarsFlags flags=0, int offset=0, int stride=sizeof(T));
885 
886 // Plots stems. Vertical by default.
887 IMPLOT_TMP void PlotStems(const char* label_id, const T* values, int count, double ref=0, double scale=1, double start=0, ImPlotStemsFlags flags=0, int offset=0, int stride=sizeof(T));
888 IMPLOT_TMP void PlotStems(const char* label_id, const T* xs, const T* ys, int count, double ref=0, ImPlotStemsFlags flags=0, int offset=0, int stride=sizeof(T));
889 
890 // Plots infinite vertical or horizontal lines (e.g. for references or asymptotes).
891 IMPLOT_TMP void PlotInfLines(const char* label_id, const T* values, int count, ImPlotInfLinesFlags flags=0, int offset=0, int stride=sizeof(T));
892 
893 // Plots a pie chart. Center and radius are in plot units. #label_fmt can be set to NULL for no labels.
894 IMPLOT_TMP void PlotPieChart(const char* const label_ids[], const T* values, int count, double x, double y, double radius, const char* label_fmt="%.1f", double angle0=90, ImPlotPieChartFlags flags=0);
895 
896 // Plots a 2D heatmap chart. Values are expected to be in row-major order by default. Leave #scale_min and scale_max both at 0 for automatic color scaling, or set them to a predefined range. #label_fmt can be set to NULL for no labels.
897 IMPLOT_TMP void PlotHeatmap(const char* label_id, const T* values, int rows, int cols, double scale_min=0, double scale_max=0, const char* label_fmt="%.1f", const ImPlotPoint& bounds_min=ImPlotPoint(0,0), const ImPlotPoint& bounds_max=ImPlotPoint(1,1), ImPlotHeatmapFlags flags=0);
898 
899 // Plots a horizontal histogram. #bins can be a positive integer or an ImPlotBin_ method. If #range is left unspecified, the min/max of #values will be used as the range.
900 // Otherwise, outlier values outside of the range are not binned. The largest bin count or density is returned.
901 IMPLOT_TMP double PlotHistogram(const char* label_id, const T* values, int count, int bins=ImPlotBin_Sturges, double bar_scale=1.0, ImPlotRange range=ImPlotRange(), ImPlotHistogramFlags flags=0);
902 
903 // Plots two dimensional, bivariate histogram as a heatmap. #x_bins and #y_bins can be a positive integer or an ImPlotBin. If #range is left unspecified, the min/max of
904 // #xs an #ys will be used as the ranges. Otherwise, outlier values outside of range are not binned. The largest bin count or density is returned.
905 IMPLOT_TMP double PlotHistogram2D(const char* label_id, const T* xs, const T* ys, int count, int x_bins=ImPlotBin_Sturges, int y_bins=ImPlotBin_Sturges, ImPlotRect range=ImPlotRect(), ImPlotHistogramFlags flags=0);
906 
907 // Plots digital data. Digital plots do not respond to y drag or zoom, and are always referenced to the bottom of the plot.
908 IMPLOT_TMP void PlotDigital(const char* label_id, const T* xs, const T* ys, int count, ImPlotDigitalFlags flags=0, int offset=0, int stride=sizeof(T));
909 IMPLOT_API void PlotDigitalG(const char* label_id, ImPlotGetter getter, void* data, int count, ImPlotDigitalFlags flags=0);
910 
911 // Plots an axis-aligned image. #bounds_min/bounds_max are in plot coordinates (y-up) and #uv0/uv1 are in texture coordinates (y-down).
912 IMPLOT_API void PlotImage(const char* label_id, ImTextureID user_texture_id, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, const ImVec2& uv0=ImVec2(0,0), const ImVec2& uv1=ImVec2(1,1), const ImVec4& tint_col=ImVec4(1,1,1,1), ImPlotImageFlags flags=0);
913 
914 // Plots a centered text label at point x,y with an optional pixel offset. Text color can be changed with ImPlot::PushStyleColor(ImPlotCol_InlayText, ...).
915 IMPLOT_API void PlotText(const char* text, double x, double y, const ImVec2& pix_offset=ImVec2(0,0), ImPlotTextFlags flags=0);
916 
917 // Plots a dummy item (i.e. adds a legend entry colored by ImPlotCol_Line)
918 IMPLOT_API void PlotDummy(const char* label_id, ImPlotDummyFlags flags=0);
919 
920 //-----------------------------------------------------------------------------
921 // [SECTION] Plot Tools
922 //-----------------------------------------------------------------------------
923 
924 // The following can be used to render interactive elements and/or annotations.
925 // Like the item plotting functions above, they apply to the current x and y
926 // axes, which can be changed with `SetAxis/SetAxes`.
927 
928 // Shows a draggable point at x,y. #col defaults to ImGuiCol_Text.
929 IMPLOT_API bool DragPoint(int id, double* x, double* y, const ImVec4& col, float size = 4, ImPlotDragToolFlags flags=0);
930 // Shows a draggable vertical guide line at an x-value. #col defaults to ImGuiCol_Text.
931 IMPLOT_API bool DragLineX(int id, double* x, const ImVec4& col, float thickness = 1, ImPlotDragToolFlags flags=0);
932 // Shows a draggable horizontal guide line at a y-value. #col defaults to ImGuiCol_Text.
933 IMPLOT_API bool DragLineY(int id, double* y, const ImVec4& col, float thickness = 1, ImPlotDragToolFlags flags=0);
934 // Shows a draggable and resizeable rectangle.
935 IMPLOT_API bool DragRect(int id, double* x1, double* y1, double* x2, double* y2, const ImVec4& col, ImPlotDragToolFlags flags=0);
936 
937 // Shows an annotation callout at a chosen point. Clamping keeps annotations in the plot area. Annotations are always rendered on top.
938 IMPLOT_API void Annotation(double x, double y, const ImVec4& col, const ImVec2& pix_offset, bool clamp, bool round = false);
939 IMPLOT_API void Annotation(double x, double y, const ImVec4& col, const ImVec2& pix_offset, bool clamp, const char* fmt, ...) IM_FMTARGS(6);
940 IMPLOT_API void AnnotationV(double x, double y, const ImVec4& col, const ImVec2& pix_offset, bool clamp, const char* fmt, va_list args) IM_FMTLIST(6);
941 
942 // Shows a x-axis tag at the specified coordinate value.
943 IMPLOT_API void TagX(double x, const ImVec4& col, bool round = false);
944 IMPLOT_API void TagX(double x, const ImVec4& col, const char* fmt, ...) IM_FMTARGS(3);
945 IMPLOT_API void TagXV(double x, const ImVec4& col, const char* fmt, va_list args) IM_FMTLIST(3);
946 
947 // Shows a y-axis tag at the specified coordinate value.
948 IMPLOT_API void TagY(double y, const ImVec4& col, bool round = false);
949 IMPLOT_API void TagY(double y, const ImVec4& col, const char* fmt, ...) IM_FMTARGS(3);
950 IMPLOT_API void TagYV(double y, const ImVec4& col, const char* fmt, va_list args) IM_FMTLIST(3);
951 
952 //-----------------------------------------------------------------------------
953 // [SECTION] Plot Utils
954 //-----------------------------------------------------------------------------
955 
956 // Select which axis/axes will be used for subsequent plot elements.
957 IMPLOT_API void SetAxis(ImAxis axis);
958 IMPLOT_API void SetAxes(ImAxis x_axis, ImAxis y_axis);
959 
960 // Convert pixels to a position in the current plot's coordinate system. Passing IMPLOT_AUTO uses the current axes.
961 IMPLOT_API ImPlotPoint PixelsToPlot(const ImVec2& pix, ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);
962 IMPLOT_API ImPlotPoint PixelsToPlot(float x, float y, ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);
963 
964 // Convert a position in the current plot's coordinate system to pixels. Passing IMPLOT_AUTO uses the current axes.
965 IMPLOT_API ImVec2 PlotToPixels(const ImPlotPoint& plt, ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);
966 IMPLOT_API ImVec2 PlotToPixels(double x, double y, ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);
967 
968 // Get the current Plot position (top-left) in pixels.
969 IMPLOT_API ImVec2 GetPlotPos();
970 // Get the curent Plot size in pixels.
971 IMPLOT_API ImVec2 GetPlotSize();
972 
973 // Returns the mouse position in x,y coordinates of the current plot. Passing IMPLOT_AUTO uses the current axes.
974 IMPLOT_API ImPlotPoint GetPlotMousePos(ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);
975 // Returns the current plot axis range.
976 IMPLOT_API ImPlotRect GetPlotLimits(ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);
977 
978 // Returns true if the plot area in the current plot is hovered.
979 IMPLOT_API bool IsPlotHovered();
980 // Returns true if the axis label area in the current plot is hovered.
981 IMPLOT_API bool IsAxisHovered(ImAxis axis);
982 // Returns true if the bounding frame of a subplot is hovered.
983 IMPLOT_API bool IsSubplotsHovered();
984 
985 // Returns true if the current plot is being box selected.
986 IMPLOT_API bool IsPlotSelected();
987 // Returns the current plot box selection bounds. Passing IMPLOT_AUTO uses the current axes.
988 IMPLOT_API ImPlotRect GetPlotSelection(ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);
989 // Cancels a the current plot box selection.
990 IMPLOT_API void CancelPlotSelection();
991 
992 // Hides or shows the next plot item (i.e. as if it were toggled from the legend).
993 // Use ImPlotCond_Always if you need to forcefully set this every frame.
994 IMPLOT_API void HideNextItem(bool hidden = true, ImPlotCond cond = ImPlotCond_Once);
995 
996 // Use the following around calls to Begin/EndPlot to align l/r/t/b padding.
997 // Consider using Begin/EndSubplots first. They are more feature rich and
998 // accomplish the same behaviour by default. The functions below offer lower
999 // level control of plot alignment.
1000 
1001 // Align axis padding over multiple plots in a single row or column. #group_id must
1002 // be unique. If this function returns true, EndAlignedPlots() must be called.
1003 IMPLOT_API bool BeginAlignedPlots(const char* group_id, bool vertical = true);
1004 // Only call EndAlignedPlots() if BeginAlignedPlots() returns true!
1005 IMPLOT_API void EndAlignedPlots();
1006 
1007 //-----------------------------------------------------------------------------
1008 // [SECTION] Legend Utils
1009 //-----------------------------------------------------------------------------
1010 
1011 // Begin a popup for a legend entry.
1012 IMPLOT_API bool BeginLegendPopup(const char* label_id, ImGuiMouseButton mouse_button=1);
1013 // End a popup for a legend entry.
1014 IMPLOT_API void EndLegendPopup();
1015 // Returns true if a plot item legend entry is hovered.
1016 IMPLOT_API bool IsLegendEntryHovered(const char* label_id);
1017 
1018 //-----------------------------------------------------------------------------
1019 // [SECTION] Drag and Drop
1020 //-----------------------------------------------------------------------------
1021 
1022 // Turns the current plot's plotting area into a drag and drop target. Don't forget to call EndDragDropTarget!
1023 IMPLOT_API bool BeginDragDropTargetPlot();
1024 // Turns the current plot's X-axis into a drag and drop target. Don't forget to call EndDragDropTarget!
1025 IMPLOT_API bool BeginDragDropTargetAxis(ImAxis axis);
1026 // Turns the current plot's legend into a drag and drop target. Don't forget to call EndDragDropTarget!
1027 IMPLOT_API bool BeginDragDropTargetLegend();
1028 // Ends a drag and drop target (currently just an alias for ImGui::EndDragDropTarget).
1029 IMPLOT_API void EndDragDropTarget();
1030 
1031 // NB: By default, plot and axes drag and drop *sources* require holding the Ctrl modifier to initiate the drag.
1032 // You can change the modifier if desired. If ImGuiMod_None is provided, the axes will be locked from panning.
1033 
1034 // Turns the current plot's plotting area into a drag and drop source. You must hold Ctrl. Don't forget to call EndDragDropSource!
1035 IMPLOT_API bool BeginDragDropSourcePlot(ImGuiDragDropFlags flags=0);
1036 // Turns the current plot's X-axis into a drag and drop source. You must hold Ctrl. Don't forget to call EndDragDropSource!
1037 IMPLOT_API bool BeginDragDropSourceAxis(ImAxis axis, ImGuiDragDropFlags flags=0);
1038 // Turns an item in the current plot's legend into drag and drop source. Don't forget to call EndDragDropSource!
1039 IMPLOT_API bool BeginDragDropSourceItem(const char* label_id, ImGuiDragDropFlags flags=0);
1040 // Ends a drag and drop source (currently just an alias for ImGui::EndDragDropSource).
1041 IMPLOT_API void EndDragDropSource();
1042 
1043 //-----------------------------------------------------------------------------
1044 // [SECTION] Styling
1045 //-----------------------------------------------------------------------------
1046 
1047 // Styling colors in ImPlot works similarly to styling colors in ImGui, but
1048 // with one important difference. Like ImGui, all style colors are stored in an
1049 // indexable array in ImPlotStyle. You can permanently modify these values through
1050 // GetStyle().Colors, or temporarily modify them with Push/Pop functions below.
1051 // However, by default all style colors in ImPlot default to a special color
1052 // IMPLOT_AUTO_COL. The behavior of this color depends upon the style color to
1053 // which it as applied:
1054 //
1055 // 1) For style colors associated with plot items (e.g. ImPlotCol_Line),
1056 // IMPLOT_AUTO_COL tells ImPlot to color the item with the next unused
1057 // color in the current colormap. Thus, every item will have a different
1058 // color up to the number of colors in the colormap, at which point the
1059 // colormap will roll over. For most use cases, you should not need to
1060 // set these style colors to anything but IMPLOT_COL_AUTO; you are
1061 // probably better off changing the current colormap. However, if you
1062 // need to explicitly color a particular item you may either Push/Pop
1063 // the style color around the item in question, or use the SetNextXXXStyle
1064 // API below. If you permanently set one of these style colors to a specific
1065 // color, or forget to call Pop, then all subsequent items will be styled
1066 // with the color you set.
1067 //
1068 // 2) For style colors associated with plot styling (e.g. ImPlotCol_PlotBg),
1069 // IMPLOT_AUTO_COL tells ImPlot to set that color from color data in your
1070 // **ImGuiStyle**. The ImGuiCol_ that these style colors default to are
1071 // detailed above, and in general have been mapped to produce plots visually
1072 // consistent with your current ImGui style. Of course, you are free to
1073 // manually set these colors to whatever you like, and further can Push/Pop
1074 // them around individual plots for plot-specific styling (e.g. coloring axes).
1075 
1076 // Provides access to plot style structure for permanant modifications to colors, sizes, etc.
1077 IMPLOT_API ImPlotStyle& GetStyle();
1078 
1079 // Style plot colors for current ImGui style (default).
1080 IMPLOT_API void StyleColorsAuto(ImPlotStyle* dst = NULL);
1081 // Style plot colors for ImGui "Classic".
1082 IMPLOT_API void StyleColorsClassic(ImPlotStyle* dst = NULL);
1083 // Style plot colors for ImGui "Dark".
1084 IMPLOT_API void StyleColorsDark(ImPlotStyle* dst = NULL);
1085 // Style plot colors for ImGui "Light".
1086 IMPLOT_API void StyleColorsLight(ImPlotStyle* dst = NULL);
1087 
1088 // Use PushStyleX to temporarily modify your ImPlotStyle. The modification
1089 // will last until the matching call to PopStyleX. You MUST call a pop for
1090 // every push, otherwise you will leak memory! This behaves just like ImGui.
1091 
1092 // Temporarily modify a style color. Don't forget to call PopStyleColor!
1093 IMPLOT_API void PushStyleColor(ImPlotCol idx, ImU32 col);
1094 IMPLOT_API void PushStyleColor(ImPlotCol idx, const ImVec4& col);
1095 // Undo temporary style color modification(s). Undo multiple pushes at once by increasing count.
1096 IMPLOT_API void PopStyleColor(int count = 1);
1097 
1098 // Temporarily modify a style variable of float type. Don't forget to call PopStyleVar!
1099 IMPLOT_API void PushStyleVar(ImPlotStyleVar idx, float val);
1100 // Temporarily modify a style variable of int type. Don't forget to call PopStyleVar!
1101 IMPLOT_API void PushStyleVar(ImPlotStyleVar idx, int val);
1102 // Temporarily modify a style variable of ImVec2 type. Don't forget to call PopStyleVar!
1103 IMPLOT_API void PushStyleVar(ImPlotStyleVar idx, const ImVec2& val);
1104 // Undo temporary style variable modification(s). Undo multiple pushes at once by increasing count.
1105 IMPLOT_API void PopStyleVar(int count = 1);
1106 
1107 // The following can be used to modify the style of the next plot item ONLY. They do
1108 // NOT require calls to PopStyleX. Leave style attributes you don't want modified to
1109 // IMPLOT_AUTO or IMPLOT_AUTO_COL. Automatic styles will be deduced from the current
1110 // values in your ImPlotStyle or from Colormap data.
1111 
1112 // Set the line color and weight for the next item only.
1113 IMPLOT_API void SetNextLineStyle(const ImVec4& col = IMPLOT_AUTO_COL, float weight = IMPLOT_AUTO);
1114 // Set the fill color for the next item only.
1115 IMPLOT_API void SetNextFillStyle(const ImVec4& col = IMPLOT_AUTO_COL, float alpha_mod = IMPLOT_AUTO);
1116 // Set the marker style for the next item only.
1117 IMPLOT_API void SetNextMarkerStyle(ImPlotMarker marker = IMPLOT_AUTO, float size = IMPLOT_AUTO, const ImVec4& fill = IMPLOT_AUTO_COL, float weight = IMPLOT_AUTO, const ImVec4& outline = IMPLOT_AUTO_COL);
1118 // Set the error bar style for the next item only.
1119 IMPLOT_API void SetNextErrorBarStyle(const ImVec4& col = IMPLOT_AUTO_COL, float size = IMPLOT_AUTO, float weight = IMPLOT_AUTO);
1120 
1121 // Gets the last item primary color (i.e. its legend icon color)
1122 IMPLOT_API ImVec4 GetLastItemColor();
1123 
1124 // Returns the null terminated string name for an ImPlotCol.
1125 IMPLOT_API const char* GetStyleColorName(ImPlotCol idx);
1126 // Returns the null terminated string name for an ImPlotMarker.
1127 IMPLOT_API const char* GetMarkerName(ImPlotMarker idx);
1128 
1129 //-----------------------------------------------------------------------------
1130 // [SECTION] Colormaps
1131 //-----------------------------------------------------------------------------
1132 
1133 // Item styling is based on colormaps when the relevant ImPlotCol_XXX is set to
1134 // IMPLOT_AUTO_COL (default). Several built-in colormaps are available. You can
1135 // add and then push/pop your own colormaps as well. To permanently set a colormap,
1136 // modify the Colormap index member of your ImPlotStyle.
1137 
1138 // Colormap data will be ignored and a custom color will be used if you have done one of the following:
1139 // 1) Modified an item style color in your ImPlotStyle to anything other than IMPLOT_AUTO_COL.
1140 // 2) Pushed an item style color using PushStyleColor().
1141 // 3) Set the next item style with a SetNextXXXStyle function.
1142 
1143 // Add a new colormap. The color data will be copied. The colormap can be used by pushing either the returned index or the
1144 // string name with PushColormap. The colormap name must be unique and the size must be greater than 1. You will receive
1145 // an assert otherwise! By default colormaps are considered to be qualitative (i.e. discrete). If you want to create a
1146 // continuous colormap, set #qual=false. This will treat the colors you provide as keys, and ImPlot will build a linearly
1147 // interpolated lookup table. The memory footprint of this table will be exactly ((size-1)*255+1)*4 bytes.
1148 IMPLOT_API ImPlotColormap AddColormap(const char* name, const ImVec4* cols, int size, bool qual=true);
1149 IMPLOT_API ImPlotColormap AddColormap(const char* name, const ImU32* cols, int size, bool qual=true);
1150 
1151 // Returns the number of available colormaps (i.e. the built-in + user-added count).
1152 IMPLOT_API int GetColormapCount();
1153 // Returns a null terminated string name for a colormap given an index. Returns NULL if index is invalid.
1154 IMPLOT_API const char* GetColormapName(ImPlotColormap cmap);
1155 // Returns an index number for a colormap given a valid string name. Returns -1 if name is invalid.
1156 IMPLOT_API ImPlotColormap GetColormapIndex(const char* name);
1157 
1158 // Temporarily switch to one of the built-in (i.e. ImPlotColormap_XXX) or user-added colormaps (i.e. a return value of AddColormap). Don't forget to call PopColormap!
1159 IMPLOT_API void PushColormap(ImPlotColormap cmap);
1160 // Push a colormap by string name. Use built-in names such as "Default", "Deep", "Jet", etc. or a string you provided to AddColormap. Don't forget to call PopColormap!
1161 IMPLOT_API void PushColormap(const char* name);
1162 // Undo temporary colormap modification(s). Undo multiple pushes at once by increasing count.
1163 IMPLOT_API void PopColormap(int count = 1);
1164 
1165 // Returns the next color from the current colormap and advances the colormap for the current plot.
1166 // Can also be used with no return value to skip colors if desired. You need to call this between Begin/EndPlot!
1167 IMPLOT_API ImVec4 NextColormapColor();
1168 
1169 // Colormap utils. If cmap = IMPLOT_AUTO (default), the current colormap is assumed.
1170 // Pass an explicit colormap index (built-in or user-added) to specify otherwise.
1171 
1172 // Returns the size of a colormap.
1173 IMPLOT_API int GetColormapSize(ImPlotColormap cmap = IMPLOT_AUTO);
1174 // Returns a color from a colormap given an index >= 0 (modulo will be performed).
1175 IMPLOT_API ImVec4 GetColormapColor(int idx, ImPlotColormap cmap = IMPLOT_AUTO);
1176 // Sample a color from the current colormap given t between 0 and 1.
1177 IMPLOT_API ImVec4 SampleColormap(float t, ImPlotColormap cmap = IMPLOT_AUTO);
1178 
1179 // Shows a vertical color scale with linear spaced ticks using the specified color map. Use double hashes to hide label (e.g. "##NoLabel"). If scale_min > scale_max, the scale to color mapping will be reversed.
1180 IMPLOT_API void ColormapScale(const char* label, double scale_min, double scale_max, const ImVec2& size = ImVec2(0,0), const char* format = "%g", ImPlotColormapScaleFlags flags = 0, ImPlotColormap cmap = IMPLOT_AUTO);
1181 // Shows a horizontal slider with a colormap gradient background. Optionally returns the color sampled at t in [0 1].
1182 IMPLOT_API bool ColormapSlider(const char* label, float* t, ImVec4* out = NULL, const char* format = "", ImPlotColormap cmap = IMPLOT_AUTO);
1183 // Shows a button with a colormap gradient brackground.
1184 IMPLOT_API bool ColormapButton(const char* label, const ImVec2& size = ImVec2(0,0), ImPlotColormap cmap = IMPLOT_AUTO);
1185 
1186 // When items in a plot sample their color from a colormap, the color is cached and does not change
1187 // unless explicitly overriden. Therefore, if you change the colormap after the item has already been plotted,
1188 // item colors will NOT update. If you need item colors to resample the new colormap, then use this
1189 // function to bust the cached colors. If #plot_title_id is NULL, then every item in EVERY existing plot
1190 // will be cache busted. Otherwise only the plot specified by #plot_title_id will be busted. For the
1191 // latter, this function must be called in the same ImGui ID scope that the plot is in. You should rarely if ever
1192 // need this function, but it is available for applications that require runtime colormap swaps (e.g. Heatmaps demo).
1193 IMPLOT_API void BustColorCache(const char* plot_title_id = NULL);
1194 
1195 //-----------------------------------------------------------------------------
1196 // [SECTION] Input Mapping
1197 //-----------------------------------------------------------------------------
1198 
1199 // Provides access to input mapping structure for permanant modifications to controls for pan, select, etc.
1200 IMPLOT_API ImPlotInputMap& GetInputMap();
1201 
1202 // Default input mapping: pan = LMB drag, box select = RMB drag, fit = LMB double click, context menu = RMB click, zoom = scroll.
1203 IMPLOT_API void MapInputDefault(ImPlotInputMap* dst = NULL);
1204 // Reverse input mapping: pan = RMB drag, box select = LMB drag, fit = LMB double click, context menu = RMB click, zoom = scroll.
1205 IMPLOT_API void MapInputReverse(ImPlotInputMap* dst = NULL);
1206 
1207 //-----------------------------------------------------------------------------
1208 // [SECTION] Miscellaneous
1209 //-----------------------------------------------------------------------------
1210 
1211 // Render icons similar to those that appear in legends (nifty for data lists).
1212 IMPLOT_API void ItemIcon(const ImVec4& col);
1213 IMPLOT_API void ItemIcon(ImU32 col);
1214 IMPLOT_API void ColormapIcon(ImPlotColormap cmap);
1215 
1216 // Get the plot draw list for custom rendering to the current plot area. Call between Begin/EndPlot.
1217 IMPLOT_API ImDrawList* GetPlotDrawList();
1218 // Push clip rect for rendering to current plot area. The rect can be expanded or contracted by #expand pixels. Call between Begin/EndPlot.
1219 IMPLOT_API void PushPlotClipRect(float expand=0);
1220 // Pop plot clip rect. Call between Begin/EndPlot.
1221 IMPLOT_API void PopPlotClipRect();
1222 
1223 // Shows ImPlot style selector dropdown menu.
1224 IMPLOT_API bool ShowStyleSelector(const char* label);
1225 // Shows ImPlot colormap selector dropdown menu.
1226 IMPLOT_API bool ShowColormapSelector(const char* label);
1227 // Shows ImPlot input map selector dropdown menu.
1228 IMPLOT_API bool ShowInputMapSelector(const char* label);
1229 // Shows ImPlot style editor block (not a window).
1230 IMPLOT_API void ShowStyleEditor(ImPlotStyle* ref = NULL);
1231 // Add basic help/info block for end users (not a window).
1232 IMPLOT_API void ShowUserGuide();
1233 // Shows ImPlot metrics/debug information window.
1234 IMPLOT_API void ShowMetricsWindow(bool* p_popen = NULL);
1235 
1236 //-----------------------------------------------------------------------------
1237 // [SECTION] Demo
1238 //-----------------------------------------------------------------------------
1239 
1240 // Shows the ImPlot demo window (add implot_demo.cpp to your sources!)
1241 IMPLOT_API void ShowDemoWindow(bool* p_open = NULL);
1242 
1243 } // namespace ImPlot
1244 
1245 //-----------------------------------------------------------------------------
1246 // [SECTION] Obsolete API
1247 //-----------------------------------------------------------------------------
1248 
1249 // The following functions will be removed! Keep your copy of implot up to date!
1250 // Occasionally set '#define IMPLOT_DISABLE_OBSOLETE_FUNCTIONS' to stay ahead.
1251 // If you absolutely must use these functions and do not want to receive compiler
1252 // warnings, set '#define IMPLOT_DISABLE_OBSOLETE_WARNINGS'.
1253 
1254 #ifndef IMPLOT_DISABLE_OBSOLETE_FUNCTIONS
1255 
1256 #ifndef IMPLOT_DISABLE_DEPRECATED_WARNINGS
1257 #if __cplusplus > 201402L
1258 #define IMPLOT_DEPRECATED(method) [[deprecated]] method
1259 #elif defined( __GNUC__ ) && !defined( __INTEL_COMPILER ) && ( __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) )
1260 #define IMPLOT_DEPRECATED(method) method __attribute__( ( deprecated ) )
1261 #elif defined( _MSC_VER )
1262 #define IMPLOT_DEPRECATED(method) __declspec(deprecated) method
1263 #else
1264 #define IMPLOT_DEPRECATED(method) method
1265 #endif
1266 #else
1267 #define IMPLOT_DEPRECATED(method) method
1268 #endif
1269 
1270 enum ImPlotFlagsObsolete_ {
1271  ImPlotFlags_YAxis2 = 1 << 20,
1272  ImPlotFlags_YAxis3 = 1 << 21,
1273 };
1274 
1275 namespace ImPlot {
1276 
1277 // OBSOLETED in v0.13 -> PLANNED REMOVAL in v1.0
1278 IMPLOT_DEPRECATED( IMPLOT_API bool BeginPlot(const char* title_id,
1279  const char* x_label, // = NULL,
1280  const char* y_label, // = NULL,
1281  const ImVec2& size = ImVec2(-1,0),
1282  ImPlotFlags flags = ImPlotFlags_None,
1283  ImPlotAxisFlags x_flags = 0,
1284  ImPlotAxisFlags y_flags = 0,
1285  ImPlotAxisFlags y2_flags = ImPlotAxisFlags_AuxDefault,
1286  ImPlotAxisFlags y3_flags = ImPlotAxisFlags_AuxDefault,
1287  const char* y2_label = NULL,
1288  const char* y3_label = NULL) );
1289 
1290 } // namespace ImPlot
1291 
1292 #endif
Definition: imgui.h:2499
Definition: imgui_internal.h:1732
Definition: implot_internal.h:1205
Definition: implot.h:562
Definition: implot.h:467
Definition: implot.h:481
Definition: implot.h:491
Definition: implot.h:505
Definition: imgui.h:254
Definition: imgui.h:267