是否可以在JavaFX 2.0中更改NumberAxis的值? [英] Is it possible to change the Values of a NumberAxis in JavaFX 2.0?
问题描述
我不知道这是否可能。但基本上我想把JavaFX中的 NumberAxis
的值更改为字符串。
I'm not sure if this is even possible. But basically I want to change the values of a NumberAxis
in JavaFX to Strings.
final NumberAxis xAxis = new NumberAxis(0, 40, 1);
现在我想改变的是任何字符串的0-40。
So what I now want to change is the numbers 0 - 40 to any String.
另一个问题是。我已将 Regions
添加到我的图表
,因此它在特定值上显示Bars。每当我将xAxis的Startvalue更改为任何高于0的值时,Bars随机消失。这是为什么?
Another Question is. I have added Regions
to my Chart
so it displays 'Bars' on specific values. Whenever I change the 'Startvalue' of my xAxis to any higher than '0', the Bars randomly disappear. Why is that?
推荐答案
您可以使用 setTickLabelFormatter
方法提供您自己的值。请参见 http:/ /docs.oracle.com/javafx/2/api/javafx/scene/chart/ValueAxis.html#setTickLabelFormatter(javafx.util.StringConverter)
You can provide your own values using setTickLabelFormatter
method. See http://docs.oracle.com/javafx/2/api/javafx/scene/chart/ValueAxis.html#setTickLabelFormatter(javafx.util.StringConverter)
PS:请分别提出第二个问题并提供代码示例
P.S.: please ask 2nd question separately and provide code sample
这篇关于是否可以在JavaFX 2.0中更改NumberAxis的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!