How to set text in Y-axis, instead of numbers, in a RadChart component from Telerik with Bar-type
Posted
by radbyx
on Stack Overflow
See other posts from Stack Overflow
or by radbyx
Published on 2010-05-25T07:39:51Z
Indexed on
2010/05/25
7:41 UTC
Read the original article
Hit count: 1250
Hi, I have made an bar RadChart with "SeriesOrientation="Horizontal"".
I have the text showing at the end for each bars, but instead I would like that text to be listet in the y-axis, instead of the 1,2,3.. numbers.
It seems like i'm not allow to set any text in the y-axis, is there a property I can set?
Here is my code snippes: === .ascx ===
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<telerik:RadChart ID="RadChart1" runat="server"
Skin="WebBlue" AutoLayout="true" Height="350px" Width="680px" SeriesOrientation="Horizontal">
<Series>
<telerik:ChartSeries DataYColumn="UnitPrice" Name="Product Unit Price">
</telerik:ChartSeries>
</Series>
<PlotArea>
<YAxis>
<Appearance>
<TextAppearance TextProperties-Font="Verdana, 8.25pt, style=Bold" />
</Appearance>
</YAxis>
<XAxis DataLabelsColumn="TenMostExpensiveProducts">
</XAxis>
</PlotArea>
<ChartTitle>
<TextBlock Text="Ten Most Expensive Products" />
</ChartTitle>
</telerik:RadChart>
</ContentTemplate>
</asp:UpdatePanel>
=========================
=== .ascx === protected void Page_Load(object sender, EventArgs e) { RadChart1.AutoLayout = false; RadChart1.Legend.Visible = false;
// Create a ChartSeries and assign its name and chart type
ChartSeries chartSeries = new ChartSeries();
chartSeries.Name = "Name";
chartSeries.Type = ChartSeriesType.Bar;
// add new items to the series,
// passing a value and a label string
chartSeries.AddItem(98, "Product1");
chartSeries.AddItem(95, "Product2");
chartSeries.AddItem(100, "Product3");
chartSeries.AddItem(75, "Product4");
chartSeries.AddItem(1, "Product5");
// add the series to the RadChart Series collection
RadChart1.Series.Add(chartSeries);
// add the RadChart to the page.
// this.Page.Controls.Add(RadChart1);
// RadChart1.Series[0].Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.Nothing;
// RadChart1.Series[0].DataYColumn = "Uptime";
RadChart1.PlotArea.XAxis.DataLabelsColumn = "Name";
RadChart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Verdana", 8);
RadChart1.BackColor = System.Drawing.Color.White;
RadChart1.Height = 350;
RadChart1.Width = 570;
RadChart1.DataBind();
}
I want to have the text: "Product1", "Product2", ect in the y-axis, can anyone help? Thx.
© Stack Overflow or respective owner