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

Need to change Bar series Color

1 Answer 48 Views
Chart
This is a migrated thread and some comments may be shown as answers.
kanna
Top achievements
Rank 1
kanna asked on 07 Sep 2012, 07:21 AM
Hi,

I am using RadChart control for Silverlight.When i am creating Bar Series it is showing with the same color. I need to change each item with separate color. Please find My Xaml and C# code.
Please help me to resolve the issue.

Regards,
Kannan S
<telerik:RadChart x:Name="radChart" telerik:StyleManager.Theme="Windows7"><br>            <telerik:RadChart.SeriesMappings><br>                <telerik:SeriesMapping><br>                    <telerik:SeriesMapping.SeriesDefinition><br>                        <telerik:BarSeriesDefinition/><br>                    </telerik:SeriesMapping.SeriesDefinition><br>                    <telerik:SeriesMapping.ItemMappings><br>                        <telerik:ItemMapping DataPointMember="YValue" FieldName="Val"/><br>                        <telerik:ItemMapping DataPointMember="Label" FieldName="LabelString"/><br>                    </telerik:SeriesMapping.ItemMappings><br>                </telerik:SeriesMapping><br>            </telerik:RadChart.SeriesMappings><br>        </telerik:RadChart>
public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            var list = new List<SomeInfo>();
            Random r = new Random();
            list.Add(new SomeInfo() { Val = 1, LabelString = "Item 1" });
            list.Add(new SomeInfo() { Val = 2, LabelString = "Item 2" });
            list.Add(new SomeInfo() { Val = r.Next(0, 10), LabelString = "Item 3" });
            list.Add(new SomeInfo() { Val = r.Next(0, 10), LabelString = "Item 4" });
            list.Add(new SomeInfo() { Val = r.Next(0, 10), LabelString = "Item 5" });
            list.Add(new SomeInfo() { Val = r.Next(0, 10), LabelString = "Item 6" });
            list.Add(new SomeInfo() { Val = r.Next(0, 10), LabelString = "Item 7" });
            list.Add(new SomeInfo() { Val = r.Next(0, 10), LabelString = "Item 8" });
            list.Add(new SomeInfo() { Val = r.Next(0, 10), LabelString = "Item 9" });
 
 
            radChart.ItemsSource = list;
        }
    }
 
    public class SomeInfo
    {
        public int Val { get; set; }
        public string LabelString { get; set; }
 
    }

1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 10 Sep 2012, 10:43 AM
Hi Kanna,

You need to set the LegendDisplayMode to DataPointLabel:
<telerik:BarSeriesDefinition LegendDisplayMode="DataPointLabel" />

Kind regards,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Chart
Asked by
kanna
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or