LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

defer update panel

Solved!
Go to solution

Oups, I have noticed that sometimes, the graph appears to be hidden after SetPlotAttribute function executes. So the behaviour is not always strictly the same...sometimes it's PlotY and sometimes it's SetPlotAttribute... Smiley Frustrated

0 Kudos
Message 11 of 33
(1,496 Views)
Solution
Accepted by topic author Julien_31

Maybe I have an idea, not very simple but it can be a solution...

I'm going to try using SetPlotAttribute with ATTR_PLOT_YDATA attribute...So, after getting a plot handle during first function call, I will have the possibility to replace plot Y data only for this plot handle (without changing any other attribute). I will need to declare some static variable inside UpdateGraph () function.

Does anybody have any other idea ?

0 Kudos
Message 12 of 33
(1,472 Views)

My solution works and legend does not "blink" any more but...it's not a good idea. In terms of performance, it's lame ! So, if anybody has another suggestion, I would really appreciate it ! ^^

0 Kudos
Message 13 of 33
(1,466 Views)

OK ! I kept my solution which made legend not blink. But there was something stupid in what I did : the number of points for each channels ! I plotted 1 second of data (2000 points) and needed to see only 40 ms, so I displayed only the 80 first points for each channel...but for each channel, 2000 points were "loaded" into the graph !

 

Instead of doing this stupid thing, I decided to plot directly 40 ms of data (80 points instead of 2000)...Now that's OK...

0 Kudos
Message 14 of 33
(1,451 Views)

Congratulations! Learning by doing is a time-consuming but sustainable method 😉

0 Kudos
Message 15 of 33
(1,447 Views)

Yes indeed ! ^^ Thank you everybody for your help ! Smiley Happy

0 Kudos
Message 16 of 33
(1,444 Views)

Hi Julien,

 

I realize you've already resolved your problem, but I was curious about the fact that you saw the graph disappear when you plotted. I wouldn't expect that to happen. I tested the following snippet:

 

SetCtrlAttribute (panel, PANEL_GRAPH, ATTR_VISIBLE, 0);
PlotY (panel, PANEL_GRAPH, data, 100, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_RED);
SetCtrlAttribute (panel, PANEL_GRAPH, ATTR_VISIBLE, 1);

 

... and for me, the graph never disappears, even if I single-step through the code, in the debugger. In other words, PlotY did not trigger a redraw event.

 

If you happen to have a code snippet for which the redraw does happen, would you mind posting here, so that I could check it?

 

Thanks,

Luis

0 Kudos
Message 17 of 33
(1,435 Views)

Hi Luis,

 

My code was as follow...(this function was called in another thread, but I guess that it does not change anything)

 

/*========================================================================================*/
/* Update graph function                                                                                                                                                     */
/*========================================================================================*/
void UpdateGraph (float64 *acqData, CHNLCONFIG *chnlConfig)
{
 int plotIndex;
 int plotHdl;
 const int chnlColor[NB_CHANNELS] = {VAL_RED, VAL_GREEN, VAL_BLUE, VAL_DK_RED, VAL_DK_GREEN, VAL_DK_BLUE};
 const char *chnlName[NB_CHANNELS] = {"U1", "U2", "U3", "I1", "I2", "I3"};
 const int chnlAxis[NB_CHANNELS] = {VAL_LEFT_YAXIS, VAL_LEFT_YAXIS, VAL_LEFT_YAXIS, VAL_RIGHT_YAXIS, VAL_RIGHT_YAXIS, VAL_RIGHT_YAXIS};
 
 // Make graph invisible
 SetCtrlAttribute (mesPanelHdl, TABMES_UIGRAPH, ATTR_VISIBLE, 0);
 
 // Delete graph
 DeleteGraphPlot (mesPanelHdl, TABMES_UIGRAPH, -1, VAL_DELAYED_DRAW);
 
 // For each plot...
 for (plotIndex = 0 ; plotIndex < NB_CHANNELS ; plotIndex++)
 {
      // If channel activated...
      if (chnlConfig[plotIndex].selected)
      {
           // Plot curve
           plotHdl = PlotY (mesPanelHdl, TABMES_UIGRAPH, acqData + plotIndex * RATE, RATE, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, chnlColor[plotIndex]);
  
           // Set curve name
           SetPlotAttribute (mesPanelHdl, TABMES_UIGRAPH, plotHdl, ATTR_PLOT_LG_TEXT, chnlName[plotIndex]);
  
           // Set curve axis
           SetPlotAttribute (mesPanelHdl, TABMES_UIGRAPH, plotHdl, ATTR_PLOT_YAXIS, chnlAxis[plotIndex]);
      }
 }
 
 // Make graph visible
 SetCtrlAttribute (mesPanelHdl, TABMES_UIGRAPH, ATTR_VISIBLE, 1);

0 Kudos
Message 18 of 33
(1,429 Views)

Thanks, Julien.

 

I have a couple more questions:

 

1. Does this graph have any cursors in VAL_SNAP_TO_POINT mode?

2. Is chnlAxis[plotIndex] = VAL_RIGHT_YAXIS for any of your plots?

 

Thanks,

Luis

0 Kudos
Message 19 of 33
(1,418 Views)

Hi Luis,

 

1. Does this graph have any cursors in VAL_SNAP_TO_POINT mode? => NO

2. Is chnlAxis[plotIndex] = VAL_RIGHT_YAXIS for any of your plots? => NO (there are 6 plots : VAL_LEFT_YAXIS for plots 1 to 3, and VAL_RIGHT_YAXIS for plots 4 to 6)

 

Any idea ? 🙂

 

0 Kudos
Message 20 of 33
(1,416 Views)