Move the mouse over the graph to display the value

Source: Internet
Author: User

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)                 {        &nbsp           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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.