This is the discussion forum for OxyPlot.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
0
Under review

Rectangular Bar Series Crash Bug

Jaloko 9 years ago updated by Oystein Bjorke 8 years ago 1
I am trying to create a graph that uses the RectangularBarSeries and RectangularBarItem classes. I have to create quite a number of these to plot the dataset I have. When clearing the bar items from the series and trying to pan the graph it crashes and gives me this stack trace leading mostly to internal OxyPlot code. I am unsure of what to do to stop this from happening. Should I pre-generate a bunch of bar items and re-use them rather than clearing them from the bar series?

--------------Stack Trace-------------
Exception thrown: 'System.ArgumentOutOfRangeException' in mscorlib.dll
System.Transactions Critical: 0 : http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/UnhandledUnhandled exceptionGraphControlTestBed.vshost.exeSystem.ArgumentOutOfRangeException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index</Message><StackTrace> at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.Generic.List`1.get_Item(Int32 index)
at OxyPlot.Series.RectangleBarSeries.GetNearestPoint(ScreenPoint point, Boolean interpolate) in c:\projects\oxyplot\Source\OxyPlot\Series\BarSeries\RectangleBarSeries.cs:line 99
at OxyPlot.Series.Series.HitTestOverride(HitTestArguments args) in c:\projects\oxyplot\Source\OxyPlot\Series\Series.cs:line 141
at OxyPlot.Model.&lt;HitTest&gt;d__0.MoveNext() in c:\projects\oxyplot\Source\OxyPlot\Graphics\Model.cs:line 72
at OxyPlot.Model.HandleMouseDown(Object sender, OxyMouseDownEventArgs e) in c:\projects\oxyplot\Source\OxyPlot\Graphics\Model.MouseEvents.cs:line 88
at OxyPlot.ControllerBase.HandleMouseDown(IView view, OxyMouseDownEventArgs args) in c:\projects\oxyplot\Source\OxyPlot\Graphics\ControllerBase.cs:line 82
at OxyPlot.WindowsForms.PlotView.OnMouseDown(MouseEventArgs e) in c:\projects\oxyplot\Source\OxyPlot.WindowsForms\PlotView.cs:line 366
at System.Windows.Forms.Control.WmMouseDown(Message&amp; m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message&amp; m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at GraphControlTestBed.Program.Main() in C:\Users\Cory\Documents\Visual Studio 2015\Projects\GraphControlTestBed\GraphControlTestBed\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.Generic.List`1.get_Item(Int32 index)
at OxyPlot.Series.RectangleBarSeries.GetNearestPoint(ScreenPoint point, Boolean interpolate) in c:\projects\oxyplot\Source\OxyPlot\Series\BarSeries\RectangleBarSeries.cs:line 99
at OxyPlot.Series.Series.HitTestOverride(HitTestArguments args) in c:\projects\oxyplot\Source\OxyPlot\Series\Series.cs:line 141
at OxyPlot.Model.&lt;HitTest&gt;d__0.MoveNext() in c:\projects\oxyplot\Source\OxyPlot\Graphics\Model.cs:line 72
at OxyPlot.Model.HandleMouseDown(Object sender, OxyMouseDownEventArgs e) in c:\projects\oxyplot\Source\OxyPlot\Graphics\Model.MouseEvents.cs:line 88
at OxyPlot.ControllerBase.HandleMouseDown(IView view, OxyMouseDownEventArgs args) in c:\projects\oxyplot\Source\OxyPlot\Graphics\ControllerBase.cs:line 82
at OxyPlot.WindowsForms.PlotView.OnMouseDown(MouseEventArgs e) in c:\projects\oxyplot\Source\OxyPlot.WindowsForms\PlotView.cs:line 366
at System.Windows.Forms.Control.WmMouseDown(Message&amp; m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message&amp; m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at GraphControlTestBed.Program.Main() in C:\Users\Cory\Documents\Visual Studio 2015\Projects\GraphControlTestBed\GraphControlTestBed\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()</ExceptionString></Exception></TraceRecord>

Problems with Metro

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

doctorj wrote at 2012-09-16 23:53:

Hi,

I am working on a Windows 8 project using metro and have some problems. I was able to include the two dll in the project and am able to import the namespaces on the VB part of a display.

I do not know how to have the xaml part of the screen recognize oxyplot or oxyplot.metro. These statements work except that I see no plot outline on the screen. I do have a white background. I believe the problem is that I do not  know how to make then xaml part of the code to recognize oxyplot. I would like to get this working for my app. If there is any more documentation that would greatly help. I used zedgraph on windows forms and good success but this is the only plotting program I have seen that will work in metro.

I simple example using vs2012 and metro app would help in either vb or c#.

 Thank you for your help

  Jerry 

Dim

 

plotControl As New OxyPlot.Metro.

Plot

 

Dim plotModel1 As New OxyPlot.

PlotModel

plotModel1.Title =

"Outside

plotModel1.Axes.Add(

 

 

New LinearAxis(AxisPosition

.Bottom, -20, 80))

plotModel1.Axes.Add(

New LinearAxis(AxisPosition  

 

 

 

 

 

.Bottom, -10, 10))

plotControl.Model = plotModel1

 

plotModel1.RefreshPlot(True

)


objo wrote at 2012-09-17 07:27:

Did you look at the Metro examples?

See how the view is defined in the XAML file:

Source\Examples\Metro\BasicSample\MainPage.xaml


doctorj wrote at 2012-09-17 16:49:

Thank you for your response. That helped , I had to download the metro stuff again and I from the xaml file. I took the commands from it for oxy and inserted in my xaml file and these commands were recognized ok. However when I executed the code with my vb code , no graph came up. I was expecting to see at the axes of the graph. Do I need the other xaml files you have in the BasicSample directory also? I also noticed that the BasicSample directory did not have a Project file so I could execute the project - is it supposed to be like that? in my VB project I have a Visual Basic Project File that I click on to start the project. Is it possible that I am not executing the right oxy commands in my vb code. I am posting the code here again.

 Dim plotControl As New OxyPlot.Metro.Plot
        Dim plotModel1 As New OxyPlot.PlotModel
        plotModel1.Title = "Outside"
        plotModel1.Axes.Add(New LinearAxis(AxisPosition.Bottom, -20, 80))
        plotModel1.Axes.Add(New LinearAxis(AxisPosition.Bottom, -10, 10))
        plotControl.Model = plotModel1
        plotModel1.RefreshPlot(True)

 

//xmlns:oxy="using:OxyPlot.Metro"

 

 

 

 

//}"/>

 

 

 

//<//oxy:Plot Model="{Binding PlotModel

 

 code I put in my xaml file