c# - 使用 xaml.cs 文件添加图例和工具提示

标签 c# wpf xaml

我正在 xaml.cs 文件中绘制图表,例如

chart = new RadCartesianChart();
chart.Name = "Chart";
chart.Margin = new Thickness(10,20,10,20);
chart.BorderThickness = new Thickness(1);
chart.Background = new SolidColorBrush(Colors.LightGray);
chart.BorderBrush = new SolidColorBrush(Colors.Black);
ObservableCollection<MultiSeries> multiseries = mainWindowViewModel.GetSeies(Row, Col);
multiseries.ToList().ForEach(series =>
{
  chart.Series.Add(SeriesHelper.getLineSeries(series));
}
chart.SetValue(Grid.ColumnProperty, Col);
chart.SetValue(Grid.RowProperty, Row);
ChartGrid.Children.Add(chart); 

我正在尝试向该图表添加工具提示和图例 但我不知道如何添加工具提示和图例。

最佳答案

使用此语句:

chart.Behaviors.Add(new ChartTooltipBehavior()); 

关于c# - 使用 xaml.cs 文件添加图例和工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25155771/

相关文章:

c# - x : thing in WPF serve for? 是什么意思

c# - 支持按分区键查询而无需更改接口(interface)的存储库

c# - 使用 JavaScriptSerializer 将 csv 转换为 JSON

c# - asp.net css 在我的本地机器和远程机器上是不同的

wpf - 从 WPF 中的 ViewModel 类(MVVM 模式)更新 UI

c# - 控制 MVVM 中的 View

c# - 使用 Entity-Framework 时是否可以从查询中返回字符串值?

wpf - 来自 MVVM 的服务调用

c# - 多个 ComboBox.DisplayMemberPath 选项?

wpf - 覆盖 Silverlight 4 中的默认 ItemsPanelTemplate?