非 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