Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Chart > Name xaxis labels within my series

Not answered Name xaxis labels within my series

Feed from this thread
  • David avatar

    Posted on Feb 3, 2012 (permalink)

    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?

    Reply

  • Evgenia Evgenia admin's avatar

    Posted on Feb 8, 2012 (permalink)

    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 >>

    Reply

  • David avatar

    Posted on Feb 8, 2012 (permalink)

    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

    Reply

  • Evgenia Evgenia admin's avatar

    Posted on Feb 13, 2012 (permalink)

    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 >>

    Reply

  • David avatar

    Posted on Feb 13, 2012 (permalink)

    Thank you for your response.

    I would really appreciate a sample. Thanks again.

    Reply

  • Evgenia Evgenia admin's avatar

    Posted on Feb 16, 2012 (permalink)

    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 >>
    Attached files

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Chart > Name xaxis labels within my series
Related resources for "Name xaxis labels within my series"

ASP.NET Chart Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]