Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Chart > Add Label/Text to ChartSeriesItem into RadChart
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 Add Label/Text to ChartSeriesItem into RadChart

Feed from this thread
  • mbro87 avatar

    Posted on Apr 8, 2011 (permalink)

    Hello, I want to add Label or Text to ChartSeriesItem into RadChart and display it instead of "YValue" field.
    This is my C# code:

    if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        ChartSeriesItem chartItem = new ChartSeriesItem();
                        chartSeries.AddItem(chartItem);

                        // "Y".
                        chartItem.YValue = Convert.ToInt32(row["StartStatus"]) / 60;
                        chartItem.YValue2 = Convert.ToInt32(row["DeltaStatus"]) / 60;

                        chartItem.Name = <-- this property doesn't work!
                    }
                }

    Thanks

  • Evgenia Evgenia admin's avatar

    Posted on Apr 13, 2011 (permalink)

    Hello Michele,

    To be able to set custom Label for Series Item you should use the Label.TextBlock.Text property like this:
    ChartSeries chartSeries1 = new ChartSeries();
         ChartSeriesItem chartItem = new ChartSeriesItem();
         chartItem.YValue = 9;
         chartItem.Label.TextBlock.Text = "MyCustomLabel";
         chartSeries1.AddItem(chartItem);
         RadChart1.AddChartSeries(chartSeries1);

    The chartItem.Name property can be used to set Legend Name for this SeriesItem which will be visible when the LegendDisplayMode property of the chart Serie is set to ItemLabels:
    chartSeries1.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;

    Kind 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 > Add Label/Text to ChartSeriesItem into RadChart