JFreeChart 饼图上的注释
具体来说,我希望将文本注释添加到 JFreeChart 的特定位置,该 JFreeChart 正在输出到 png 文件以供 Web 使用。 注释可以/如何添加到饼图中。 我已经能够成功地将注释添加到 XY 图,但不知道如何覆盖或添加注释到 PiePlot。
我的全部任务是使用 PiePlot 创建一种时钟。 到目前为止,一切都很顺利,但现在我需要在 12、3、6 和 9 点钟位置添加标签,完全被难住了。
亚当
Specifically I am looking to add text annotations to specific locations to a JFreeChart that is being output to a png file for web use. Can/how do annotations get added to pie charts. I have been able to successfully add annotations to XYPlots, but don't know how to overlay or add one to a PiePlot.
My full task is to use the PiePlot to create a sort of clock. So far everything has worked great, but now I need to add labels at the 12, 3, 6, and 9 o'clock locations and completely stumped.
Adam
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个老问题,但这是我如何使用极坐标图做类似的事情(在 1、2、3、... 点钟位置进行注释)。 它使用 ChoiceFormatter 和 NumberTickUnit:
最终看起来像 http://img522.imageshack.us /img522/6693/hapihours.jpg
Bit of an old question, but here's how I did something similar (annotation at 1, 2, 3, ... o'clock positions) using a polar plot. It uses a ChoiceFormatter and the NumberTickUnit:
winds up looking like http://img522.imageshack.us/img522/6693/hapihours.jpg
经过相当艰苦的搜索后,我认为目前这是不可能的(JFreeChart 1.0.13)。
可能的选项有:
使用 XYPlot 创建第二个图表,以生成带有所需注释的第二个图像。 将此图像叠加在页面上。 此选项不好,因为它会使要上传的图表图像数量增加一倍。
将图像设置为页面背景,并在图像上设置 HTML 文本。 不好是因为它不可维护并且使数据传输令人头痛。
就我个人而言,我只是想找到另一种方式来传达标题中的信息,但我想将我的发现发布给下一个人。
亚当
After a fairly strenuous search I don't believe this is currently possible (JFreeChart 1.0.13).
Possible options are:
Create a second chart with an XYPlot to generate a second image with needed annotations. Overlay this image on the page. This option is bad because it doubles the number of chart images to be uploaded.
Set the image as a background on the page and HTML the text over the image. Bad because it isn't maintainable and makes a headache of data transfer.
Personally I am just going to find another way to communicate the information in the title, but I wanted to post my findings for the next person.
Adam