Jump to content
Software FX Community

IndexOutOfRangeException when setting AxisX.Min with a Date Axis?


Darin Daubert
 Share

Recommended Posts

I've been getting an IndexOutOfRangeException on my graphs when I set the AxisX.Min and AxisX.Max when my axis format is a date format.  I've attached a sample app recreating the issue I'm getting.  The strange thing is that if you remove the WindowState=Maximized in XAML, I no longer get the error.  Alternatively, I can also remove the AxisX.Min and AxisX.Max calls, and I no longer get the error.  Unfortunately, in my project, I need to be able to set the Min and Max dates.  Can you take a look at the example and let me know what I'm doing wrong?

Thanks again!Darin

Link to comment
Share on other sites

You have to do the following

  1. Move the BindingPathX from AllSeriesAttributes to the Series in the Chart.Series collection. We do not try to use any of the BindingPath* properties from AllSeries

  2. Remove the BindingPath from AxisLabelAttributes: You should not use this property when using XY charts.
  3. Remove the AxisX.AutoScale = false setting, this is not necessary as we will set it to false internally when you set Min and Max

I would also recommend that to improve the formatting in your X axis you choose one of the following

  • If you know your data will never include more than a day you can set Format="Time" and CustomFormat="hh:mm"

  • If your data might include more than a day you might want to set Format="DateTime" (no CustomFormat required)

JuanC

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.

Guest
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.

 Share

×
×
  • Create New...