PowerTools SPREAD for Windows Forms 10.0J
サンバーストチャートの作成

サンバーストチャートを使用して、階層データを表示できます。このグラフでは、個々の階層レベルは1つのリング(円)として表現されます。最も内側の円が、階層の最上位のデータです。

次の図は、複数のリングから成るデータを示します。

サンバーストチャートを追加するには、SunburstSeriesおよびSunburstPlotAreaクラスを使用します。

SPREADデザイナまたはチャートデザイナを使用したグラフの作成については、「SPREAD上でのチャートの使用」または「チャートの追加」を参照してください。

設定方法

  1. シートにデータを設定します。
  2. シートのAddChartメソッドを使用して、1.のデータを参照するチャートを追加します。

サンプルコード

次のサンプルコードは、サンバーストチャートを作成します。

C#
コードのコピー
fpSpread1.ActiveSheet.Cells[0, 0].Text = "Quarter";
fpSpread1.ActiveSheet.Cells[0, 1].Text = "Month";
fpSpread1.ActiveSheet.Cells[0, 2].Text = "Week";
fpSpread1.ActiveSheet.Cells[0, 3].Text = "Sales";
fpSpread1.ActiveSheet.Cells[1, 0].Text = "1st";
fpSpread1.ActiveSheet.Cells[1, 1].Text = "Jan";
fpSpread1.ActiveSheet.Cells[1, 3].Value = 1.7;
fpSpread1.ActiveSheet.Cells[2, 1].Text = "Feb";
fpSpread1.ActiveSheet.Cells[2, 2].Text = "Wk1";
fpSpread1.ActiveSheet.Cells[2, 3].Value = 2.0;
fpSpread1.ActiveSheet.Cells[3, 2].Text = "Wk2";
fpSpread1.ActiveSheet.Cells[3, 3].Value = 1.0;
fpSpread1.ActiveSheet.Cells[4, 2].Text = "Wk3";
fpSpread1.ActiveSheet.Cells[4, 3].Value = 1.0;
fpSpread1.ActiveSheet.Cells[5, 2].Text = "Wk4";
fpSpread1.ActiveSheet.Cells[5, 3].Value = 1.5;
fpSpread1.ActiveSheet.Cells[6, 1].Text = "Mar";
fpSpread1.ActiveSheet.Cells[6, 3].Value = 3.0;
fpSpread1.ActiveSheet.Cells[7, 0].Text = "2nd";
fpSpread1.ActiveSheet.Cells[7, 1].Text = "Apr";
fpSpread1.ActiveSheet.Cells[7, 3].Value = 1.1;
fpSpread1.ActiveSheet.Cells[8, 1].Text = "May";
fpSpread1.ActiveSheet.Cells[8, 3].Value = 2.8;
fpSpread1.ActiveSheet.Cells[9, 1].Text = "Jun";
fpSpread1.ActiveSheet.Cells[9, 3].Value = 1.3;
fpSpread1.ActiveSheet.Cells[10, 0].Text = "3rd";
fpSpread1.ActiveSheet.Cells[10, 1].Text = "July";
fpSpread1.ActiveSheet.Cells[10, 3].Value = 1.7;
fpSpread1.ActiveSheet.Cells[11, 1].Text = "Aug";
fpSpread1.ActiveSheet.Cells[11, 3].Value = 1.6;
fpSpread1.ActiveSheet.Cells[12, 1].Text = "Sept";
fpSpread1.ActiveSheet.Cells[12, 3].Value = 2.1;
fpSpread1.ActiveSheet.Cells[13, 0].Text = "4th";
fpSpread1.ActiveSheet.Cells[13, 1].Text = "Oct";
fpSpread1.ActiveSheet.Cells[13, 3].Value = 1.4;
fpSpread1.ActiveSheet.Cells[14, 1].Text = "Nov";
fpSpread1.ActiveSheet.Cells[14, 3].Value = 2.0;
fpSpread1.ActiveSheet.Cells[15, 1].Text = "Dec";
fpSpread1.ActiveSheet.Cells[15, 2].Text = "Wk1";
fpSpread1.ActiveSheet.Cells[15, 3].Value = 3.0;
fpSpread1.ActiveSheet.AddChart(new FarPoint.Win.Spread.Model.CellRange(0, 0, 16, 4), typeof(FarPoint.Win.Chart.SunburstSeries), 550, 450, 300, 0);
FarPoint.Win.Chart.SunburstSeries sunseries = (FarPoint.Win.Chart.SunburstSeries)fpSpread1.Sheets[0].Charts[0].Model.PlotAreas[0].Series[0];
sunseries.Fills.AddRange(new FarPoint.Win.Chart.Fill[] { new FarPoint.Win.Chart.SolidFill(Color.MediumSeaGreen), null, null, null, null, null, new FarPoint.Win.Chart.SolidFill(Color.PaleGreen), null, null });
Visual Basic
コードのコピー
FpSpread1.ActiveSheet.Cells(0, 0).Text = "Quarter"
FpSpread1.ActiveSheet.Cells(0, 1).Text = "Month"
FpSpread1.ActiveSheet.Cells(0, 2).Text = "Week"
FpSpread1.ActiveSheet.Cells(0, 3).Text = "Sales"
FpSpread1.ActiveSheet.Cells(1, 0).Text = "1st"
FpSpread1.ActiveSheet.Cells(1, 1).Text = "Jan"
FpSpread1.ActiveSheet.Cells(1, 3).Value = 1.7
FpSpread1.ActiveSheet.Cells(2, 1).Text = "Feb"
FpSpread1.ActiveSheet.Cells(2, 2).Text = "Wk1"
FpSpread1.ActiveSheet.Cells(2, 3).Value = 2.0
FpSpread1.ActiveSheet.Cells(3, 2).Text = "Wk2"
FpSpread1.ActiveSheet.Cells(3, 3).Value = 1.0
FpSpread1.ActiveSheet.Cells(4, 2).Text = "Wk3"
FpSpread1.ActiveSheet.Cells(4, 3).Value = 1.0
FpSpread1.ActiveSheet.Cells(5, 2).Text = "Wk4"
FpSpread1.ActiveSheet.Cells(5, 3).Value = 1.5
FpSpread1.ActiveSheet.Cells(6, 1).Text = "Mar"
FpSpread1.ActiveSheet.Cells(6, 3).Value = 3.0
FpSpread1.ActiveSheet.Cells(7, 0).Text = "2nd"
FpSpread1.ActiveSheet.Cells(7, 1).Text = "Apr"
FpSpread1.ActiveSheet.Cells(7, 3).Value = 1.1
FpSpread1.ActiveSheet.Cells(8, 1).Text = "May"
FpSpread1.ActiveSheet.Cells(8, 3).Value = 2.8
FpSpread1.ActiveSheet.Cells(9, 1).Text = "Jun"
FpSpread1.ActiveSheet.Cells(9, 3).Value = 1.3
FpSpread1.ActiveSheet.Cells(10, 0).Text = "3rd"
FpSpread1.ActiveSheet.Cells(10, 1).Text = "July"
FpSpread1.ActiveSheet.Cells(10, 3).Value = 1.7
FpSpread1.ActiveSheet.Cells(11, 1).Text = "Aug"
FpSpread1.ActiveSheet.Cells(11, 3).Value = 1.6
FpSpread1.ActiveSheet.Cells(12, 1).Text = "Sept"
FpSpread1.ActiveSheet.Cells(12, 3).Value = 2.1
FpSpread1.ActiveSheet.Cells(13, 0).Text = "4th"
FpSpread1.ActiveSheet.Cells(13, 1).Text = "Oct"
FpSpread1.ActiveSheet.Cells(13, 3).Value = 1.4
FpSpread1.ActiveSheet.Cells(14, 1).Text = "Nov"
FpSpread1.ActiveSheet.Cells(14, 3).Value = 2.0
FpSpread1.ActiveSheet.Cells(15, 1).Text = "Dec"
FpSpread1.ActiveSheet.Cells(15, 2).Text = "Wk1"
FpSpread1.ActiveSheet.Cells(15, 3).Value = 3.0
FpSpread1.ActiveSheet.AddChart(New FarPoint.Win.Spread.Model.CellRange(0, 0, 16, 4), GetType(FarPoint.Win.Chart.SunburstSeries), 550, 450, 300, 0)
Dim sunseries As FarPoint.Win.Chart.SunburstSeries = DirectCast(FpSpread1.Sheets(0).Charts(0).Model.PlotAreas(0).Series(0), FarPoint.Win.Chart.SunburstSeries)
sunseries.Fills.AddRange(New FarPoint.Win.Chart.Fill() {New FarPoint.Win.Chart.SolidFill(Color.MediumSeaGreen), Nothing, Nothing, Nothing, Nothing, Nothing, New FarPoint.Win.Chart.SolidFill(Color.PaleGreen), Nothing, Nothing})

 

 


© 2004-2017, GrapeCity inc. All rights reserved.