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

Programmatically set column labels in HTMLChart

1 Answer 87 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Nate
Top achievements
Rank 2
Nate asked on 16 Jul 2015, 12:41 PM

See Telerik column chart demo here:

http://demos.telerik.com/aspnet-ajax/htmlchart/examples/charttypes/columnchart/defaultcs.aspx 

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?

1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 21 Jul 2015, 05:50 AM
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 - http://demos.telerik.com/aspnet-ajax/htmlchart/examples/functionality/clienttemplates/defaultcs.aspx

Regards,
Danail Vasilev
Telerik
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
Tags
Chart (HTML5)
Asked by
Nate
Top achievements
Rank 2
Answers by
Danail Vasilev
Telerik team
Share this question
or