XYPlot plot = chart.getXYPlot();
plot.setForegroundAlpha(0.5f);
XYItemRenderer renderer = plot.getRenderer();
renderer.setToolTipGenerator(
new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
new **DateFormat(yyyy-MM),
new DecimalFormat( "0 )
)
);
DateAxis dateAxis = new DateAxis( "时间 ");
dateAxis.setDateFormatOverride(new **DateFormat( "yyyy-MM ")); dateAxis.setAutoRange(true);
dateAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
plot.setDomainAxis(dateAxis);
//为柱图设置“数据挖陷”
//第一个参数是跳转的连接地址
renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator(
"detail.jsp", "fruit", ""));
本文介绍如何使用Java配置图表的时间轴,包括设置日期格式、透明度、工具提示以及为柱状图添加链接。
4175

被折叠的 条评论
为什么被折叠?



