Devexpress Chart series 点击时获取SeriesPoint的值

//设置此属性为true
chartControl1.RuntimeHitTesting = true;

private void ChartControl1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            try
            {
                ChartHitInfo hitInfo = chartControl1.CalcHitInfo(e.Location);
                if (hitInfo.SeriesPoint == null)
                {
                    toolTip.HideHint();
                    return;
                }
                //图例名
                string lengthName = ((DevExpress.XtraCharts.Native.IOwnedElement)hitInfo.SeriesPoint).Owner.ToString();
                //点的Y轴数值
                string yValue = hitInfo.SeriesPoint.Argument;
                //点的X轴数值
                string xValue = hitInfo.SeriesPoint.Values[0].ToString();
                toolTip.ShowHint(lengthName + "   " + xValue + "   " + yValue);
            }
            catch (Exception ex)
            {
                FileLogUtility.Error(ex);
            }
        }

 

posted @ 2017-05-24 14:07  儿歌三百首  阅读(1863)  评论(0编辑  收藏  举报