Line chart: General tooltips incorrect when line is autosampled (16.8.8.12)


https://www.nevron.com/Forum/Topic11949.aspx
Print Topic | Close Window

By Kevin Harrison - 8 Years Ago
Hi
I'm creating line series and using line.SamplingMode = SeriesSamplingMode.Auto
I set individual point tooltips for up to 2048 points using InteractivityStyles.Add for each point
This all works fine.. However, for performance I set a generic tooltip for more than 2048 points, using:
nevronSeries.InteractivityStyle = new NInteractivityStyle( 
string.Format( CultureInfo.CurrentCulture, "{0}: <xvalue>{2}{1}: <value>",  xTitle,   YTitle, Environment.NewLine));
However, all tooltips display 0 for <xvalue> and <value> when the line is sampled.
The tooltips are correct if I don't set a SamplingMode.
Is this a bug?
- On a separate note, is there a way for me to supply a tooltip dynamically when the mouse is hovered over a point rather than supplying all tooltips upfront? It's very wasteful of resources!

Thanks

Kevin
By Nevron Support - 8 Years Ago
Hi Kevin,

This is by design - when in sampled mode the chart does not record individual information for hit testing purposes on a per data point basis. This is done to improve performance. You can overcome the problem by getting the nearest data point and displaying relevant information in a tooltip for it. We have also modified the tooltip tool to have an public virtual method called GetTooltipFromPoint which you'll have to override and return a tooltip based on the currently hit tested mouse position. We'll publish a SP about this today or tomorrow. Hope this helps - let us know if you have any questions.
By Kevin Harrison - 8 Years Ago
Hi guys

That sounds really useful. We'd already discovered GetTooltipFromPoint wasn't virtual. The next question is how do I get the nearest data point as GetTooltipFromPoint gives me the mouse location and it sounds like I can't use NHitTestResult.DataPointIndex?

Thanks

Kevin