This is a migrated thread and some comments may be shown as answers.

Custom tooltip for chart, returns tooltip's DataPoints.DataItem as null

1 Answer 46 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 1
Edward asked on 01 Dec 2011, 02:47 AM
    When using the event which allows you to custom the tooltips for a bar\line chart. The DataItem that is passed to the event is returned as null. This only happens when you have alot of points to display in a small area. But if you have less pionts to display, the dataitem object contents the data for the piont that was rollover, allowing you to custom the tooltip. 

So, is there is property which I can be set that allows you to custom the tooltip, even when their is alot of pionts in a small area.

One thing interesting is, when Dataitem is null the tooltip is just the default one that the points was bind too.

Any help would be appreciated.

Best Regards,
Jeramie

1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 05 Dec 2011, 03:11 PM
Hello Edward,

When working with a huge number of data items (in the ItemsSource) the RadChart offers a feature called Sampling. To avoid unclear visual representation, and to improve performance, the chart combines several data items into a single data point.

For instance - if you have 1000 items in your items source - only 200 data points will be visualized (that is 200 bars, if you use bar series). That means that each data point contains information for 5 data items.

This is why the DataItem that is passed is null. 

You can set how many data points to be visualized by setting the SamplingThreshold property (by default it is 200).

In your case you might need to fully disable Sampling by setting SamplingThreshold  to "0".
<telerik:RadChart x:Name="radChart">
 <telerik:RadChart.SamplingSettings>
  <telerik:SamplingSettings SamplingThreshold="0" />

You can read about Sampling here where you can also get information about Custom Sampling Functions which are very helpful to use in some scenarios where disabling Sampling will have a negative impact on the performance.

I hope this helps. 

Kind regards,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Chart
Asked by
Edward
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or