4 posts, 0 answers
  1. Prakash
    Prakash avatar
    7 posts
    Member since:
    Nov 2013

    Posted 02 Dec 2013 Link to this post

    Am using radchart in my wpf application, my requirement is based on Y axis value i have to set the different color for point marks in same line series chart.
    for example am having values from 50 to 100, let say i want to set point mark Redfor values between 50 to 75, and remaining green in the same line series chart area..
    please help to find the solution...

    i have try the below option but it not works,,
    foreach (var item in qry)
                            line.Appearance.Fill = new SolidColorBrush(Colors.Green);
                            else if (condition)
                                line.Appearance.Fill = new SolidColorBrush(Colors.Red);
    i need like this kind of effect in my wpf application ...


    my code below...
     public void chartmain()
                listStackPanel.Visibility = System.Windows.Visibility.Hidden;
                    var qry = (from s in SWindow.HBList
                               where (s.User_id.Equals(W.Profile.UserId))
                               orderby s.Test_date ascending
                               select new { s.HB_score, s.Test_date }).ToList();

                    if (qry.Count == 0)
                        SMessageBox.MessageBox.ShowInformation("No Records Found...");
                        radChart.Visibility = System.Windows.Visibility.Hidden;
                        listStackPanel.Visibility = System.Windows.Visibility.Hidden;

                        radChart.Visibility = System.Windows.Visibility.Visible;
                        radChart.DefaultView.ChartArea.AxisX.IsDateTime = true;
                        radChart.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Auto;
                        radChart.DefaultView.ChartArea.AxisX.LabelRotationAngle = 45;
                        radChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd-MMM";

                        DataSeries lineSeries1 = new DataSeries();

                        foreach (var item in qry)
                            lineSeries1.Add(new DataPoint() {
                                YValue = Convert.ToDouble(item.HB_score), XValue = item.Test_date.ToOADate() 



                        LineSeriesDefinition line = new LineSeriesDefinition();
                        radChart.DefaultSeriesDefinition = line;

                        line.Appearance.Fill = new SolidColorBrush(Colors.Black);
                        line.Appearance.Stroke = new SolidColorBrush(Colors.DarkGreen);
                        line.Appearance.PointMark.Stroke = new SolidColorBrush(Colors.Black);
                        line.ShowPointMarks = true;
                        line.ShowItemLabels = true;
                        lineSeries1.Definition = line;

                        this.BHGridView.ItemsSource = qry;
                        this.radChart.DefaultView.ChartLegend.Visibility = System.Windows.Visibility.Collapsed;


                catch (Exception ex) {

  2. Yavor
    Yavor avatar
    401 posts

    Posted 03 Dec 2013 Link to this post


    The best way to achieve this is to use MVVM and to put your custom logic in your models. This approach is demonstrated in the help topic you mentioned. Once you incorporate it you can use it with any control - RadChart, RadChartView, etc. By the way, the RadChartView is our new charting solution, which is designed with performance and simplicity in mind. You can try it out and see how easier it is.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. Arun
    Arun avatar
    1 posts
    Member since:
    Jul 2016

    Posted 28 Jul 2016 Link to this post

    Am using radchart in my wpf application and showing the data for three years like current year, last year and 2 year ago.

    Graphs is working fine for 2 year ago but when we open same for current year or last year getting below errors -

    {"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. "}

    Trace file details-
       at System.Linq.Expressions.Expression.FindMethod(Type type, String methodName, Type[] typeArgs, Expression[] args, BindingFlags flags)
       at System.Linq.Expressions.Expression.Call(Type type, String methodName, Type[] typeArguments, Expression[] arguments)
       at Telerik.Windows.Data.Expressions.EnumerableSelectorAggregateFunctionExpressionBuilderBase.CreateMethodCallExpression(LambdaExpression memberSelectorExpression) in c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Expressions\Grouping\Aggregates\EnumerableSelectorAggregateFunctionExpressionBuilderBase.cs:line 36


    Above path is also not available in my machine.
    please help to find the solution...

  4. Martin Ivanov
    Martin Ivanov avatar
    1451 posts

    Posted 01 Aug 2016 Link to this post

    Hi Arun,

    Without your set up I cannot be sure what is causing the error. This is why would ask you to send me runnable code snippets that isolates the exception, here in the forum. Or open a new support ticket and attach a sample project.

    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top