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

Axis labels after zooming

Hi,

I'm trying to set the axis labels manually after zooming (want's to manage the zooming manually - see posted message Zoom behaviour) but the labels are not shown, only the old labels.

When the event ChartControl.VisibleRangedChanged is fired I calculates the new start and end value for the y-axis by using ZoomFactorY and ZoomPositionY.
After this I want to show new labels with the new scale and with descent numbers (rounded off numbers). For this I'm using following code:
(I have calculated the newMin and newMax and stepvalue values to get descent numbers)

****************************

ChartControl.PrimaryYAxis.TickLabelsDrawingMode = ChartAxisTickLabelDrawingMode.UserMode
ChartControl.PrimaryYAxis.Labels.Clear()


ChartControl.PrimaryYAxis.Range.Max = newmax
ChartControl.PrimaryYAxis.Range.Min = newMin
ChartControl.PrimaryYAxis.Range.Interval = stepvalue

numberOfSteps = CInt((newmax - newMin) / stepvalue)

j = newMin

For i As Integer = 1 To numberOfSteps

ChartControl.PrimaryYAxis.Labels.Add(New ChartAxisLabel(j.ToString(), Color.Black, New Font("Arial", 8, FontStyle.Regular), j, "", ChartValueType.Custom))

j = CDbl(j + stepvalue)
Next

*********************

Can you see whats wrong/what I have missed that causes the labels to not be shown.

Best regards,
Ana

7 Replies

AD Administrator Syncfusion Team February 23, 2007 08:59 AM UTC

Hi Ana,

Thank You for your interest in Syncfusion Products.

I tried to reproduce the issue using the KeyAndMouseZoomingSample (Syncfusion\Essential Studio\4.4.0.51\Windows\Chart.Windows\Samples\Zooming and Scrolling\KeyAndMouseZoomingSample) which ships with our EssentialChart ProductPackage.

In this sample, I used the same code snippet given by you with direct values assigned to the Min, Max and Interval properties of the axis as shown in the code snippet below, but I was not able to reproduce the condition that you have mentioned here.

ChartControl.PrimaryYAxis.TickLabelsDrawingMode = ChartAxisTickLabelDrawingMode.UserMode
ChartControl.PrimaryYAxis.Labels.Clear()


ChartControl.PrimaryYAxis.Range.Max = 30
ChartControl.PrimaryYAxis.Range.Min = 5
ChartControl.PrimaryYAxis.Range.Interval = 5

numberOfSteps = CInt((30 - 5) / 5)

j = 5

For i As Integer = 1 To numberOfSteps

ChartControl.PrimaryYAxis.Labels.Add(New ChartAxisLabel(j.ToString(), Color.Black, New Font("Arial", 8, FontStyle.Regular), j, "", ChartValueType.Custom))

j = CDbl(j + 5)
Next

The labels were getting displayed along the PrimaryYAxis as per the values assigned by me in the above code snippet.

Could you please say us how you calculated the new start and end value for the Y-axis by using ZoomFactorY and ZoomPositionY or could you please try to provide us with a sample which reproduces the condition that you have mentioned here?

Thanks & Regards,
Ramya.


AN Ana February 23, 2007 11:44 AM UTC

Hi again,

Thanks for all help.

I have made a small test application which reproduces the condition mentioned above.

Best regards,
Ana

ZoomAndRescale.zip

Note: This attachment has been removed on the customer's request.


AD Administrator Syncfusion Team February 26, 2007 09:25 AM UTC

Hi Ana,

Thanks a lot for providing us the sample.

I am afraid that I was not able to reproduce the issue that you have mentioned here.

The steps I followed to reproduce the issue are,

1. Executed the attached sample.
2. Intially the labels along PrimaryYAxis were
-200 , 0, 200,400,600,800.
3.I zoomed the Chart.
4. The labels got changed to
-100,0,100,200,300,400,500,600,700.

Also kindly take a look at the attached video file in which you can see the labels getting changed when the chart is zoomed.

Could you please let me know if I have missed any steps in reproducing the issue?

Thanks & Regards,
Ramya.





Labels1.zip


AN Ana February 26, 2007 09:56 AM UTC

Hello,

In the attached video it looks ok. I however expected the labels and the gridlines to be lined up together (as by default). How can I achieve this?

The problem does however still exist in some zoom cases.
If you zoom in only a small part of the y-axis region (200 to 500) you will see that the labels are not displayed correctly. Ánd if you zoom are very small part of the y-axis you do not get any labels at all...

I also have another question. Is the event VisibleRangeChanged always fired up to four times every time you zoom?

Best regards,
Ana


AN Ana February 26, 2007 01:17 PM UTC

Hi again,

I just saw that I had calculated the new min and max values for y wrong, that caused the missing labels.

I still need some answer on the two other qustestions I wrote
1 - How do I align the labels and the gridlines
2 - Why is the VisibleRangeChanged event fired up to four times? Is there any way to figure out how exact how many times the event will be fired?

Thanks for all help by the way.

Best regards,
Ana


AD Administrator Syncfusion Team March 1, 2007 07:17 PM UTC

Hi Ana,

My apologies for the delay in getting back to you.

Regarding your query of aligning labels and gridlines, in our current version the labels are not getting aligned properly when new ChartAxisLabels are created with ChartValueType as Custom.

Thanks for bringing this issue to our attention. I will forward this issue to our developers and let you know the timeframe for the fix of this issue by next week.

With regard to your query on VisibleRangeChanged event, this event gets called whenever ZoomPositionX, ZoomPositionY, ZoomFactorX, ZoomFactorY, ScrollPrecision values are changed. It also gets called when the ZoomButton of HScrollBar or VscrollBar is clicked and when values of HScrollBar or VscrollBar are changed. These are the scrollbars that appear when a chart is zoomed.

And since the values of ZoomPositionX, ZoomPositionY, ZoomFactorX, ZoomFactorY get changed as soon as the chart is zoomed using the mouse, the VisibleRangeChanged event gets called four times.

Let me know if you have any queries.

Thanks & Regards,
Ramya.


AD Administrator Syncfusion Team March 23, 2007 08:04 AM UTC

Hi Ana,

My strong apologies for the delay in getting back to you.

This issue has been forwarded to our developers and we will update you with the fix for the same on or before April6th, 2007. You can keep track of the progress of the issue from the below link

http://www.syncfusion.com/support/issues/chart/Default.aspx?ToDo=view&questId=3755

Please let us know if you have any queries.

Thanks & Regards,
Sharmila


Loader.
Live Chat Icon For mobile
Up arrow icon