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

Chart not showing all data.

3 Answers 158 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Imran Javed Zia
Top achievements
Rank 1
Imran Javed Zia asked on 02 Dec 2011, 01:50 PM
Hi,

We have a line chart which shows about 4000 data values, with Date in X-axis and Decimal values in Y axis. We have encountered the issue that chart does not shows all the values particularly ending values.
For this purpose, we enabled Zooming on the chart and found that in normal chart is not showing last 100 values, but when we enabled the sampling too at 400 then we found in normal we are missing last 6 values at the end of line.

for more details, i have attached the image of chart in both states, with no zoom and zoomed to 10%. Can you help us to fix this issue.

Thanks

3 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 07 Dec 2011, 12:49 PM
Hi Imran,

Thank you for the attachments and explanations.

Our chart offers a feature called Sampling. To improve performance and to avoid unclear visual representation when dealing with a huge number of items (in the ItemsSource) the chart combines (clusters) some data items into a single data point. For example - If you have 4000 data items in your items source - only 200 data points will be visualized (200 is the default, but you can control this number). This means that if you used bar series - only 200 bars will be shown, each bar corresponding to one data point, and this data point contains the information for 20 data items. The values for the X and Y in this data point are somehow summarized (by default it is the Average, but you can control this too).

Now, in the snapshot you have attached - the chart on the left shows information for 4000 data items, but it only visualizes 400 data points (you said you have set it to 400). Each data point holds average information for 10 data items. This means that if the X values in these data items range from the 13th day to the 23rd day of the same month and year - an average estimate will be held in the data point - the 18th day of that month and year.

And this is why when not zoomed in the tooltip shows 13 and when you zoom in it shows the actual 19. In other words - data is not missing from the chart but it is "averaged".

I am not familiar with your scenario and I can't make any suggestions for you but here are a couple of things that you can consider.
1. Simply not show a date in the tool tip.
2. Create a custom sampling function. Custom Sampling Functions can be very helpful in situations where you do not want to disable the Sampling feature (I have left a link below)
3. Fully disable sampling. This way no clustering will be done and no average values will be passed and shown - only the actual data. But keep in mind that this will slow performance and might make things a bit unclear.

Please read about Data Sampling ad Custom Sampling Functions here.

You might also be interested in using format expressions for your tooltips, as many things can be achieved in XAML.

I hope this helps.

Best wishes,
Petar Marchev
the Telerik team

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

0
Imran Javed Zia
Top achievements
Rank 1
answered on 07 Dec 2011, 01:55 PM
Hi Petar,

Thanks for the information and suggestions, we are trying to identify if any work around is suitable for us or not. You are right about disabling the sampling resolves the data missing issue, but it is causing a serious performance issue as you told, on local machine, with about 4000 point, no zoom applied and sampling 0 it is taking about 12 seconds to draw the chart, on the other hand with same settings and default sampling settings it is just loaded in 1 second.

I have asked client for suitable sampling method, but I don't think that we may be able to use some sampling method. and this low performance on disabled sampling will not be acceptable too.


Please assist us further in the following:

First of all, We are thinking to provide daily/weekly/monthly/quaterly options to view the data so that user may get lower number of data points particularly monthly/quaterly view. Is there any way to force sampling on particular datesn(like weekend, month end and so on) or we have to rearange our data manually?

Secondly, we have noticed that tolltip does not shown correct value on last point, instead of last point value it shows previous point values.

Thanks
0
Petar Marchev
Telerik team
answered on 12 Dec 2011, 09:06 AM
Hi Imran,

I am glad that my explanations were of help to you.

If I understand your first question correctly - no, you can not specify how the sampling function would gather and pass the data items to a data point. The sampling mechanism simply divides 4000 / 400 = 10 and each data point is being passed 10 data items.

You can, however, do the data sampling yourself (as you suggested, restructure/rearrange the data manually) and then pass it to the chart, and not take advantage of the built-in feature. 

For now I can suggest that you simply show in your tool tips a date range. What I mean is, instead of showing a single date "15 Nov 2011" show the actual range "[10 Nov 2011 - 20 Nov 2011]". This can be achieved with the previously pointed Custom Sampling Functions.

I have attached a runnable project and a snapshot to demonstrate what I have in mind.

As for the second issue - about the tool tip - I was not able to reproduce this, you can check that in the project that I have attached it works correctly. If you encounter this problem again please send us a project that we can test. 

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
Imran Javed Zia
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Imran Javed Zia
Top achievements
Rank 1
Share this question
or