Jump to content
Software FX Community

Chart Sizing Behaviour


MMCCPaulEden

Recommended Posts

Hi

 We are seeing some strange behaviour when sizing chart controls:

  1. If the chart is reduced too far, an exception is thrown saying the heigh / width cannot be a negative number - this is thrown from the ChartFx dlls, not the framework and possibly related to the usage of

    chart.PlotArea.MinSize = 0;

  2. Do the charts try to default to a specific size if no size is set / size is auto?

Many thanks

 

Paul Eden

Link to comment
Share on other sites

Seeing as I seem to be unable to edit my own post, exception example as follows (reference to chartFX is bold/underline as no colouring easily available).

In this instance the exception was thrown when exporting the object to a PNG with Size(150,120).  This is causing us a quite major issue as charts regularly need to be resized based on user input, and sized in such as way that no clipping ooccurs (as per usage of chart.PlotArea.MinSize = 0) :

 

System.Reflection.TargetInvocationException was unhandled

  Message="Exception has been thrown by the target of an invocation."

  Source="mscorlib"

  StackTrace:

at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)

at System.Delegate.DynamicInvokeImpl(Object[] args)

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)

at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

at System.Windows.Threading.DispatcherOperation.InvokeImpl()

at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)

at System.Threading.ExecutionContext.runTryCode(Object userData)

at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Windows.Threading.DispatcherOperation.Invoke()

at System.Windows.Threading.Dispatcher.ProcessQueue()

at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)

at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)

at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)

at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)

at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)

at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)

at System.Windows.Threading.Dispatcher.Run()

at System.Windows.Application.RunInternal(Window window)

at System.Windows.Application.Run(Window window)

at System.Windows.Application.Run()

at NTO.App.Main() in C:\Users\Neutrino_1\Documents\Projects\Neutrino\OBM\obj\Debug\App.g.vb:line 75

at System.AppDomain._nExecuteAssembly(Assembly 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.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart()

  InnerException: System.ArgumentException

Message="Width must be non-negative."

Source="WindowsBase"

StackTrace:

  at System.Windows.Rect.set_Width(Double value)

  at ChartFX.WPF.Controls.SpacingDockPanel.ArrangeOverride(Size finalSize)

  at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)

  at System.Windows.UIElement.Arrange(Rect finalRect)

  at System.Windows.ContextLayoutManager.UpdateLayout()

  at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)

  at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()

  at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()

  at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)

  at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)

  at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)

  at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

  at System.Windows.Threading.DispatcherOperation.InvokeImpl()

  at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)

  at System.Threading.ExecutionContext.runTryCode(Object userData)

  at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

  at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

  at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

  at System.Windows.Threading.DispatcherOperation.Invoke()

  at System.Windows.Threading.Dispatcher.ProcessQueue()

  at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

  at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

  at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)

  at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)

  at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

  at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)

  at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)

  at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

  at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)

  at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)

  at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)

  at System.Windows.Threading.DispatcherOperation.Wait(TimeSpan timeout)

  at System.Windows.Threading.DispatcherOperation.Wait()

  at ChartFX.WPF.Chart.a(BitmapEncoder A_0, Stream A_1)

  at ChartFX.WPF.Chart.Export(FileFormat format, Stream stream)

InnerException:

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...