|
|
@ -1561,16 +1561,17 @@ static void ShowDemoWindowWidgets()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Plot/Graph widgets are not very good.
|
|
|
|
// Plot/Graph widgets are not very good.
|
|
|
|
// Consider writing your own, or using a third-party one, see:
|
|
|
|
// Consider using a third-party library such as ImPlot: https://github.com/epezent/implot
|
|
|
|
// - ImPlot https://github.com/epezent/implot
|
|
|
|
// (see others https://github.com/ocornut/imgui/wiki/Useful-Extensions)
|
|
|
|
// - others https://github.com/ocornut/imgui/wiki/Useful-Extensions
|
|
|
|
|
|
|
|
if (ImGui::TreeNode("Plots Widgets"))
|
|
|
|
if (ImGui::TreeNode("Plots Widgets"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
static bool animate = true;
|
|
|
|
static bool animate = true;
|
|
|
|
ImGui::Checkbox("Animate", &animate);
|
|
|
|
ImGui::Checkbox("Animate", &animate);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Plot as lines and plot as histogram
|
|
|
|
static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };
|
|
|
|
static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };
|
|
|
|
ImGui::PlotLines("Frame Times", arr, IM_ARRAYSIZE(arr));
|
|
|
|
ImGui::PlotLines("Frame Times", arr, IM_ARRAYSIZE(arr));
|
|
|
|
|
|
|
|
ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0, 80.0f));
|
|
|
|
|
|
|
|
|
|
|
|
// Fill an array of contiguous float values to plot
|
|
|
|
// Fill an array of contiguous float values to plot
|
|
|
|
// Tip: If your float aren't contiguous but part of a structure, you can pass a pointer to your first float
|
|
|
|
// Tip: If your float aren't contiguous but part of a structure, you can pass a pointer to your first float
|
|
|
@ -1600,7 +1601,6 @@ static void ShowDemoWindowWidgets()
|
|
|
|
sprintf(overlay, "avg %f", average);
|
|
|
|
sprintf(overlay, "avg %f", average);
|
|
|
|
ImGui::PlotLines("Lines", values, IM_ARRAYSIZE(values), values_offset, overlay, -1.0f, 1.0f, ImVec2(0, 80.0f));
|
|
|
|
ImGui::PlotLines("Lines", values, IM_ARRAYSIZE(values), values_offset, overlay, -1.0f, 1.0f, ImVec2(0, 80.0f));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0, 80.0f));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Use functions to generate output
|
|
|
|
// Use functions to generate output
|
|
|
|
// FIXME: This is rather awkward because current plot API only pass in indices.
|
|
|
|
// FIXME: This is rather awkward because current plot API only pass in indices.
|
|
|
|