JFreeChart with selectable domain axis and zoom

前端 未结 1 1658
独厮守ぢ
独厮守ぢ 2020-11-30 14:53

How to have chart like https://www.amcharts.com/demos/line-chart-with-scroll-and-zoom/

I am specifically interested in these functionalities

  1. To be able
相关标签:
1条回答
  • 2020-11-30 15:23

    You'll have to combine several approaches:

    1. 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.

    2. 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.

    3. Zooming out: Drag left to zoom out or use a button handler, as shown here.

    4. Tooltips: Enable tooltips in your chosen ChartFactory. If needed, create a custom XYToolTipGenerator, as shown here.

    0 讨论(0)
提交回复
热议问题