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

Moving Ticks / Gridlines when scrolling after zoom

Hello,

When zoomed and scrolled, the ChartControl changes the values at which the ticks / gridlines are, so that the latter remain static.

I was wondering how hard it is to have the ticks at particular values and move them as the user scrolls.

Thanks,
Kamen

9 Replies

RR Ramya R Syncfusion Team May 14, 2007 07:34 AM UTC

Hi Kamen,

Thank you for your interest in Essential Chart.

Could you please provide me with some more information about your requirement along with some screenshots, so that it would help me to meet your requirement exactly?

Could you also please let me know what version of Syncfusion Essential Studio you are using?

Thanks & Regards,
Ramya.


KY Kamen Yotov May 14, 2007 02:27 PM UTC

I don't have screen shots from Syncfusion, because I have not been able to achieve what I need.

I am including a screenshot from our current app.
Note that I dragged the X Axis and the ticks moved together with the data. Is this possible with your ChartControl?

test213.zip


RF Rashidha F Syncfusion Team May 16, 2007 01:29 PM UTC

Hi Kamen,

My apologies for the delay in responding to you.

I hope your intention is to create a chart with perfect Zooming and Scrolling feature. Yes, you can achieve your requirements using Syncfusion chart product.

Please look at the attached sample. Let me know whether it meets your requirement. If not, then provide me more information or sample as you expect.

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

Thanks for your patience.

Regards,
Rashidha.


KY Kamen Yotov May 16, 2007 05:11 PM UTC

on your example, when you scroll after you zoom, the ticks/gridlines stay at the same location on screen and their labels change.

i need the ticks/gridlines glued to the data... say the range of the data on x axis is 1/1/06 to 31/12/06, and we have monthly ticks (positioned at 1/1/06, 2/1/06, ..., 12/1/06). When I zoom, I want the 12 ticks to remain at those locations in the data. If I scroll, I want the ticks to scroll together with the data -- so that there is always a tick at 2/1/06 and it moves as you scroll...

let me know if you need more detail.

thanks,
kamen


RR Ramya R Syncfusion Team May 21, 2007 12:58 PM UTC

Hi Kamen,

Thank you for the update.

In general, ticks do not move with values along the axis. They appear at the point whereever the data appears along the axis.

Whenever a chart is zoomed, the values appearing along the axis appears with a tick. Similarly while scrolling though the values alone move they get displayed with a tick as they are moved. So there will always be a tick at the point of data along the axis.

I used the KeyAndMouseZoomingSample (Syncfusion\EssentialStudio\5.1.0.51\Windows\Chart.Windows\Samples\2.0\Zooming and Scrolling\KeyAndMouseZoomingSample)which ships with our Essential Chart Product Package to check whether all the values along the axis have ticks when the chart is zoomed and scrolled and it worked fine. All values along the axis had ticks when scrolled or zoomed.


If you are facing a condition such as a value along the axis appearing without a tick when a chart is scrolled or zoomed, could you please provide us with that sample which reproduces the issue, so that it would help us in analyzing the issue.

Thanks & Regards,
Ramya.


KY Kamen Yotov May 22, 2007 08:22 PM UTC

The data in the sample is at the intereger points 1, 2, ..., 10
When you zoom, ticks are no longer at the integer points... rather the range is equally divided in 6 intervals (as the original one) and then the ticks show up at 5.35, 7.83, etc.
If you can make the ticks show up at exactly the values 1, 2, ..., 10 (no matter what the zoom is), that will solve my problem.


RF Rashidha F Syncfusion Team May 24, 2007 01:39 PM UTC

Hi Kamen,

My apologies for the delay in responding to you.

If your intension is to display an axes value as an integer value after zooming the chart control means, use the custom label feature in chart control

Please take a look at the sample attached.

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

Let me know if this helps.

Regards,
Rashidha.


KY Kamen Yotov May 24, 2007 10:33 PM UTC

this is going to do the job.

the only thing i am worried about is if i have too many ticks...

is there a way to implement an interface that returns the number of ticks, their positions, etc? that way i will not have to explicitly store the ticks in the axis...

thanks,
kamen


RF Rashidha F Syncfusion Team May 28, 2007 09:05 PM UTC

Hi Kamen,

My apologies for the delay in responding to you.

You can able to display custom labels using Interface IChartAxisLabelModel in chart control.

Able to set the custom label for axis by following methods. It is common for all chart types.

Method 1:

this.chartControl1.PrimaryXAxis.LabelsImpl = new LabelModel(new string[] { "NYSC", "DELL", "LLC", "CITI", "ORCL", "CSCO" });
this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.Custom;

Method 2:

this.chartControl1.PrimaryXAxis.Labels.Clear();
this.chartControl1.PrimaryXAxis.TickLabelsDrawingMode = Syncfusion.Windows.Forms.Chart.ChartAxisTickLabelDrawingMode.UserMode;
this.chartControl1.PrimaryYAxis.TickLabelsDrawingMode = Syncfusion.Windows.Forms.Chart.ChartAxisTickLabelDrawingMode.AutomaticMode;
for (int i = 0; i < labels.Length; i++)
{
this.chartControl1.PrimaryXAxis.Labels.Add(new Syncfusion.Windows.Forms.Chart.ChartAxisLabel(labels[i], Color.Crimson, new Font("Times New Roman", font_size), i, "", Syncfusion.Windows.Forms.Chart.ChartValueType.Custom));
}

Method 3:

private void chartControl1_ChartFormatAxisLabel(object sender, ChartFormatAxisLabelEventArgs e)
{
if (e.AxisOrientation == ChartOrientation.Vertical )
{
if (e.Value == 0)
e.Label = "NYSC";
else if (e.Value == 1)
e.Label = "DELL";
else if (e.Value == 2)
e.Label = "LLC";
else if (e.Value == 3)
e.Label = "CITI";
else if (e.Value == 4)
e.Label = "ORCL";
else if (e.Value == 5)
e.Label = "CSCO";
else
e.Label = "";
e.Handled = true;
}
}

Please take a look at the attached sample.

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

In the above sample, the range of the data on x axis is 1/1/06 to 31/12/06, and we have monthly ticks positioned at 1/1/06, 2/1/06, ..., 12/1/06. When I select any one of the dates in combobox, It will displayed 24 ticks to remain at those locations in the data.

Let me know if this helps.

Regards,
Rashidha.

Loader.
Live Chat Icon For mobile
Up arrow icon