Hi,
I am databinding multiple series to my chart. Each series is money spent per month per person.
So, say I have three people a, b, and c. I am trying to plot their spending over aperiod of 6 months (all the same months Jan 2008 through June 2008).
My data is coming back via an ObjectDataSource with these fields:
Person | Amount | Month
The key portion of my code looks like this:
The problem I am running into is that the x-axis is adding a total of 18 months (6 for each of the three people). The x-axis looks like this:
Jan Feb Mar Apr May Jun Jul Jan Feb Mar Apr May Jun Jul Jan Feb Mar Apr May Jun Jul
I want 6 months and three series -- How can I get the x-axis to display only unique values?
Thanks,
Mike
I am databinding multiple series to my chart. Each series is money spent per month per person.
So, say I have three people a, b, and c. I am trying to plot their spending over aperiod of 6 months (all the same months Jan 2008 through June 2008).
My data is coming back via an ObjectDataSource with these fields:
Person | Amount | Month
The key portion of my code looks like this:
//add a series for each person |
for (int i = 0; i <= (selectedPersons.Count - 1); i++) |
{ |
ChartSeries chartSeries = new ChartSeries(); |
chartSeries.Name = selectedPersonNames[i].ToString(); |
chartSeries.Type = ChartSeriesType.Line; |
chartSeries.DataYColumn = "$"; |
usageChart.Series.Add(chartSeries); |
} |
//set the x axis labels, adjust any appearance, and bind the data |
usageChart.DataSource = personExpenses; |
usageChart.PlotArea.XAxis.DataLabelsColumn = "Month"; |
usageChart.DataBind(); |
The problem I am running into is that the x-axis is adding a total of 18 months (6 for each of the three people). The x-axis looks like this:
Jan Feb Mar Apr May Jun Jul Jan Feb Mar Apr May Jun Jul Jan Feb Mar Apr May Jun Jul
I want 6 months and three series -- How can I get the x-axis to display only unique values?
Thanks,
Mike