MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / Demo_Annotations

Function Demo_Annotations

Source/3rdParty/implot/implot_demo.cpp:2135–2159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2133//-----------------------------------------------------------------------------
2134
2135void Demo_Annotations() {
2136 IMGUI_DEMO_MARKER("Tools/Annotations");
2137 static bool clamp = false;
2138 ImGui::Checkbox("Clamp",&clamp);
2139 if (ImPlot::BeginPlot("##Annotations")) {
2140 ImPlot::SetupAxesLimits(0,2,0,1);
2141 static float p[] = {0.25f, 0.25f, 0.75f, 0.75f, 0.25f};
2142 ImPlot::PlotScatter("##Points",&p[0],&p[1],4);
2143 ImVec4 col = GetLastItemColor();
2144 ImPlot::Annotation(0.25,0.25,col,ImVec2(-15,15),clamp,"BL");
2145 ImPlot::Annotation(0.75,0.25,col,ImVec2(15,15),clamp,"BR");
2146 ImPlot::Annotation(0.75,0.75,col,ImVec2(15,-15),clamp,"TR");
2147 ImPlot::Annotation(0.25,0.75,col,ImVec2(-15,-15),clamp,"TL");
2148 ImPlot::Annotation(0.5,0.5,col,ImVec2(0,0),clamp,"Center");
2149
2150 ImPlot::Annotation(1.25,0.75,ImVec4(0,1,0,1),ImVec2(0,0),clamp);
2151
2152 float bx[] = {1.2f,1.5f,1.8f};
2153 float by[] = {0.25f, 0.5f, 0.75f};
2154 ImPlot::PlotBars("##Bars",bx,by,3,0.2);
2155 for (int i = 0; i < 3; ++i)
2156 ImPlot::Annotation(bx[i],by[i],ImVec4(0,0,0,0),ImVec2(0,-5),clamp,"B[%d]=%.2f",i,by[i]);
2157 ImPlot::EndPlot();
2158 }
2159}
2160
2161//-----------------------------------------------------------------------------
2162

Callers

nothing calls this directly

Calls 10

CheckboxFunction · 0.85
BeginPlotFunction · 0.85
SetupAxesLimitsFunction · 0.85
PlotScatterFunction · 0.85
GetLastItemColorFunction · 0.85
ImVec2Function · 0.85
ImVec4Class · 0.85
PlotBarsFunction · 0.85
EndPlotFunction · 0.85
AnnotationFunction · 0.70

Tested by

no test coverage detected