DEV Chart控件鼠标选中某条曲线

Posted vuedi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DEV Chart控件鼠标选中某条曲线相关的知识,希望对你有一定的参考价值。

 1   this.Chart.ObjectSelected += new DevExpress.XtraCharts.HotTrackEventHandler(this.Chart_ObjectSelected);
 2             this.Chart.ObjectHotTracked += new DevExpress.XtraCharts.HotTrackEventHandler(this.Chart_ObjectHotTracked);
 3             Chart.SelectionMode = ElementSelectionMode.Single;
 4             //Chart.SeriesSelectionMode = SeriesSelectionMode.Point;
 5 
 6  public Series seriesSelected = null;
 7         public SeriesPoint pointSelected = null;
 8         public object selectedAnotherObject = null;
 9         bool SeriesSelection = true;
10 
11         protected virtual bool AllowSelectAnotherObject(object obj)
12         {
13             return false;
14         }
15         private void Chart_ObjectSelected(object sender, HotTrackEventArgs e)
16         {
17             if (e.Object is Series)
18             {
19                 e.Cancel = !SeriesSelection;
20                 if (SeriesSelection) 
21                 {
22                     this.seriesSelected = (Series)e.Object;
23                     this.pointSelected = e.AdditionalObject as SeriesPoint;
24                 }
25             }
26             else
27             {
28                 if (AllowSelectAnotherObject(e.Object))
29                 {
30                     this.selectedAnotherObject = e.Object;
31                     e.Cancel = false;
32                 }
33                 else
34                 {
35                     this.selectedAnotherObject = null;
36                     e.Cancel = true;
37                     Chart.ClearSelection(false);
38                 }
39                 if (SeriesSelection)
40                 {
41                     this.seriesSelected = null;
42                     this.pointSelected = null;
43                 }
44             }
45         }
46 
47         private void Chart_ObjectHotTracked(object sender, HotTrackEventArgs e)
48         {
49             if (e.Object is Series)
50                 e.Cancel = !SeriesSelection;
51             else
52                 e.Cancel = !AllowSelectAnotherObject(e.Object);
53         } 

 

以上是关于DEV Chart控件鼠标选中某条曲线的主要内容,如果未能解决你的问题,请参考以下文章

C# Chart控件,chartSeriesChartArea曲线图绘制的重要属性

C# Chart控件,chartSeriesChartArea曲线图绘制的重要属性

.net C# Chart控件,如何动态画rangeColumn图和Bar图?

需要在WPF中绘制曲线图,请问使用哪种控件比较好

DEV的GridControl控件的选中列属性设置高光

Winform(C#)中Chart控件鼠标点击显示波形上相应点对应坐标轴的x,y值