This is a migrated thread and some comments may be shown as answers.

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

14 Answers 698 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Rahul Khinvasara
Top achievements
Rank 1
Rahul Khinvasara asked on 03 Apr 2012, 03:44 PM
Hi,
      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

Sort by
0
Manoj
Top achievements
Rank 1
answered on 04 Apr 2012, 06:33 PM
I am also facing same problem.
0
Manoj
Top achievements
Rank 1
answered on 05 Apr 2012, 06:06 PM
Any Update? I don't want to create duplicate ticket for this.
0
Petar Marchev
Telerik team
answered on 06 Apr 2012, 09:46 AM
Hello Rahul,

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
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Pat
Top achievements
Rank 1
answered on 24 Oct 2012, 06:26 PM
I seem to be getting this error when trying to chart data with DateTime as x-axis. In particular when x-axis data points are not unique. Wile trying to debug this it also tells me the Average function is not defined for collections of DateTime.
0
Petar Marchev
Telerik team
answered on 25 Oct 2012, 07:05 AM
Pat, we will need more information in order to help you. I have attached a simple app that demonstrates a bar chart which uses DateTime along its x-axis and takes advantage of the Sampling feature. I will ask of you that you open a new thread in which you explain your set up in more details and if possible - attach a modified version of the attached example that reproduces this exception.

Greetings,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Mark
Top achievements
Rank 1
answered on 15 Jan 2013, 10:29 PM
I found that I have same problem when I try get values from dictionary. I cannot reproduce this error if I have same mapping/path in XAML

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);

0
Mark
Top achievements
Rank 1
answered on 17 Jan 2013, 06:29 AM
I was wrong in my previous message. Problem is here property Parameters[0].Value return type is Syste.Object and not double/int/float/byte. So class ChartSamplingFunctions does not contain method like 

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();
}

0
Petar Marchev
Telerik team
answered on 18 Jan 2013, 07:42 AM
Hello Mark,

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.

0
arun
Top achievements
Rank 1
answered on 04 Nov 2016, 09:15 AM
I'm also facing same issue, when X-Axis has more than 200 data point or items; it is working fine with less than 200 data items on x-axis.
0
arun
Top achievements
Rank 1
answered on 04 Nov 2016, 09:28 AM

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.

0
Dinko | Tech Support Engineer
Telerik team
answered on 08 Nov 2016, 11:31 AM
Hello ,

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
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Patrick
Top achievements
Rank 1
answered on 30 Mar 2017, 03:19 PM

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));

 

0
Patrick
Top achievements
Rank 1
answered on 30 Mar 2017, 03:35 PM

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?

0
Dinko | Tech Support Engineer
Telerik team
answered on 04 Apr 2017, 12:33 PM
Hi Patrick,

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:
Regards,
Dinko
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
ChartView
Asked by
Rahul Khinvasara
Top achievements
Rank 1
Answers by
Manoj
Top achievements
Rank 1
Petar Marchev
Telerik team
Pat
Top achievements
Rank 1
Mark
Top achievements
Rank 1
arun
Top achievements
Rank 1
Dinko | Tech Support Engineer
Telerik team
Patrick
Top achievements
Rank 1
Share this question
or