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

Name xaxis labels within my series

5 Answers 49 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 03 Feb 2012, 04:04 PM
ChartSeries objSeriesActual = new ChartSeries("Actual", ChartSeriesType.Bar);
foreach (FinanceData objFinanceData in actualFinanceDataList)
{
    objSeriesActual.AddItem(objFinanceData.Revenue, objFinanceData.Revenue.ToString());
}
 
 
ChartSeries objSeriesBudget = new ChartSeries("Budget", ChartSeriesType.Bar);
foreach (FinanceData objFinanceData in budgetFinanceDataList)
{
    objSeriesBudget.AddItem(objFinanceData.Revenue, objFinanceData.Revenue.ToString());
}
 
 
revenueFinanceChart.Series.Add(objSeriesActual);
revenueFinanceChart.Series.Add(objSeriesBudget);
revenueFinanceChart.DataBind();

Dear Telerik,

I have made a chart that displays two series of actual and budget finance data for some companies. I would like to now replace the xaxis labels 1, 2, 3 etc underneath the bars with the name of the companies. I want this to be picked up from the financedata lists such as
using objSeriesActual.PlotArea.XAxis.AxisLabel.TextBlock.Text = objFinanceData.Name but this does not work; reference to object not found.
How can I accomplish this?

5 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 08 Feb 2012, 09:22 AM
Hello David,

You can review this help topic where it is shown how to bind the Axis Labels to a property ofyour business object. For the purpose RadChart exposes the DataLabelsColumn property of the XAxis.

Kind regards,
Evgenia
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
David
Top achievements
Rank 1
answered on 08 Feb 2012, 06:45 PM
Thank you for your response.

I am still not able to implement this after reading your link. As you can see by my example I am itterating through actualFinanceDataList  and budgetFinanceDataList and adding the items to the series. So I need to name my xaxis labels at that time right?

Thanks

0
Evgenia
Telerik team
answered on 13 Feb 2012, 03:34 PM
Hello David,

 As reviewing your code snippet again I saw that you are binding the two series to two collections of one and the same business object (FinanceData object). Do you really need this? I suggest that you create two properties in your FinanceData class for each series. Something like RevenueSeries1 and RevenueSeries2. Then you may easily bind the DataLabelsColumn property of the XAxis to a common property of your business object.

Let me know if you need a sample for the described approach.

All the best,
Evgenia
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
David
Top achievements
Rank 1
answered on 13 Feb 2012, 04:08 PM
Thank you for your response.

I would really appreciate a sample. Thanks again.
0
Evgenia
Telerik team
answered on 16 Feb 2012, 02:23 PM
Hi David,

You may find the sample project attached. I hope it helps.

All the best,
Evgenia
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Chart (Obsolete)
Asked by
David
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
David
Top achievements
Rank 1
Share this question
or