日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java窗体线条切换消失_java – 如何更改apache poi生成的图表不使用平滑线条并将空单元格显示为间隙?...

發布時間:2025/3/8 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java窗体线条切换消失_java – 如何更改apache poi生成的图表不使用平滑线条并将空单元格显示为间隙?... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我使用的是POI 3.12-beta1,并且代碼可以在圖例中創建包含多個數據集和命名系列的折線圖.但是,poi中折線圖的默認設置會生成一條已在數據點上平滑的線.空值也被繪制為0,但我們希望這些線在第一列停止,其中有一個空單元格.

一旦在xlsx文件中呈現并更改這些設置,我就可以進入圖表屬性,但我們需要使用這些設置渲染xlsx.我在可用的API中找不到任何更改這些設置的內容.

Drawing drawing = sheet.createDrawingPatriarch();

ClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 0, 17, 18, 30);

Chart chart = drawing.createChart(anchor);

ChartLegend legend = chart.getOrCreateLegend();

legend.setPosition(LegendPosition.RIGHT);

LineChartData data = chart.getChartDataFactory().createLineChartData();

ChartAxis bottomAxis = chart.getChartAxisFactory().createCategoryAxis(AxisPosition.BOTTOM);

ValueAxis leftAxis = chart.getChartAxisFactory().createValueAxis(AxisPosition.LEFT);

leftAxis.setCrosses(AxisCrosses.AUTO_ZERO);

int row = 2;

int startCol = 3;

int endCol = 17;

boolean abs = false;

ChartDataSource xs = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(row, row, startCol, endCol));

row = 10;

int seriesCol = 0;

ChartDataSource ys1 = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(row, row, startCol, endCol));

LineChartSerie ser1 = data.addSerie(xs, ys1);

ser1.setTitle(new CellReference(sheet.getSheetName(), row, seriesCol, abs, abs));

row = 11;

ChartDataSource ys2 = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(row, row, startCol, endCol));

LineChartSerie ser2 = data.addSerie(xs, ys2);

ser2.setTitle(new CellReference(sheet.getSheetName(), row, seriesCol, abs, abs));

row = 12;

ChartDataSource ys3 = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(row, row, startCol, endCol));

LineChartSerie ser3 = data.addSerie(xs, ys3);

ser3.setTitle(new CellReference(sheet.getSheetName(), row, seriesCol, abs, abs));

chart.plot(data, new ChartAxis[] { bottomAxis, leftAxis });

總結

以上是生活随笔為你收集整理的java窗体线条切换消失_java – 如何更改apache poi生成的图表不使用平滑线条并将空单元格显示为间隙?...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。