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

时间:2014-08-06 08:39:00

标签: 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); 

我试图在此图表中添加工具提示和图例 但我不知道如何添加工具提示和传奇。

1 个答案:

答案 0 :(得分:4)

使用此声明:

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