Exemplo n.º 1
0
        private void Chart1_MouseMove(object sender, MouseEventArgs e)
        {
            Series s          = null;
            Point  mousePoint = new Point(e.X, e.Y);

            Chart1.ChartAreas[0].CursorX.Interval = 0;
            Chart1.ChartAreas[0].CursorY.Interval = 0;

            Chart1.ChartAreas[0].CursorX.SetCursorPixelPosition(mousePoint, true);
            Chart1.ChartAreas[0].CursorY.SetCursorPixelPosition(mousePoint, true);

            HitTestResult result = Chart1.HitTest(e.X, e.Y);

            if (result != null)
            {
                s = result.Series;
            }
            if (s != null)
            {
                string text = s.LegendText != "" ? s.LegendText : s.Name;
                lbl4.Text = text;
                lbl3.Text = "";
            }
            if (result.PointIndex > -1 && result.ChartArea != null)
            {
                lbl3.Text = "FRAMESLOST: " + result.Series.Points[result.PointIndex].YValues[0].ToString();
            }
        }
Exemplo n.º 2
0
        private void Chart1_MouseClick(object sender, MouseEventArgs e)
        {
            HitTestResult hit = Chart1.HitTest(e.X, e.Y);
            Series        s   = null;

            if (hit != null)
            {
                s = hit.Series;
            }
            if (s != null)
            {
                string text = s.LegendText != "" ? s.LegendText : s.Name;
                txtObject.Text = text;
            }
        }