MESCIUS SPREAD for Windows Forms 17.0J
CanChangeSeriesType メソッド

ソース系列。
このインスタンスが、指定したソース系列の系列タイプを変更できるかどうかを判定します。
構文
'Declaration
 
Public Function CanChangeSeriesType( _
   ByVal sourceSeries As Series _
) As Boolean
public bool CanChangeSeriesType( 
   Series sourceSeries
)

パラメータ

sourceSeries
ソース系列。

戻り値の型

このインスタンスが、指定したソース系列の系列タイプを変更できる場合はtrue、それ以外の場合はfalse
次のサンプルコードは、CanChangeSeriesTypeメソッドを使用します。
fpSpread1.Sheets[0].Cells[0, 1].Value = "c1";
fpSpread1.Sheets[0].Cells[0, 2].Value = "c2";
fpSpread1.Sheets[0].Cells[0, 3].Value = "c3";
fpSpread1.Sheets[0].Cells[1, 0].Value = "s1";
fpSpread1.Sheets[0].Cells[2, 0].Value = "s2";
fpSpread1.Sheets[0].Cells[3, 0].Value = "s3";
fpSpread1.Sheets[0].Cells[4, 0].Value = "s4";
fpSpread1.Sheets[0].Cells[5, 0].Value = "s5";
fpSpread1.Sheets[0].Cells[6, 0].Value = "s6";

fpSpread1.Sheets[0].Cells[1, 1].Value = 1;
fpSpread1.Sheets[0].Cells[2, 1].Value = 2;
fpSpread1.Sheets[0].Cells[3, 1].Value = 3;
fpSpread1.Sheets[0].Cells[4, 1].Value = 4;
fpSpread1.Sheets[0].Cells[5, 1].Value = 5;
fpSpread1.Sheets[0].Cells[6, 1].Value = 6;

fpSpread1.Sheets[0].Cells[1, 2].Value = 7;
fpSpread1.Sheets[0].Cells[2, 2].Value = 8;
fpSpread1.Sheets[0].Cells[3, 2].Value = 9;
fpSpread1.Sheets[0].Cells[4, 2].Value = 10;
fpSpread1.Sheets[0].Cells[5, 2].Value = 11;
fpSpread1.Sheets[0].Cells[6, 2].Value = 12;

fpSpread1.Sheets[0].Cells[1, 3].Value = 13;
fpSpread1.Sheets[0].Cells[2, 3].Value = 14;
fpSpread1.Sheets[0].Cells[3, 3].Value = 15;
fpSpread1.Sheets[0].Cells[4, 3].Value = 16;
fpSpread1.Sheets[0].Cells[5, 3].Value = 17;
fpSpread1.Sheets[0].Cells[6, 3].Value = 18;

FarPoint.Win.Spread.Model.CellRange range = new FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 3);
fpSpread1.Sheets[0].AddChart(range, typeof(FarPoint.Win.Chart.BarSeries), 200, 200, 300, 0, FarPoint.Win.Chart.ChartViewType.View3D, false);
FarPoint.Win.Spread.Model.CellRange range1 = new FarPoint.Win.Spread.Model.CellRange(2, 1, 1, 3);
fpSpread1.Sheets[0].AddChart(range1, typeof(FarPoint.Win.Chart.LineSeries), 200, 200, 300, 200, FarPoint.Win.Chart.ChartViewType.View3D, false);

