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

How change specific point style on one LineSeries?

5 Answers 268 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Johnny
Top achievements
Rank 1
Veteran
Johnny asked on 19 Jan 2021, 04:06 AM

I use a LineSeries show points in a ChartView with data binding.

I want to change specific point style by specific condition from bound data.

How to do that?

Example: if data value bigger than 10 and change the point size to bigger.

5 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 19 Jan 2021, 07:36 AM
Hello, Johnny, 

The following help article demonstrates how to use data binding for populating a LineSeries with data: https://docs.telerik.com/devtools/winforms/controls/chartview/populating-with-data/binding-to-datatable   

The LineSeries offers several properties that may be useful for styling the lines and their points:
- BorderWidth: The property determines the thickness of the lines.
- PointSize: The property denotes the size of the points.

If you need to customize certain point values in a different size, please have a look at the following code snippet which result is illustrated in the screenshot: 
            DataTable table = new DataTable();
            table.Columns.Add("Value", typeof(double));
            table.Columns.Add("Name", typeof(string));
            table.Rows.Add(1, "John");
            table.Rows.Add(13, "Adam");
            table.Rows.Add(5, "Peter");
            table.Rows.Add(12, "Sam");
            table.Rows.Add(6, "Paul");

            LineSeries lineSeria = new LineSeries();
            radChartView1.Series.Add(lineSeria);
            lineSeria.ValueMember = "Value";
            lineSeria.CategoryMember = "Name";
            lineSeria.DataSource = table;
            lineSeria.PointSize = new SizeF(8, 8);
            lineSeria.BorderColor = Color.Red;
            lineSeria.BorderWidth = 1;

            foreach (CartesianLinePointElement pointElement in lineSeria.Children)
            {
                CategoricalDataPoint dataPoint = pointElement.DataPoint as CategoricalDataPoint;
                if (dataPoint.Value > 10) 
                {
                    pointElement.BackColor = Color.Aqua;
                }
            }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
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/.

0
Johnny
Top achievements
Rank 1
Veteran
answered on 19 Jan 2021, 07:54 AM
Awsome, but my bound data is live data. It's unexpected.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 19 Jan 2021, 10:24 AM

Hi, Johnny,

If you are using live data, I suppose that the data is being changed at a certain interval. Hence, after each update iteration, you can enumerate the LineSeries.Children and adjust the desired point elements according to your custom requirements.

Our Demo application >> ChartView >> Live Data example may be useful for your scenario.

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
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/.

0
Johnny
Top achievements
Rank 1
Veteran
answered on 21 Jan 2021, 03:57 PM

My preferred way.

https://www.telerik.com/forums/are-there-any-samples-for-drawing-points-on-lineseries#2pSeTCT61EyVN9VWeT9mQA

 
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Jan 2021, 02:18 PM

Hello, Johnny,

I have already reviewed the custom implementation that you have. I am glad that you have found a suitable solution for your precise case.

If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
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
Johnny
Top achievements
Rank 1
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Johnny
Top achievements
Rank 1
Veteran
Share this question
or