在Jfreechart中将条形与条形标签对齐 [英] Align bars with bar labels in Jfreechart

查看:141
本文介绍了在Jfreechart中将条形与条形标签对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据标签与此图表中的正确条形对齐有问题。

此条形图是使用jsp中的jfreechart生成的。

I have a problem with data labels to align with correct bar in this chart.
This bar chart is generated using jfreechart in jsp.

推荐答案

这是JFreeChart中一个非常常见的错误。图表中的每个类别('abc','xyz'等)都有6个系列中每个类别的值('q1','q2'...'q6'),因此总共有36个数据项。但是其中30个数据项为空,因为您没有指定它们。当数据值为空时,JFreeChart会留下条形图出现的空格。

This is a pretty common mistake in JFreeChart. Each category in your chart ('abc', 'xyz' etc) has a value for each of the 6 series ('q1', 'q2' ... 'q6'), so there are 36 data items in all. But 30 of those data items are null, because you didn't specify them. JFreeChart leaves a space where the bar would appear, when the data value is null.

如果你真的只有六个数据值,你应该有一个包含6个类别的系列,或者一个类别和六个系列。

If you really have only six data values, you should have one series with 6 categories, or one category and six series.

这篇关于在Jfreechart中将条形与条形标签对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