User (Legacy) Posted June 18, 2003 Report Share Posted June 18, 2003 I have a chart that is sent data related to a date axis. I set the start and end points of the X-axis in response to user input. I am getting a fatal exception on redraw if the dataset span is significantly smaller than the span of the x-axis. For example, I have a dataset that only covers a month time span, and contains say 60 points. If I set the date range of the axis to 1 month, it plots fine.6 months, it still plots fine. However, when the span gets to >1 year, the app wiil crash when the chart is drawing, giving the following exception and backtrace: -- Exception: System.ArgumentOutOfRangeException Message: Specified argument was out of the range of valid values. Parameter name: Year, Month, and Day parameters describe an unrepresentable DateTime. Source: mscorlib at System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day) at System.DateTime.AddMonths(Int32 months) at SoftwareFX.ChartFX.AxisBase.CT(17 19H, IGraphicsEx 19I, Rectangle[] 19J, SetPropFlag& 19K, 0S 19L) at SoftwareFX.ChartFX.AxisCollection.DA(17 1B5, IGraphicsEx 1B6, Rectangle[] 1B7, 0S 1B8) at SoftwareFX.ChartFX.Chart.DM(17 1BX, IGraphicsEx 1BY, Boolean 1BZ, Boolean 1C0) at SoftwareFX.ChartFX.Chart.DL(17 1BT, IGraphicsEx 1BU, Rectangle& 1BV, Int32& 1BW) at SoftwareFX.ChartFX.Chart.DK(PaintBar 1BQ, IGraphicsEx 1BR, Rectangle& 1BS) 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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMetho ds+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) -- Since the exception occurs during the Paint event, I cannot get at the exception in place, I have to wait for it to bubble to my app. Note that the size of the chart's client area has bearing on the maximum ratio of data range to axis range, in that a larger chart will allow a larger axis range before tripping the exception. This makes me think that an error is occuring when ChartFX tries to calculate a sub-pixel x value. I could be very wrong about the specifics, but in general, there seems to be a problem trying to cram too many data points into too small a chart region. Is there anything you would recommend to remedy this? Is there a documented way I could check for this condition or gain some notion of the point-per-pixel ration that ChartFX is going to arrive at? Thanks for your help. If there is anything else I can provide, let me know. Trey Schultz Link to comment Share on other sites More sharing options...
Software FX Posted June 18, 2003 Report Share Posted June 18, 2003 If you can provide a saved chart (use the export method) along with a combination of chart size and axis settings (min-max) it will help us fix the problem more quickly. Regards, JC Software FX Support "Trey Schultz" <trey.schultz@serveron.com> wrote in message news:$V0LEKdNDHA.2552@webserver1.softwarefx.com... > I have a chart that is sent data related to a date axis. I set the start and > end points of the X-axis in response to user input. I am getting a fatal > exception on redraw if the dataset span is significantly smaller than the > span of the x-axis. > > For example, I have a dataset that only covers a month time span, and > contains say 60 points. If I set the date range of the axis to 1 month, it > plots fine.6 months, it still plots fine. However, when the span gets to >1 > year, the app wiil crash when the chart is drawing, giving the following > exception and backtrace: > -- > Exception: System.ArgumentOutOfRangeException > Message: Specified argument was out of the range of valid values. > Parameter name: Year, Month, and Day parameters describe an unrepresentable > DateTime. > Source: mscorlib > at System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day) > at System.DateTime.AddMonths(Int32 months) > at SoftwareFX.ChartFX.AxisBase.CT(17 19H, IGraphicsEx 19I, Rectangle[] > 19J, SetPropFlag& 19K, 0S 19L) > at SoftwareFX.ChartFX.AxisCollection.DA(17 1B5, IGraphicsEx 1B6, > Rectangle[] 1B7, 0S 1B8) > at SoftwareFX.ChartFX.Chart.DM(17 1BX, IGraphicsEx 1BY, Boolean 1BZ, > Boolean 1C0) > at SoftwareFX.ChartFX.Chart.DL(17 1BT, IGraphicsEx 1BU, Rectangle& 1BV, > Int32& 1BW) > at SoftwareFX.ChartFX.Chart.DK(PaintBar 1BQ, IGraphicsEx 1BR, Rectangle& > 1BS) > 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.DebuggableCallback(IntPtr hWnd, > Int32 msg, IntPtr wparam, IntPtr lparam) > at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) > at > System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMetho > ds+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, > Int32 pvLoopData) > at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, > ApplicationContext context) > at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, > ApplicationContext context) > at System.Windows.Forms.Application.Run(Form mainForm) > -- > > Since the exception occurs during the Paint event, I cannot get at the > exception in place, I have to wait for it to bubble to my app. Note that the > size of the chart's client area has bearing on the maximum ratio of data > range to axis range, in that a larger chart will allow a larger axis range > before tripping the exception. This makes me think that an error is occuring > when ChartFX tries to calculate a sub-pixel x value. I could be very wrong > about the specifics, but in general, there seems to be a problem trying to > cram too many data points into too small a chart region. Is there anything > you would recommend to remedy this? Is there a documented way I could check > for this condition or gain some notion of the point-per-pixel ration that > ChartFX is going to arrive at? > > Thanks for your help. If there is anything else I can provide, let me know. > Trey Schultz > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted June 18, 2003 Author Report Share Posted June 18, 2003 Attached is a chart that has a dataset with values that cover about a week and a half. The x-axis is set to span just over 3 months. The chart as saved was being drawn at about 640x480 (chart size not screen rez). There are 2 ways to reporduce my error. The first is to alter either the end date or the start date of the x-axis, adding ~4-6 months at this size will usually cause the error. At the given chart size, setting the start date of the x-axis to 9/1/2002 is usually sufficient to cause the crash. Alternatively, host the chart control on a form with dock set to fill, meaning the chart will resize with the form, and then shrink the form by using the resize handle. At a certain point (my hypothesis, again, is that the "certain point" is when plotted points hit fractional or sub-pixel values) the chart will crash during its Paint event. Thanks <snip -- see previous posts in thread for history> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.