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 the cursor width in chart control

Hi All,

I am using cursor in "X" axis chart control,

Please anyone tell me how do i set width of cursor based on "x" axis daterange.

I am using syncfusion version 4.4.0.51 and .NET 2.0

Thanks and Regards
K.Sathishkumar

18 Replies

RR Ramya R Syncfusion Team March 30, 2007 09:53 AM UTC

Hi Satishkumar,

Thanks for your interest in Syncfusion Products.

Could you please provide us with some more information regarding the condition that you have mentioned here along with some screenshots, so that it would help us in meeting your requirement exactly?

Thanks & Regards,
Ramya.


SK Sathishkumar Kaliavaradhan March 30, 2007 11:22 AM UTC

Hi Ramya,

First of all please tell how do i width of cursor ?

Second:Is it Width of the cursor is related to "X" axis Date Range ?

Thanks and Regards
K.Sathishkumar



SK Sathishkumar Kaliavaradhan April 2, 2007 04:59 AM UTC

Hi Ramya,

What i want is whatever daterange in "X" axis like 2 day or 3 month or 1 year i want constant size of cursor in "x" axis.

can you please tell me how do i do this or give me an example.

Waiting for your reply...Because very very urgent for me.

Thanks and Regards
K.Sathishkumar


RR Ramya R Syncfusion Team April 3, 2007 08:13 AM UTC

Hi Satishkumar,

My apologies for the delay in responding to you.

I hope your intention is to use the ChartInteractiveCursor. The size of the ChartInteractiveCursor is fixed. The ChartInteractiveCursor can added to the ChartControl as shown in the code snippet below,

chart1 = new ChartInteractiveCursor(this.chartControl1.Series[0]);
this.chartControl1.ChartArea.InteractiveCursors.Add(chart1 );

Also kindly refer the ChartInteractiveCursor sample (Syncfusion\Essential Studio\4.4.0.51\Windows\Chart.Windows\Samples\User Interaction\ChartInteractiveCursor) which ships with our Essential Chart ProductPackage.

In this sample , a ChartInteractiveCursor is added to the ChartControl for each series in the Chart. The Interactive cursors inform users the chart coordinates of all points in a given series

Let me know if I am wrong in getting your requirement.

Thanks & Regards,
Ramya.


SK Sathishkumar Kaliavaradhan April 3, 2007 10:19 AM UTC

Hi Ramya,

No.I am using "ChartStripLine" in "X" axis for cursor but it showinig different size for different "X" axis daterange but i want cursor size should be constant size.

Please give me an example to achieve.

Waiting for your reply...It is very very urgent for me.

Thanks and Regards
K.Sathishkumar



RC Rajesh C Syncfusion Team April 4, 2007 02:48 AM UTC

Hi Sathishkumar,

Thank you for the update.

