DataLabelsColumn for numeric values?

Thread is closed for posting
2 posts, 0 answers
  1. Joel
    Joel avatar
    166 posts
    Member since:
    Oct 2006

    Posted 13 Nov 2009 Link to this post

    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 
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 18 Nov 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top