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

RadChart Spline with two coordinates

3 Answers 79 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Adrien Pellegrini
Top achievements
Rank 1
Adrien Pellegrini asked on 10 Sep 2009, 08:23 AM
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 :
<!-- Chart --> 
<t:RadChart Grid.Column="2" x:Name="_uiChart"
    <t:RadChart.SeriesMappings> 
        <!-- Measurement --> 
        <t:SeriesMapping CollectionIndex="0" LegendLabel="Measurement" x:Name="_uiMeasurementSeriesMapping"
            <t:SeriesMapping.SeriesDefinition> 
                <t:SplineSeriesDefinition /> 
            </t:SeriesMapping.SeriesDefinition> 
            <t:SeriesMapping.ItemMappings> 
                <t:ItemMapping DataPointMember="YValue" />
            </t:SeriesMapping.ItemMappings> 
        </t:SeriesMapping> 
    </t:RadChart.SeriesMappings> 
</t:RadChart> 

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


Thanks,
Adrien.





3 Answers, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 11 Sep 2009, 08:39 AM
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.
0
Adrien Pellegrini
Top achievements
Rank 1
answered on 11 Sep 2009, 02:28 PM
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.
0
Adrien Pellegrini
Top achievements
Rank 1
answered on 14 Sep 2009, 10:21 AM
Well, finally it works fine.
Tags
Chart
Asked by
Adrien Pellegrini
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Adrien Pellegrini
Top achievements
Rank 1
Share this question
or