Coder Posted January 21, 2009 Report Share Posted January 21, 2009 I am creating a simple chart and passing in data that has ~25 years of data. This is a time series, so the chart is setup for an X-Values date scale. If I show all of the data on the chart, it works fine. However, if I limit the x-range to show less than the whole data set, I get this error, "Exception of type 'System.OutOfMemoryException' was thrown." It works fine to do this with a line chart. I can work around this by using a subset of my data that's within my x-axis min/max range, but I thought I would bring it to your attention. My code example... Chart chart = new Chart();SeriesAttributes sa = new SeriesAttributes();sa.Gallery = Gallery.Area;sa.ItemsSource = sd.DataRaw; //Data from 1986 to Presentsa.BindingPath = "Value";sa.BindingPathX = "Date";chart.AxisX.DataFormat.Format = AxisFormat.Date;chart.AxisX.Labels.Format = AxisFormat.Date;chart.AxisX.Min = new DateTime(1999, 1, 1); //This causes OutOfMemoryException//chart.AxisX.Min = new DateTime(1986, 1, 1) <- This works, showing all the datachart.AxisX.Max = DateTime.Today;chart.AxisY.LogBase = 10.0;chart.AxisY.Min = min;chart.AxisY.Max = max;chart.AxisY.AxisStyle = AxisStyles.ShowEnds | AxisStyles.ShowIntermediateLogLabels | AxisStyles.AutoFirstLabel;chart.Series.Add(sa);Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.