• 大小: 3.6MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-13
  • 语言: Java
  • 标签: Java  SSH  饼图  

资源简介

主要是通过SSH框架所实现的显示饼图跟柱状图。

资源截图

代码片段和文件信息

package actions;

import java.awt.Font;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.List;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.labels.StandardPieSectionLabelGenerator;
import org.jfree.chart.plot.PiePlot3D;
import org.jfree.chart.title.Legendtitle;
import org.jfree.chart.title.Texttitle;
import org.jfree.data.general.DefaultPieDataset;

import services.ResultService;

import com.opensymphony.xwork2.ActionSupport;

import entity.Results;

public class ResultAction extends ActionSupport {



private JFreeChart chart;
private ResultService resultService;



public JFreeChart getChart() {
chart=ChartFactory.createPieChart3D(“学生成绩分析“ getDataset() true false false);
chart.settitle(new Texttitle(“学生成绩分析“new Font(“黑体“Font.ITALIC22)));


Legendtitle legend=chart.getLegend();
legend.setItemFont(new Font(“宋体“ Font.ITALIC 14));


PiePlot3D plot=(PiePlot3D) chart.getPlot();
plot.setLabelFont(new Font(“隶书“ Font.ITALIC 18));

      plot.setBackgroundAlpha(0.9f);
      plot.setForegroundAlpha(0.50f);
      
      String unitstyle=“{0}={1}({2})“;
      plot.setLabelGenerator(new StandardPieSectionLabelGenerator(unitstyleNumberFormat.getNumberInstance()new DecimalFormat(“0.00%“)));
      plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator(unitstyleNumberFormat.getNumberInstance()new DecimalFormat(“0.00%“)));

      return chart;
}

  



public void setChart(JFreeChart chart) {
this.chart = chart;
}

public ResultService getResultService() {
return resultService;
}

public void setResultService(ResultService resultService) {
this.resultService = resultService;
}


private List resultList;

public List getResultList() {
return resultList;
}

public void setResultList(List resultList) {
this.resultList = resultList;
}

@Override
public String execute() throws Exception {
resultList=resultService.findAll();
return SUCCESS;
}



private DefaultPieDataset getDataset(){
DefaultPieDataset dataset=new DefaultPieDataset();
for(Results  result:resultList){
dataset.setValue(result.getComm() result.getTotal());
}
return dataset;

}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1340  2014-08-05 09:32  pieDemo\.classpath

     文件        534  2014-08-05 09:38  pieDemo\.myhibernatedata

     文件        294  2014-09-08 17:10  pieDemo\.mymetadata

     文件        240  2014-08-05 09:32  pieDemo\.mystrutsdata

     文件       2243  2014-08-05 09:34  pieDemo\.project

     文件        500  2014-08-05 09:31  pieDemo\.settings\.jsdtscope

     文件        364  2014-08-05 09:31  pieDemo\.settings\org.eclipse.jdt.core.prefs

     文件        459  2014-08-05 09:31  pieDemo\.settings\org.eclipse.wst.common.component

     文件        252  2014-08-05 09:31  pieDemo\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2014-08-05 09:31  pieDemo\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2014-08-05 09:31  pieDemo\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件        462  2014-08-05 09:32  pieDemo\.springBeans

     文件       2386  2014-08-05 11:25  pieDemo\src\actions\ResultAction.java

     文件       2515  2014-08-05 11:21  pieDemo\src\actions\ZhuZhuangActon.java

     文件       1570  2014-08-05 11:23  pieDemo\src\applicationContext.xml

     文件        396  2014-08-05 09:45  pieDemo\src\dao\impl\ResultDaoImpl.java

     文件        134  2014-08-05 09:42  pieDemo\src\dao\ResultDao.java

     文件        922  2014-08-05 09:38  pieDemo\src\entity\Results.hbm.xml

     文件        956  2014-08-05 09:39  pieDemo\src\entity\Results.java

     文件        406  2014-08-05 09:48  pieDemo\src\services\impl\ResultServiceImpl.java

     文件        143  2014-08-05 09:46  pieDemo\src\services\ResultService.java

     文件        783  2014-08-05 11:07  pieDemo\src\struts.xml

     文件        640  2014-08-05 11:08  pieDemo\WebRoot\index.jsp

     文件         36  2014-08-05 09:31  pieDemo\WebRoot\meta-INF\MANIFEST.MF

     文件       3831  2014-08-05 11:25  pieDemo\WebRoot\WEB-INF\classes\actions\ResultAction.class

     文件       3987  2014-08-05 11:21  pieDemo\WebRoot\WEB-INF\classes\actions\ZhuZhuangActon.class

     文件       1570  2014-08-05 11:23  pieDemo\WebRoot\WEB-INF\classes\applicationContext.xml

     文件        851  2014-08-05 11:15  pieDemo\WebRoot\WEB-INF\classes\dao\impl\ResultDaoImpl.class

     文件        201  2014-08-05 11:15  pieDemo\WebRoot\WEB-INF\classes\dao\ResultDao.class

     文件       1348  2014-08-05 11:15  pieDemo\WebRoot\WEB-INF\classes\entity\Results.class

............此处省略32个文件信息

评论

共有 条评论