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

Dynamic creation of Point Template for scatterplot

1 Answer 14 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Usama
Top achievements
Rank 1
Veteran
Usama asked on 16 Nov 2020, 10:02 AM

Hi, In telerik For my scatter point data (dynamically created in c#), I want to assign colors to each point dynamically by Point Template 
as
           var chart = new Telerik.Windows.Controls.RadCartesianChart();
            ScatterPointSeries scatterSeries = new ScatterPointSeries();
            for (int i = 0; i < 100; i++)
            {
                ScatterDataPoint point = new ScatterDataPoint();
                point.XValue = xvaluelist[i];
                point.YValue = yvaluelist[i];
                scatterSeries.DataPoints.Add(point);
                Brush color = new SolidColorBrush(colorlist[i]);

                Ellipse ellipse = new Ellipse();
                ellipse.Fill = color;
                ellipse.Stroke = color;
                ellipse.Height = 10;
                ellipse.Width = 10;
              DataTemplate datatemplate = new DataTemplate(typeof(Ellipse));
              FrameworkElementFactory element= new FrameworkElementFactory(typeof(Ellipse));
              element.SetValue(,);   //Issue is here
              datatemplate.VisualTree = element;

             scatterSeries.PointTemplates.Add(datatemplate);
             }        
            chart.Series.Add(scatterSeries);

element.SetValue accept two inputs that are dependencyproperty dp, object value

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 18 Nov 2020, 05:50 PM

Hello Usama,

I already answered your question in the other forum.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
ChartView
Asked by
Usama
Top achievements
Rank 1
Veteran
Answers by
Martin Ivanov
Telerik team
Share this question
or