This is a migrated thread and some comments may be shown as answers.

DataLabelsColumn for numeric values?

1 Answer 67 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 2
Joel asked on 13 Nov 2009, 06:56 PM
Is there a way to establish the datalabelscolumn for a numeric column?

I am returning  3 columns from a stored procedure.  Column 1 is weekname and has values 1-52 in rotating order, the other two are the series data.

DataLabelsColumn is being set in page.load as:

rctrend.PlotArea.XAxis.DataLabelsColumn = "weekname"

 


If from the stored procedure, I do this:  Select [weekname] as weekname
I get 3 series in my chart  and the datalabelscolumn directive is ignored.

If from the stored procedure, I do this:  Select convert(varchar(10),[weekname]) as weekname
or SELECT convert(text, convert(varchar(10),[weekname]) )) as weekname
I get 3 series in my chart and the datalabelscolumn directive is ignored.


If from the stored procedure, I do this:  SELECT 'w ' + convert(varchar(10), [weekname]) as weekname
DataLabelsColumn is respected and I get 2 series.

Whole routine is below:
    Private Sub MakeGraph()  
        If Not IsPostBack Then  
            rctrend.Chart.PlotArea.YAxis.AutoScale = True 
            rctrend.PlotArea.YAxis.AutoScale = True 
            rctrend.PlotArea.YAxis.IsZeroBased = False 
            rctrend.PlotArea.XAxis.DataLabelsColumn = "weekname" 
        End If  
 
        rctrend.ChartTitle.TextBlock.Text = "Something" 
        rctrend.DataSource = gensql.Get52WeekGraph  
        rctrend.DataBind()  
 
        If Not IsPostBack Then  
            rctrend.Series(0).Appearance.ShowLabels = False 
            rctrend.Series(1).Appearance.ShowLabels = False 
        End If  
    End Sub 

1 Answer, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 18 Nov 2009, 12:04 PM
Hi Joel,

In this case you will need to manually specify the ChartSeries you want to bind like this so the control should not guess which of the data fields should be used to create series data:

Dim series As New ChartSeries()
series.DataYColumn = "Value1"
RadChart1.Series.Add(series)
 
Dim series2 As New ChartSeries()
series2.DataYColumn = "Value2"
RadChart1.Series.Add(series2)
 
RadChart1.PlotArea.XAxis.DataLabelsColumn = "weekname"
 
RadChart1.DataSource = gensql.Get52WeekGraph
RadChart1.DataBind()



All the best,
Manuel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Chart (Obsolete)
Asked by
Joel
Top achievements
Rank 2
Answers by
Giuseppe
Telerik team
Share this question
or