After completing the line chart report, the product manager asks for the values on the polyline to be removed, and the values are displayed when the mouse passes through the line points, as follows: This method is used for charting line chart reports under Dotnetcharting. Implement the idea of adding a lable tag on the form that gets the x-axis, y-axis value, and mouse coordinate value of the point when the mouse passes through the polyline. The coordinates of the lable are then marked as the coordinates of the mouse and assigned to the lable, and the lable is displayed. //<summary> //mouse moves to the graph display values //</summar y> //<param name= "sender" ></param> //<param NA Me= "E" ></param> private void Chart4_mousemove (object sender, MouseEventArgs e) { var chart = sender as chart; &N Bsp if (chart! = null) { &NBSP ; HitTestInfo hit = chart. HitTest (e.x, e.y); var o = hit. Object as element; if (o! = null) {   var yvaule = o.yvalue; &N Bsp Label2. Visible = true;//When mouse is over label display Label2. Text = Yvaule. ToString (CultureInfo.InvariantCulture); Label2. Location = new Point (e.x, e.y-20); } & nbsp else//mouse away lable hidden { &NBSP ; Label2. Visible = false; } } } line charts and other reports can be generated with reference to the simple use of dotnetcharting
Move the mouse over the graph to display the value