|
|
@ -1043,6 +1043,8 @@ static void ShowDemoWindowWidgets()
|
|
|
|
ImGui::TreePop();
|
|
|
|
ImGui::TreePop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Plot/Graph widgets are currently fairly limited.
|
|
|
|
|
|
|
|
// Consider writing your own plotting widget, or using a third-party one (see "Wiki->Useful Widgets", or github.com/ocornut/imgui/issues/2747)
|
|
|
|
if (ImGui::TreeNode("Plots Widgets"))
|
|
|
|
if (ImGui::TreeNode("Plots Widgets"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
static bool animate = true;
|
|
|
|
static bool animate = true;
|
|
|
@ -1066,7 +1068,18 @@ static void ShowDemoWindowWidgets()
|
|
|
|
phase += 0.10f*values_offset;
|
|
|
|
phase += 0.10f*values_offset;
|
|
|
|
refresh_time += 1.0f/60.0f;
|
|
|
|
refresh_time += 1.0f/60.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::PlotLines("Lines", values, IM_ARRAYSIZE(values), values_offset, "avg 0.0", -1.0f, 1.0f, ImVec2(0,80));
|
|
|
|
|
|
|
|
|
|
|
|
// Plots can display overlay texts
|
|
|
|
|
|
|
|
// (in this example, we will display an average value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
float average = 0.0f;
|
|
|
|
|
|
|
|
for (int n = 0; n < IM_ARRAYSIZE(values); n++)
|
|
|
|
|
|
|
|
average += values[n];
|
|
|
|
|
|
|
|
average /= (float)IM_ARRAYSIZE(values);
|
|
|
|
|
|
|
|
char overlay[32];
|
|
|
|
|
|
|
|
sprintf(overlay, "avg %f", average);
|
|
|
|
|
|
|
|
ImGui::PlotLines("Lines", values, IM_ARRAYSIZE(values), values_offset, overlay, -1.0f, 1.0f, ImVec2(0,80));
|
|
|
|
|
|
|
|
}
|
|
|
|
ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0,80));
|
|
|
|
ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0,80));
|
|
|
|
|
|
|
|
|
|
|
|
// Use functions to generate output
|
|
|
|
// Use functions to generate output
|
|
|
|