Hai
In ultra chart How can I show Tooltip for X,Y Axis Labels? The values need to be shown on mouse over. How can I do this?
Thanks
Sridhar
Sridhar said:Thanks It works fine for Y axis, i need that logic for X axis
in the FillSceneGraph method, add
Axis xAxis = e.Grid["X"] as Axis;
and change the condition
if (t != null && t.bounds.Right < yAxis.startPoint.X)
to
if (t != null && (t.bounds.Right < yAxis.startPoint.X || t.bounds.Top > xAxis.startPoint.Y))
Sridhar said: also and the columns should have FormatString ="<ITEM_LABEL> (<DATA_VALUE:>)"
also and the columns should have
FormatString
="<ITEM_LABEL> (<DATA_VALUE:>)"
change
return context["DATA_VALUE"].ToString();
return context["ITEM_LABEL"].ToString() + " (" + context["DATA_VALUE"].ToString() +")";
Thanks It works fine for Y axis, i need that logic for X axis also and the columns should have
Because I have to show combined tooltips for column values.
today i looked at this more closely and remembered that it's a bit more complicated on the web; you have to add a transparent Box primitive to show the tooltip, implement IRenderLabel, and manipulate a few other things to get it working. but here you go...
protected void Page_Load(object sender, EventArgs e) { this.UltraChart1.Data.DataSource = Infragistics.UltraChart.Data.DemoTable.Table(); this.UltraChart1.Data.DataBind(); this.UltraChart1.FillSceneGraph += new Infragistics.UltraChart.Shared.Events.FillSceneGraphEventHandler(UltraChart1_FillSceneGraph); Hashtable labelRenderers = new Hashtable(); labelRenderers.Add("MY_LABEL", new MyLabelRenderer()); this.UltraChart1.LabelHash = labelRenderers; this.UltraChart1.Tooltips.FormatString = "<MY_LABEL>"; } internal class MyLabelRenderer : IRenderLabel { public string ToString(Hashtable context) { int row = Convert.ToInt32(context["DATA_ROW"]); if (row > 999) { return context["MY_VALUE"].ToString(); } else { return context["DATA_VALUE"].ToString(); } } } void UltraChart1_FillSceneGraph(object sender, FillSceneGraphEventArgs e) { Axis yAxis = e.Grid["Y"] as Axis; if (yAxis == null) { return; } PrimitiveCollection primitivesToAdd = new PrimitiveCollection(); int pointCounter = 0; foreach (Primitive p in e.SceneGraph) { Text t = p as Text; if (t != null && t.bounds.Right < yAxis.startPoint.X) { Box boxToAdd = new Box(t.bounds); boxToAdd.PE.FillOpacity = boxToAdd.PE.StrokeOpacity = 0; boxToAdd.Caps = PCaps.Tooltip | PCaps.HitTest; boxToAdd.Layer = e.ChartCore.GetChartLayer(); boxToAdd.Chart = e.ChartCore.ChartType; boxToAdd.Row = boxToAdd.Column = 1000 + pointCounter++; boxToAdd.Value = double.Parse(t.GetTextString()); boxToAdd.Tags = new Hashtable(); boxToAdd.Tags.Add("MY_VALUE", boxToAdd.Value); primitivesToAdd.Add(boxToAdd); } } e.SceneGraph.AddRange(primitivesToAdd.ToArray()); }
I tried and could not get success for showing values in tooltip on axis. I am using asp.net web application. Can you just tell steps to do? I could not get result by your win application code forums. Remember I just want to show $0, $2000000 etc in tooltip. Please refer the attachment.
question is answered here: http://community.infragistics.com/forums/p/4740/28139.aspx and here: http://community.infragistics.com/forums/p/24452/90134.aspx