Microsoft Excel のようなチャート軸の自動単位の処理
Contents
[
Hide
]
考えられる使用シナリオ
Aspose.Cells の初期のバージョンでは、グラフが画像または PDF にレンダリングされたときに、グラフ軸の自動単位を適切に処理できませんでした。現在、Aspose.Cells は、グラフ軸の自動単位の処理をサポートしています。コードの変更はありません。グラフを画像または PDF に変換するだけで、Microsoft Excel がレンダリングするのと同じようにグラフ軸がレンダリングされます。
Microsoft Excel のようなチャート軸の自動単位の処理
次のサンプル コードは、サンプル Excel ファイルを生成し、出力 PDF チャート.スクリーンショットは、グラフ軸の自動単位を赤い四角形で示し、サンプルの Excel ファイル グラフと出力 PDF グラフを比較しています。どちらもまったく同じです。
サンプルコード
This file contains hidden or 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"); |