Solved

Adding Large Numbers To Chart

Posted on 2013-05-10
4
343 Views
Last Modified: 2013-05-19
I’m having some trouble adding large (8+ digit) numbers to the Y-axis of a chart at runtime. The Y-axis should display numbers (double data type) and the x-axis should display strings.
      When I add a number under 8 digits (using Points.AddXY, Points.AddY, or Points.Add) I get an error saying this:

A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll

Additional information: The added or subtracted value results in an un-representable DateTime.’
     There should be nothing date-related going on with the chart, only number values. This error occurs with and with decimals in the value I’m trying to add.
      The odd thing is that the error doesn’t occur when I can the Points.Add method, but when I call Chart.Update. I can add all the data fine, but when I call update, it gives me the above error.
      It seems like its treating the data as an OLE Automation Date, but I can’t imagine why. I set the Series. XValueType to String and Series. YValueType to Double at runtime for each series before adding the data.
      Any ideas?
0
Comment
Question by:BROOKLYN1950
  • 2
4 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39160519
this error occurs when one of the types is datetime and it set to be its min/max values, either DateTime.MinValue or DateTime.MaxValue (default).
make sure u have no datetime type under any circumstance in your chart.
0
 
LVL 33

Expert Comment

by:sarabande
ID: 39160825
a first chance exception is not necessarily an error. it is a test on a variable which is controled by a try-catch block and where the exception was caught and handled by the software.

is there enough space at left of the y-axis to display a 8+ number? you also may consider that a floating point number rarely matches exactly to the number displayed but that there is mostly a rounding difference, for example the number 123456.78 might have the internal value 123456.7799998... where at the 14th or 15th decimal digit there is a significant difference. if the chart library uses float type the precision reduces to 6 or 7 digits. all that could lead to range errors if not configured rightly and the error message could be misleading in those cases.

Sara
0
 

Accepted Solution

by:
BROOKLYN1950 earned 0 total points
ID: 39166640
I figured out the problem. I had the intervaltype of the minorgridlines set to Minutes from when I was experimenting to try to solve this problem (which is still not solved). Setting it back to Auto or Number eliminated the error.
0
 

Author Closing Comment

by:BROOKLYN1950
ID: 39178305
I found the solution before anyone else had any idea what it was. It was a mistake on my end, I had done something wrong and not fixed it, then forgotten about it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now