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
ChartText is something completely different from tooltips. Currently, there is no way to set tooltips specifically for one layer, so you will need to come up with a way to make one single IRenderLabel object handle all tooltips from the Tooltips.FormatString
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.
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.
Hi, can u please post the code u used for the charts dataitem over event ..it would be of great help to me..
To do this, you need to create a Composite Chart with 2 ColumnChart layers, each of which uses a different Y-axis.
Want to set two different scales on the same y axis for a column chart
i.e.,
with a minumum range of 0 to a max of 10.. i wanna set 0 - 5 with an interval of 1 and from 5 to 10 wit 2 as the inteval..
any solutions???
Are you sure you're using Infragistics UltraChart for Windows Forms? Is the dll you're using named Infragistics2.Win.UltraWinChart.vX.x.dll ?
i dont find the data item over event handler in the events list of the ultrachart..
any solns?
Let me try to add some more color:
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);
private void CustomizeTooltips(int layerIndex){chart.Tooltips.Format = TooltipStyle.Custom;chart.Tooltips.FormatString = "<TOOLTIP>";Hashtable tooltips = chart.LabelHash;if (tooltips["TOOLTIP"] != null)tooltips.Remove("TOOLTIP");tooltips.Add("TOOLTIP", new RenderTooltip(layerIndex));chart.LabelHash = tooltips;}
{
chart.Tooltips.FormatString = "<TOOLTIP>";
if (tooltips["TOOLTIP"] != null)
chart.LabelHash = tooltips;
}
Create a new class that implements the IRenderLabel interface. In this class you'll need a constructor to store the layer ID you're passing in, and a ToString method that implements the logic you want:
using System;using System.Collections;using System.Text;using Infragistics.UltraChart.Shared.Styles;using Infragistics.UltraChart.Resources;class RenderTooltip : IRenderLabel{private int layerID;public RenderTooltip(int layerID) {this.layerID = layerID; } public string ToString(Hashtable context) { // Add your logic here if (layerID == 0)return context["DATA_VALUE"].ToString(); elsereturn ...; }}
using System;
using System.Collections;
using System.Text;
using Infragistics.UltraChart.Shared.Styles;
using Infragistics.UltraChart.Resources;
class RenderTooltip : IRenderLabel
{ // Add your logic here
if (layerID == 0)
else
Hope that helps! Thanks mtanska for your posts - they got me to the solution I needed!Yash.
Hope that helps!
Thanks mtanska for your posts - they got me to the solution I needed!
Yash.