Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

ScatterPlot crashes on drawing Graphics during ScatterPlot_AfterDrawPlotArea event

I am trying to draw some graphics on ScatterPlot.

So everytime the graph repaints I need to redraw my graphics.

 

I try doing this on AfterDrawPlotArea event.

My chart crashes.

 

Does anyone have a solution?

 

-pankil

0 Kudos
Message 1 of 8
(5,070 Views)

By the way,

I am using Visual C# 2008 with measurement studio.

0 Kudos
Message 2 of 8
(5,069 Views)

pankil,

 

When you say the chart crashes, what happens to the chart?  Is an error thrown?  What code do you have in the event callback?

 

Have you tried using the BeforeDrawPlotArea event?

Eric B.
National Instruments
0 Kudos
Message 3 of 8
(5,051 Views)

I use graphics to draw shapes on the ScatterGraph

 

I cannot use BeforeDrawPlotArea event because  I need the graph to be all painted before I draw any graphics else it shall refresh and I shall have to repaint and as far as I know there is no AfterPaint event in ScatterGraph

 

When the graph crashes, I get an error, '...collection has been modified...'

0 Kudos
Message 4 of 8
(5,044 Views)

pankil,

 

Can you post the code for your AfterDrawPlotArea callback?  I'd like to see how you're drawing on the plot to see if there is anything strange going on.

Eric B.
National Instruments
0 Kudos
Message 5 of 8
(5,024 Views)

Well I figured my code did have a bug.

Fixed it.

0 Kudos
Message 6 of 8
(4,958 Views)

Pankil,

 

Could you post what the problem was?  That way if anyone else comes across this forum post in the future with a similar problem, they can see how the issue was resolved.

Eric B.
National Instruments
0 Kudos
Message 7 of 8
(4,946 Views)

I added a Graphical object I needed to draw on the graph to a list.

So everytime I repainted the object it would add coies to the list thus entering a infinite loop.

 

Fixed it.

0 Kudos
Message 8 of 8
(4,878 Views)