package test;import orgapachepoissusermodelClientAnchor;import orgapachepoissusermodelSheet;import orgapachepoissusermodelWorkbook;import orgapachepoixssfusermodelXSSFChart;import orgapachepoixssfuser
要将横坐标轴的时间显示间隔调大一点,需要修改以下代码:
- 找到创建横坐标轴的代码段:
//cat axis 1 (lines)
CTCatAx ctCatAx = ctPlotArea.addNewCatAx();
ctCatAx.addNewAxId().setVal(123456); //id of the cat axis
CTScaling ctScaling = ctCatAx.addNewScaling();
ctScaling.addNewOrientation().setVal(STOrientation.MIN_MAX);
ctCatAx.addNewDelete().setVal(false);
ctCatAx.addNewAxPos().setVal(STAxPos.B);
ctCatAx.addNewCrossAx().setVal(123457); //id of the val axis
ctCatAx.addNewTickLblPos().setVal(STTickLblPos.NEXT_TO);
- 在该代码段中,找到
ctScaling.addNewOrientation().setVal(STOrientation.MIN_MAX);这一行,将STOrientation.MIN_MAX改为STOrientation.MAX_MIN。修改后的代码如下:
//cat axis 1 (lines)
CTCatAx ctCatAx = ctPlotArea.addNewCatAx();
ctCatAx.addNewAxId().setVal(123456); //id of the cat axis
CTScaling ctScaling = ctCatAx.addNewScaling();
ctScaling.addNewOrientation().setVal(STOrientation.MAX_MIN);
ctCatAx.addNewDelete().setVal(false);
ctCatAx.addNewAxPos().setVal(STAxPos.B);
ctCatAx.addNewCrossAx().setVal(123457); //id of the val axis
ctCatAx.addNewTickLblPos().setVal(STTickLblPos.NEXT_TO);
- 保存并运行代码,生成修改后的Excel文件。
原文地址: http://www.cveoy.top/t/topic/iiZK 著作权归作者所有。请勿转载和采集!