[英]WPF Binding Telerik Chartview
I have some data that is coming from a Stored procedure which i have been able to display in a non-Telerik DataGrid. 我有一些来自存储过程的数据,这些数据已经可以在非Telelerik DataGrid中显示。 using the following code.
使用以下代码。
CBFdataDataContext conn = new CBFdataDataContext();
List<spTotalRevByZipResult> sptotalrevbyzipresult = (from s in conn.spTotalRevByZip() select s).ToList();
ZipGrid.ItemsSource = sptotalrevbyzipresult;
But with using the radCartesianChart, It says that there is no ItemSource. 但是使用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>
So How do i load the chart with Data? 那么,如何向图表加载数据?
CBFsqldataDataContext conn = new CBFsqldataDataContext();
List<spTotalRevByZipResult> sptotalrevbyzipresult = (from s in conn.spTotalRevByZip()
select s).ToList();
ZipGrid????????? = sptotalrevbyzipresult;
sample Data 样本数据
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
I suggest you go and read some documentation. 我建议您去阅读一些文档。
Here is a good link to Telerik's RadCartesianChart using BarSeries . 这是使用BarSeries到Telerik的RadCartesianChart的良好链接。
You can use the following definition to display a simple BarSeries
您可以使用以下定义来显示简单的BarSeries
XAML
XAML
<telerik:RadCartesianChart Palette="Windows8"> <telerik:RadCartesianChart.HorizontalAxis> <telerik:CategoricalAxis/> </telerik:RadCartesianChart.HorizontalAxis> <telerik:RadCartesianChart.VerticalAxis> <telerik:LinearAxis /> </telerik:RadCartesianChart.VerticalAxis> <telerik:RadCartesianChart.Series> <telerik:BarSeries> <telerik:BarSeries.DataPoints> <telerik:CategoricalDataPoint Category="January" Value="2" /> <telerik:CategoricalDataPoint Category="February" Value="5" /> <telerik:CategoricalDataPoint Category="March" Value="3" /> <telerik:CategoricalDataPoint Category="April" Value="10" /> <telerik:CategoricalDataPoint Category="May" Value="9" /> <telerik:CategoricalDataPoint Category="June" Value="7" /> <telerik:CategoricalDataPoint Category="July" Value="1" /> </telerik:BarSeries.DataPoints> </telerik:BarSeries> </telerik:RadCartesianChart.Series> </telerik:RadCartesianChart>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.