private void button1_Click(object sender, EventArgs e)
{            
FarPoint.Win.Spread.Chart.SpreadChart sourceChart = fpSpread1.Sheets[0].Charts[0];
FarPoint.Win.Chart.ChartModel targetModel = fpSpread1.Sheets[0].Charts[1].Model;
sourceChart.ChangeChartType(targetModel);
//uncomment this and comment the above to change the series type
//FarPoint.Win.Spread.Chart.SpreadChart sourceChart = fpSpread1.Sheets[0].Charts[0];
//FarPoint.Win.Chart.Series sourceSeries = fpSpread1.Sheets[0].Charts[0].Model.PlotAreas[0].Series[0];
//FarPoint.Win.Chart.Series targetSeries = fpSpread1.Sheets[0].Charts[1].Model.PlotAreas[0].Series[0];
//listBox1.Items.Add(sourceChart.CanChangeSeriesType(sourceSeries));
//sourceChart.ChangeSeriesType(sourceSeries, targetSeries);
}
fpSpread1.Sheets(0).Cells(0, 1).Value = "c1"
fpSpread1.Sheets(0).Cells(0, 2).Value = "c2"
fpSpread1.Sheets(0).Cells(0, 3).Value = "c3"
fpSpread1.Sheets(0).Cells(1, 0).Value = "s1"
fpSpread1.Sheets(0).Cells(2, 0).Value = "s2"
fpSpread1.Sheets(0).Cells(3, 0).Value = "s3"
fpSpread1.Sheets(0).Cells(4, 0).Value = "s4"
fpSpread1.Sheets(0).Cells(5, 0).Value = "s5"
fpSpread1.Sheets(0).Cells(6, 0).Value = "s6"

fpSpread1.Sheets(0).Cells(1, 1).Value = 1
fpSpread1.Sheets(0).Cells(2, 1).Value = 2
fpSpread1.Sheets(0).Cells(3, 1).Value = 3
fpSpread1.Sheets(0).Cells(4, 1).Value = 4
fpSpread1.Sheets(0).Cells(5, 1).Value = 5
fpSpread1.Sheets(0).Cells(6, 1).Value = 6

fpSpread1.Sheets(0).Cells(1, 2).Value = 7
fpSpread1.Sheets(0).Cells(2, 2).Value = 8
fpSpread1.Sheets(0).Cells(3, 2).Value = 9
fpSpread1.Sheets(0).Cells(4, 2).Value = 10
fpSpread1.Sheets(0).Cells(5, 2).Value = 11
fpSpread1.Sheets(0).Cells(6, 2).Value = 12

fpSpread1.Sheets(0).Cells(1, 3).Value = 13
fpSpread1.Sheets(0).Cells(2, 3).Value = 14
fpSpread1.Sheets(0).Cells(3, 3).Value = 15
fpSpread1.Sheets(0).Cells(4, 3).Value = 16
fpSpread1.Sheets(0).Cells(5, 3).Value = 17
fpSpread1.Sheets(0).Cells(6, 3).Value = 18

Dim range As New FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 3)
fpSpread1.Sheets(0).AddChart(range, GetType(FarPoint.Win.Chart.BarSeries), 200, 200, 300, 0, FarPoint.Win.Chart.ChartViewType.View3D, False)
Dim range1 As New FarPoint.Win.Spread.Model.CellRange(2, 1, 1, 3)
fpSpread1.Sheets(0).AddChart(range1, GetType(FarPoint.Win.Chart.LineSeries), 200, 200, 300, 200, FarPoint.Win.Chart.ChartViewType.View3D, False)       

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sourceChart As FarPoint.Win.Spread.Chart.SpreadChart
sourceChart = fpSpread1.Sheets(0).Charts(0)
Dim targetModel As FarPoint.Win.Chart.ChartModel
targetModel = fpSpread1.Sheets(0).Charts(1).Model
sourceChart.ChangeChartType(targetModel)
'uncomment this and comment the above to change the series type
'Dim sourceChart As FarPoint.Win.Spread.Chart.SpreadChart
'sourceChart = fpSpread1.Sheets(0).Charts(0)
'Dim sourceSeries As FarPoint.Win.Chart.Series
'Dim targetSeries As FarPoint.Win.Chart.Series
'sourceSeries = fpSpread1.Sheets(0).Charts(0).Model.PlotAreas(0).Series(0)
'targetSeries = fpSpread1.Sheets(0).Charts(1).Model.PlotAreas(0).Series(0)
'ListBox1.Items.Add(sourceChart.CanChangeSeriesType(sourceSeries))
'sourceChart.ChangeSeriesType(sourceSeries, targetSeries)
End Sub
参照

SpreadChart クラス
SpreadChart メンバ

 

 


© MESCIUS inc. All rights reserved.