I have created a fixed size vertical interactive cursor by using strip line. Please refer to the following code snippet.
[ C# ]

this.stripLine1.Start = chpt.X;
this.stripLine1.End = this.stripLine1.Start + 1;

Please have a look at this sample and let me know if this helps you.
http://websamples.syncfusion.com/samples/Chart.Windows/F58835/main.htm

Regards,
Rajesh


SK Sathishkumar Kaliavaradhan April 4, 2007 06:37 AM UTC

Hi Rajesh,

Can you modify your example with "X" axis value type as "DateTime" because i tried with your example to my program but it showing cursor width is very big

I attached my Screen shot too.

Please reply me as soon as possible.

Waiting for your reply...

Thanks and Regards
K.Sathishkumar


SK Sathishkumar Kaliavaradhan April 4, 2007 07:04 AM UTC

Hi Rajesh,

Sorry i forgot to upload my screen shot.my chart control "X" axis value type is DateTime.

Please look into the screen shot.

Thanks and Regards
K.Sathishkumar

Cursor Problem.zip


SK Sathishkumar Kaliavaradhan April 5, 2007 02:44 PM UTC

Hi Rajesh,

i waiting for your reply for so long time.

can you please provide me an help ASAP.Because very very urgent for me.

Thanks and Regards
K.Sathishkumar


SK Sathishkumar Kaliavaradhan April 6, 2007 09:52 AM UTC

Hi Rajesh,

I am waiting for your help.

Please provide me an example as soon as possible.

Thanks and Regards
K.Sathishkumar


SK Sathishkumar Kaliavaradhan April 9, 2007 05:58 AM UTC

Hi Rajesh,

Can you provide me an example how do i set the constant size of cursor irrespective of "X" axis daterange and also while zoom in.

I am keep on asking last three weeks but no reply from your side.

can you please reply me as soon as possible.

Thanks and Regards
K.Sathishkumar


RC Rajesh C Syncfusion Team April 9, 2007 10:53 AM UTC

Hi sathishkumar,

Sorry for the delay in responding to you.

You can control the size of the StripLine while Zoom In the chart by setting the StripLine width in VisibleRangeChanged event. Please refer to the following snippet.

[ C# ]

void chartControl1_VisibleRangeChanged(object sender, EventArgs e)
{
stripLine1.Width = this.chartControl1.PrimaryXAxis.VisibleRange.Interval / 30;
stripLine2.Width = this.chartControl1.PrimaryXAxis.VisibleRange.Interval / 30;
}

//the code to prevent the cursor move to out side of chart area.

void chartControl1_ChartAreaPaint(object sender, PaintEventArgs e)
{
Rectangle bounds = this.chartControl1.ChartArea.RenderBounds;

if (bounds.Left < this.chartControl1.ChartArea.GetPointByValue(new ChartPoint(this.stripLine1.Start, 0)).X )
this.stripLine1.Enabled = true;
else
this.stripLine1.Enabled = false;

if (bounds.Left < this.chartControl1.ChartArea.GetPointByValue(new ChartPoint(this.stripLine2.Start, 0)).X)
this.stripLine2.Enabled = true;
else
this.stripLine2.Enabled = false;
}

Also kindly take a look at the modified sample.

http://websamples.syncfusion.com/samples/Chart.Windows/F58835/main.htm

Regards,
Rajesh


SK Sathishkumar Kaliavaradhan April 9, 2007 11:27 AM UTC

Hi Rajesh,

you gave the same answer in third update itself but after that i asked you for different example because your example "X" axis valuetype is "double" and mine is "DateTime" it is not working for me.

Please try to understand my problem.
I am asking you is it possible to set the size of the cursor as constant irresptive of "X" axis daterange value? if then tell me how do i set?

please reply as soon as possible.

Thanks and Regards
K.Sathishkumar




RC Rajesh C Syncfusion Team April 9, 2007 01:23 PM UTC

Hi Sathishkumar

I regret for the inconvenience caused.

I have changed the X-axis value type as DateTime then the interactive cursor is working fine. Please take look at the screen shot and download a sample from following web link.

http://websamples.syncfusion.com/samples/Chart.Windows/F58835_1/main.htm

In this sample I am using two different size cursors.

Please let me know if you have any queries.

Regards,
Rajesh


SK Sathishkumar Kaliavaradhan April 9, 2007 03:01 PM UTC

Hi Rajesh,

I think you didn't got my problem yet because i am not using "ChartInteractiveCursor" at all i am just using only one stepline for my entire chart once user clicks on the particular location in the chart control then cursor will be drawn there and correcponding chart point value will be shown in another place.

i am changing the cursor position using cursor start and end property.i am getting the "X" axis datetime value by
this.chartControl1.ChartArea.GetValueByPoint(clickPoint).DateX.ToOADate();

i have attached my example i tried here in that what you have to do is just change the end date time value from
DateTime end = new DateTime(2007, 5, 1);
to
DateTime end = new DateTime(2007, 12, 1);

then check cursor itself is not shown.problem is between the "X" axis datetime range only.

Can you please modify the example so that whatever daterange in "X" axis cursor will be shown in constant size in normal mode not in zooming mode.

Waiting for your reply...

Because very very urgent for me.

Thanks and Regards
K.Sathishkumar



Modified DateTime Visible1.zip


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

Hi Sathishkumar,

Thank you for your sample.

I have created a own cursor by drawing a line instead of strip line. You can change the width of cursor with constant size when it is in zooming mode. Please refer to the following code snippet.

[ C# ]

private void chartControl1_ChartAreaPaint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
curpos = this.chartControl1.ChartArea.GetPointByValue(ChartPt);
Rectangle bounds = this.chartControl1.ChartArea.RenderBounds;
if (curpos.X > bounds.Left && curpos.X < bounds.Right)
g.DrawLine(new Pen(Color.Red, CursorWidth), curpos.X, bounds.Top, curpos.X, bounds.Bottom);
}

private void chartControl1_ChartRegionClick(object sender, ChartRegionMouseEventArgs e)
{
ChartPt = this.chartControl1.ChartArea.GetValueByPoint(e.Point);
}

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

Modified DateTime Visible1.zip

Regards,
Rajesh


SK Sathishkumar Kaliavaradhan May 15, 2007 12:13 PM UTC

Hi Rajesh,

I am facing one big problem in chart control.

whatever solution you gave for fixed cursor width problem useful only if i click on the region then it will draw there but i want to draw line while scrolling the scroll bar also.

Can you please give me solution how do i achieve?

waiting for your reply...

please reply me as soon as possible.

Thanks and Regards
k.Sathishkumar


RR Ramya R Syncfusion Team May 21, 2007 01:55 PM UTC

Hi Satishkumar,

We apologize for the delay in responding to you.

Is your intention to move the ChartStripLine as the windows scrollbar which you have placed within the ChartControl is scrolled?

If "Yes", then it can be done by setting start and end points of the ChartStripLine under scroll event of the ScrollBar as shown in the code snippet below,

private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
{

Point clickPoint = Control.MousePosition;
cursor.Start = this.chartControl1.ChartArea.GetValueByPoint(clickPoint).DateX.ToOADate();
cursor.End = this.chartControl1.ChartArea.GetValueByPoint(clickPoint).DateX.ToOADate() + cursor.Width;
cursor.Enabled = true;
this.chartControl1.Refresh();
}

Let me know whether this helps you.

Also let me know if I am wrong in getting your requirement.

Thanks & Regards,
Ramya.

Loader.
Live Chat Icon For mobile
Up arrow icon