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

custom label in bar series

7 Answers 165 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Kevin Tran
Top achievements
Rank 1
Kevin Tran asked on 01 Sep 2010, 03:53 PM
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.

7 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 03 Sep 2010, 04:15 PM
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
0
Kevin Tran
Top achievements
Rank 1
answered on 06 Sep 2010, 07:35 AM
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,
0
Kevin Tran
Top achievements
Rank 1
answered on 07 Sep 2010, 06:59 AM
Hi,
Any help
0
Kevin Tran
Top achievements
Rank 1
answered on 08 Sep 2010, 08:33 AM
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
0
Evgenia
Telerik team
answered on 08 Sep 2010, 04:31 PM
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
0
safeer
Top achievements
Rank 1
answered on 13 Sep 2010, 05:34 PM
Hi,
I want to create a Waterfall chart by using your controls. Could you please let me how can I do that?
Thanks
0
Evgenia
Telerik team
answered on 15 Sep 2010, 02:59 PM
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
Tags
Chart
Asked by
Kevin Tran
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Kevin Tran
Top achievements
Rank 1
safeer
Top achievements
Rank 1
Share this question
or