Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Chart > XAxis name
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered XAxis name

Feed from this thread
  • kiran gowda avatar

    Posted on Apr 11, 2011 (permalink)

    Dear all,

    how can i show a state name in the XAxis, for example let say i am using the chart for population count,
    i need to show the state name on the Xaxis and on the yAxis the graph is shown. 

    on ASP.Net control i can use this:
    "<asp:Series Name="Series1" XValueMember="sname" YValueMembers="Column1"  ChartType="Column">
                        
                    </asp:Series>
               "

    XValueMember="sname" is the state name.

    Thanks.

  • Evgenia Evgenia admin's avatar

    Posted on Apr 14, 2011 (permalink)

    Hi kiran,

    There are two ways to set Labels for the XAxis:

    1. You can bind them using the XAxis.DataLabelsColumn property. This code sample shows how to bind
    RadChart to DataTable and set the "Name" Column of the DataTable as XAxis DataLabelsColumn:

    DataTable table = new DataTable();
           table.Columns.Add(new DataColumn("Name", typeof(string)));
           table.Columns.Add(new DataColumn("Value", typeof(int)));
           table.Rows.Add(new object[] { "A", 10});
           table.Rows.Add(new object[] { "B", 20 });
           table.Rows.Add(new object[] { "C", 30 });
           ChartSeries chartSeries1 = new ChartSeries();
           chartSeries1.DataYColumn = "Value";
           chartSeries1.DefaultLabelValue = "#Y%";
           chartSeries1.Type = Telerik.Charting.ChartSeriesType.Bar;
           RadChart1.AddChartSeries(chartSeries1);
           RadChart1.PlotArea.XAxis.DataLabelsColumn = "Name";
           RadChart1.DataSource = table;
           RadChart1.DataBind();

    2. You can set the Axis labels Programmatically as shown in this help article.

    Regards,
    Evgenia
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Chart > XAxis name