Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在JFreeChart spider图表中显示值_Java_Charts_Jfreechart - Fatal编程技术网

Java 在JFreeChart spider图表中显示值

Java 在JFreeChart spider图表中显示值,java,charts,jfreechart,Java,Charts,Jfreechart,默认情况下,的蜘蛛网图不显示接近标记点的值: 要显示数字,必须做些什么 这就是我现在所拥有的,在返回StreamedContent的方法中(对于PrimeFaces'p:graphicImage: CategoryDataset categorydataset = createCategoryDataset(displayBy, configuration, null); SpiderWebPlot plot = new SpiderWebPlot(categorydataset); plot

默认情况下,的蜘蛛网图不显示接近标记点的值:

要显示数字,必须做些什么

这就是我现在所拥有的,在返回
StreamedContent
的方法中(对于PrimeFaces'
p:graphicImage

CategoryDataset categorydataset = createCategoryDataset(displayBy, configuration, null);
SpiderWebPlot plot = new SpiderWebPlot(categorydataset);
plot.setInteriorGap(0.40);
plot.setNoDataMessage("No data available");
plot.setStartAngle(0);
plot.setLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", NumberFormat.getInstance()));
plot.setWebFilled(true);

JFreeChart chart = new JFreeChart(title, TextTitle.DEFAULT_FONT, plot, true);

File chartFile = new File(String.valueOf(new Random().nextLong()));
ChartUtilities.saveChartAsPNG(chartFile, chart, 375, 300);
return new DefaultStreamedContent(new FileInputStream(chartFile), "image/png");
编辑:在@trashgood的建议后,出现了一些值,但在预期的位置没有。我想要
columnKey
值,而不是'rowKey'值():

要显示数字,必须做些什么

可以使用标签在打印上标记点,如图所示

重要的是其他三点


看起来您可能可以添加第二个系列,一个带有第二个
行键的系列,以便获得与这些点相关联的标签。

使用
CategoryItemLabelGenerator
,如图所示。这样做了。现在我用该方法创建了数据集,它有值,因为我现在调试了它。没有显示任何内容。
plot.setLabelGenerator(新的StandardCategoryItemLabelGenerator(){@Override公共字符串generateColumnLabel(CategoryDataset dataset,int col){return dataset.getColumnKey(col)+“TESTE”+dataset.getValue(0,col);}}};
Edited,查看所做的更改。一些值出现在预期的位置,但没有。我需要它们放在“点”旁边.我不明白;标签怎么不在点的旁边?见我的版本。最后一张照片。