Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

exception when changing axis max in wpf graph

I have a wpf graph control that shows a series of plots that are associated to some Y Axis. Sometimes (not for every collection of plots) when I click on the top value of an y-axis scale (it allows me to change the value) and insert a new value, it throws an Invalid Operation Exception. In other cases, the scale and the plots associated to the it are correctly rescaled.

I didn't notice particular differences between the cases in which the error occurs and the cases in which everything works.

 

The part of StackTrace that regards NationalInstruments libraries is the following:

 

 

Exception: System.InvalidOperationException
Message: Cannot draw outside of a draw cycle.
Source: NationalInstruments.Common
Data: System.Object:
StackTrace: in NationalInstruments.Restricted.Guard`1.Satisfies(Boolean condition, Func`4 exceptionCreator, String format, Object[] args)
in NationalInstruments.Restricted.Guard`1.Satisfies(Boolean condition, String format, Object[] args)
in NationalInstruments.Restricted.NIValidation.IsEqualTo[T](Guard`1 guard, T expected, String format, Object[] args)
in NationalInstruments.Controls.Internal.VectorRenderTargetBase.a(RenderTargetOptions A_0)
in NationalInstruments.Controls.Internal.VectorRenderTargetBase.a(RenderTargetOptions A_0, Buffer`1 A_1, Buffer`1 A_2)
in NationalInstruments.Controls.Internal.VectorRenderTargetBase.DrawLines(RenderTargetOptions options, Buffer`1 xRelativeValues, Buffer`1 yRelativeValues)
in NationalInstruments.Controls.Rendering.LineStep.NoneImpl.RenderCore(IRenderTarget target, RenderTargetOptions options, RelativeDataCollection data)
in NationalInstruments.Controls.Rendering.LineStep.Render(IRenderTarget target, RenderTargetOptions options, RelativeDataCollection data)
in NationalInstruments.Controls.Rendering.LinePlotRenderer.a(IRenderTarget A_0, RelativeDataCollection A_1)
in NationalInstruments.Controls.Rendering.LinePlotRenderer.RenderGraphCore(PlotRenderArgs renderArgs)
in NationalInstruments.Controls.Rendering.PlotRenderer.Render(RenderArgs renderArgs)
in NationalInstruments.Controls.Primitives.DataPlotArea.RenderDataInternal(IDictionary`2 plotRenderArgsCache, IDictionary`2 plotsToRender, IRasterRenderTarget rasterTarget)
in NationalInstruments.Controls.Primitives.DataPlotArea.RenderPlotData()
in NationalInstruments.Controls.Primitives.PlotArea.RenderPlotData(IQueryableGraph graph, IDictionary`2 plotData)
in NationalInstruments.Controls.Primitives.PlotArea.RenderCopiedPlotData(IQueryableGraph graph, IEnumerable`1 data)
in NationalInstruments.Controls.Graph.NationalInstruments.Controls.Internal.IDefaultDataProcessorTarget.ReceiveData(IDictionary`2 data)
in NationalInstruments.Controls.Internal.DefaultPipelineDataProcessor.a(ICollection`1 A_0)
in NationalInstruments.Controls.Internal.DefaultPipelineDataProcessor.RemapDataCore(ICollection`1 dataIndices)
in NationalInstruments.Controls.Primitives.DataProcessorBase.RemapData(ICollection`1 dataIndices)
in NationalInstruments.Controls.Primitives.GraphBase.RemapData(ICollection`1 plotIndices)
in NationalInstruments.Controls.Graph.d()
in NationalInstruments.Controls.Internal.GraphUpdateAction.a()
in System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

 

 

Any suggestion?

 

Thank you

0 Kudos
Message 1 of 3
(5,292 Views)

Hi,

 

I found other users with similar issues. Looking for a possible solution I found a CAR (Corrective Action Request). It looks like a bug and it'll be fixed on 2013 release of Measurement Studio.

 

Best Regards

 

Cla_CUP

NI ITALY

0 Kudos
Message 2 of 3
(5,278 Views)

I created a small test application containing five plots with 10 000 random values, but could not reproduce the issue when I changed the Y axis range manually or through a timer event.


From the call stack, the graph appears to be responding to either the range change or a plot area size change. For the first, you could try changing the RenderMode of the graph to a value other than Auto. For the second, you could work around the size change issue with a fixed-size display format that would avoid resizing the plot area when the range is updated.


To narrow down the issue further, it would be helpful to know what the range and the plot area size is before and after the edit, and how much data the graph is displaying. If you could create a small application to reproduce the issue, that would also be extremely useful.

~ Paul H
0 Kudos
Message 3 of 3
(5,267 Views)