如何在碧玉报告的蜘蛛图框架中设置类别名称

How to set the category name with in the spider chart frame in jasper report

我已经使用 jasper 报告做了一个蜘蛛图,我能够很好地获取数据,但是在类别中有一个问题,如果我的那个类别的名字很大,那么它最后会省略几个词,这是走出蜘蛛图的框架。我可以让它定位浮动,也可以为类别设置拉伸类型吗?有没有办法把我的类别名称放在我的蜘蛛图的框架中。

在上面的蜘蛛图中,我找不到“驱动程序 2 中的性能维护”。请帮我找到解决办法。

蜘蛛网是由 库创建的。没有自动边界检测或标签换行。

这是让标签可见的方法:

  • 增加 interiorGap,最多 MAX_INTERIOR_GAP = 0.40

  • 减小labelFont大小

  • 旋转蜘蛛图集startAngle

jrxml 中的示例

<sc:spiderPlot startAngle="90.0" interiorGap="0.4">
    <labelFont>
        <font size="8.0"/>
    </labelFont>
</sc:spiderPlot>

如果您需要完全控制标签的生成方式,您需要创建自己的图表定制器 class 扩展 AbstractChartCustomizer。这将暴露

public void customize(JFreeChart chart, ChartComponent chartComponent)
{
  //1. Here you need to make your own SpiderWebPlot overriding the drawLabel
  //2. Create a new JFreeChart using the datasource and your plot
  //3. Set the chart to your new JFreeChart
}

这种方法的复杂性相当大,超出了这个问题的范围