I am plotting WeekNumber of the year on X-axis, and Number of Requests of a particular school on to Y-axis of a Line Series.
Results of a Stored Procedure are assigned to a List of section-requests, by passing School ID, and a date range.
The output of Stored procedure gives: Number of Requests per week, Created Date, Week Number (of the Year), School Name.
Code calls stored procedure 5 times, and stores the results in 5 individual Lists. Code loops through an array of 5 Lists (section-requests) .
By using the LineSeries, AxisItem, and CategorySeriesItem , I have created a Multi-Line chart.
My issues are:
(1) Once the first List plots on the first LineChart, because of the looping as individual Lists, the Week Number of the second List is starting from where the Week Number of the first List ended. Is there a way that I can group all the Lists with the LineSeries, and plot only one set of Week Numbers (X axis) and related LineSeries (Y axis) for each individual school? Please take a look at the Line chart in the attached file
(2) If there is no section-request in a particular week, I need logic to treat “Number of Requests per week” as zero.
For Loop Code:
for (int i = 0; i < arrMasterList.Length; i++)
{
int intCount = arrMasterList[i].Count;
foreach (var sectionRequest in arrMasterList[i])
{
intSecReqs =
sectionRequest.NumberOfRequestsPerWeek;
if (intSecReqs >= 0)
{
AxisItem item = new AxisItem();
item.LabelText = "Wk: " +
sectionRequest.WeekNumber;
LineChart.PlotArea.XAxis.Items.Add(item);
CategorySeriesItem categorySeriesItem = new CategorySeriesItem();
categorySeriesItem.Y = intSecReqs;
arrLineSeries[i].SeriesItems.Add(categorySeriesItem);
lstSecReqs.Add(intSecReqs);
}
LineChart.PlotArea.Series.Add(arrLineSeries[i]);
}
}
intMaxValueReqs = lstSecReqs.Max();
LineChart.PlotArea.YAxis.MinValue = 0;
LineChart.PlotArea.YAxis.MaxValue =
intMaxValueReqs + 10;
LineChart.PlotArea.YAxis.MinorGridLines.Color = Color.White;
LineChart.PlotArea.XAxis.MajorGridLines.Color = Color.White;
LineChart.PlotArea.XAxis.TitleAppearance.Text = "Week number";