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).
I can already do this for BarCharts:
CategoryPlot plot = (CategoryPlot) chart.getPlot();
final CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
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?
Thanks,
Edit: 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.
ValueAxis
does this automatically in drawTickMarksAndLabels()
for an axis on the RectangleEdge.TOP
edge:
xyPlot.setDomainAxisLocation(AxisLocation.TOP_OR_LEFT);
Example based on a variation of ScatterAdd
.
回答我自己的问题,这似乎是不可能的,因此我不得不自己将功能添加到jfreechart源。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.