Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
355
CategoryDateTimeXAxis Range No Data
posted

When using the CategoryDateTimeXAxis and setting the .MinimumValue/.MaximumValue the axis displays properly when there is data to be displayed.  If a user tries to display a date range with no data setting the MinimumValue/MaximumValue does not seem to work.  I get crazy Xaxis values like 01/01/0001, etc.  Is there anyway to display proper Xaxis values even if there is no data to display in the chart?

Parents
No Data
Reply
  • 355
    posted

    Well, I took a look through CategoryDateTimeXAxis and it looks like the problem is in the InitializeActualMinimumAndMaximum method.  The ActualMinimumValue and ActualMaximumValue are only set if the DateTimeColumn.Count > 0.  Otherwise it uses DateTime.MinValue and DateTime.MaxValue which is the reason for the crazy XAxis values.

    There's no hope of overriding that method since it's marked internal so the only way I've found to overcome the issue is to use a separate X Axis for display only (not attached to a series) and to add 2 dummy data points to it's DataSource that are updated every time the chart's date range is updated.  The dummy data points are set to the Min/Max values for the chart.

    This seems like it would be a common request for a chart so it seems weird that I'd have to use hack like this to get it to work.  Am I missing something here?  Same goes for graphing a LineSeries.  It seems crazy that the XAxis doesn't support a differing number of data points per Series and that I have to create a unique XAxis for each and overlay them all to get it to work.

Children