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);
            }
        }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM