This question is locked. New answers and comments are not allowed.
Hi,
I'm using version 2012.2.607.1050.
I have a data bound piechart with checkbox next to it. When i click the checkbox I then change the ItemSource collection. I have discovered that if the new collection has fewer points than the old collection i get an exception.
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at System.Collections.ObjectModel.Collection`1.get_Item(Int32 index)
at Telerik.Windows.Controls.ChartView.ChartPalette.GetEntry(String family, Int32 index)
at Telerik.Windows.Controls.ChartView.PieSeries.ApplyPaletteCore()
at Telerik.Windows.Controls.ChartView.PresenterBase.ApplyPalette()
at Telerik.Windows.Controls.ChartView.PresenterBase.UpdateUI(ChartLayoutContext context)
at Telerik.Windows.Controls.ChartView.RadChartBase.UpdateUICore(ChartLayoutContext context)
at Telerik.Windows.Controls.ChartView.PresenterBase.UpdateUI(ChartLayoutContext context)
at Telerik.Windows.Controls.ChartView.RadChartBase.CallUpdateUI()
at Telerik.Windows.Controls.ChartView.RadChartBase.OnInvalidated()
The xaml looks like this
<telerik:RadPieChart Grid.Row="1" x:Name="FolderVersionsPieChart" Palette="Metro" >
<telerik:PieSeries ShowLabels="True" ItemsSource="{Binding VersionData}" >
<telerik:PieSeries.LabelDefinitions>
<telerik:ChartSeriesLabelDefinition Margin="-8,0,0,0">
<telerik:ChartSeriesLabelDefinition.Binding>
<telerik:PropertyNameDataPointBinding PropertyName="Label" />
</telerik:ChartSeriesLabelDefinition.Binding>
</telerik:ChartSeriesLabelDefinition>
</telerik:PieSeries.LabelDefinitions>
<telerik:PieSeries.ValueBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Value" />
</telerik:PieSeries.ValueBinding>
</telerik:PieSeries>
</telerik:RadPieChart>
In the view model the collection is changed by setting new VersionData in the following method
public ObservableCollection<DataPoint> VersionData
{
get { return _versionData; }
set
{
_versionData = value;
RaisePropertyChanged("VersionData");
}
}
The DataPoint class a simple string, value class
public class DataPoint
{
private double _value;
private string _label;
public double Value
{
get { return _value; }
set { _value = value; }
}
public string Label
{
get { return _label; }
set { _label = value; }
}
}
The only way I can get around this error is to populate the new collection with dummy zero DataPoint object values if the new collection has fewer DataPoint objects than the old collection. Then the new collection size will be the same size as the old one or larger. A bit ugly to say the least.
Am I doing something wrong here or is there another less hacky work around to fix this?
Thanks for your help
Doug
I'm using version 2012.2.607.1050.
I have a data bound piechart with checkbox next to it. When i click the checkbox I then change the ItemSource collection. I have discovered that if the new collection has fewer points than the old collection i get an exception.
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at System.Collections.ObjectModel.Collection`1.get_Item(Int32 index)
at Telerik.Windows.Controls.ChartView.ChartPalette.GetEntry(String family, Int32 index)
at Telerik.Windows.Controls.ChartView.PieSeries.ApplyPaletteCore()
at Telerik.Windows.Controls.ChartView.PresenterBase.ApplyPalette()
at Telerik.Windows.Controls.ChartView.PresenterBase.UpdateUI(ChartLayoutContext context)
at Telerik.Windows.Controls.ChartView.RadChartBase.UpdateUICore(ChartLayoutContext context)
at Telerik.Windows.Controls.ChartView.PresenterBase.UpdateUI(ChartLayoutContext context)
at Telerik.Windows.Controls.ChartView.RadChartBase.CallUpdateUI()
at Telerik.Windows.Controls.ChartView.RadChartBase.OnInvalidated()
The xaml looks like this
<telerik:RadPieChart Grid.Row="1" x:Name="FolderVersionsPieChart" Palette="Metro" >
<telerik:PieSeries ShowLabels="True" ItemsSource="{Binding VersionData}" >
<telerik:PieSeries.LabelDefinitions>
<telerik:ChartSeriesLabelDefinition Margin="-8,0,0,0">
<telerik:ChartSeriesLabelDefinition.Binding>
<telerik:PropertyNameDataPointBinding PropertyName="Label" />
</telerik:ChartSeriesLabelDefinition.Binding>
</telerik:ChartSeriesLabelDefinition>
</telerik:PieSeries.LabelDefinitions>
<telerik:PieSeries.ValueBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Value" />
</telerik:PieSeries.ValueBinding>
</telerik:PieSeries>
</telerik:RadPieChart>
In the view model the collection is changed by setting new VersionData in the following method
public ObservableCollection<DataPoint> VersionData
{
get { return _versionData; }
set
{
_versionData = value;
RaisePropertyChanged("VersionData");
}
}
The DataPoint class a simple string, value class
public class DataPoint
{
private double _value;
private string _label;
public double Value
{
get { return _value; }
set { _value = value; }
}
public string Label
{
get { return _label; }
set { _label = value; }
}
}
The only way I can get around this error is to populate the new collection with dummy zero DataPoint object values if the new collection has fewer DataPoint objects than the old collection. Then the new collection size will be the same size as the old one or larger. A bit ugly to say the least.
Am I doing something wrong here or is there another less hacky work around to fix this?
Thanks for your help
Doug