如何指定JFreeChart图表图例的位置和布局 [英] How to specify the position and layout of a JFreeChart chart legend

查看:440
本文介绍了如何指定JFreeChart图表图例的位置和布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JFreeChart渲染堆积面积图.默认情况下,图表图例显示在图的下方,并且元素水平放置.我希望图例以垂直列表的形式出现在图的右侧.

I am using JFreeChart to render a stacked area chart. By default, the chart legend is rendered below the plot with the elements laid out horizontally. I would like the legend to appear on the right of the plot with the elements laid out as a vertical list.

这有可能吗?如果可以,我该怎么办?

Is this possible and, if so, how do I do it?

推荐答案

再花一点时间检查API就会给我答案:

A little more time examining the API would have given me the answer:

LegendTitle legend = chart.getLegend();
legend.setPosition(RectangleEdge.RIGHT);

这篇关于如何指定JFreeChart图表图例的位置和布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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