Как установить текст в оси Y, вместо номеров, в компоненте RadChart из Teleerik с помощью бара

StackOverflow https://stackoverflow.com/questions/2902835

  •  04-10-2019
  •  | 
  •  

Вопрос

Я сделал бар Radchart с "серии" серии "" горизонтальным "".

У меня есть текст, показывающий в конце для каждой панели, но вместо этого я хотел бы, чтобы этот текст был Listet в оси Y вместо 1,2,3 .. Числа.

Похоже, я не позволяю установить какой-либо текст в оси Y, есть ли недвижимость, которую я могу установить?

Вот мой код surppes: === .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();
        }

============ Я хочу иметь текст: «Product1», «Product2» и т. Д. В оси Y.

Кто-нибудь может помочь?

Это было полезно?

Решение

Вам нужно связать диаграмму - установить свойство DataSource и Data Data Data (). Вам не нужно будет звонить chartseries.additem (). Databind () добавит элементы для вас. DataSource может быть DataTable с двумя колоннами - «UnitPrice» и «десяткомиастеквартирныйПродукты». Смотрите, это имена, которые вы устанавливаете CANYOCOLUMN в серии и DatalabelsColumn в Xaxis.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top