We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem with displaying of the data on graph

Thread ID:





130085 Apr 20,2017 02:12 PM UTC Apr 23,2017 09:47 AM UTC WPF 1
Tags: SfChart
Asked On April 20, 2017 02:12 PM UTC

I try to present the dynamic data on the sfChart, but with no result.

My chart code XAML:

<chart:SfChart x:Name="myChart" Style="{StaticResource chartStyle}">
        <TextBlock Text="Chart output" Style="{StaticResource chartHeaderDefaultStyle}"/>
        <local:ChartPoints x:Name="T1"/>
        <chart:NumericalAxis ActualRangeChanged="XAxis_ActualRangeChanged" 
            EnableScrollBarResizing="False" EnableTouchMode="False" 
            EnableScrollBar="{StaticResource showScrollInChartStyle}" x:Name="Chart1_XAxis" Header="Frequency [MHz]" 
            LabelFormat=""  EdgeLabelsDrawingMode="Fit" 
            LabelTemplate="{StaticResource labelTemplate}" 
            AxisLineStyle="{StaticResource axisLineStyle}"
            MajorTickLineStyle="{StaticResource majorTickLineStyle}"
            MajorGridLineStyle="{StaticResource gridLineStyle}"/>

        <chart:NumericalAxis x:Name="Chart1_YAxis" 
            LabelTemplate="{StaticResource labelTemplate}" 
            AxisLineStyle="{StaticResource axisLineStyle}"
            MajorTickLineStyle="{StaticResource majorTickLineStyle}"
            MajorGridLineStyle="{StaticResource gridLineStyle}">

    <chart:SplineSeries StrokeThickness="2" x:Name="Chart1_Series1" 
        Label="Platinum" ItemsSource="{Binding FoundFrequencies}" 
        XBindingPath="Frequency" YBindingPath="Amplitude" Background="LightCyan"/>

    <chart:LineSeries ItemsSource="{Binding UnfoundFrequencies}"
              XBindingPath="Frequency" Interior="Red"

        <chart:RectangleAnnotation x:Name="Chart1_PossibleRange"/>

And here my ChartPoints object (T1):

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace sfchart1_WPF
    public class ChartPoints 
        public ObservableCollection<ChartPoint> FoundFrequencies = new ObservableCollection<ChartPoint>();
        public ObservableCollection<ChartPoint> UnfoundFrequencies = new ObservableCollection<ChartPoint>();

        public void Clear()

        public ChartPoints() 

        private void Init()
            FoundFrequencies.Add(new ChartPoint { Frequency = 200, Amplitude = 2 });
            FoundFrequencies.Add(new ChartPoint { Frequency = 210, Amplitude = 8});
            FoundFrequencies.Add(new ChartPoint { Frequency = 220, Amplitude = 5});
            FoundFrequencies.Add(new ChartPoint { Frequency = 230, Amplitude = 7});
            FoundFrequencies.Add(new ChartPoint { Frequency = 240, Amplitude = 4});
            FoundFrequencies.Add(new ChartPoint { Frequency = 250, Amplitude = 3});
            FoundFrequencies.Add(new ChartPoint { Frequency = 260, Amplitude = 5});

    public class ChartPoint
        public double Frequency { get; set; }
        public double Amplitude { get; set; }

I don't see any points on the chart. I don't understand where I did a mistake.. :( 

Thank you a lot!!

Devi Aruna Maharasi Murugan [Syncfusion]
Replied On April 21, 2017 10:58 AM UTC

Hi Michael, 
Thanks for contacting Syncfusion Support. 
We have checked your provided code and to bind the collection to chart, we have to define the collection field as property as shown in the below code 

public ObservableCollection<ChartPoint> FoundFrequencies { get; set; }  
public ObservableCollection<ChartPoint> UnfoundFrequencies { get; set; }  

We have created a demo sample by modifying the provided code and it can be downloaded from below link, 
Sample: Chart130085 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon