RadChart Spline with two coordinates

4 posts, 0 answers
  1. Adrien Pellegrini
    Adrien Pellegrini avatar
    10 posts
    Member since:
    Sep 2009

    Posted 10 Sep 2009 Link to this post

    Hello,

    Can you explain me how to precisely place a point onto the chart with the X and Y coordinates ? Must I set two items mapping and a 2-dimensional array ?

    I wrote this sample in Xaml :
    1 <!-- Chart --> 
    2 <t:RadChart Grid.Column="2" x:Name="_uiChart"
    3     <t:RadChart.SeriesMappings> 
    4         <!-- Measurement --> 
    5         <t:SeriesMapping CollectionIndex="0" LegendLabel="Measurement" x:Name="_uiMeasurementSeriesMapping"
    6             <t:SeriesMapping.SeriesDefinition> 
    7                 <t:SplineSeriesDefinition /> 
    8             </t:SeriesMapping.SeriesDefinition> 
    9             <t:SeriesMapping.ItemMappings> 
    10                 <t:ItemMapping DataPointMember="YValue" />
    11             </t:SeriesMapping.ItemMappings> 
    12         </t:SeriesMapping> 
    13     </t:RadChart.SeriesMappings> 
    14 </t:RadChart> 

    And I passed to the ItemSource a double array like this :
    1 List<double[]> itemsSource = new List<double[]> 
    2
    3     new double[] {3, 5, 9, 8} 
    4 }; 
    5 this._uiChart.ItemsSource = itemsSource; 


    Thanks,
    Adrien.





  2. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 11 Sep 2009 Link to this post

    Hello Adrien,

    You need to provide XValue and YValue for each point.

    There are two approaches:
    1. Build DataSeries, giving X & Y values for each DataPoint.
    2. Create custom object that has two values, and use data binding (2 item mappings will be required, one for the X value and one for the Y).

    There is no way to map N-dimensional arrays to the chart and support for such binding is not planned.

    Please, review the following two help topics:
    Kind regards,
    Evtim
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Adrien Pellegrini
    Adrien Pellegrini avatar
    10 posts
    Member since:
    Sep 2009

    Posted 11 Sep 2009 Link to this post

    I found what to do but I can't even bind the ItemSource to the data.

    Xaml code :
    <t:RadChart Grid.Column="2" x:Name="_uiChart"
                    <t:RadChart.SeriesMappings> 
                        <t:SeriesMapping LegendLabel="Measurement"
                            <t:SeriesMapping.SeriesDefinition> 
                                <t:SplineSeriesDefinition /> 
                            </t:SeriesMapping.SeriesDefinition> 
                            <t:SeriesMapping.ItemMappings> 
                                <t:ItemMapping DataPointMember="XValue" FieldName="XValue" /> 
                                <t:ItemMapping DataPointMember="YValue" FieldName="YValue" /> 
                            </t:SeriesMapping.ItemMappings> 
                        </t:SeriesMapping> 
                    </t:RadChart.SeriesMappings> 
                </t:RadChart> 

    Source code :
                List<Point> points = new List<Point>(100); 
                points.Add(new Point { XValue = 1, YValue = 3 }); 
                points.Add(new Point { XValue = 3, YValue = 9 }); 
                points.Add(new Point { XValue = 7, YValue = 16 }); 
                points.Add(new Point { XValue = 9, YValue = 5 }); 
                points.Add(new Point { XValue = 15, YValue = 2 }); 
                this._uiChart.ItemsSource = points; 

    Passing data by code and "bind" it to the itemSource works, but when I make a binding in Xaml, it doesn't work.

    I added to the snippet in Xaml this code for the binding :  ItemsSource="{Binding Points}".


    Is the chart must be refreshed or something else ?


    Thanks,
    Adrien.
  4. Adrien Pellegrini
    Adrien Pellegrini avatar
    10 posts
    Member since:
    Sep 2009

    Posted 14 Sep 2009 Link to this post

    Well, finally it works fine.
Back to Top