Lock the ChartView Axies Zoom Ratio

0 Answers 64 Views
ChartView
Guang
Top achievements
Rank 1
Iron
Guang asked on 07 Mar 2023, 08:24 AM | edited on 07 Mar 2023, 08:25 AM

If I Set the ChartPanAndZoomBehavior to "Both", I can zoom a both within the same ratio or zoom one axis on its scrollbar.

 

How can I lock the two Axis to the same display ratio? (Same value/pixel ratio , I have the same unit meter on both axis), and allow the user zoom only together with two axis, disable the func of zoom single axis. 

Martin Ivanov
Telerik team
commented on 09 Mar 2023, 07:56 PM

I am not sure that I understand your requirement. By default the chart is zooming both axes using the same ratio when you use the mouse wheel. In case you want the same behavior on resize of the PanZoomBar scrollers, then you can manually sync the HorizontalZoomRangeStart and HorizontalRangeZoomRange properties of the chart with its VerticalZoomRangeStart and VerticalZoomRangeEnd.

If this doesn't help, can you send over few drawings showing the desired result?

Guang
Top achievements
Rank 1
Iron
commented on 11 Mar 2023, 12:49 AM | edited

I am afriad thats not the case.

Bind start and end will keep the two axises at the same position, and will not allow the position of the content to pan.

what i need is:

1. when initial load data, the x scale and the y scale are the same (ActuralWidth/data length)

2.when zoom using pan bar, zoom x and y axises simutanetiously

3. x and y bar range can be pan to different positions. (i.e. 0-0,3 and 0,6-0.9)

Martin Ivanov
Telerik team
commented on 20 Mar 2023, 08:42 PM

Thank you for the extra information. The chart doesn't support this behavior out of the box. However, you should be able to achieve it using some custom code. Basically, you can get the PanZoomBar controls and subscribe to their SelectionChanged event. In the event handlers, you can implement logic that ensures that the other PanZoomBar have the same selection range, as the the current one raising the event. You can see this idea in the attached project. Note that this is not well tested, so I can't tell if the calculations will work in all expected cases, but I believe that it is a good starting point. I hope that helps.

No answers yet. Maybe you can help?

Tags
ChartView
Asked by
Guang
Top achievements
Rank 1
Iron
Share this question
or