Commit b7e30991 by wangweidong

土工平台修改

parent 22874954
......@@ -49,12 +49,18 @@ import com.patzn.cloud.service.soil.vo.SoilUserVO;
import jcifs.smb.SmbFile;
import net.coobird.thumbnailator.Thumbnails;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.charts.LegendPosition;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xddf.usermodel.chart.AxisPosition;
import org.apache.poi.xssf.usermodel.*;
import org.apache.poi.xssf.usermodel.charts.XSSFChartLegend;
import org.apache.poi.xssf.usermodel.charts.XSSFValueAxis;
import org.openxmlformats.schemas.drawingml.x2006.chart.*;
import org.openxmlformats.schemas.drawingml.x2006.main.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
......@@ -482,6 +488,7 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
XSSFCell cell101 = sheet.getRow(10).getCell(1);
cell101.setCellFormula("10^(B8*LOG10(25)+B9)");
GenerateChart(sheet,"'界限含水率 (碟式液限仪多点法)'!$D$"+xBegin1+":"+"$D$"+xBegin3,"'界限含水率 (碟式液限仪多点法)'!$J$"+xBegin1+":$J$"+xBegin3);
xBegin1+=xStep;
xBegin2+=xStep;
xBegin3+=xStep;
......@@ -1211,6 +1218,94 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
return objectKey;
}
public void GenerateChart(XSSFSheet sheet,String xValue , String yValue) {
XSSFDrawing drawing = sheet.createDrawingPatriarch();
ClientAnchor anchor = drawing.createAnchor(13, 3, 25, 9, 0, 0, 6, 12);
XSSFChart chart = drawing.createChart(anchor);
chart.setTitleText("预选赛项目得分分布图");
chart.setAutoTitleDeleted(false);
CTChart ctChart = chart.getCTChart();
ctChart.addNewPlotVisOnly().setVal(true);
ctChart.addNewDispBlanksAs().setVal(STDispBlanksAs.Enum.forInt(2));
ctChart.addNewShowDLblsOverMax().setVal(false);
CTPlotArea ctPlotArea = ctChart.getPlotArea();
CTScatterChart scatterChart = ctPlotArea.addNewScatterChart();
scatterChart.addNewScatterStyle().setVal(STScatterStyle.LINE_MARKER);
scatterChart.addNewVaryColors().setVal(false);
scatterChart.addNewAxId().setVal(123456);
scatterChart.addNewAxId().setVal(123457);
CTCatAx ctCatAx = ctPlotArea.addNewCatAx();
ctCatAx.addNewAxId().setVal(123456);
CTScaling ctScaling = ctCatAx.addNewScaling();
ctScaling.addNewOrientation().setVal(STOrientation.MIN_MAX);
ctCatAx.addNewDelete().setVal(false);
ctCatAx.addNewAxPos().setVal(STAxPos.B);
ctCatAx.addNewCrossAx().setVal(123457);
ctCatAx.addNewTickLblPos().setVal(STTickLblPos.NEXT_TO);
CTValAx ctValAx = ctPlotArea.addNewValAx();
ctValAx.addNewAxId().setVal(123457);
CTScaling ctScaling1 = ctValAx.addNewScaling();
ctScaling1.addNewOrientation().setVal(STOrientation.MIN_MAX);
ctValAx.addNewDelete().setVal(false);
ctValAx.addNewAxPos().setVal(STAxPos.B);
ctValAx.addNewCrossAx().setVal(123456);
CTShapeProperties ctShapeProperties = ctValAx.addNewMajorGridlines().addNewSpPr();
CTLineProperties ctLineProperties = ctShapeProperties.addNewLn();
ctLineProperties.setW(9525);
ctLineProperties.setCap(STLineCap.Enum.forInt(3));
ctLineProperties.setCmpd(STCompoundLine.Enum.forInt(1));
ctLineProperties.setAlgn(STPenAlignment.Enum.forInt(1));
// 不显示Y轴上的坐标刻度线
ctValAx.addNewMajorTickMark().setVal(STTickMark.NONE);
ctValAx.addNewMinorTickMark().setVal(STTickMark.NONE);
ctValAx.addNewTickLblPos().setVal(STTickLblPos.NEXT_TO);
// 设置散点图内的信息
CTScatterSer ctScatterSer = scatterChart.addNewSer();
ctScatterSer.addNewIdx().setVal(0);
ctScatterSer.addNewOrder().setVal(0);
// 去掉连接线
ctPlotArea.getScatterChartArray(0).getSerArray(0).addNewSpPr().addNewLn().addNewNoFill();
// 设置散点图各图例的显示
CTDLbls ctdLbls = scatterChart.addNewDLbls();
ctdLbls.addNewShowVal().setVal(true);
ctdLbls.addNewShowLegendKey().setVal(false);
ctdLbls.addNewShowSerName().setVal(false);
ctdLbls.addNewShowCatName().setVal(false);
ctdLbls.addNewShowPercent().setVal(false);
ctdLbls.addNewShowBubbleSize().setVal(false);
// 设置标记的样式
CTMarker ctMarker = ctScatterSer.addNewMarker();
ctMarker.addNewSymbol().setVal(STMarkerStyle.Enum.forInt(3));
ctMarker.addNewSize().setVal((short) 5);
CTShapeProperties ctShapeProperties1 = ctMarker.addNewSpPr();
ctShapeProperties1.addNewSolidFill().addNewSchemeClr().setVal(STSchemeColorVal.Enum.forInt(5));
CTLineProperties ctLineProperties1 = ctShapeProperties1.addNewLn();
ctLineProperties1.setW(9525);
ctLineProperties1.addNewSolidFill().addNewSchemeClr().setVal(STSchemeColorVal.Enum.forInt(5));
CTAxDataSource ctAxDataSource = ctScatterSer.addNewXVal();
CTStrRef ctStrRef = ctAxDataSource.addNewStrRef();
ctStrRef.setF(xValue);
CTNumDataSource ctNumDataSource = ctScatterSer.addNewYVal();
CTNumRef ctNumRef = ctNumDataSource.addNewNumRef();
ctNumRef.setF(yValue);
}
@Override
public SoilExpReport saveExcelExpReport(String expName, Long entrustId, Long[] ids, Long templateId, Account account) {
RestAssert.fail(ArrayUtils.isEmpty(ids),"请选择试验项目!");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment