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

Points are not visible in ScatterPointSeriesChart

2 Answers 116 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
yalçın
Top achievements
Rank 1
yalçın asked on 06 Oct 2015, 08:46 AM

Hello 

 

I am trying to generate a simple chart with 3 datapoint. Datapoints are defined as shown below

public IDgraphViewModel()         {         

    Data = new ObservableCollection<ChartProfileSerisi>();        

     ChartProfileSerisi chartProfil1 = new ChartProfileSerisi();         

    chartProfil1.Noktalar.Add(new ChartVeriNoktasi(1.0,1.0));      

     chartProfil1.Noktalar.Add(new ChartVeriNoktasi(10.0, 10));    

         chartProfil1.Noktalar.Add(new ChartVeriNoktasi(140, 60));   

                        Data.Add(chartProfil1);                    } 

I define the series with code behind

 Chart.HorizontalAxis = new LinearAxis();            Chart.VerticalAxis = new LinearAxis();                        ScatterPointSeries series1 = new ScatterPointSeries();

           series1.ItemsSource = Data[0].Noktalar;            series1.XValueBinding = new PropertyNameDataPointBinding() {PropertyName = "Zaman"};            series1.XValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Stres" };            series1.Visibility = Visibility.Visible;                        

           Chart.Series.Add(series1);

 In generated graph, axis appears correctly, x axis covers all data range up to 140 but points are not visible. In debugger, I checked

series1.DataPoints  property, it is empty. What could be missing? The remaining code is below

 

public class ChartProfileSerisi     {      

  public ObservableCollection<ChartVeriNoktasi> Noktalar { get; set; }

   public ChartProfileSerisi()        {           

 Noktalar = new ObservableCollection<ChartVeriNoktasi>();           

         }    }    

 

 

public class ChartVeriNoktasi    {            

    public ChartVeriNoktasi(double zaman, double stres)        {      

      this.Zaman = zaman;            this.Stres = stres;        }

       public double Zaman { get; set; }   

     public double Stres { get; set; }    

}​

2 Answers, 1 is accepted

Sort by
0
yalçın
Top achievements
Rank 1
answered on 06 Oct 2015, 05:51 PM

I managed to get it work but I can't set legend marker geometry if I use a custom PointTemplate for a series. In the screenshot "Seri 1" legend is missing.

I tried to defien an ellipseGeometry as Static Resource but it also did not work out.

0
Martin Ivanov
Telerik team
answered on 08 Oct 2015, 09:16 AM
Hello yalçın,

The LegendItems in RadChartView gets their marker color from the default visual element of the corresponding series. Using a PointTemplate allows you to use any UI element as a visual for the data points. In other words the legend items doesn't know from what element to get their marker color.

In order to display the color for a series that has a PointTemplate you can define a custom ItemTemplate for the RadLegend control and in its template add a Path that is bound to a Brush property that presents the series color.

I hope this information helps.

Regards,
Martin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ChartView
Asked by
yalçın
Top achievements
Rank 1
Answers by
yalçın
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or