I am trying to add two arraylists to a 2 dimensional array but I am coming across a problem. If I fill the array manually, shown in the code below as array arr1, and bind this array to a chart, the chart displays as expected. However, when I add the two arraylists to the array using a for loop and bind this array to a chart, it does not display as expected.
My Code:
DateTime date1 = new DateTime(2012, 10, 1);
DateTime date2 = new DateTime(2012, 11, 2);
DateTime date3 = new DateTime(2012, 12, 3);
DateTime date4 = new DateTime(2013, 01, 4);
DateTime date5 = new DateTime(2013, 02, 8);
//Create time arraylist
ArrayList al1 = new ArrayList();
al1.Add(date1);
al1.Add(date2);
al1.Add(date3);
al1.Add(date4);
al1.Add(date5);
int int1 = 9;
int int2 = 15;
int int3 = 20;
int int4 = 13;
int int5 = 17;
//Create int arraylist
ArrayList al2 = new ArrayList();
al2.Add(int1);
al2.Add(int2);
al2.Add(int3);
al2.Add(int4);
al2.Add(int5);
//Tester 2D array
Object[,] arr1 = new Object[,] { {date1, int1}, {date2, int2}, {date3, int3}, {date4,int4}, {date5, int5} };
//Create 2D array
Object[,] arr = new Object[2, al2.Count];
for (int k = 0; k <al2.Count; k++)
{
arr[0, k] = al1[k];
arr[1, k] = al2[k];
}
Data d1 = new Data(arr);
Series s1 = new Series { Name = "Series 1", Data=d1};
DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart");
chart.SetXAxis(new XAxis
{
Type = AxisTypes.Datetime
});
chart.SetSeries(s1);
ltrChart.Text = chart.ToHtmlString();
Is my problem with in the adding of the arraylists to the array or is it something within dotnet highcharts?
ArrayList, if "HighCharts" only accepts a multidimensionalArrayListdon't use "HighCharts".