Profile Picture

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

Posted By Kevin Harrison 8 Years Ago

Line chart: General tooltips incorrect when line is autosampled...

Author
Message
Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:38 AM
Posts: 3,054, Visits: 4,006
Hi Kevin,
Just a short note that we published a SP that exposes the GetTooltipFromPoint method. Regarding the closest value - if you wish to search the closest value in just one particular dimension (for example closest x value) you can use the FindClosestValue method of the respective series:

int closestDataPointIndex = someSeries.XValues.FindClosestValue(someValue, false); // second argument specifies whether the series is ordered

Otherwise you need to perform the following:
1.Convert the view coordinate to scale coordinate.
2. Loop through the data points and find the closest data point.

Hope this helps - let us know if you meet any problems.


Best Regards,
Nevron Support Team



Kevin Harrison
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 176, Visits: 1,865
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

Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:38 AM
Posts: 3,054, Visits: 4,006
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.


Best Regards,
Nevron Support Team



Kevin Harrison
Question Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 176, Visits: 1,865
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




Similar Topics


Reading This Topic