Hello,
I have a little problem with my chart.
In my project containt a RadGridView and a RadChart. the itemSource of radChart are the ItemSelected of Grid.
For Draw my chart I use this function :
I made DataItemViewModel class, it's containt my data. A properties in this class are the group number of point. the number of series in the chart are the number of group in the parameter list.
When start my project, all works, the funtion PopulateChart take All Data in parameter.
But after, when I change the grid selection, it's works only when parameters list containt datas with the same group.
When group are different I have, in the instruction : radChart.SeriesMappings = seriesMapping; this Exception :
No IEnumerable item found at index: 1 in the ItemsSource!
I don't understand why I have this exception, the type of data are the same, the processing are the same.
If someone have an idea or a clue.
I have a little problem with my chart.
In my project containt a RadGridView and a RadChart. the itemSource of radChart are the ItemSelected of Grid.
For Draw my chart I use this function :
private
void
PopulateChart(List<DataItemViewModel> listDataViewModel)
{
SeriesMappingCollection seriesMapping =
new
SeriesMappingCollection();
ObservableCollection<List<DataItemViewModel>> itemSourceList =
new
ObservableCollection<List<DataItemViewModel>>();
foreach
(GroupDescription groupDesc
in
_groupList)
{
SeriesDefinition seriesDef =
this
.GetSeriesDefinition(
"Bubble"
);
SeriesMapping seriesMap =
new
SeriesMapping();
ItemMapping itemMapX;
ItemMapping itemMapY;
SeriesDescription seriesDesc = _seriesList.First<SeriesDescription>(desc => desc.SeriesDefinition.Equals(
"Bubble"
));
itemMapY =
new
ItemMapping(String.Concat(
"DrawnItem."
, seriesDesc.Criterium), DataPointMember.YValue);
seriesMap.ItemMappings.Add(
new
ItemMapping(String.Concat(
"DataItem.Lbl"
, seriesDesc.Criterium), DataPointMember.Label));
seriesMap.ItemMappings.Add(itemMapY);
if
(_xSeries.DataType.Equals(
"double"
) || _xSeries.DataType.Equals(
"long"
))
{
itemMapX =
new
ItemMapping(String.Concat(
"DrawnItem."
, _xSeries.Criterium), DataPointMember.XValue);
}
else
{
if
(!_xSeries.Criterium.Equals(
"LABEL"
))
itemMapX =
new
ItemMapping(String.Concat(
"DrawnItem.S"
, _xSeries.Criterium), DataPointMember.XCategory);
else
itemMapX =
new
ItemMapping(String.Concat(
"DrawnItem."
, _xSeries.Criterium), DataPointMember.XCategory);
}
seriesDef.ItemToolTipFormat =
"#LABEL"
;
seriesMap.ItemMappings.Add(itemMapX);
seriesMap.SeriesDefinition = seriesDef;
List<DataItemViewModel> listDataView = listDataViewModel.Where<DataItemViewModel>(dataItemTemp => dataItemTemp.DrawnItem.Grp == groupDesc.Num).ToList<DataItemViewModel>();
if
(listDataView.Count > 0)
{
itemSourceList.Add(listDataView);
seriesMap.CollectionIndex = itemSourceList.Count - 1;
seriesMap.LegendLabel = groupDesc.Label;
seriesMapping.Add(seriesMap);
}
}
radChart.SeriesMappings = seriesMapping;
radChart.ItemsSource = itemSourceList;
radChart.DefaultView.ChartArea.AxisY.AutoRange =
true
;
}
I made DataItemViewModel class, it's containt my data. A properties in this class are the group number of point. the number of series in the chart are the number of group in the parameter list.
When start my project, all works, the funtion PopulateChart take All Data in parameter.
But after, when I change the grid selection, it's works only when parameters list containt datas with the same group.
When group are different I have, in the instruction : radChart.SeriesMappings = seriesMapping; this Exception :
No IEnumerable item found at index: 1 in the ItemsSource!
I don't understand why I have this exception, the type of data are the same, the processing are the same.
If someone have an idea or a clue.