Jump to content
Software FX Community

CrosstabTransform Index outside the bounds of the array


mr.mghenry
 Share

Recommended Posts

Hey,

  I was wondering if you could help me with this? I'm getting the "Index outside the bounds of the array"

  Here is the code to create my chart:

  chart.Series.Clear();   chart.DataTransforms.Clear();   chart.ItemsSource = null;   chart.Titles.Clear();   chart.Culture = CultureInfo.CurrentCulture;   chart.AxisY.Title.Content = "Boed";   var dataTransform = new CrosstabTransform();   dataTransform.ValuePath = "Volume";   dataTransform.RowPath = "AccountDateString";   dataTransform.ColumnPath = "Series";   dataTransform.Sorted = true;   chart.DataTransforms.Add(dataTransform);   chart.DataBound += chart_DataBound;   chart.AxisX.Labels.BindingPath = "AccountDateString";   chart.AxisX.Labels.Format = AxisFormat.Date;   chart.AxisX.Separation = 0;   chart.AxisX.AutoScale = true;   chart.AxisX.Title.Content = "Month";   chart.Gallery = Gallery.Bar;   chart.AllSeries.Stacked = true;   chart.AllSeries.StackedStyle = StackedStyle.Normal;   chart.ItemsSource = items;   chart.Titles.Add(new Title("Volumes (boed)"));

 and here is the object that is in the items list

 public class EngineeringChartDto   {   private string budgetEntity;   private string commodityType;   private DateTime accountDate;   private double volume;   private string series;   public string Series   {   get { return series; }   }   public EngineeringChartDto(string budgetEntity, string commodityType, DateTime accountDate, double volume, string series)   {   this.budgetEntity = budgetEntity;     this.series = series;   this.commodityType = commodityType;   this.accountDate = accountDate;   this.volume = volume;   }     public string BudgetEntity   {   get { return budgetEntity; }   }   public string CommodityType   {   get { return commodityType; }   }   public DateTime AccountDate   {   get { return accountDate;}   }   public string AccountDateString   {   get { return accountDate.ToString(OracleDate.DayMonthYearFormat); }   }   public double Volume   {   get { return volume; }   }   public override string ToString()   {   return accountDate.ToShortDateString();   }   }

}

 

Here is the Error:

at as.c(Int32 A_0) at ChartFX.WPF.Internal.PlotAreaCore.a(PaintMark A_0, AttributesResolver A_1, Double A_2, Double A_3, LogicalItemCollection A_4, LogicalItemCollection A_5, Int32 A_6) at ChartFX.WPF.Internal.PlotAreaCore.a(AttributesResolver A_0, Double A_1, Double A_2) at ChartFX.WPF.Internal.PlotAreaCore.e(Double A_0, Double A_1) at ChartFX.WPF.Internal.PlotAreaCore.a(Double A_0, Double A_1, Boolean A_2) at ChartFX.WPF.Internal.PlotAreaItems.OnRenderSizeChanged(SizeChangedInfo sizeInfo) at System.Windows.ContextLayoutManager.fireSizeChangedEvents() at System.Windows.ContextLayoutManager.UpdateLayout() at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg) at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork() at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.MessageBox(HandleRef hWnd, String text, String caption, Int32 type) at System.Windows.MessageBox.ShowCore(IntPtr owner, String messageBoxText, String caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options) at System.Windows.MessageBox.Show(String messageBoxText, String caption) at longrangemodel.ui.Main.ErrorMessageBox(String message) in C:\Projects\longrangemodel\src\app\longrangemodel.ui\Main.xaml.cs:line 128 at longrangemodel.ui.Main.Dispatcher_UnhandledException(Object sender, DispatcherUnhandledExceptionEventArgs e) in C:\Projects\longrangemodel\src\app\longrangemodel.ui\Main.xaml.cs:line 123 at System.Windows.Threading.Dispatcher.CatchException(Exception e) at System.Windows.Threading.Dispatcher.CatchExceptionStatic(Object source, Exception e) at System.Windows.Threading.ExceptionWrapper.CatchException(Object source, Exception e, Delegate catchHandler) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at longrangemodel.ui.App.Main() in C:\Projects\longrangemodel\src\app\longrangemodel.ui\obj\Debug\App.g.cs:line 0

 

Any help would be greatly appreciated,

Thanks,

Mike Henry

Link to comment
Share on other sites

The code looks fine, are you able to duplicate this exception by filling the items collection with dummy data that "looks like" your real data? If so, please post the items contents needed to duplicate the problem.

Can you also post the file version for ChartFX.WPF.dll?

JuanC

post-3268-13922406429987_thumb.jpg

Link to comment
Share on other sites

 Juan C,

  Thanks for you reply...however yesterday I made some changes to the way that I was filling the chart and it now looks like this

 

 I changed from the CrosstabTransorm to a ListTransform . Everything works fine except that for every DateTime property I'm getting 4 values (based on the AccountTypeName from my object model) and they are not stacked (I think), only because the x-axis is not being populated with the DateTime values. Here is what my new code looks like:

  chart.Series.Clear();   chart.DataTransforms.Clear();   chart.ItemsSource = null;   chart.Titles.Clear();   chart.Culture = CultureInfo.CurrentCulture;   chart.AxisY.Title.Content = "Boed";   var dataTransform = new ListTransform();   dataTransform.SeriesPath = "Source";   dataTransform.ValuePath = "Value";   dataTransform.XValuePath = "DateTime";   dataTransform.ColumnPath = "AccountDetails";   dataTransform.Sorted = true;   dataTransform.RowPath = "DateTime";   chart.DataTransforms.Add(dataTransform);   chart.DataBound += chart_DataBound;   chart.AxisX.Labels.Format = AxisFormat.Date;   chart.AxisX.Separation = 0;   chart.AxisX.AutoScale = true;   chart.AxisX.Title.Content = "Month";   chart.Gallery = Gallery.Bar;   chart.AllSeries.Stacked = true;   chart.AllSeries.StackedStyle = StackedStyle.Normal;   chart.ItemsSource = items;   chart.Titles.Add(new Title("Volumes (boed)"));

I also changed my object of items to the following:

 public class EngineeringChartDto   {   private string source;   private IRichList<EngineeringAccountDetail> accountDetails;   public EngineeringChartDto(string year, IRichList<EngineeringAccountDetail> accountDetails)   {   this.source = year;   this.accountDetails = accountDetails;   }   public EngineeringChartDto(string year)   : this(year, new RichList<EngineeringAccountDetail>())   {     }   public string Source   {   get { return source; }   }   public IRichList<EngineeringAccountDetail> AccountDetails   {   get { return accountDetails; }   }   }   public class EngineeringAccountDetail   {   private readonly DateTime dateTime;   private readonly string accountTypeName;   private readonly double value;   public EngineeringAccountDetail(DateTime dateTime, string accountTypeName, double value)   {   this.dateTime = dateTime;   this.accountTypeName = accountTypeName;   this.value = value;   }   public string DateTime   {   get { return dateTime.ToString(OracleDate.DayMonthYearFormat); }   }   public string AccountTypeName   {   get { return accountTypeName; }   }   public double Value   {   get { return value; }   }   }

 

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