PowerTools SPREAD for Windows Forms 8.0J
SP3の新機能

ここでは、Service Pack 3(以下、SP3)の新機能について解説します。

Windows Server 2016 対応

Windows Server 2016での動作を保証します。

.NET Framework 4.6.2 対応

新たに、.NET Framework 4.6.2での動作を保証します。

SeriesExpanded イベント

SpreadChart クラスにユーザー操作でチャートのデータ範囲が拡大されたことにより新しい系列が追加されるときに発生するSeriesExpanded イベントが追加されました。以下のサンプルのようにSeriesExpanded イベントを使用して任意のチャート種を追加することができます。

C#
コードのコピー
FarPoint.Win.Spread.Chart.SpreadChart chart1 = new FarPoint.Win.Spread.Chart.SpreadChart();

private void Form1_Load(object sender, EventArgs e)
{
    // テストデータの設定
    fpSpread1.ActiveSheet.SetArray(0, 0, new Object[,] { { null, "Q1", "Q2", "Q3", "Q4" } });
    fpSpread1.ActiveSheet.SetArray(1, 0, new Object[,] { { "S-1", 12, 14, 13, 15 } });
    fpSpread1.ActiveSheet.SetArray(2, 0, new Object[,] { { "S-2", 3, 1, 4, 2 } });
    fpSpread1.ActiveSheet.SetArray(3, 0, new Object[,] { { "S-3", 2, 5, 4, 3 } });
    fpSpread1.ActiveSheet.SetArray(4, 0, new Object[,] { { "S-4", 4, 1, 4, 2 } });

    // シリーズの設定(S-1)
    FarPoint.Win.Chart.LineSeries series1 = new FarPoint.Win.Chart.LineSeries();
    series1.SeriesNameDataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$A$2:$A$2", FarPoint.Win.Spread.Chart.SegmentDataType.Text);
    series1.Values.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$B$2:$E$2");
    series1.CategoryNames.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$B$1:$E$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text);

    // シリーズの設定(S-2)
    FarPoint.Win.Chart.BarSeries series2 = new FarPoint.Win.Chart.BarSeries();
    series2.SeriesNameDataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$A$3:$A$3", FarPoint.Win.Spread.Chart.SegmentDataType.Text);
    series2.Values.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$B$3:$E$3");
    series2.CategoryNames.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$B$1:$E$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text);

    FarPoint.Win.Chart.YPlotArea plotArea = new FarPoint.Win.Chart.YPlotArea();
    plotArea.Location = new PointF(0.2f, 0.2f);
    plotArea.Size = new SizeF(0.55f, 0.6f);

    // 折れ線の追加
    plotArea.Series.Add(series1);

    // 積み上げ縦棒の追加
    FarPoint.Win.Chart.StackedBarSeries sbar = new FarPoint.Win.Chart.StackedBarSeries();
    sbar.Series.Add(series2);
    plotArea.Series.Add(sbar);

    // 凡例の設定
    FarPoint.Win.Chart.LegendArea legend = new FarPoint.Win.Chart.LegendArea();
    legend.Location = new PointF(0.98f, 0.5f);
    legend.AlignmentX = 1f;
    legend.AlignmentY = 0.5f;

    // チャートモデルに各情報を追加
    FarPoint.Win.Chart.ChartModel model = new FarPoint.Win.Chart.ChartModel();
    model.LegendAreas.Add(legend);
    model.PlotAreas.Add(plotArea);

    // SPREADチャートにチャートモデルを設定
    chart1.ChartName = "barchart";
    chart1.Size = new Size(400, 200);
    chart1.Location = new Point(3, 130);
    chart1.Model = model;

    // シートにSPREADチャートを追加
    fpSpread1.Sheets[0].Charts.Add(chart1);

    // SeriesExpandedイベントの関連付け
    chart1.SeriesExpanded += Chart1_SeriesExpanded;
}

private void Chart1_SeriesExpanded(object sender, FarPoint.Win.Spread.Chart.ExpandSeriesEventArgs e)
{
    // 積み上げ縦棒の追加
    e.Series = new FarPoint.Win.Chart.StackedBarSeries();
    e.AppendOnExist = true;
}
Visual Basic
コードのコピー
Private WithEvents chart1 As New FarPoint.Win.Spread.Chart.SpreadChart()

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    ' テストデータの設定
    FpSpread1.ActiveSheet.SetArray(0, 0, New [Object](,) {{Nothing, "Q1", "Q2", "Q3", "Q4"}})
    FpSpread1.ActiveSheet.SetArray(1, 0, New [Object](,) {{"S-1", 12, 14, 13, 15}})
    FpSpread1.ActiveSheet.SetArray(2, 0, New [Object](,) {{"S-2", 3, 1, 4, 2}})
    FpSpread1.ActiveSheet.SetArray(3, 0, New [Object](,) {{"S-3", 2, 5, 4, 3}})
    FpSpread1.ActiveSheet.SetArray(4, 0, New [Object](,) {{"S-4", 4, 1, 4, 2}})

    ' シリーズの設定(S-1)
    Dim series1 As New FarPoint.Win.Chart.LineSeries()
    series1.SeriesNameDataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "Values", "Sheet1!$A$2:$A$2", FarPoint.Win.Spread.Chart.SegmentDataType.Text)
    series1.Values.DataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "Values", "Sheet1!$B$2:$E$2")
    series1.CategoryNames.DataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "Values", "Sheet1!$B$1:$E$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text)

    ' シリーズの設定(S-2)
    Dim series2 As New FarPoint.Win.Chart.BarSeries()
    series2.SeriesNameDataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "Values", "Sheet1!$A$3:$A$3", FarPoint.Win.Spread.Chart.SegmentDataType.Text)
    series2.Values.DataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "Values", "Sheet1!$B$3:$E$3")
    series2.CategoryNames.DataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "Values", "Sheet1!$B$1:$E$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text)

    Dim plotArea As New FarPoint.Win.Chart.YPlotArea()
    plotArea.Location = New PointF(0.2F, 0.2F)
    plotArea.Size = New SizeF(0.55F, 0.6F)

    ' 折れ線の追加
    plotArea.Series.Add(series1)

    ' 積み上げ縦棒の追加
    Dim sbar As New FarPoint.Win.Chart.StackedBarSeries()
    sbar.Series.Add(series2)
    plotArea.Series.Add(sbar)

    ' 凡例の設定
    Dim legend As New FarPoint.Win.Chart.LegendArea()
    legend.Location = New PointF(0.98F, 0.5F)
    legend.AlignmentX = 1.0F
    legend.AlignmentY = 0.5F

    ' チャートモデルに各情報を追加
    Dim model As New FarPoint.Win.Chart.ChartModel()
    model.LegendAreas.Add(legend)
    model.PlotAreas.Add(plotArea)

    ' SPREADチャートにチャートモデルを設定
    chart1.ChartName = "barchart"
    chart1.Size = New Size(400, 200)
    chart1.Location = New Point(3, 130)
    chart1.Model = model

    ' シートにSPREADチャートを追加
    FpSpread1.Sheets(0).Charts.Add(chart1)
End Sub

Private Sub chart1_SeriesExpanded(sender As Object, e As ExpandSeriesEventArgs) Handles chart1.SeriesExpanded
    ' 積み上げ縦棒の追加
    e.Series = New FarPoint.Win.Chart.StackedBarSeries()
    e.AppendOnExist = True
End Sub

 

 


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