Microsoft Excelのようにチャートの軸の自動単位を処理する
Contents
[
Hide
]
可能な使用シナリオ
Aspose.Cellsの初期バージョンは、チャートが画像やPDFにレンダリングされたときにチャートの軸の自動単位を適切に処理できませんでした。現在、Aspose.Cellsはチャートの軸の自動単位の処理をサポートしています。コード変更は必要ありません。チャートを画像またはPDFに変換すると、Microsoft Excelがそれをレンダリングするのと同じようにチャート軸をレンダリングします。
Microsoft Excelのようにチャートの軸の自動単位を処理する
次のサンプルコードは、サンプルExcelファイルをロードし、出力PDFチャートを生成します。スクリーンショットは、チャートの軸の自動単位を赤い四角で示し、サンプルExcelファイルのチャートと出力PDFチャートを比較します。どちらも全く同じです。
サンプルコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
//Load the sample Excel file | |
Workbook wb = new Workbook("sampleHandleAutomaticUnitsOfChartAxisLikeMicrosoftExcel.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Access first chart | |
Chart ch = ws.getCharts().get(0); | |
//Render chart to pdf | |
ch.toPdf("outputHandleAutomaticUnitsOfChartAxisLikeMicrosoftExcel.pdf"); |