-
I'm still new to ImPlot and ImGui in general, but this library seems to have everything I could possibly want for my current project and more, except for one problem: I want to chart a plot for a data set from a file where the size of said data set varies greatly each time, could be a few thousand elements, could be over a million, but the plot methods don't accept vectors as arguments, only arrays, and I really don't want to allocate a lot of space that I won't end up using, is there anyway around this? Or do I have to possibly modify the source code and write my own plot methods? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Unless I'm misunderstanding your problem, you can just pass a pointer to the underlying data of your std::vector xs = ...;
std::vector ys = ...;
...
if (ImPlot::BeginPlot("My Plot")) {
ImPlot::PlotLine("My Line", xs.data(), ys.data(), xs.size()); // assuming xs and ys are same size!
ImPlot::EndPlot();
} Generally speaking, this is quite typical when a function calls for a |
Beta Was this translation helpful? Give feedback.
Unless I'm misunderstanding your problem, you can just pass a pointer to the underlying data of your
std::vector
like so:Generally speaking, this is quite typical when a function calls for a
T*
and your data is contained in astd::vector<T>
(or evenstd::array
).