Chart visual states

2 posts, 0 answers
  1. Tonchi91
    Tonchi91 avatar
    2 posts
    Member since:
    May 2014

    Posted 22 Mar 2015 Link to this post

    Hello,

    I am having problems with refreshing Visual state of the Pie Chart.
    When I set two values for Pie Chart, I still have the same look, no matter what values I enter from the C# code.

    I can only change visual state by changing values from XAML.
    My question is, how can I change the visual state by C# code? For example I have green and silver colors for values, and if my First value is 8, and second is 0, Pie Chart should be filled all by green color.

    Default values are:
    <telerikCharting:PieDataPoint Value="50"/>
    <telerikCharting:PieDataPoint Value="50"/>


    I am changing values from C# code like this:
    PieSeries pieSeries = new PieSeries();
    pieSeries.DataPoints.Insert(0, new PieDataPoint() { Value = value1});
    pieSeries.DataPoints.Insert(1, new PieDataPoint() { Value = value2});
                             
    radPieChart3.Series.Add(pieSeries);


  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 25 Mar 2015 Link to this post

    Hi Antonio,

    The update should happen automatically with no additional code. The code you have provided looks good to me and I do not expect any issues with it, given that you remove the series before adding a new one. Alternatively, you can clear the datapoints and keep the same series. Please, find attached a small example.

    Best regards,
    Ves
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. DevCraft banner
Back to Top