B4J Question xChart: how to use ZoomLeftButtonClick, ZoomRightButtonClick, ZoomLeftAreaClick and ZoomRightAreaClick events ?

peacemaker

Expert
Licensed User
Longtime User
HI, All

I'm trying to investigate zoom, but no examples yet to see what this is.
B4X:
Sub xChart1_ZoomLeftButtonClick
    Log("ZoomLeftButtonClick")
End Sub

Sub xChart1_ZoomRightButtonClick
    Log("ZoomRightButtonClick")
End Sub

Sub xChart1_ZoomLeftAreaClick
    Log("ZoomLeftAreaClick")
End Sub

Sub xChart1_ZoomRightAreaClick
    Log("ZoomRightAreaClick")
End Sub

How they are used ? When occured ?
 

klaus

Expert
Licensed User
Longtime User
If you look at the demo project i posted HERE, you could see that i use the SetZoomSteps method.
SetZoomSteps(SmallStep As Int, BigStep As Int)
In the zoom bar you have:
- two buttons, one at each end, when you click on on of the buttons the zoom area is moved by SmallStep point indexes.
- two areas between the zoom cursor and the buttons, when you click on of these ares the zoom area is shifted by BigStep point indexes.
- the zoom cursor, when you move it, the zoom are is shifted accordingly.

The four click events are available and you can use them or not.
They are in the xChart demo project to show that they do exist and how to use those.
If i remember well i had used them to synchronize two charts one zoomed the other not.
Most users do not need those.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Sorry, I just do not understand what "zoombar" is, how it looks like on a working example...
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
1686256577977.png

This is what i call the zoom bar.
Two buttons, the cursor and two areas between the buttons and the cursor.

Here it's me who created them, i did not see your example with them, any link, pls ?
Sorry, my mistake, the demo program in the xChart thread is still an old one.
But the event routines there have no code just the routines like you did.
These events exist, but you do not need those for sure so you can forget them.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
One case to use the ZoomArea click events.
If you have data with one sample per day over one or more years and you want to display only one month.
The number of days in a month are different, in the ZoomArea click event you can adjust the number of data to display.
 
Upvote 0
Top