How to have chart like https://www.amcharts.com/demos/line-chart-with-scroll-and-zoom/
I am specifically interested in these functionalities
I made initial attempt here Scrollable JFree domain axis and custom marker label with help of trashgod I made domain scrollable.
I am still missing these functionality to be able to use graph effectively.
You'll have to combine several approaches:
Panning controls: Invoke, setDomainPannable(true) to enable panning; in your controls, use panDomainAxes(), as shown in the implementation of mouseDragged(); use the mouse as suggested here.
Zooming: Zooming by dragging on the axis is not supported, but dragging on the plot is supported; drag right to see the selection rectangle. To ensure the mouse wheel only zooms the domain axis when is rolled, invoke setRangeZoomable(false) on the ChartPanel; vice-versa for the range axis.
Zooming out: Drag left to zoom out or use a button handler, as shown here.
Tooltips: Enable tooltips in your chosen ChartFactory. If needed, create a custom XYToolTipGenerator, as shown here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With