Hello,
1) I want to show tooltips for labels which are on the X and Y axis. For custom chart the solution with creating CustomTooltips class worked fine
public class CustomTooltips : IRenderLabel { string _tooltip = String.Empty;
public string Tooltip { get { return _tooltip; } set { _tooltip = value; } }
#region IRenderLabel Members
public string ToString(System.Collections.Hashtable context) { if (!_tooltip.Equals(String.Empty)) { return _tooltip; } if (!context["SERIES_LABEL"].ToString().Equals(String.Empty)) { return context["DATA_VALUE"].ToString(); }
return context["ITEM_LABEL"].ToString(); }
#endregion }
than Mouse move event looks like this
private void ultraChart1_MouseMove(object sender, MouseEventArgs e) { ChartLayerCollection layers = ultraChart1.CompositeChart.ChartLayers; foreach (ChartLayerAppearance layer in layers) { bool success = false; if (layer.ChartLayer != null) { var text = layer.ChartLayer.ChartCore.GetChartPrimitiveFromPoint(e.Location) as Text; if (text != null) { labels.Tooltip = text.GetTextString(); success = true; } } if (!success) { labels.Tooltip = String.Empty; } } }
but now I am trying to do the same for bar chart like this
private void ultraBarChart_MouseMove(object sender, MouseEventArgs e) { ChartLayerCollection layers = new ChartLayerCollection(); layers.Add(barChart.BarChart.ChartComponent);
but I can't figure out what to add to "layers" collection.
Can you help me out?
The same question regarding TimeSeries chart.
2) The other question is when I apply this solution in composite chart which consist of column and line chart, the tooltips on line chart originally were showing Y axis values (which was good for me), after solution the show X axis values. How can I take back Y axis values?
Thanks
Hello Oleksandr,
Thank you for contacting Infragistics!
I recommend you see the following documentation and sample:
http://help.infragistics.com/doc/ASPNET/2014.2/CLR4.0/?page=Chart_Customize_Chart_ToolTips.html
http://ko.infragistics.com/samples/aspnet/chart/adding-tooltips-to-a-chart
As you can see there are a couple presets that display with data and or label. Then you can customize if you like:
this.UltraChart1.Tooltips.Format = TooltipStyle.Custom; this.UltraChart1.Tooltips.FormatString = "My Data: <DATA_VALUE:$#0.00>";
Please let me know if you have any further questions concerning this matter.
Hello
The second issue resolved, thanks. But the first question was about showing tooltips for labels on X an Y axis. For example when I get mouse over one of the labels (not on columns) on X or Y axis it will show the tooltip for this label. Dimitar helped me with this for composite chart, now I just want to apply this for BarChart and TimeSeries chart.
Thanks!
I recommend you read the following forum thread. If you look at David’s posts you can see he has some additional links and also goes over with a code example:
http://ko.infragistics.com/community/forums/p/30045/165536.aspx#165536
the http://ko.infragistics.com/community/forums/p/30045/165536.aspx#165536 post is regarding Web charts, and I can't get it work. I have also looked at this post http://ko.infragistics.com/community/forums/p/4740/28139.aspx but when I get mouse over Y axis labels I see a value of bar(despite that for FormatString = "<ITEM_LABEL>"), not the label itself, and if I get mouse over X axis labels I see the same value (value of the first bar).
What I need is just to adjust the solution that I described originaly in my post just to TimeSeriesChart and BarChart.
If you could provide me with the code sample it would be very appreciated.
I have gone through David’s post and found a sample he attached at the end. I have modified it to use a later version of the chart controls. And changed the type to bar. As you can see it creates tooltips for the x and y axis labels. The value set to the tooltips is boxToAdd.Value in the UltraChart1_FillSceneGraph method/event. I am attaching the sample.
As for your currently method why are you changing it to add to the layers in the mouse move when you were not doing this previously in your version that worked? Where did you obtain your original code?
This type of tooltip is not supported by UltraChart. I recommend submitting this as a product idea.You can suggest new product ideas for future versions (or vote for existing ones) at http://ideas.infragistics.com.
There are many benefits to submitting a product idea:
- Direct communication with our product management team regarding your product idea.- Notifications whenever new information regarding your idea becomes available.- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.- Allow you to shape the future of our products by requesting new controls and products altogether.- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea: 1. Log into the Infragistics Product Idea site at http://ideas.infragistics.com (creating a new login if needed).2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)3. Add your product idea and be sure to be specific and provide as much detail as possible. • Explain the context in which a feature would be used, why it is needed, why it can’t be accomplished today, and who would benefit from it. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. Be convincing!• Include a link to this thread in your idea so product management will be able to look back at this case.
The Product Idea site puts you in the driver’s seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Thank you for contacting Infragistics.
Hello again Mike,
I think you misunderstood me, I have WinForms application not Web. I have tryied to put the code you sent me in my solution and it didn't work. Can you please attach WinForm solution from VS 2010 ?