简体   繁体   English

使用JFreeCharts,如何分别对x轴标签和图例项目进行排序?

[英]With JFreeCharts, how can I sort the x-axis labels and legend items separately?

I have a multi-lined chart that contains the following data: 我有一个包含以下数据的多线图表:

Line 1: Name=B, X-Axis Label=A Line 2: Name=A, X-Axis Label=C Line 3: Name=C, X-Axis Label=B 第1行:名称= B,X轴标签= A第2行:名称= A,X轴标签= C第3行:名称= C,X轴标签= B

I would like the x-axis labels to show up in the order: A, B, C, and I would like for the legend items to display in that same order. 我希望x轴标签按以下顺序显示:A,B,C,并且我希望图例项目以相同的顺序显示。 However, depending on the order the data is in when I give it to the chart, one of these may be true but not both. 但是,根据我将数据提供给图表时数据的顺序,其中之一可能是正确的,但不是全部。

Is there some class that can be overridden to order x-axis labels and another to order legend items? 是否可以重写某些类以订购x轴标签,而另一类可以订购图例项目? Or is there an alternative/better solution? 还是有替代/更好的解决方案?

Any help or suggestions would be appreciated, thank you. 任何帮助或建议,将不胜感激,谢谢。

在渲染器中重写getLegendItems()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM