如何使用Java中的JFReechart的图标移动XYPLOT
我有一个Xyplot,可以忽略一个图标和几个图。下图显示了图表的初始视图。
图标都有运动,并且执行类似:
图标路径比此初始视图更长,但是到目前为止,我都使用了缩放和放大 为了沿着小路移动自己,我想自动化它。 我希望当图标到达X轴中间时,整个图表在图标的同一时间进行移动。我不知道是否可能。
我认为代码很有用:
public final class VerticalRoute {
BufferedImage planeIcon = null;
XYAnnotation xyannotation;
XYPlot xyplot = null;
JFreeChart chart = null;
ChartPanel panel = null;
private VerticalRoute(Trafico t) {
try {
planeIcon = ImageIO.read(getClass().getClassLoader().getResource("Resources/Imagenes/lateral_avion_2.png"));
} catch (IOException e) {
e.printStackTrace();
}
chart = ChartFactory.createXYLineChart("Vertical profile", "Orthodromic distance (NM)", "Altitude (ft)", this.oDataset);
xyplot = (XYPlot) chart.getPlot();
}
private void updatePlaneMovement() {
xyannotation = new XYImageAnnotation(dist_avion, alt, rotatedPlaneIcon);
this.xyplot.addAnnotation(xyannotation);
}
}
“ dist_avion”和“ alt”是每秒重新计算的变量,它们允许图标运动。 “旋转平板”给出了一个角度,以模拟“平面”在攀爬相或下降相处。
我试图放置一个水平的卷轴,但是当我阅读时,jfreechart尚不允许。
我该如何在图表上铺好,以遵循图标的运动?
I have an xyplot where I have an icon and several plots that you can ignore. The following picture shows the initial view of the chart.
The icon has movement, and does something like:
The icon path is more longer than this initial view, but until now I used the zoom out and zoom in
in order to move myself along the path, and I would want to automate it.
I would like that when the icon arrives to the middle of the x axis, the entire chart takes movement at the same time that the icon. I don't know if it's possible.
The code I think is useful:
public final class VerticalRoute {
BufferedImage planeIcon = null;
XYAnnotation xyannotation;
XYPlot xyplot = null;
JFreeChart chart = null;
ChartPanel panel = null;
private VerticalRoute(Trafico t) {
try {
planeIcon = ImageIO.read(getClass().getClassLoader().getResource("Resources/Imagenes/lateral_avion_2.png"));
} catch (IOException e) {
e.printStackTrace();
}
chart = ChartFactory.createXYLineChart("Vertical profile", "Orthodromic distance (NM)", "Altitude (ft)", this.oDataset);
xyplot = (XYPlot) chart.getPlot();
}
private void updatePlaneMovement() {
xyannotation = new XYImageAnnotation(dist_avion, alt, rotatedPlaneIcon);
this.xyplot.addAnnotation(xyannotation);
}
}
"dist_avion" and "alt" are the variables that are recalculated each second, and they allow the icon movement. "rotatedPlaneIcon" gives an angle in order to simulate that the "plane" is in the climb phase or in descent phase.
I tried to put an horizontal scrollbar, but as I was reading, jfreechart don't allows yet.
How can I pan the chart so it follows the movement of the icon?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论