How to dynamically change the pointSeries PointSize?

6 posts, 0 answers
  1. Chinmaya
    Chinmaya avatar
    24 posts
    Member since:
    Aug 2014

    Posted 22 Sep 2014 Link to this post

    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.
  2. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 23 Sep 2014 Link to this post

    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.
     
  3. DevCraft banner
  4. Chinmaya
    Chinmaya avatar
    24 posts
    Member since:
    Aug 2014

    Posted 23 Sep 2014 in reply to Martin Link to this post

    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?

  5. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 24 Sep 2014 Link to this post

    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.
     
  6. Chinmaya
    Chinmaya avatar
    24 posts
    Member since:
    Aug 2014

    Posted 24 Sep 2014 in reply to Martin Link to this post

    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
  7. Chinmaya
    Chinmaya avatar
    24 posts
    Member since:
    Aug 2014

    Posted 24 Sep 2014 in reply to Chinmaya Link to this post

    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 
Back to Top
DevCraft banner