-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImPlot v0.1 Discussions #1
Comments
|
|
|
That is a fair point. I guess we only really need to expose the ability to do basic queries, and then let the end user decide how to process the query. I've added a feature that allows a query range to be drawn (middle drag or Ctrl + right drag). Use the Alt and Shift keys to expand the range. The range can then be retrieved with |
|
I agree that a "set and forget" mode for query ranges would be useful. I will need to decouple it a bit more from box selection to make it work, but it should be doable. Do you have any ideas for what the input method would be? |
What you did is excellent, but i think it's annoying that selection disappears and you cannot refine the query context. |
.. or cursors #1 (comment) |
gp.BB_grid is the regular bounding box of the plot area/grid in pixels. gp.PixelRange is the same, but the min/max values get swapped when the axes are flipped/inverted. I think the digital signals look great! My only concern is that they don't scroll with everything else. I would like to see them work similar to the bar plots function. The way I would do it, is let the user specify a y location and height, both in plot units. What is the function signature? How is digital data represented? (bool* ?) |
I should be more specific...I find it strange that they don't scroll in the Y direction. |
To be honest the vertical scrolling and zooming is what i do not want at all for digital signals; the real scenario is mixing logic events (digital) with control signals (analog), and if you zoom vertically the digital signals you will loose the analysis context. About the function signature actually it's derived from Plot() so it's still float* and so signals value are 0.0f or 1.0f. Obviously it's not good, but i was more afraid about new API familiarization. |
Is there a reason that the digital signals couldn't be plotted on a separate plot? |
they can be plotted on separate plot as well, but imagine that you want to check at rising edge of digital signal the value of another analog signal? it's easy to vertical scroll the analog signal and the point of intersection with digital positive edge is the value at that specific moment. It's very usefull |
Ah, I see. I suppose you also would need to link their x-axis somehow. I understand the issue now. We can keep it as is until we come up with a better solution. Submit a PR when you are ready. Can you also add it to the demo under a new header (and possibly to Realtime Plots as well? |
Yes, correct. I will work to cleanup a little bit the code and try to handle digital data as bool*. If you have a tip about this topic, you are welcome. |
actually, the minimum amount of information needed to render the plot is 1) the initial state (low/high), and then a sequence of times ( or x values) where the state flips. so: PlotDigital(const char* label, const float* x_flip, bool intial_value) or, if you prefer: PlotDigital(const char* label, const float* xs, const bool* ys) |
The second may be more user friendly. |
I pushed a much improved query mode per your recommendations. This took a while to get just right, but I'm very happy with how it turned out. Checkout the I couldn't decide if queries should be pixel based, or plot unit based. They both seemed useful, so I added both. The mode can be toggled with the |
I just need to add a few functions that allow for query ranges to be set through code, and then I think this is good enough for now. Any thing else you'd like to see from this? |
Great job! |
Change ImPlotGetterData like so or am I totally wrong? struct ImPlotGetterData
{
const float* Xs;
const float* Ys;
const bool* YDs;
const float* ErrNeg;
const float* ErrPos;
int Stride;
float XShift;
float YShift;
ImPlotGetterData(const float* xs, const float* ys, int stride,
float x_shift = 0, float y_shift = 0,
const float* err_neg = NULL, const float* err_pos = NULL) {
Xs = xs;
Ys = ys;
Stride = stride;
XShift = x_shift;
YShift = y_shift;
ErrNeg = err_neg;
ErrPos = err_pos;
}
ImPlotGetterData(const float* xs, const bool* ys, int stride,
float x_shift = 0, float y_shift = 0,
const float* err_neg = NULL, const float* err_pos = NULL) {
Xs = xs;
YDs = ys;
Stride = stride;
XShift = x_shift;
YShift = y_shift;
ErrNeg = err_neg;
ErrPos = err_pos;
}
}; |
I would probably just make a new ImGetterDigitalData. This one has too many fields that won't be useful, and doesn't have a bool* member. |
I try but i failed so many times. I will leave in float because I'm loosing to much time. |
No worries, I'll add it when I review/merge your PR. Thanks for working on this! |
It was never that way. It's only ever been that you could double click the plot area to fit both axes. However, axes that are locked aren't fit. Fitting by double clicking the axis labels seems like a good idea. I'll add that now. |
You can fit individual axes now! I also added the original mahi-gui benchmark to the demo. I get around 110 FPS on my machine, which is about 3x slower than it used to be. The slow down is probably due to 1) the conditional in the point transformation function ( |
Thanks! |
Right. I am going to make the Plot(..., |
I think that pointer to circular buffer is the most efficient way to put and get points, but i did some trials with I'm thinking that probably there are other optimizations that could improve performances at least for "continuous plot" and i mean the condition when x data buffer is a "monotone ascending sequence": Eventually this "optimization" can be enabled by a flag "x monotone ascending sequence". Obviously those considerations and improves are not related to benchmark since the aim is to evaluate global code efficiency. |
This comment has been minimized.
This comment has been minimized.
Awesome! I've also been working on some optimizations (moved linear/log scaling conditionals to the outside of the loop, and using templates instead of function points to get a compile time advantage). I'll integrate your code with my changes (expect a push soon). However, I discovered what the real issue is. There's a dramatic decrease in performance when more than one ImGui window is present. This is because each window has it's own DrawList, and apparently swapping the DrawLists given to OpenGL has a significant overhead. The issue has only presented itself now because I started using a BeginChild/EndChild region inside of BeginPlot/EndPlot to capture mouse scroll (so that the window doesn't scroll when the plot is scrolled). With my optimizations above and disabling the child region, my FPS goes from 110 to 360. So, I think it's worth investigating other ways to capture mouse scroll. |
This is a great. I guess that @ocornut can help you about this topic with proper advise. |
About #6 (comment) (where i'm not authorized to reply directly), Cursors are actually sort of "XQuery". Query are very nice and usefull but you need to draw and drag, while "XQuery" they just appear and you move where you need for your data analysis. Inspired by https://www.youtube.com/watch?v=9HWBc_oHB-k |
What if instead we made the edges and corners of Query dragable/resizable after it is created? If the query was initially created using the Shift key (to expand vertical), then it would be the exact same behavior as far as I can tell. It also has the added benefit of working in the Y direction when needed. I'd just rather not have two similar tools to manage and upkeep. |
Hi... random interloper here. I'm interested in implementing multiple y axis support as a more general version of the digital signal handling (and I need it for more generally referencing signals with disparate y ranges). Question for @epezent : Your initial comment in this thread implied that maybe the old version in mahi-gui had support for multiple y axes? I looked prior to 2c957b5 and didn't see anything, so I'm guessing that was just me mis-reading the thread? Second question: You mused about an API of the form Any other thoughts on the topic? |
Hi @jpieper! Thanks for stopping by. No, mahi-gui never had multiple y axes. It's only ever been a pipe dream, and no one has started working on it as far as I know. I'm in favor of a more generic API as you suggest, that just works with the existing If we are to keep it generic, then either we'd need to make the number of visible axes a parameter of The most extreme approach would be to delay all rendering until It's a challenging problem, so I gladly accept your support and any and all contributions. |
So, there's still a fair amount of work left, but how does the general approach in look? You can only drag the first Y axis, fitting doesn't work, and auxiliary axes have no ticks or visual rendering at all yet. I'm happy to take feedback on all levels, including API, style, and implementation. |
I should say, I have not implemented it yet, but in prior systems I have set it up so that holding down the |
That sounds reasonable to me for when input is done while hovering the main plot area. For input done over the axes labels, I think each should have an independent hit box. A couple comments/questions that come to mind (stream of consciousness, apologies):
In general, it looks like you did a pretty good job finding all the places that code needed to be changed or variables needed to be added. Kudos. Please keep posting updates as you make progress. Also, GIFs are always appreciated! |
Agreed.
I wasn't planning on it, and haven't seen it supported in other tools, like matplotlib. In any event, I don't think this work would preclude later generalization to more than one x axis.
Heh. I use 3 pretty often, and have actually used 4 on occasion, although I can usually live without with more contortions. Granted, more than 2 (and more than 1) can also be somewhat emulated by having multiple separate plots with linked x axes. That just makes it harder sometimes to see the relations if you can't squish things around to be appropriately close together.
I was planning on just having them enable independently. In that regime, it would be admittedly somewhat silly to select y3 without y2. I'm not sure any alternatives I can think of are any better:
I was planning to have it display all enabled axes simultaneously, like "%f,%f,%f,%f" if all 3 axes were enabled.
I admit to not knowing the rationale for the query system, and was planning on leaving it stuck to the first y axis at the moment.
Yeah, I don't have great ideas there at the moment.
I was planning on having the second and third y axis be hard coded to the right hand side for now. If you have 3 and are rendering the values, it will be cluttered, but if you need 3, then I figure it doesn't matter that much if it is ugly?
Thanks for the feedback! Would you prefer this discussion be pulled out into a separate issue to keep this more general one uncluttered? |
Yep, let's move this discussion. I replied to your comments here: #20 |
Closing. I may start a v0.2 thread later. |
Draw query rect only when ImPlotFlags_Query is set.
Draw query rect only when ImPlotFlags_Query is set.
DatePicker separate disabled color
The issue serves to continue on-going discussions from the original plotting widget that was found in mahi-gui.
The text was updated successfully, but these errors were encountered: