Link to home
Start Free TrialLog in
Avatar of BROOKLYN1950
BROOKLYN1950Flag for United States of America

asked on

Adding Large Numbers To Chart

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?
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

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.
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
ASKER CERTIFIED SOLUTION
Avatar of BROOKLYN1950
BROOKLYN1950
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BROOKLYN1950

ASKER

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.