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

Sampling with string values

1 Answer 45 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Courouble Damien
Top achievements
Rank 1
Courouble Damien asked on 03 Mar 2011, 10:46 AM
Hi guys,

I'm trying to enable sampling on a collection of 60 items.
I wanna sample of 20 so i've put 

<telerik:RadChart.SamplingSettings>
              <telerik:SamplingSettings SamplingThreshold="30" SamplingFunction="Average"  />
          </telerik:RadChart.SamplingSettings>

On the xaml part and this code on the vb part

Dim seriesMapping As New SeriesMapping()
        seriesMapping.CollectionIndex = tI
        seriesMapping.LegendLabel = tChartData.SeriesName(tI).ToString
        seriesMapping.ItemMappings.Add(New ItemMapping("X", DataPointMember.XValue) With {.FieldType = GetType(String)})
        seriesMapping.ItemMappings.Add(New ItemMapping("Y", DataPointMember.YValue))
 
        Dim t As New LineSeriesDefinition()
        t.ShowItemLabels = False
        t.ShowPointMarks = False
        t.ShowItemToolTips = False
        seriesMapping.SeriesDefinition = t
 
        RadChart1.SeriesMappings.Add(seriesMapping)

This code is working very nice when i have some DateTime to Bind on the XAxis ( Even when i have more than 20000 records) 

But Having some name ( strings) on the Axis X render items numbers instead of items name ( 1 instead of "mystring", 2 instead of "mysecondstring" )

Any chance to display the correct label ?

Thanks,

Damien

1 Answer, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 08 Mar 2011, 09:17 AM
Hi Courouble Damien,

Unfortunately this is not possible -- when sampling is enforced, certain information is lost (individual values of YValue, XCategory, etc) as several datapoints are aggregated into one. And while RadChart allows you to choose how the YValue of the resulting datapoint is calculated, it is not possible to provide the same functionality for XCategory as each category is individual and meaningful (the control cannot guess what is the average between let's say "Apples" and "Bananas").

If you would like to display string categories along the XAxis, you will need to disable the sampling mechanism by setting SamplingThreshold to 0.



Regards,
Giuseppe
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Chart
Asked by
Courouble Damien
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Share this question
or