从JavaFX图表中删除轴 [英] Remove an axis from JavaFX Chart

查看:143
本文介绍了从JavaFX图表中删除轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 XYChart ,数值不同(例如温度和压力),所以我想在我的图表旁边绘制自己的轴。要做到以下我不知道YAxis,我应该怎么做?

I've created a XYChart with numerical values different (for example temperatue with pressure) so I want to draw my own axeS just beside my chart. To do the following I've to unshow the YAxis, how should I do that ?

推荐答案

通过使用技巧:图表需要Y轴保持原位,以便知道在哪里呈现您的内容。但是,你可以隐藏它。隐藏刻度标签并使用以下代码将轴的不透明度设置为0:

By using a trick: The Chart needs the Y Axis to remain in place so it knows where to render your content. You can, however, hide it. Hide the tick labels and set the axis' opacity to 0 using this code:

    chart.getYAxis().setTickLabelsVisible(false);
    chart.getYAxis().setOpacity(0);

轴仍然在那里,但未显示。

The axis will still be there, but not shown.

这篇关于从JavaFX图表中删除轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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