How to have chart like https://www.amcharts.com/demos/line-chart-with-scroll-and-zoom/
I am specifically interested in these functionalities
- To be able to select window of domain axis with those 2 selection controlls.
- To be able to zoom by selecting portion of domain axis.
- To be able to zoom out and see the bigger picture.
- To be able to map to range axis (Y) and see the value on that balloon like tool tip at any point (without Marker)
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, usepanDomainAxes()
, as shown in the implementation ofmouseDragged()
; 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 theChartPanel
; 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 customXYToolTipGenerator
, as shown here.
来源:https://stackoverflow.com/questions/44150322/jfreechart-with-selectable-domain-axis-and-zoom