B4J Question xChart: two measure cursors, zoom and point selection

peacemaker

Expert
Licensed User
Longtime User
HI, All

Maybe is it possible for xChart:

1) 2 vertical lines-cursors to measure X between them
2) Zooming a selected area of a chart (by a mouse wheel or pitch)
3) Static point chosen on the chart, always visible

?
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
Thanks, Klaus.
But xChart is already used, for oscillographic chart, and i guess, better to continue updating this class.

I see
....
'Version 9.3
'Added SetZoomSteps(SmallStep As Int, BigStep As Int) method
'Added ZoomLeftButtonClick, ZoomRightButtonClick, ZoomLeftAreanClick and ZoomRightAreaClick events
'Added ZoomSmallStep, ZoomBigStep, ZoomBeginIndex, ZoomEndIndex and ZoomNbVisiblePoints properties read only

Do you have any demo of this zoom ?
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Sure, in the demo program.
But not with a wheel nor pitch.
1686129022215.png


Here ? But how to try zoom here ?
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Yes, realtime data from COM-ports. But i think, the zoom it's only viewing some static selected area... should be, without dynamic update of this area.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Could you use Line charts, those have the zoom function.
The YXChart data organisation is not well suited for zoom.
For this kind of charts i would have used the xGraph library which is dedicated for signal analysis.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Thanks for suggestion. But if any example with this zoom demo available, please, point me. Just to see how it works.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Attached you find a small demo program showing the zoon in a LINE chart.
It has two operating modes.
1. Static: you can set the ZoomBeginIndex and the ZoomEndIndex with the cursor. In the main program not in the xChart library.
2. Dynamic: the chart is dynamically filled with data up to the given max number of points (MaxPoints) and then scrolls.
When it begins to scroll a zoom is set and shows the last NumberVisiblePoints.
When you click on Stop the program returns to static mode.

For this i had to modify the xChart library.
- Changed the getNbPoints property to return the total number of points.
- Add a ZoombarEnabled property, because in dynamic mode the zoom does not work correctly.
For the moment the xChart module is included in the project.
If all this is OK for you i will update the library.

1686229423577.png
1686229645845.png
 

Attachments

  • PeaceMakerDemo.zip
    51.2 KB · Views: 62
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
If all this is OK for you i will update the library.
Thanks very much, Klaus !
It looks super, sure, include into the lib.
I guess, left and right cursors can be set by long right mouse clicks...
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I guess, left and right cursors can be set by long right mouse clicks...
No, there is no LongClick event supported in the xChart library directly.
Only Touch events are supported, but you could implement a LongClick in the CursorTouch event.
When i want to set a cursor i like to activate the cursor in the mouse down event, move the cursor at the desired place and set the cursor in the mouse up event, this is what i did in the demo project above.
 
Upvote 0
Top