WPF TChart Inverted Legeng bug
Posted: Fri May 07, 2010 5:38 am
Hello!
This code brings to crash:
public MainWindow()
{
InitializeComponent();
TChart tChart = new TChart();
tChart.Series.Add(new Steema.TeeChart.WPF.Styles.Line());
tChart.Series.Add(new Steema.TeeChart.WPF.Styles.Line());
tChart.Legend.Inverted = true;
Content = tChart;
}
If you only comment string "tChart.Legend.Inverted = true;" all works Ok. This bug appeared only in latest version 4.0.2010.13053.
Exception text:
System.ArgumentNullException was unhandled
Message=Value cannot be null.
Parameter name: textToFormat
Source=PresentationCore
ParamName=textToFormat
StackTrace:
at System.Windows.Media.FormattedText..ctor(String textToFormat, CultureInfo culture, FlowDirection flowDirection, Typeface typeface, Double emSize, Brush foreground, NumberSubstitution numberSubstitution, TextFormattingMode textFormattingMode)
at System.Windows.Media.FormattedText..ctor(String textToFormat, CultureInfo culture, FlowDirection flowDirection, Typeface typeface, Double emSize, Brush foreground)
at Steema.TeeChart.WPF.Drawing.ChartFont.GetDrawingText(String text)
at Steema.TeeChart.WPF.Drawing.Graphics3DWPF.DoDrawString(Double x, Double y, String text, ChartBrush aBrush)
at Steema.TeeChart.WPF.Drawing.Graphics3D.TextOut(ChartFont f, Double x, Double y, String text)
at Steema.TeeChart.WPF.Drawing.Graphics3D.TextOut(Double x, Double y, String text)
at Steema.TeeChart.WPF.Legend.DrawLegendItem(Int32 ItemIndex, Int32 ItemOrder)
at Steema.TeeChart.WPF.Legend.DrawItems()
at Steema.TeeChart.WPF.Legend.Paint(Graphics3D g, Rect rect)
at Steema.TeeChart.WPF.Chart.DoDrawLegend(Rect& tmp)
at Steema.TeeChart.WPF.Chart.DrawTitlesAndLegend(DrawingContext g, Rect& tmp, Boolean BeforeSeries)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g, Boolean noTools)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g)
at Steema.TeeChart.WPF.TChart.Draw(DrawingContext g)
at Steema.TeeChart.WPF.TChart.OnRender(DrawingContext drawingContext)
at System.Windows.UIElement.Arrange(Rect finalRect)
at MS.Internal.Helper.ArrangeElementWithSingleChild(UIElement element, Size arrangeSize)
at System.Windows.Controls.ContentPresenter.ArrangeOverride(Size arrangeSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Documents.AdornerDecorator.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Window.ArrangeOverride(Size arrangeBounds)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at System.Windows.Window.SetRootVisual()
at System.Windows.Window.SetRootVisualAndUpdateSTC()
at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
at System.Windows.Window.CreateSourceWindowDuringShow()
at System.Windows.Window.SafeCreateWindowDuringShow()
at System.Windows.Window.ShowHelper(Object booleanBox)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, 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, Boolean ignoreSyncCtx)
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, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
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.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
This code brings to crash:
public MainWindow()
{
InitializeComponent();
TChart tChart = new TChart();
tChart.Series.Add(new Steema.TeeChart.WPF.Styles.Line());
tChart.Series.Add(new Steema.TeeChart.WPF.Styles.Line());
tChart.Legend.Inverted = true;
Content = tChart;
}
If you only comment string "tChart.Legend.Inverted = true;" all works Ok. This bug appeared only in latest version 4.0.2010.13053.
Exception text:
System.ArgumentNullException was unhandled
Message=Value cannot be null.
Parameter name: textToFormat
Source=PresentationCore
ParamName=textToFormat
StackTrace:
at System.Windows.Media.FormattedText..ctor(String textToFormat, CultureInfo culture, FlowDirection flowDirection, Typeface typeface, Double emSize, Brush foreground, NumberSubstitution numberSubstitution, TextFormattingMode textFormattingMode)
at System.Windows.Media.FormattedText..ctor(String textToFormat, CultureInfo culture, FlowDirection flowDirection, Typeface typeface, Double emSize, Brush foreground)
at Steema.TeeChart.WPF.Drawing.ChartFont.GetDrawingText(String text)
at Steema.TeeChart.WPF.Drawing.Graphics3DWPF.DoDrawString(Double x, Double y, String text, ChartBrush aBrush)
at Steema.TeeChart.WPF.Drawing.Graphics3D.TextOut(ChartFont f, Double x, Double y, String text)
at Steema.TeeChart.WPF.Drawing.Graphics3D.TextOut(Double x, Double y, String text)
at Steema.TeeChart.WPF.Legend.DrawLegendItem(Int32 ItemIndex, Int32 ItemOrder)
at Steema.TeeChart.WPF.Legend.DrawItems()
at Steema.TeeChart.WPF.Legend.Paint(Graphics3D g, Rect rect)
at Steema.TeeChart.WPF.Chart.DoDrawLegend(Rect& tmp)
at Steema.TeeChart.WPF.Chart.DrawTitlesAndLegend(DrawingContext g, Rect& tmp, Boolean BeforeSeries)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g, Boolean noTools)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g)
at Steema.TeeChart.WPF.TChart.Draw(DrawingContext g)
at Steema.TeeChart.WPF.TChart.OnRender(DrawingContext drawingContext)
at System.Windows.UIElement.Arrange(Rect finalRect)
at MS.Internal.Helper.ArrangeElementWithSingleChild(UIElement element, Size arrangeSize)
at System.Windows.Controls.ContentPresenter.ArrangeOverride(Size arrangeSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Documents.AdornerDecorator.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Window.ArrangeOverride(Size arrangeBounds)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at System.Windows.Window.SetRootVisual()
at System.Windows.Window.SetRootVisualAndUpdateSTC()
at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
at System.Windows.Window.CreateSourceWindowDuringShow()
at System.Windows.Window.SafeCreateWindowDuringShow()
at System.Windows.Window.ShowHelper(Object booleanBox)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, 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, Boolean ignoreSyncCtx)
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, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
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.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()