具有可选域轴和缩放的JFreeChart [英] JFreeChart with selectable domain axis and zoom

查看:79
本文介绍了具有可选域轴和缩放的JFreeChart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 https://www .amcharts.com/demos/line-chart-with-scroll-and-zoom/

我对这些功能特别感兴趣

I am specifically interested in these functionalities

  1. 要能够使用这两个选择控件来选择域轴窗口.
  2. 通过选择部分域轴进行缩放.
  3. 能够放大并查看大图.
  4. 为了能够映射到范围轴(Y)并在任意点(无标记)像工具提示一样看到该气球上的值

我在此处进行了初步尝试可滚动的JFree域轴和自定义标记标签在垃圾桶的帮助下,我使域可滚动.

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:

  1. 平移控件:调用setDomainPannable(true)启用平移;在控件中,使用此处使用鼠标.

  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.

缩放:不支持通过在轴上拖动进行缩放,但支持在图上进行拖动;拖动 right 可以看到选择矩形.要确保鼠标滚轮在滚动时仅缩放域轴,请在ChartPanel上调用setRangeZoomable(false);否则,请单击setRangeZoomable(false).反之亦然.

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.

工具提示:在您选择的ChartFactory中启用工具提示.如果需要,请创建自定义XYToolTipGenerator,如此处所示.

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

这篇关于具有可选域轴和缩放的JFreeChart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