I fiddled around a little more with this version and found the following:
The exception disappears, if I
remove the following two lines of code from my app:
Code: Select all
chart.Legend.CheckBoxes = True
chart.Legend.FontSeriesColor = True
1.) Legend checkboxes have been deprecated as I have learned from this
forum. Why is the
Legend.Checkboxes
property still available? Shouldn't the property be completely removed so that I get an error when compiling and am unable to mistakenly set it to True in the first place?
2.) The
Legend.FontSeriesColor
issue seems to be new. If I don't set this property to True in the code, and then activate the corresponding checkbox in the editor at runtime, the app crashes with the following exception:
Code: Select all
System.NullReferenceException
HResult=0x80004003
Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Source=TeeChart
StackTrace:
at Steema.TeeChart.Legend.DrawLegendItem(Int32 itemIndex, Int32 itemOrder)
at Steema.TeeChart.Legend.DrawItems()
at Steema.TeeChart.Legend.Paint(IGraphics3D g, Rectangle rect, Boolean doDraw, Boolean doCalc)
at Steema.TeeChart.Chart.DoDrawLegend(Rectangle& tmp, Boolean doDraw, Boolean doCalc)
at Steema.TeeChart.Chart.DrawTitlesAndLegend(Rectangle& tmp, Boolean beforeSeries)
at Steema.TeeChart.Chart.InternalDraw(Boolean noTools)
at Steema.TeeChart.TChart.Draw(Graphics g, Rectangle rect)
at Steema.TeeChart.TChart.Draw(Graphics g)
at Steema.TeeChart.TChart.OnPaintBackground(PaintEventArgs pevent)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
3.) The replacement for legend checkboxes, being able to click on a legend item to activate/deactivate the series, is only half working: I can click a legend item do activate/deactivate the series, but the legend item does not change it's appearance, i.e. there is no visual indication in the legend about which series are currently active/inactive. I read
here that there is a plan for displaying deactivated items with a strikethrough line. Either that has not yet been implemented or it is not working?