Comment définir le texte dans l'axe Y, au lieu de chiffres, dans un composant RadChart de Telerik avec Bar-Type
Question
Je l'ai fait une barre RadChart avec "SeriesOrientation =" horizontal "".
J'ai le texte montrant à la fin pour chaque bar, mais je voudrais que le texte soit listet dans l'axe des y, au lieu du 1,2,3 .. nombres.
Il semble que je permets pas de mettre un texte dans l'axe des y, est-il une propriété que je peux définir?
Voici mon code snippes: === === .ascx
<div>
<asp:ScriptManager ID="ScriptManager" runat="server" />
<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>
</div>
=========================
=== .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();
}
============ Je veux avoir le texte:. "Product1", "Product2", etc dans l'axe y
Quelqu'un peut-il aider?
La solution
Vous devez lier la carte - définissez la propriété DataSource et appelez DataBind (). Vous ne aurez pas besoin d'appeler chartSeries.AddItem (). DataBind () ajoutera les éléments pour vous. La source de données peut être un DataTable avec deux colonnes - « UnitPrice » et « TenMostExpensiveProducts ». Voir, ce sont les noms que vous définissez à DataYColumn dans la série et DataLabelsColumn dans XAxis.