I have a single series bar chart which when hove over a bar causing it to highlight, it produces an invalidcast unhandled exception. It seems to be a problem with the template I am using to load the chart properties. If I just use the default properties (ie do not load the template) it produces a line chart. this highlights points with no problem. If I change it to a bar chart and hover over a bar, it highlights the bar successfully. If I use a template I get the described error.
I also found that if I clear the highlight it prevents the exception occurring.
The error message is
"Unable to cast object of type 'ChartFX.WinForms.Internal.SeriesPointIndex' to type 'ChartFX.WinForms.AxisX'."
StackTrace: at ChartFX.WinForms.Internal.AttributesBase.SetAttribute(AttributeCode attributeCode, Object thisValue) at ChartFX.WinForms.PointAttributes.Apply(AttributesBase attributes) at ChartFX.WinForms.HighlightAttributes.a(AttributesBase A_0) at ChartFX.WinForms.aw.a(HighlightState A_0) at ChartFX.WinForms.aw.c(Int32 A_0, Int32 A_1, Boolean A_2) at ChartFX.WinForms.aw.b(Int32 A_0) at ChartFX.WinForms.aw.g(Int32 A_0) at ChartFX.WinForms.aw.n() at ChartFX.WinForms.aw.u() at ChartFX.WinForms.aw.a(IFrame A_0, Int32& A_1) at ChartFX.WinForms.Chart.a(PaintBar A_0, IGraphicsEx A_1) at ChartFX.WinForms.ag.a(PaintEventArgs A_0) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 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 PCISM.frmMain.Main() in C:\Projects\CISM\CISM\frmMain.vb:line 1144
The template file is
<?xml version="1.0" encoding="UTF-8"?><CFX7> <TEMPLATEMASK>523775</TEMPLATEMASK> <TOOLTIPFORMAT>%s%x - %x%v - %v"</TOOLTIPFORMAT> <HIGHLIGHT> <POINTATTRIBUTES type="ChartFX.WinForms.PointAttributes"> <LINE.WIDTH>7</LINE.WIDTH> </POINTATTRIBUTES> </HIGHLIGHT> <BACKCOLOR>#ffffffff</BACKCOLOR> <PANES> <ITEM index="0"> <AXES> <ITEM index="0"> <STYLE>SingleLine, BreakZero, LongTick, AutoScale, RoundStep, DetectArea, AutoMinorStep, AutoFirstLabel, AutoCenter, AllowHalf, HighlightValues</STYLE> <FORCEZERO>False</FORCEZERO> <LABELSFORMAT> <FORMAT>Percentage</FORMAT> </LABELSFORMAT> </ITEM> <ITEM index="1"> <STYLE>SingleLine, BreakZero, LongTick, AutoScale, RoundStep, DetectArea, AutoMinorStep, AutoFirstLabel, AutoCenter, AutoLabelLayout, AllowHalf, HighlightValues</STYLE> <FORCEZERO>False</FORCEZERO> </ITEM> </AXES> </ITEM> </PANES> <AXESX> <ITEM index="0"> <LABELSFORMAT> <FORMAT>Date</FORMAT> </LABELSFORMAT> </ITEM> </AXESX> <ALLSERIES> <GALLERYARRAY type="ChartFX.WinForms.Internal.IGalleryType[]"> <ITEM index="1" type="ChartFX.WinForms.Galleries.Bar"/> </GALLERYARRAY> <GALLERY>Bar</GALLERY> </ALLSERIES> <SERIES> <ITEM index="0"> <GALLERY>Bar</GALLERY> <TEXT>Reported Actual [31 Dec 2006 : 59%]</TEXT> </ITEM> <ITEM index="1"> <TEXT>Broker Forecast</TEXT> </ITEM> </SERIES> <TITLES> <ITEM> <TEXT>Actual/Broker Gross Margin</TEXT> </ITEM> </TITLES> <LEGENDBOX> <VISIBLE>False</VISIBLE> </LEGENDBOX> <BORDER type="ChartFX.WinForms.Adornments.ImageBorder" assembly="ChartFX.WinForms.Adornments, Version=7.0.2664.18371, Culture=neutral, PublicKeyToken=a1878e2052c08dce"/> <BACKGROUND type="ChartFX.WinForms.Adornments.GradientBackground" assembly="ChartFX.WinForms.Adornments, Version=7.0.2664.18371, Culture=neutral, PublicKeyToken=a1878e2052c08dce"> <COLORS type="ChartFX.WinForms.Adornments.GradientBackground+ColorCollection" assembly="ChartFX.WinForms.Adornments, Version=7.0.2664.18371, Culture=neutral, PublicKeyToken=a1878e2052c08dce"/> </BACKGROUND></CFX7>