Apache POI Line Chart colors

后端 未结 2 560
花落未央
花落未央 2021-01-20 11:42

I am creating an Excel file with some statistics, also including line charts. I had succeed in creating charts and filling them with data. But I am not satisfied with defaul

2条回答
  •  不要未来只要你来
    2021-01-20 12:07

    It works for me. Groovy, PieChart, random colors.

    def ctChart = chart.getCTChart()
    def ctPieChart = ctChart.getPlotArea().addNewPieChart()
    def ctPieSer = ctPieChart.addNewSer()
    
    byte[] b = new byte[3];
    
    (0 .. rows).each {
      random.nextBytes(b)
      def x = ctPieSer.addNewDPt()
      x.addNewIdx().setVal(it)
      x.addNewBubble3D().setVal(false)
      x.addNewSpPr().addNewSolidFill().addNewSrgbClr().setVal(b)
    }
    

提交回复
热议问题