Well!
I have a stack column chat whose data source databale contains 3 columns.
1 = Patient Id
2 = Patient Bill Amount
3= Patient Name
Right now Column Stack chart is showing patient id as Horizantal and Bill Amount as Vertical and Legends are also showing patient Id. What i want is to show the Patient Name in the Legends instead of its Patient Id. How to achieve this any idea or help woul be appreciated.
Thanks in Advance.
Any time you need to display labels that aren't included in the chart's binding (when the chart can only use one label column) you need to implement IRenderLabel interface to create custom labels. Take a look at this post:http://forums.infragistics.com/forums/p/8472/35220.aspx#35220In that sample code, replace myChart.Tooltips.FormatString = "<CUSTOM>"with myChart.Legend.FormatString = "<CUSTOM>" and you will have a custom laber renderer for the legend items.
Which event handler do you override? I need to have custom labels for my ultrachart legend.
When I put the logic in the page load I get row = 1 and col=1 every time.
e) { Hashtable labelHash = new Hashtable(); labelHash.Add(
{
Hashtable labelHash = new Hashtable();
labelHash.Add(
, new MyLabelRenderer()); UltraChart1.LabelHash = labelHash; this.UltraChart1.Legend.FormatString =
UltraChart1.LabelHash = labelHash;
this.UltraChart1.Legend.FormatString =
;
You only need to create a class that implements IRenderLabel and has a public string ToString(Hashtable context) method. ToString will automatically be called each time a legend label is about to be displayed. The code that you have provided does indeed need to be in page load. Though, i'm not sure which chart type you're using and what kind of data you have, I tried a simple column chart, and I do get different DataColumn value for each legend item. Check context["DATA_COLUMN"] to see if you get different column values.
public class LabelRenderer : IRenderLabel{ public string ToString(Hashtable context) { return context["DATA_COLUMN"].ToString(); }}