I have a chart with four chart areas where i'm manually adding dataseries. Based on upon buttons clicked, I clear the data series and manually re-add a new series. This is working well except one particular case: when the user clicks the button and current chartarea has 3 XCategory datapoints and the new series also as 3 XCategory datapoints, the XCategory values in the 'new' chart are not updated. Howerver, if the new dataseries has a different number of XCategories then the old datasieres, the chart is update correcty. Below is snippet of how I'm updating the charts. Does anyone have any ideas on what I can try?
Thanks!
Thanks!
void processInboundCalls(object sender, getInboundCallsByWorkgroupCompletedEventArgs e) |
{ |
ChartAreaInbound.DataSeries.Clear(); |
var res = e.Result.GroupBy(x => x.IDisplayType); |
foreach (IGrouping<string, InboundCall> ic in res) |
{ |
DataSeries ds = new DataSeries(); |
ds.Definition = new StackedBarSeriesDefinition(); |
ds.LegendLabel = ic.Key.ToString(); |
//reverse order |
for (int i = ic.Count(); i > 0; i--) |
{ |
{ |
DataPoint dp = new DataPoint(); |
dp.XCategory = ic.ElementAt(i - 1).Name.ToString(); |
dp.YValue = ic.ElementAt(i - 1).Calls; |
ds.Add(dp); |
} |
} |
ChartAreaInbound.DataSeries.Add(ds); |
} |
if (ChartAreaInbound.Visibility == Visibility.Collapsed) { ChartAreaInbound.Visibility = Visibility.Visible; } |
} |