我创建了一个饼图来显示我的 RAM 利用率(usedRam 和 availableRam)。我曾经System.Windows.Controls.DataVisualization.Charting创建饼图。usedRam和的值availableRam被填充到我的名为 的数据库表中RamUsage。
我想在我的饼图上usedRam显示最新值。availableRam如何在 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>
输出是

编辑
我想显示来自 XAML 的 RamUsage 的最新值。
例如
select top 1 [RamID],[Used],[Available] from dbo.RamUsage order by [RamID] desc