サンバーストチャートの作成方法

可能な使用シナリオ

ツリーマップチャートは、階層内での比較に適していますが、最大のカテゴリと各データポイントの階層レベルを示すのは得意ではありません。サンバーストチャートは、それを示すためのより良いビジュアルチャートです。サンバーストチャートは階層データを表示するのに最適です。階層の各レベルは、内側の円またはサークルで表されます。階層構造のデータがないサンバーストチャート(1つのカテゴリレベル)は、ドーナツチャートに似ています。ただし、複数のカテゴリレベルを持つサンバーストチャートは、外側のリングが内側のリングと関連する方法を示します。サンバーストチャートは、どのリングが寄与する要素に分割されるかを示すのに最も効果的です。他の種類の階層チャートであるツリーマップチャートは、相対的なサイズを比較するのに最適です。

todo:image_alt_text

サンバーストチャート

以下のコードを実行すると、下記のサンバーストチャートが表示されます。

todo:image_alt_text

サンプルコード

下記のサンプルコードは、サンプルExcelファイルを読み込み、出力Excelファイルを生成します。

from aspose.cells import Workbook
from aspose.cells.charts import ChartType
from aspose.cells.drawing import FillType
# Create an instance of Workbook
workbook = Workbook("sunburst.xlsx")
# Access the first worksheet
worksheet = workbook.worksheets[0]
# Add a Treemap chart
pieIdx = worksheet.charts.add(ChartType.SUNBURST, 5, 6, 25, 12)
# Retrieve the Chart object
chart = worksheet.charts[pieIdx]
# Set the legend can be showed
chart.show_legend = True
# Set the chart title name
chart.title.text = "Sunburst Chart"
# Add series data range
chart.n_series.add("D2:D16", True)
# Set category data(A2:A16 is incorrect,as hierarchical catogory)
chart.n_series.category_data = "A2:C16"
# Show the DataLabels with category names
chart.n_series[0].data_labels.show_category_name = True
# Fill the PlotArea area with nothing
chart.plot_area.area.fill_format.fill_type = FillType.NONE
# Save the Excel file
workbook.save("out.xlsx")