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

How to dynamically change the pointSeries PointSize?

5 Answers 95 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Chinmaya
Top achievements
Rank 1
Chinmaya asked on 22 Sep 2014, 08:29 AM
I want to have 3 different point size for pointSeries and want to control this point size with check able menu dynamically.


                        PointSeries valueSeries = new PointSeries();             
                        valueSeries.ItemsSource = parameterResults;

       // current point size which is fixed
                        valueSeries.PointSize = new Size() { Height = 6, Width = 6 };
                
                        valueSeries.CategoryBinding = new PropertyNameDataPointBinding("Time");
                        valueSeries.ValueBinding = new PropertyNameDataPointBinding("Val");
                        valueSeries.Visibility = System.Windows.Visibility.Visible;
                        valueSeries.LegendSettings = new SeriesLegendSettings();
                        valueSeries.LegendSettings.Title = location.Replace(locationInfo.Name + ".", "");                       


I tried and failed can anyone help with this ?

sample project is appreciated.

Thanks in advance.

5 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 23 Sep 2014, 06:59 AM
Hi Chinmaya,

In order to control the PointSize of the series at runtime you can set the property in code or bind it to a property from your view model. 

For example if you have a Button that you want to change the point sizes you can subscribe for its Click event and inside its handler change the PointSize of the series.
private void Button_Click(object sender, RoutedEventArgs e)
        {
            var series = this.xChart.Series[0] as Telerik.Windows.Controls.ChartView.PointSeries;
            series.PointSize = new Size() { Height = 6, Width = 6 };
        }

You can take a look at the attached project to see this approach.

Regards,
Martin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Chinmaya
Top achievements
Rank 1
answered on 23 Sep 2014, 08:43 AM
Hi Martin,

I your example you have explained how to change the point size to higher value.
what i am expecting in my project is to change both the way ie: to increase the size and as well as decrees maybe by having one more button.

i tried creating one more button and changing the point size to lower values but it did not work for me it only worked if i increase the value.

one more thing i have eight different point series in a chart so is there any simple way to refer that series by name or anything like that?

0
Martin Ivanov
Telerik team
answered on 24 Sep 2014, 09:32 AM
Hi Chinmaya,

I tested the project from my last reply with additional button that decreases the PointSize of the series and everything works as expected. Can you please take a look at the attachment and let me know if I am missing something?

As for referring the series, you can set their Name (or Tag) property when they are created and then you can use it to get them.
valueSeries.Name= "series2";
...
var series2 = this.xChart.Series.FirstOrDefault(x => x.Name == "series2") as Telerik.Windows.Controls.ChartView.PointSeries;

Regards,
Martin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Chinmaya
Top achievements
Rank 1
answered on 24 Sep 2014, 12:41 PM
Hi Martin,

Thank you for the tip on the "Series name".

problem still not solved, the same project if i run in my system still the decrees is not working ! ! !

I do not know the environment contribute or  not but FYI. I am using  MVS Express 2013 for web and my original project is " silverlight " 

I ran your project both in internet explorer and FireFox browsers still decrees is not working for me !! :-(

Regard,
Chinmaya
0
Chinmaya
Top achievements
Rank 1
answered on 24 Sep 2014, 02:28 PM
Hi Martin,

I found out what was the problem for that strange behavior.

I was using  2013 Q3 dll's
now i switched to 2014 Q2 dll's  everything is working fine.

Thank you for the support again :-)

Regards,
Chinmaya 
Tags
ChartView
Asked by
Chinmaya
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Chinmaya
Top achievements
Rank 1
Share this question
or