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

Change Series Color & Legend Position

1 Answer 257 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Praveen Rustagi
Top achievements
Rank 1
Praveen Rustagi asked on 10 Oct 2009, 11:35 AM

Dear Sir/Madam,

I am adding series programmatically. I want to give "Red" color to first series & "Green" to second. and Series should display on top of chart.like

1. Series_1      2. series_2  3. Series_3

code to add series is as follows:

// dtSource.Rows.Clear();

chart.ChartTitle.TextBlock.Text =

"Report Summary";

 

crtSeries =

new ChartSeries("Total");

 

chart.AddChartSeries(crtSeries);

crtSeries.Type =

ChartSeriesType.Bar;

 

 

//crtSeries.Appearance.FillStyle.MainColor = System.Drawing.Color.Red;

 

 

//crtSeries.Appearance.FillStyle.SecondColor = System.Drawing.Color.Red;

 

crtSeries.Appearance.LabelAppearance.LabelLocation = Telerik.Charting.Styles.

StyleSeriesItemLabel.ItemLabelLocation.Auto;

 

crtSeries =

new ChartSeries("Pending");

 

chart.AddChartSeries(crtSeries);

crtSeries.Type =

ChartSeriesType.Bar;

 

 

//crtSeries.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;

 

 

//crtSeries.Appearance.FillStyle.SecondColor = System.Drawing.Color.Green;

 

crtSeries.Appearance.LabelAppearance.LabelLocation = Telerik.Charting.Styles.

StyleSeriesItemLabel.ItemLabelLocation.Auto;


please resolve ASAP..

 

1 Answer, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 13 Oct 2009, 04:36 PM
To give a series a color use the following code:
 
mySeries.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;  
mySeries.Appearance.FillStyle.MainColor = Color.Orchid;  

And then to display your legend at the top of the chart you should use:
 
RadChart1.Legend.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Top;  

If you want to add color to the font of the legend items you can do:
 
RadChart1.Legend.Items[0].TextBlock.Appearance.TextProperties.Font = new System.Drawing.Font("Arial", 15);  
RadChart1.Legend.Items[0].TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.DarkGreen;  

Tags
Chart (Obsolete)
Asked by
Praveen Rustagi
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Share this question
or