读书人

请教: 小弟我用jfreechart做出了柱状图

发布时间: 2012-01-29 21:39:32 作者: rapoo

请问: 我用jfreechart做出了柱状图,怎么可以在柱体上加上链接呢?
我用jfreechart实现了柱状图,怎么可以在柱体上加上链接呢?
就是可以点击柱体转向或弹出新的页面.
可以加的话,又怎么控制它是新开窗口还是在本页打开呢?先谢了..

部分代码:
.......................
JFreeChart chart = ChartFactory.createBarChart3D(
null,
null,
null,
dataset,
PlotOrientation.VERTICAL,
false,false,false);
//设置整个图表背景
chart.setBackgroundPaint(Color.GREEN);

Font font=new Font( "宋体 ",Font.ITALIC, 6);

CategoryPlot plot = chart.getCategoryPlot();

//设置绘图区背景
plot.setBackgroundPaint(Color.ORANGE);
//设置绘图区线条颜色
plot.setRangeGridlinePaint(Color.RED);

CategoryAxis domainAxis = plot.getDomainAxis();
//设置绘图区柱体的左边距
domainAxis.setLowerMargin(0.01);
//设置绘图区柱体的右边距
domainAxis.setUpperMargin(0.01);

domainAxis.setTickLabelFont(new Font( "宋体 ",Font.ITALIC, 7));

plot.setDomainAxis(domainAxis);

ValueAxis rangeAxis = plot.getRangeAxis();
//设置数值轴的字体
rangeAxis.setTickLabelFont(new Font( "宋体 ",Font.ITALIC, 8));
BarRenderer3D renderer = new BarRenderer3D();
renderer.setBaseOutlinePaint(Color.BLACK);
..................


[解决办法]
好像是用 <map 的一个标记,
JFreeChart可以生成这个文什的

读书人网 >Java Web开发

热点推荐