VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
imgui_plot.h
Go to the documentation of this file.
1 #pragma once
2 //#include <cstdint> //once we move up to c++11 we can use this header.
3 #include <stdint.h>
4 #include <imgui.h>
5 
6 namespace ImGui {
7 // Use this structure to pass the plot data and settings into the Plot function
8 struct PlotConfig {
9 
11  : values()
12  , scale()
13  , tooltip()
14  , grid_x()
15  , grid_y()
16  , selection()
17  , v_lines()
18  , frame_size(0.f, 0.f)
19  , line_thickness(1.f)
20  , skip_small_lines(true)
21  , overlay_text(NULL)
22  {
23 
24  }
25 
26  struct Values {
28  : xs(NULL)
29  , ys(NULL)
30  , count(0)
31  , offset(0)
32  , color(0)
33  , ys_list(NULL)
34  , ys_count(NULL)
35  , colors(NULL)
36  {
37 
38  }
39  // if necessary, you can provide x-axis values
40  const float *xs /*= NULL*/;
41  // array of y values. If null, use ys_list (below)
42  const float *ys /*= NULL*/;
43  // the number of values in each array
44  int count;
45  // at which offset to start plotting.
46  // Warning: count+offset must be <= length of array!
47  int offset /*= 0*/;
48  // Plot color. If 0, use ImGuiCol_PlotLines.
49  ImU32 color /*= 0*/;
50 
51  // in case you need to draw multiple plots at once, use this instead of ys
52  const float **ys_list /*= NULL*/;
53  // the number of plots to draw
54  int ys_count /*= 0*/;
55  // colors for each plot
56  const ImU32* colors /*= NULL*/;
57  } values;
58  struct Scale {
60  : min(0)
61  , max(0)
62  , type(Linear)
63  {
64 
65  }
66  // Minimum plot value
67  float min;
68  // Maximum plot value
69  float max;
70  enum Type {
73  };
74  // How to scale the x-axis
75  Type type /*= Linear*/;
76  } scale;
77  struct Tooltip {
79  : show(false)
80  , format("%g: %8.4g")
81  {
82 
83  }
84  bool show /*= false*/;
85  const char* format /*= "%g: %8.4g"*/;
86  } tooltip;
87  struct Grid {
88  Grid()
89  : show(false)
90  , size(100)
91  , subticks(10)
92  {
93 
94  }
95  bool show /*= false*/;
96  float size /*= 100*/; // at which intervals to draw the grid
97  int subticks /*= 10*/; // how many subticks in each tick
98  } grid_x, grid_y;
99  struct Selection {
101  : show(false)
102  , start(NULL)
103  , length(NULL)
104  , sanitize_fn(NULL)
105  {
106 
107  }
108  bool show /*= false*/;
109  uint32_t* start /*= NULL*/;
110  uint32_t* length /*= NULL*/;
111  // "Sanitize" function. Give it selection length, and it will return
112  // the "allowed" length. Useful for FFT, where selection must be
113  // of power of two
114  uint32_t(*sanitize_fn)(uint32_t) /*= NULL*/;
115  } selection;
116  struct VerticalLines {
118  : show(false)
119  , indices(NULL)
120  , count(0)
121  {
122 
123  }
124  bool show /*= false*/;
125  const size_t* indices /*= NULL*/; // at which indices to draw the lines
126  size_t count /*= 0*/;
127  } v_lines;
128  ImVec2 frame_size /*= ImVec2(0.f, 0.f)*/;
129  float line_thickness /*= 1.f*/;
130  bool skip_small_lines /*= true*/;
131  const char* overlay_text /*= NULL*/;
132 
133 
134 };
135 // C++11
136 //enum class PlotStatus {
140 };
141 
142 IMGUI_API PlotStatus Plot(const char* label, const PlotConfig& conf);
143 }
bool show
Definition: imgui_plot.h:124
const size_t * indices
Definition: imgui_plot.h:125
unsigned int ImU32
Definition: imgui.h:230
Selection()
Definition: imgui_plot.h:100
const char * format
Definition: imgui_plot.h:85
const float * ys
Definition: imgui_plot.h:42
Definition: imgui_plot.h:77
ImVec2 frame_size
Definition: imgui_plot.h:128
struct ImGui::PlotConfig::Values values
Tooltip()
Definition: imgui_plot.h:78
struct ImGui::PlotConfig::Grid grid_x
voidpf void uLong size
Definition: ioapi.h:39
int ys_count
Definition: imgui_plot.h:54
bool show
Definition: imgui_plot.h:84
IMGUI_API PlotStatus Plot(const char *label, const PlotConfig &conf)
int subticks
Definition: imgui_plot.h:97
Definition: imgui_plot.h:116
struct ImGui::PlotConfig::VerticalLines v_lines
Definition: imgui_plot.h:58
const float * xs
Definition: imgui_plot.h:40
struct ImGui::PlotConfig::Grid grid_y
PlotStatus
Definition: imgui_plot.h:137
Definition: imgui.h:262
struct ImGui::PlotConfig::Tooltip tooltip
#define IMGUI_API
Definition: imgui.h:78
size_t count
Definition: imgui_plot.h:126
ImU32 color
Definition: imgui_plot.h:49
Type
Definition: imgui_plot.h:70
Type type
Definition: imgui_plot.h:75
VerticalLines()
Definition: imgui_plot.h:117
float line_thickness
Definition: imgui_plot.h:129
float max
Definition: imgui_plot.h:69
Definition: imgui_plot.h:87
Definition: imgui_plot.h:8
Definition: imgui_plot.h:99
struct ImGui::PlotConfig::Scale scale
uint32_t * length
Definition: imgui_plot.h:110
Values()
Definition: imgui_plot.h:27
bool show
Definition: imgui_plot.h:108
Scale()
Definition: imgui_plot.h:59
Definition: imgui_plot.h:139
int count
Definition: imgui_plot.h:44
bool show
Definition: imgui_plot.h:95
Definition: imgui_plot.h:26
struct ImGui::PlotConfig::Selection selection
float min
Definition: imgui_plot.h:67
const char * overlay_text
Definition: imgui_plot.h:131
Definition: imgui_plot.h:72
Definition: imgui_plot.h:71
voidpf uLong offset
Definition: ioapi.h:42
const ImU32 * colors
Definition: imgui_plot.h:56
PlotConfig()
Definition: imgui_plot.h:10
Definition: imgui_plot.h:138
uint32_t(* sanitize_fn)(uint32_t)
Definition: imgui_plot.h:114
uint32_t * start
Definition: imgui_plot.h:109
Grid()
Definition: imgui_plot.h:88
bool skip_small_lines
Definition: imgui_plot.h:130
const float ** ys_list
Definition: imgui_plot.h:52

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)