2013-03-12 27 views
0

我创建了一个饼图来显示我的RAM利用率(usedRam和availableRam)。 我用System.Windows.Controls.DataVisualization.Charting来创建饼图。 usedRamavailableRam的值将填充到我的数据库表RamUsage中。如何使用来自XAML的订单

我想在我的饼图上显示最新值usedRamavailableRam。 如何在XAML中实现这一点?我现在无法触及代码,因为我已经使用EntityFramework拖放功能将饼图放在我的视图中。

XAML的饼图:

<dvc:Chart Background="White" Foreground="Black" Name="chart3"> 
<dvc:PieSeries DependentValueBinding="{Binding Path=Available}" 
    IndependentValueBinding="{Binding Path=Used}" 
    ItemsSource="{Binding Source={StaticResource serverRamUsagesViewSource}}" /> 
</dvc:Chart> 

和输出

output

编辑

我想显示从XAML的RamUsage的最新值。

为e.g

select top 1 [RamID],[Used],[Available] from dbo.RamUsage order by [RamID] desc 
+0

其实你想要什么?你的标题是说顺序和内容是问如何显示图表?请清除 – Smaug 2013-03-12 13:53:57

+0

@RameshMuthiah _我想显示Ram使用的最新值。请看看我编辑的问题 – user1221765 2013-03-12 13:55:07

回答

1

我已经改变了DependentValueBinding,IndependentValueBinding到DependentValuePath和IndependentValuePath。同时确保绑定是否正确发生。如果你的绑定没有数据 那么你不会看到结果

<dvc:PieSeries DependentValuePath="Available" 
     IndependentValuePath="Used" ItemsSource="{Binding Source={StaticResource serverRamUsagesViewSource}}" /> 
+0

谢谢Ramesh,但这不是我的问题。我的价值观已被展示。但我想展示最新的(top 1和使用oderby),请参阅我编辑的问题 – user1221765 2013-03-12 14:02:35