Programmatically set column labels in HTMLChart

2 posts, 0 answers
  1. Nate
    Nate avatar
    4 posts
    Member since:
    Apr 2014

    Posted 16 Jul 2015 Link to this post

    See Telerik column chart demo here: 

    Notice the labels above each column, such as "25000 sales". Now notice in the declarative code how this label is set:

    <LabelsAppearance DataFormatString="{0} sales" Position="OutsideEnd"></LabelsAppearance>

    I either need to set DataFormatString programmatically, or (better yet) I need to set it to the value of a column in my dataset from sql server. This column's data is not on the chart currently because I ONLY want that column's data used at the label at the top of each column. I can't figure out how to do either. How is it done?

  2. Danail Vasilev
    Danail Vasilev avatar
    1502 posts

    Posted 21 Jul 2015 Link to this post

    Hi Nate,

    You can use the same property and tag names from the markup in the code behind as well.

    If you want, however, to set different values for labels/tooltips I can suggest that you use client templates and data-bind the chart. See an example in this demo -

    Danail Vasilev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top