Sampling with string values

2 posts, 0 answers
  1. Courouble Damien
    Courouble Damien avatar
    54 posts
    Member since:
    Aug 2009

    Posted 03 Mar 2011 Link to this post

    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
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 08 Mar 2011 Link to this post

    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!
Back to Top