Apache poi Excel line chart points

前端 未结 2 1266
礼貌的吻别
礼貌的吻别 2020-11-29 13:44

I am creating an Excel file with line chart. I\'ve created chart and filled it with data but I cannot create points on my chart. Does anyone know, is there a way I could gen

相关标签:
2条回答
  • 2020-11-29 13:58

    Solution:

    CTPlotArea plotArea = xssfChart.getCTChart().getPlotArea();
    CTMarker ctMarker = CTMarker.Factory.newInstance();
    ctMarker.setSymbol(CTMarkerStyle.Factory.newInstance());
    for (CTLineSer ser : plotArea.getLineChartArray()[0].getSerArray()) {
        ser.setMarker(ctMarker);
    }
    
    0 讨论(0)
  • 2020-11-29 14:13

    Following code will give you what exactly you are looking for

        CTPlotArea plotArea = xssfChart.getCTChart().getPlotArea();
        plotArea.getLineChartArray()[0].getSmooth();
        CTMarker ctMarker = CTMarker.Factory.newInstance();
        ctMarker.setSymbol(CTMarkerStyle.Factory.newInstance());
        CTBoolean ctBool = CTBoolean.Factory.newInstance();
        ctBool.setVal(false);
        plotArea.getLineChartArray()[0].setSmooth(ctBool);
        for (CTLineSer ser : plotArea.getLineChartArray()[0].getSerArray()) {
            ser.setSmooth(ctBool);
            ser.setMarker(ctMarker);
        }
    
    0 讨论(0)
提交回复
热议问题