We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Regarding Mouse point in "X" axis equal to DateTime in "X" axis

Hi All,

I need to very urgent help

I configured the my chart control with datetime in "X" axis interval fromdate and todate.

when i click on the chart control i want know equal datetime in "X" axis.

Please any help me very very urgent for me.

Thanks and Regards
K.Sathishkumar

4 Replies

AD Administrator Syncfusion Team March 17, 2007 03:47 AM UTC

Hi Sathishkumar,

Thank you for using Syncfusion products.

You can get the equal DateTime value of X-axis by mouse click on the chart control. Please refer to the following code snippet.

[ C# ]

private void chartControl1_MouseDown(object sender, MouseEventArgs e)
{

if (e.Button == MouseButtons.Left)
{
Point clickPoint = new Point(e.X, e.Y);
MessageBox.Show (this.chartControl1.ChartArea.GetValueByPoint(clickPoint).DateX.ToString(),"X-axis Date Time");
}
}

Please have a look at this sample and let me know if this helps you.

http://www.syncfusion.com/Support/user/uploads/DateTimeSample_6746ad12.zip



Regards,
Rajesh


K. k.sathishkumar March 20, 2007 06:38 AM UTC

Hi Rajesh,

Thanks so much for your answer...

Thanks and Regards
K.Sathishkumar


AM Andrew Mihalik April 5, 2007 04:46 PM UTC

Hi Rajesh,
You answered the question I attached below. Thank you for answering it. Do you know what the code snippet you posted would be in the Visual Basic .NET language? Like the user who originally posted the question, I, too, would like to get the DateTime on a chart's X-axis corresponding to a mouse click.
Thank you very much,
Andrew




Hi All,

I need to very urgent help

I configured the my chart control with datetime in "X" axis interval fromdate and todate.

when i click on the chart control i want know equal datetime in "X" axis.

Please any help me very very urgent for me.


RC Rajesh C Syncfusion Team April 6, 2007 12:47 AM UTC

Hi Andrew,

Thank you for using Syncfusion products.

Get the DateTime on a chart's X-axis corresponding to a mouse click. Please refer to the following VB.Net code snippet and attached samples.

[ VB.Net ]

Private Sub ChartControl1_ChartRegionMouseDown(ByVal sender As System.Object, ByVal e As Syncfusion.Windows.Forms.Chart.ChartRegionMouseEventArgs) Handles ChartControl1.ChartRegionMouseDown
Dim text As String
text = "X = " + Me.ChartControl1.ChartArea.GetValueByPoint(e.Point()).DateX.ToString() + Environment.NewLine
text = text + "Y = " + Me.ChartControl1.ChartArea.GetValueByPoint(e.Point()).YValues(0).ToString()
Me.ToolTip1.SetToolTip(Me.ChartControl1, text)
End Sub

Download a sample from following link :
http://websamples.syncfusion.com/samples/Chart.Windows/F58035/main.htm

Regards,
Rajesh

Loader.
Live Chat Icon For mobile
Up arrow icon