删除JavaFX 2 LineChart图例项 [英] Remove JavaFX 2 LineChart Legend Items

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

问题描述

我有一个折线图与许多系列。这些系列分为一个或多个超级系列。每个超级系列在行中可以具有许多中断,以便准确地描述监视进程何时不主动收集数据。



我已经成功地克服了一些技术问题,例如图表为每个新系列分配了一种新颜色,图表线符号颜色不匹配系列颜色等。所有的工作相当好,除了每次我添加一个新的系列到图表,它添加一个项目到图例。



有没有办法从图例中删除项目,或者我必须隐藏默认图例并添加我自己的自定义图例窗格吗?

解决方案

不显示图例

  chart.setLegendVisible 

然后,您可以创建自己的自定义窗格来制作自己的图例, / p>

I have a line chart with many series. These series are grouped into one or more super-series. Each super-series may have many "breaks" in the line in order to accurately depict when a monitor process is not actively collecting data. Each data break is actually starting a new series.

I have been able to successfully overcome several technical issues with this such as the chart assigning a new color to each new series, chart line symbol color not matching the series color, etc. All is working quite well right now, except that each time I add a new series to the chart, it adds an item to the legend.

Is there a way to remove items from the legend, or do I have to hide the default legend and add my own custom legend pane?

解决方案

Don't show the legend:

chart.setLegendVisible(false);

You can then create your own custom pane to make your own legend and render it how you wish.

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

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