VR-Vantage 3.0 API Documentation
Home
Modules
Namespaces
Classes
Files
Libraries
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
vrvImgui
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
10
PlotConfig
()
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
{
27
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
{
59
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
{
71
Linear
,
72
Log10
,
73
};
74
// How to scale the x-axis
75
Type
type
/*= Linear*/
;
76
}
scale
;
77
struct
Tooltip
{
78
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
{
100
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
{
117
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 {
137
enum
PlotStatus
{
138
nothing
,
139
selection_updated
,
140
};
141
142
IMGUI_API
PlotStatus
Plot
(
const
char
*
label
,
const
PlotConfig& conf);
143
}
Copyright © 2005-2022 MAK Technologies. All Rights Reserved (
www.mak.com
)