LGSInnovations / sigplot

SigPlot provides fast interactive web-plotting for software defined radio.
https://sigplot.lgsinnovations.com
Apache License 2.0
36 stars 26 forks source link

Display currently "selected" intensity value with raster plots #108

Open KevinPoole opened 3 years ago

KevinPoole commented 3 years ago

Hey all,

First, a very cool tool. Appreciate you all making this available.

I am putting this as a feature request but it may really just be a request for slightly more detailed documentation.

All I want to do, is when hovering over a raster plot, to be able to see what the value is of any given pixel I am hovered over (the Z value basically, the intensity). If necessary I could do this in some sort of custom way with event listeners (at least, I think I could. I could do something similar to the mouse events example - https://sigplot.lgsinnovations.com/sigplot-2.0/tryout.html - and try to figure out where I am in the raster grid and then correlate that to the value in the source data) but it just seems like the sort of thing that sigplot must surely support out of the box and I simply can not figure out how. I would expect to be able to see a z (and corresponding dz value) in the bottom left of the plot window, or at least to be able to optionally toggle on such a thing, but again I can not figure out how.

Thanks in advance for any assistance you can offer!

maihde commented 3 years ago

@KevinPoole first off, glad that you like SigPlot.

For static (i.e. not streaming) raster plots you can hover over a point and press 'z' on the keyboard and it will show you the intensity value as a pop-up.

There is also an API, but it's not well documented (as you have discovered).

plot.get_layer(layer_id).get_z(real_x_pos, real_y_pos)

For scrolling rasters, it's not as easy because some optimizations have been made to improve performance.

Your idea of having a 'Z' and 'dZ' in the bottom would be a new feature, but I like the idea. I'll see if we can work that into the next release.

PS - the latest SigPlot code can now be found at https://github.com/spectriclabs/sigplot

KevinPoole commented 3 years ago

@maihde first, thank you so much for your quick and detailed response.

I just got back to this today and had the chance to try your suggestions. A few observations:

I would love to hear any thoughts you might have, and also whether you see the same behavior that I do.

maihde commented 3 years ago

The JSbin doesn't work because it appears that the textbox is stealing the keypress inputs for everything (for example the 'm' keypress doesn't work either).

Do you know what version of SigPlot you are using in your test? Are you able to download the latest version of Sigplot from https://github.com/spectriclabs/sigplot and run the unitests?

maihde commented 3 years ago

@KevinPoole - due to the fact that you closed this, am I to assume that you have resolved the issue?

KevinPoole commented 3 years ago

Hi @maihde - actually, no. Perhaps closing the issue was the wrong approach. Truthfully what happened is that this particular problem fell in priority for me at the moment.

Also, we're using the react-sigplot library from NPM so I was not positive how to take your suggested next steps.

I will reopen the issue - sorry for the confusion.

maihde commented 3 years ago

@KevinPoole I think I found the issue. If the minimum z value was zero it would cause the 'show-z' method to not display anything. https://github.com/spectriclabs/sigplot/commit/905903e4b649021d47ca61b44e69ecbcf45835c6