Click here to Skip to main content
15,851,387 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using MsChart control for a charting application. In that, i am using MouseMove event to display the x-axis dynamic data on graph. Code snippet is as below -

try { //if(EventChart.ChartAreas[0].AxisX.PixelPositionToValue(e.Location.X) == EventChart.Series[0].ChartArea) if (e.Location.X < 0) cursorX = EventChart.ChartAreas[0].AxisX.PixelPositionToValue(0);
                    cursorX = EventChart.ChartAreas[0].AxisX.PixelPositionToValue(e.Location.X);
            cursorY = EventChart.ChartAreas[0].AxisY.PixelPositionToValue(e.Location.Y);

            tipInfo = "Date: " + DateTime.FromOADate(cursorX);

            DataPoint x = new DataPoint(cursorX, cursorY);
                //for (int i = 0; i < 39; i++)
                //    //bool status = EventChart.Series[i].Points.Contains(x);
                //    if (EventChart.Series[i].Points[Convert.ToInt16(EventChart.ChartAreas[0].CursorX.Position)].ToString() != null)
                //    {
                //        tipInfo += "\n" + GraphSeries[i];
                //        break;
                //    }
            tooltip.UseFading = true;
            tooltip.SetToolTip(EventChart, tipInfo);
            tooltip.Show(tipInfo, EventChart);

The problem i am facing is that, the mouse move event is getting called, whenever i get into the area where the data is to be displayed, this code updates the x- axis data only for particular left region of my chart. And it does not update x-axis data at tooltip for rest of part of chart.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900