Gerald Drouin Posted July 22, 2010 Report Share Posted July 22, 2010 I'm working on a fairly simple chart, but have recently started receiving the following error: System.DivideByZeroException: Attempted to divide by zero. at SoftwareFX.ChartFX.PaneCollection.PO(IGraphicsEx 2JE, Int32 2JF) at SoftwareFX.ChartFX.1V.PW(IGraphicsEx 2JX, Rectangle& 2JY, Boolean 2JZ) at SoftwareFX.ChartFX.1V.PU(IGraphicsEx 2JS, Boolean 2JT, Rectangle& 2JU, Int32 2JV) at SoftwareFX.ChartFX.0X.OnPaint(PaintEventArgs e) 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.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) The containing panel for the control starts off as enabled=false. The data is then populated into the chart . Finally a saved chart template is applied and the containing panel is set to enabled=true. My code then exits the sub. A second or two later I trap the above error in my Sub Main(). Any ideas? Could this be a corrupt chart template or something? I've been serializing it to XML for storage in a SQL database. Here's the code I'm using to apply the template: Private Sub ApplyChartTemplate(ByVal ChartXML As String) Dim ms As IO.MemoryStream = New IO.MemoryStream((New System.Text.ASCIIEncoding).GetBytes(ChartXML))Me.Chart1.Import(SoftwareFX.ChartFX.FileFormat.XML, ms) End Sub And here's the string I'm passing in.<?xml version="1.0" encoding="UTF-8"?> <CFX6> <PANES> <ITEM> <PROPORTION>0</PROPORTION> </ITEM> </PANES> <AXIS> <ITEM index="0"> <STYLE>SingleLine, BreakZero, LongTick, AutoMinorStep, AutoFirstLabel, AutoCenter</STYLE> <AUTOSCALE>False</AUTOSCALE> <FORCEZERO>False</FORCEZERO> <ALTERNATECOLOR>#fff1efe2</ALTERNATECOLOR> <ALTERNATECOLOR>#fff1efe2</ALTERNATECOLOR> <MIN>NaN</MIN> <MAX>NaN</MAX> <STEP>0.2</STEP> <TITLE> <TEXT>Line</TEXT> <AREA>Left</AREA> <LINEALIGNMENT>Near</LINEALIGNMENT> <FLAGS>DrawingArea, NoChangeDockArea</FLAGS> </TITLE> </ITEM> <ITEM index="1"> <POSITION>Far</POSITION> <STEP>4E+307</STEP> <TITLE> <TEXT>None</TEXT> <AREA>Right</AREA> <LINEALIGNMENT>Near</LINEALIGNMENT> <FLAGS>DrawingArea, NoChangeDockArea</FLAGS> </TITLE> <PANE>1</PANE> </ITEM> <ITEM index="2"> <STYLE>SingleLine, BreakZero, LongTick, ForceZero, AutoMinorStep, AutoFirstLabel, AutoCenter</STYLE> <AUTOSCALE>False</AUTOSCALE> <LABELANGLE>45</LABELANGLE> <KEYLIST> <ITEM> 151243-000 </ITEM> <ITEM> 153691-000 </ITEM> <ITEM> 153692-000 </ITEM> <ITEM> 153694-000 </ITEM> <ITEM> 153689-000 </ITEM> <ITEM> 153664-000 </ITEM> <ITEM> 153688-000 </ITEM> <ITEM> 153695-000 </ITEM> <ITEM> 155782-000 </ITEM> <ITEM> 155783-000 </ITEM> <ITEM> 155784-000 </ITEM> <ITEM> 155789-000 </ITEM> <ITEM> 155790-000 </ITEM> </KEYLIST> <MIN>0</MIN> <MAX>0</MAX> <STEP>1</STEP> </ITEM> </AXIS> <TOOLBAR>True</TOOLBAR> <LINECOLOR>Black</LINECOLOR> <BORDEREFFECT>None</BORDEREFFECT> <GALLERY>Lines</GALLERY> <SMOOTHFLAGS>Fill, Border, Text, TextSystem</SMOOTHFLAGS> <SERIES> <ITEM index="0"> <COLOR>Blue</COLOR> </ITEM> <ITEM index="1"> <COLOR>Blue</COLOR> </ITEM> </SERIES> <SERLEG> <ITEM> Line </ITEM> <ITEM> None </ITEM> </SERLEG> <KEYSER> <ITEM> Line </ITEM> <ITEM> None </ITEM> </KEYSER> <LEGENDBOXOBJ> <VISIBLE>False</VISIBLE> <DOCKED>Right</DOCKED> <TITLES> <ITEM> <TEXT>Line</TEXT> </ITEM> <ITEM> <TEXT>None</TEXT> </ITEM> <ITEM> <TEXT>None</TEXT> </ITEM> </TITLES> </LEGENDBOXOBJ> <BORDEROBJECT type="SoftwareFX.ChartFX.DefaultBorder" assembly="ChartFX.Base"> </BORDEROBJECT> </CFX6> <?xml version="1.0" encoding="UTF-8"?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.