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

Custom Sampling Function

3 Answers 80 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Ulrich Witschaß
Top achievements
Rank 1
Ulrich Witschaß asked on 02 Nov 2010, 05:33 PM
Hello Telerik Team,

I am implementing the WPF Chart in a scenario with lot's of data, so sampling is critical to keep drawing performance high.

What I need is basically a custom "keepextremes"-function when sampling data.
Currently, keepextremes keeps smaller values of the value is smaller than zero, and larger values of the value is larger than zero. Is this correct? If so, I need to change the value where the graph sampling decides wether to keep the lower value or the higher value to - for example - keep max values if the value is greater than 4, and keep min values of the value is below 4.

Is this possible?

best regards

Ulrik

3 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 05 Nov 2010, 12:57 PM
Hello Ulrich Witschaß,

Basically, the process is very close to creating a custom aggregate function for RadGridView, which is described here. The original KeepExtremes function actually returns the value of the  point which is farthest from the average. I have attached a small example, where the custom sampling function returns the min value if the average is less than 4 and the max value if the average is greater or equal to 4. You can further customize it to fit your requirements. Note, that you need to set the CustomSamplingFunction property of the corresponding ItemMapping object.

Best regards,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ulrich Witschaß
Top achievements
Rank 1
answered on 05 Nov 2010, 06:41 PM
Hello,

many thanks for the great help :)

I am currently implementing the function and everything looks promising.

I currently am struggling with another, I guess "simple" problem, loosely related to this. I want to show the other sampled values behind my lineseries in a candlestick series, so basically having the lineseries as the result of the sampling function, while the candlestick series show the first, last, max, min and average values of the temperature in the sampled timeframe. While this works perfectly, I can't seem to find a way to scale the candlesticks on the x-axis. Currently, they are very wide and case some graphical issues, I basically want them to be "very thin".

How can I programmatically change the width of the candlestick series?

best regards and thanks in advance!

Ulrik
0
Ves
Telerik team
answered on 10 Nov 2010, 12:26 PM
Hi Ulrich Witschaß,

The ItemWidthPercent property of the ChartArea is meant to define the width of Bars/Candlesticks:

RadChart1.DefaultView.ChartArea.ItemWidthPercent = 30;

Best regards,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Ulrich Witschaß
Top achievements
Rank 1
Answers by
Ves
Telerik team
Ulrich Witschaß
Top achievements
Rank 1
Share this question
or