
i am using telerik silverlight chart.i got exception "No generic method 'Average' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic" when tried to bind list to chart.
When I use very small data it works fine. But for large number of records I get following error.
RadChart1.ItemsSource = lst1;
i also tried with changes suggested in the forums:
ItemMapping mapping = new ItemMapping("Sales", DataPointMember.YValue, ChartAggregateFunction.Sum);
mapping.FieldType = typeof(double)
but with no luck.
and i also noticed one thing that exception is occurring when result set is reaches more than 200
Thanks.
14 Answers, 1 is accepted


I will need more information in order to be able to help you. Are you using any group settings? Do you have any other item mappings?
200 is the default sampling threshold. Here you can read about sampling. So I guess that the problem will disappear when you disable sampling (by setting the threshold to zero). But I am not sure if this is the right way to go. You can send us some code that reproduces this, with which I can create a new project here so I can test it and try to find where the problem is.
Manoj, even though you are getting a similar error it does not mean your problem is the same. You can either follow this thread or you can open a new support ticket and attach a small project that reproduces this so we can investigate your case, too.
All the best,
Petar Marchev
the Telerik team

Greetings,
Petar Marchev
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

string
xPropertyName =
"ReadTime"
;
string
yPropertyName =
string
.Format(
"Parameters[{0}].Value"
, item.Id /*int key value*/);
//yPropertyName = "Parameters.TestValue"; //this path does not raise exception
var seriesMapping =
new
SeriesMapping();
seriesMapping.LegendLabel = item.Name;
seriesMapping.ItemsSource = item.ParameterValueSets;
seriesMapping.SeriesDefinition = lineSeriesDefinition;
seriesMapping.ItemMappings.Add(
new
ItemMapping() { FieldName = xPropertyName, DataPointMember = DataPointMember.XValue });
seriesMapping.ItemMappings.Add(
new
ItemMapping() { FieldName = yPropertyName, DataPointMember = DataPointMember.YValue });
radChart.SeriesMappings.Add(seriesMapping);

public static object MemberFirst<TSource>(IEnumerable<TSource> source, Func<TSource, System.Object> selector)
and method below just crushes with weird message.
public
override
System.Linq.Expressions.Expression CreateAggregateExpression(System.Linq.Expressions.Expression enumerableExpression)
{
var builder =
this
.binding.CreateExpressionBuilder(enumerableExpression,
this
);
return
builder.CreateAggregateExpression();
}
I apologize for not understanding you fully. Have you managed to resolve the issues you are experiencing or do you need assistance? You can open a new thread (so that we don't jam this thread) in which you can give us more details for your current app and if possible attach a small project that reproduces the issue, so that we can test and look for solutions.
Greetings,
Petar Marchev
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.


Hi,
I'm getting below error when x-axis data item has 200 data point or items. -
An
unhandled exception of type 'System.InvalidOperationException' occurred in
WindowsBase.dll
Additional
information: No generic method 'Average' on type 'System.Linq.Enumerable' is
compatible with the supplied type arguments and arguments. No type arguments
should be provided if the method is non-generic.
We weren't able to reproduce this exception when the RadChartView is populated with 200 items. That is why we would ask you to send us sample project from your application reproducing this exception. This way we can further investigate it directly on our side.
Regards,
Dinko
Telerik by Progress

I am experiencing the same issue if I add more than 200 data points to the series. The error is thrown on the raiseproperty. Works perfectly fine until the series contain more than 200 points.
PropertyInfo[] properties = typeof(U_Chart.ChartData).GetProperties();
foreach (PropertyInfo tmpP in properties)
{
if ((tmpP.Name != "SampleNo") & (tmpP.Name != "Condition"))
{
_ChartSeriesMapping = new SeriesMapping();
_ChartSeriesMapping.LegendLabel = tmpP.Name;
_ChartSeriesMapping.SeriesDefinition = new SplineSeriesDefinition();
_ChartSeriesMapping.ItemsSource = Uchart.Chart_Data;
_ChartSeriesMapping.ItemMappings.Add(new ItemMapping("SampleNo", DataPointMember.XValue));
_ChartSeriesMapping.ItemMappings.Add(new ItemMapping(tmpP.Name, DataPointMember.YValue));
_ChartSeriesMapping.SeriesDefinition.ShowItemLabels = false;
_ChartSeries.Add(_ChartSeriesMapping);
}
}
RaisePropertyChanged(nameof(Uchart));
RaisePropertyChanged(nameof(Uchart.Chart_Data));
RaisePropertyChanged(nameof(ChartSeries));

in the properties for the rad chart I can increase the sampling threshold and it will plot correctly but when I close and reopen the WPF window the chart shows and error (red x and text "Value cannot be null. Parameter name: source"). Through the property panel I can click the "New" next to Sampling Settings and the error goes away and the radchart displays as expected in the WPF window. Any ideas?
Looking at the provided code we can see that you are using the old RadChart. Instead of the old I recommend you to use the new RadChartView suite that resolves many known issues and limitations of the old chart. The new components have better implementation and improved performance. You can read about the differences between the charts in the RadChart vs. RadChartView help article. The new is actually a set of controls - RadCartesianChart, RadPieChart, RadPolarChart, ChartDataSource. It is much faster, very flexible, resolves almost all limitations the old control had and is pretty easy to set up. You can also take a look at the following resources:
- Create Data-Bound Chart help article
- Axis help article
- ChartDataSource help article which describes how to use the in sampling scenarios
- Our GitHub repository where you can find different example for the
Regards,
Dinko
Telerik by Progress