Hi,
I have a composite chart with 1 area and 3 layers on it. One layer has stack column chart, two layers have line charts. I would like to set custom tooltips separately for each layer. I wrote my own IRenderLabel classes, set them as renderers for custom format strings, created the hashtable from it. I set also the appropriate format strings on the layers (I did it in designer : Chart Layer->Chart Type Appearance->Chart Text->ItemFormatString), but it doesn't work.
Is there any way to solve this problem? Thanks in advance
thanks ! .. but thn am not very clear about how to associate tat particular data item over event handler with the ultra chart.. how do i do tat
?
Hi ahsin,
It's my chart_dataitemover event handler.
int oldLayerIndex = layerIndex; if (e.LayerID == "Layer One") layerIndex = 0; else if (e.LayerID == "Layer Two") layerIndex = 1; else if (e.LayerID == "Layer Three") layerIndex = 2; if (oldLayerIndex != layerIndex) CustomizeLabels(layerIndex);
I have a variable "layerIndex", which is stored in the form. I change it every time, when this event is called. If it's different from the old layer index, I customize the labels for the chart.
private void CustomizeLabels(int layerIndex) { chart.Tooltips.Format = TooltipStyle.Custom; chart.Tooltips.FormatString = "<TOOLTIP>"; Hashtable tooltips = new Hashtable(); tooltips.Add("TOOLTIP", new IRenderLabelClass(layerIndex)); chart.LabelHash = tooltips; }
And the result of ToString() method in IRenderLabelClass depends on layerIndex value.
Regards:)
Hi, can u please post the code u used for the charts dataitem over event ..it would be of great help to me..
Thanks for help, I use the DataItemOver event to obtain the layer index, and I call my IRenderLabel class every time in this event, when the layer index has changed. It works fine.
i'm not sure how to get this information from the context of IRenderLabel. maybe you could try handling the chart's DataItemOver event and storing e.Primitive.Layer in there, so you know when IRenderLabel gets called for the tooltip, you can check to see the Layer of the last primitive that was hovered over.