gpt4 book ai didi

java - 通过Java代码在jasper Report中类别轴标签表达式对齐

转载 作者:行者123 更新时间:2023-12-01 09:59:25 24 4
gpt4 key购买 nike

有没有办法通过Java代码更改Jasper Report中图表的类别轴标签表达式的对齐方式。我想要类别轴标签表达式左对齐。如下图所示,我希望“hello”左对齐。

given picture

最佳答案

BarChartDemo1 开头,包含在分布中,下面的更改创建了一个条形图,其轴标签的位置设置为LOW_END。对于 PlotOrientation.VERTICAL,这意味着左侧对齐。

JFreeChart chart = ChartFactory.createBarChart(
"Performance: JFreeSVG vs Batik",
"$P{hello}" /* x-axis label*/,
"Milliseconds" /* y-axis label */,
dataset, PlotOrientation.VERTICAL, false, false, false);

CategoryPlot plot = (CategoryPlot) chart.getPlot();
CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setLabelLocation(AxisLabelLocation.LOW_END);

image

尝试对范围轴执行相同的操作以查看效果:

rangeAxis.setLabelLocation(AxisLabelLocation.LOW_END);

关于java - 通过Java代码在jasper Report中类别轴标签表达式对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36934604/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com