Jump to content
Software FX Community

Exception is thrown: "The added or subtracted value results in an un-representable DateTime."


Recommended Posts


 I am getting the following exception when I am creating a graph when the items are from different months only:

The graph is showing items  in a bar and each item is located by it's date/time.

The legend of each item is showing it's hour only.

It is working fine for items from the same month but fails when there are items from different months.

Can you please take a look and assist?



Exception: "The added or subtracted value results in an un-representable DateTime. Parameter name: months"

Stack Trace:

  at System.DateTime.AddMonths(Int32 months)

at SoftwareFX.ChartFX.17.KP(Double 27D, Double 27E, Boolean& 27F, Boolean& 27G, Double& 27H)

at SoftwareFX.ChartFX.AxisBase.JP(1R 23O, Rectangle[] 23P, SetPropFlag& 23Q, 1C 23R, AxisSection& 23S)

at SoftwareFX.ChartFX.AxisCollection.KA(1R 254, Rectangle[] 255, 1C 256)

at SoftwareFX.ChartFX.ChartCore.EP(1R 1T1, Boolean 1T2, Boolean 1T3)

at SoftwareFX.ChartFX.ChartCore.EO(1R 1SY, Rectangle& 1SZ, Int32& 1T0)

at SoftwareFX.ChartFX.ChartCore.EN(PaintBar 1SV, IGraphicsEx 1SW, Rectangle& 1SX)

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.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.SafeNativeMethods.UpdateWindow(HandleRef hWnd)

at System.Windows.Forms.Control.Update()

at System.Windows.Forms.Control.Refresh()


Examples from the code:


Chart62 chartResults = new .... 

chartResults.IniValue[indx,rowNum] = locationInRow + minStartHour.TotalSeconds;

locationInRow = (int)TimeSpan.TotalSeconds and minStartHour is an instance of  TimeSpan )

interactionChart.chartResults.AxisY.Min = minStartHour; (minStartHour is TimeSpan.TotalSeconds value)

DateTime startTime = (DateTime)row[iNTERACTION_START_TIME_COLUMN];

TimeSpan startTimeDelta = startTime.Subtract(minStartTime);

 interactionChart.chartResults.AxisY.Max = minStartHour + maxLocation + 3600; (maxLocation = Convert.ToInt32(startTimeDelta.TotalSeconds);)

chartResults.Width = 32767;

Link to comment
Share on other sites

Hi leroy2611

This is not a common problem and we will need to replicate it on our side. Could you please send us an email to support at softwarefx dot com and provide us with the simplest form of the code (small compilable sample) that reproduces the problem? Since other lines of code could be causing the problem, please isolate the sample including only the code that replicates the issue in question. Please remove the extra-code that is not related to Chart FX so we can focus on the problem itself.

Also, please include your product serial number. So, we can properly track your issue.


Carlos Chaves

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...