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

Adding Series to the chart X items

2 Answers 46 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Rafal
Top achievements
Rank 1
Rafal asked on 10 Jan 2011, 10:59 PM
Hi, Im trying to programatically create a chart.

I hardcode Xaxis values of A, B, C and would like to add series coresponding to each of thsoe a b c values,

Unfortunately it always ends up adding all of the values to only one of the X axis items.


The fallowing code is the exert from my backend object

/radChartObj.PlotArea.XAxis.Items.Add(new ChartAxisItem("C"));

 

 

//radChartObj.PlotArea.XAxis.Items.Add(new ChartAxisItem("B"));

 

 

 

//radChartObj.PlotArea.XAxis.Items.Add(new ChartAxisItem("A"));

 


 

 

foreach (CallCenterStatistics callCenterStatObj in lstCallCenterStats)

 

{

 

chartSeriesObj =

 

new ChartSeries();

 

chartSeriesObj.Type =

 

ChartSeriesType.Bar;

 

chartSeriesObj.Name = lstChars[count] +

 

"-" + callCenterStatObj.Description;

 

chartSeriesObj.AddItem(

 

Convert.ToInt64(callCenterStatObj.Value), callCenterStatObj.Value + " - " + lstChars[count]);

 

 

chartSeriesObj.Items[0].Label.TextBlock.Appearance.TextProperties.Color =

 

Color.White;

 

chartSeriesObj.Items[0].Label.TextBlock.Appearance.TextProperties.Font =

 

new System.Drawing.Font("Arial", 8,FontStyle.Bold);

 

chartSeriesObj.Items[0].Label.TextBlock.Appearance.AutoTextWrap =

 

AutoTextWrap.True;

 

 

chartSeriesObj.Items[0].Label.Appearance.LabelLocation =

 

StyleSeriesItemLabel.ItemLabelLocation.Inside;

 

chartSeriesObj.Items[0].Label.Appearance.Position.AlignedPosition =

 

AlignedPositions.Left;

 

chartSeriesObj.Items[0].Appearance.FillStyle.MainColor =

 

Color.SeaGreen;

 

chartSeriesObj.Items[0].Appearance.FillStyle.FillType =

 

FillType.Solid;

 

 

 

count ++ ;

radChartObj.Series.Add(chartSeriesObj);

Any ideas what im doing wrong with this one?

Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Ves
Telerik team
answered on 13 Jan 2011, 09:31 AM
Hello Rafal,

I can see your code creating several ChartSeries with one item each. RadChart will place the first ChartSeiresItem of every ChartSeries at the first position along the X axis. What you need here is one ChartSeries with 3 (several) ChartSeriesItems in it. This way the second item will appear at the second position along the X axis. If you need them colored individually, you can check this help topic.

Regards,
Ves
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Rafal
Top achievements
Rank 1
answered on 13 Jan 2011, 03:09 PM
Thank You!!
Tags
Chart (Obsolete)
Asked by
Rafal
Top achievements
Rank 1
Answers by
Ves
Telerik team
Rafal
Top achievements
Rank 1
Share this question
or