JFreechart-XYChart上的垂直X轴标签 [英] JFreechart - vertical X-axis labels on an XYChart

查看:35
本文介绍了JFreechart-XYChart上的垂直X轴标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个XYLineChart,其中X轴上的标签是水平书写的.我希望能够垂直(降序)编写它们.

I have an XYLineChart, where the labels on the X axis are written horizontally. I would like to be able to write them vertically (descending).

我已经可以为BarCharts做到这一点了

I can already do this for BarCharts:

CategoryPlot plot = (CategoryPlot) chart.getPlot();
final CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);

,但是XYChart返回XYPlot,而不是CategoryPlot,并且XYPlot的getDomainAxis()返回ValueAxis,而不是CategoryAxis.ValueAxis让我打电话

but an XYChart returns an XYPlot, rather than a CategoryPlot, and the getDomainAxis() of an XYPlot returns a ValueAxis, not a CategoryAxis. ValueAxis lets me call

setVerticalTickLabels(true);

几乎快到了!但是它使它们上升而不是下降.可以解决这个问题吗?

which is almost there! But it draws them ascending, rather than descending. Any way around this?

谢谢

我需要域轴保持在图表的底部.撰写原始帖子时没有考虑过其他任何方式.

I need the domain axis to stay at the bottom of the chart. Hadn't considered it being any other way when making the original post.

推荐答案

回答我自己的问题,这似乎是不可能的,所以我不得不自己将功能添加到jfreechart源中.

Answering my own question, this didn't seem to be possible, so I had to add the functionality to the jfreechart source myself.

这篇关于JFreechart-XYChart上的垂直X轴标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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