[英]Category Axis Label Expression Alignment In jasper Report through Java code
Is there any way, to change Category Axis Label Expression's Alignment of a Chart in Jasper Report through Java Code. 有什么方法可以通过Java代码更改Jasper Report中图表的类别轴标签表达式的对齐方式。 I want Left alignment of Category Axis Label Expression.
我想要类别轴标签表达式的左对齐。 As shown the picture below, I want "hello" to be left aligned.
如下图所示,我希望“ hello”保持对齐。
Starting with BarChartDemo1
, included in the distribution, the changes below create a bar chart with an axis label having its location set to the LOW_END
. 从分发中包含的
BarChartDemo1
开始,以下更改将创建一个条形图,其轴标签的位置设置为LOW_END
。 For PlotOrientation.VERTICAL
, that means aligned on the left. 对于
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);
Try doing the same for the range axis to see the effect: 尝试对范围轴执行相同操作以查看效果:
rangeAxis.setLabelLocation(AxisLabelLocation.LOW_END);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.