我有一些来自存储过程的数据,我已经能够在非 Telerik DataGrid 中显示这些数据。使用以下代码。
CBFdataDataContext conn = new CBFdataDataContext();
List<spTotalRevByZipResult> sptotalrevbyzipresult = (from s in conn.spTotalRevByZip() select s).ToList();
ZipGrid.ItemsSource = sptotalrevbyzipresult;
但是使用 radCartesianChart,它说没有 ItemSource。
<telerik:RadCartesianChart HorizontalAlignment="Left" Margin="10,104,0,0" Grid.Row="1" VerticalAlignment="Top" Width="723" Height="218" Name="ZipGrid">
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis/>
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:CategoricalAxis/>
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.Series>
<telerik:BarSeries CategoryBinding="subTotal"
ValueBinding="custzip"
ItemsSource="{Binding}"/>
</telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>
那么如何使用数据加载图表?
CBFsqldataDataContext conn = new CBFsqldataDataContext();
List<spTotalRevByZipResult> sptotalrevbyzipresult = (from s in conn.spTotalRevByZip()
select s).ToList();
ZipGrid????????? = sptotalrevbyzipresult;
样本数据
custzip subTotal
NULL 18229530.07
123 0.00
674 0.00
1532 0.00
1701 0.00
1821 10860.08
1923 0.00
2134 0.00
2194 0.00
2715 2779.80
2876 72.00
3051 109.63
3060 186.00