LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

highlighting a sction of graph

Solved!
Go to solution

Hi,

I want to highlight a section of a data plotted on a graph  (i.e. a rectangle area in the middle of th graph),

is there any tricky methods to achieve this?

thanks for any help

 

sahin

0 Kudos
Message 1 of 4
(3,200 Views)
Solution
Accepted by sahin

You can plot a rectangle and set its z-plane order behind the data plots, e.g. using

 

rectangle_handle = PlotRectangle (...);

GetCtrlAttribute ( panel_handle, PANEL_GRAPH, ATTR_NUM_PLOTS, &plot_handles );

SetPlotAttribute ( panel_handle, PANEL_GRAPH, rectangle_handle, ATTR_PLOT_ZPLANE_POSITION, plot_handles - 1 );

0 Kudos
Message 2 of 4
(3,198 Views)

thanks a lot Wolfgang,

it works well, but with one drawback:

grid lines stay in the background, rectangle covers in lines of the graph.

but it's not so important.

0 Kudos
Message 3 of 4
(3,183 Views)

You're welcome.

 

It's indeed possible to do it nicer, taking into account the grid lines. However, this involves increased effort and you have to judge yourself if it's worth the extra work...

 

  1. One possibility could be to have two graphs on top of each other, the top-most having a transparent background, hence showing the underlying rectangle (plotted on the rear graph, while your plots are plotted on the front graph)
  2. Alternatively you could use just one graph (with a transparent background) on top of a canvas control.
  3. One approach I tried once was to use one regular graph and then draw individual lines on top of the grid lines, i.e. backmost plane: rectangle indicating the region of interest, next plane: self made grid lines, on top: plots. It involves a bit of bookkeeping and gets involved it you use autoscaling, otherwise it's fine.
0 Kudos
Message 4 of 4
(3,180 Views)