custom label in bar series

8 posts, 0 answers
  1. Kevin Tran
    Kevin Tran avatar
    40 posts
    Member since:
    Apr 2010

    Posted 01 Sep 2010 Link to this post

    HI Support,

    I used  a stacked chart with series mappings, Everything working fine, which is great now Only thing i want is i want to display custom label for each series, With item label true i am able to show the value of that particular series , in addition to that i need to display a label for each group,How can i achieve that.

    Tx.
  2. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 03 Sep 2010 Link to this post

    Hello Kevin Tran,

    There are two ways you can get closer to your desired scenario:
    1) Using categorical charts - http://www.telerik.com/help/silverlight/radchart-features-categorical-charts.html but the labels will be shown along the X-Axis.
    2) Try using customized labels by specifying label formats as shown here - http://www.telerik.com/help/silverlight/radchart-features-format-expressions.html

    All the best,
    Evgenia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Kevin Tran
    Kevin Tran avatar
    40 posts
    Member since:
    Apr 2010

    Posted 06 Sep 2010 Link to this post

    Hi Support,
    Thanks for the reply, I am getting labels but what i need is for every segment i have to put a different label,In my second attachment i mentioned how i need those labels. One more question how to assign value for depedencyproperty:Content Property

    Thanks,
  5. Kevin Tran
    Kevin Tran avatar
    40 posts
    Member since:
    Apr 2010

    Posted 07 Sep 2010 Link to this post

    Hi,
    Any help
  6. Kevin Tran
    Kevin Tran avatar
    40 posts
    Member since:
    Apr 2010

    Posted 08 Sep 2010 Link to this post

    HI Support

    here is my code i used to chnage colors for individual bars

    private Style CreateItemStyle(Control control, Style baseStyle, DataPoint dataPoint, DataSeries dataSeries)
        {
            // Do not change the style of the legend item
            if (control is ChartLegendItem)
                return baseStyle;
     
            if (dataPoint == null)
                return baseStyle;
            //dataPoint
            // Create a new style, do not use the one that is provided as parameter.
            Style newStyle = new Style(baseStyle.TargetType);
            newStyle.BasedOn = baseStyle;
            Brush brush = null;
            Brush Foregroundbrush = null;
            if (control is BaseChartItem2D)
            {
                 
                if (dataPoint.XCategory.ToString() == "Pipeline")
                {
                    if (temp == 0)
                    {
                        brush = new SolidColorBrush(Colors.Transparent);
                    }
                    else if (temp == 1)
                    {
                        //brush = new SolidColorBrush(Color.FromArgb(255, 0, 126, 0));
                        brush = new SolidColorBrush(Colors.Magenta);
                    }
                    else if (temp == 2)
                    {
                        //brush = new SolidColorBrush(Color.FromArgb(255, 130, 149, 33));
                        brush = new SolidColorBrush(Colors.Red);
                    }
                    temp++;
                }
                newStyle.Setters.Add(new Setter(Shape.FillProperty, brush));
                //newStyle.Setters.Add(new Setter(Shape.StyleProperty ,CustomStyle1));
            }
            string strLabel = "";
            if (control is SeriesItemLabel)
            {
     
               if (dataPoint.XCategory.ToString() == "Pipeline")
                {
                    if (temp1 == 0)
                    {
                        Foregroundbrush = new SolidColorBrush(Colors.Blue);
                    }
                    else if (temp1 == 1)
                    {
                        Foregroundbrush = new SolidColorBrush(Colors.Blue);
                    }
                    temp1++;
                }
                newStyle.Setters.Add(new Setter(SeriesItemLabel.ForegroundProperty, Foregroundbrush));
                newStyle.Setters.Add(new Setter(SeriesItemLabel.ContentProperty, strLabel));
            }
            if (control is SeriesItemLabel)
            {
                newStyle.Setters.Add(new Setter(SeriesItemLabel.FillProperty, brush));
            }
            return newStyle;
        }

    here is the code block to call this delegate
    RadChart1.CreateItemStyleDelegate = CreateItemStyle;

    So i am able to set color property but i am not able to do same with the content property

    Thanks
  7. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 08 Sep 2010 Link to this post

    Hi Kevin Tran,

    This delegate is OK to be used for styling individual bars labels. To be able to give each label new content try the ItemDataBound event and set e.DataPoint.Label as per your requirements.

    All the best,
    Evgenia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. safeer
    safeer avatar
    14 posts
    Member since:
    Nov 2006

    Posted 13 Sep 2010 Link to this post

    Hi,
    I want to create a Waterfall chart by using your controls. Could you please let me how can I do that?
    Thanks
  9. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 15 Sep 2010 Link to this post

    Hi safeer,

    Unfortunately current version of RadChart does not provide Waterfall chart officially. We'll consider this in our future releases. Meanwhile, you can check the implementation shared by Alexey Oyun in the other thread where you posted your question.

    All the best,
    Evgenia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner