此案例是用swing显示数据的。须要引入jfreechart相关包。不同版本号可能包不同样。本人用的是
此案例在ssi框架下会报错,不用框架就没问题。
Java后台逻辑代码:
public class BarChart {
ChartPanel frame1;
public BarChart() {
CategoryDataset dataset = getDataSet();
JFreeChart chart = ChartFactory.createBarChart3D("水果", // 图表标题
"水果种类", // 文件夹轴的显示标签
"数量", // 数值轴的显示标签
dataset, // 数据集
PlotOrientation.VERTICAL, // 图表方向:水平、垂直
true, // 是否显示图例(对于简单的柱状图必须是false)
false, // 是否生成工具
false // 是否生成URL链接
);
// 从这里開始
CategoryPlot plot = chart.getCategoryPlot();// 获取图表区域对象
CategoryAxis domainAxis = plot.getDomainAxis(); // 水平底部列表
domainAxis.setLabelFont(new