本文介绍了如何使用JAVAFX图表在图表上绘制多个轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

平等待你!

以下是一个巨大软件中的趋势图,其中绘制了一些实时以及历史数据。有两个笔注册,每个笔的单独轴定义在同一趋势上。

Following is an image of a trend in a huge software where some real time as well as history data is being plotted. There are two pens registered and separate axis for each pen is defined on the same trend.

我一直在尝试在JavaFX 2.0图表中做到这一点。我已经能够绘制一个实时图表如下:

I have been trying to do exactly this in JavaFX 2.0 charts. I have been able to plot a real time chart which is as follows:

我一直在使用JavaFX研究多轴,可以找到 link,但我认为这是一个旧版本的JavaFX使用FXML。但是,我使用JavaFX常规类来完成这个。

I have been researching about multiple axis using JavaFX and could find the this link but I think this is an older version of JavaFX using FXML. However, I am using JavaFX regular classes to accomplish this.

帮助!!!

推荐答案

a href =http://docs.oracle.com/javafx/2.0/api/javafx/scene/layout/StackPane.html =nofollow noreferrer> StackPane 。

Place two charts in a StackPane.

使用 来翻译(使用translate-x和translate-y)它的轴和标签,以便它们可以独立于底部图表进行读取。保留顶部图表的数据图,使其覆盖底部图表。修改颜色和图例(或混合图表样式,例如线和条),以便显而易见哪个数据图属于哪个系列。

Use css lookups on the top chart to translate (using translate-x and translate-y) it's axes and labels so that they can be read independently of the bottom chart. Leave the top chart's data plot so that it overlays the bottom chart. Modify colors and legends (or mix chart styles, e.g. line and bar) so that it is obvious which data plot belongs to which series.

上面的一些技巧:


  • 在回答:(显示如何在似乎是单个图表上绘制多个轴)。

  • 在此(但不包括轴平移)。

  • In the answer to: Move tick label JavaFx 2 (which shows how to draw multiple axes on what seems to be a single chart).
  • In this sample code which layers a linechart on a barchart (but without the axis translation).

这篇关于如何使用JAVAFX图表在图表上绘制多个轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 23:24
查看更多