MESCIUS SPREAD for Windows Forms 17.0J 移行ガイド
チャートの外枠の設定がExcelファイルにエクスポートされる

ステータス

バージョン ID 機能分類 対応策
10.0.4001.2012 100013 Excel

詳細

旧バージョンではチャートの外枠の設定が有効になりませんでしたが、本バージ ョンでは外枠の設定が有効になりました。また、旧バージョンではExcelファイルにエクスポートしたチャートの外枠が黒色の実線でしたが、本バージョンでは設定した枠線が維持されます。エクスポートしたExcelファイル上でも黒色の実線にするには、ShapeOutlineColor/ShapeOutlineStyle/ShapeOutlineThicknessを設定する必要があります。

private void Form1_Load(object sender, EventArgs e)
{
    // テストデータの設定
    fpSpread1.ActiveSheet.Cells[0, 1].Value = "S1";
    fpSpread1.ActiveSheet.Cells[0, 2].Value = "S2";
    fpSpread1.ActiveSheet.Cells[1, 0].Value = "1Q";
    fpSpread1.ActiveSheet.Cells[2, 0].Value = "2Q";
    fpSpread1.ActiveSheet.Cells[3, 0].Value = "3Q";
    fpSpread1.ActiveSheet.Cells[4, 0].Value = "4Q";
    fpSpread1.ActiveSheet.Cells[1, 1].Value = 50;
    fpSpread1.ActiveSheet.Cells[2, 1].Value = 30;
    fpSpread1.ActiveSheet.Cells[3, 1].Value = 20;
    fpSpread1.ActiveSheet.Cells[4, 1].Value = 40;
    fpSpread1.ActiveSheet.Cells[1, 2].Value = 30;
    fpSpread1.ActiveSheet.Cells[2, 2].Value = 15;
    fpSpread1.ActiveSheet.Cells[3, 2].Value = 50;
    fpSpread1.ActiveSheet.Cells[4, 2].Value = 20;
    // シリーズを設定
    FarPoint.Win.Chart.LineSeries series1 = new FarPoint.Win.Chart.LineSeries();
    series1.SeriesNameDataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$B$1:$B$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text);
    series1.Values.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$B$2:$B$5");
    series1.CategoryNames.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$A$2:$A$5", FarPoint.Win.Spread.Chart.SegmentDataType.Text);
    FarPoint.Win.Chart.LineSeries series2 = new FarPoint.Win.Chart.LineSeries();
    series2.SeriesNameDataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$C$1:$C$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text);
    series2.Values.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$C$2:$C$5");
    series2.CategoryNames.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$A$2:$A$5", FarPoint.Win.Spread.Chart.SegmentDataType.Text);
    
    // 折れ線グラフを設定
    FarPoint.Win.Chart.YPlotArea plotArea = new FarPoint.Win.Chart.YPlotArea();
    plotArea.Location = new PointF(0.2f, 0.1f);
    plotArea.Size = new SizeF(0.55f, 0.7f);
    plotArea.Series.Add(series1);
    plotArea.Series.Add(series2);
    // 凡例を設定
    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チャートにチャートモデルを設定
    FarPoint.Win.Spread.Chart.SpreadChart chart1 = new FarPoint.Win.Spread.Chart.SpreadChart();
    chart1.Size = new Size(250, 200);
    chart1.Location = new Point(200, 10);
    chart1.Model = model;
    // チャートの外枠を設定
    chart1.ShapeOutlineColor = Color.Black;
    chart1.ShapeOutlineStyle = System.Drawing.Drawing2D.DashStyle.Solid;
    chart1.ShapeOutlineThickness = 1;
    // シートにチャートを追加
    fpSpread1.ActiveSheet.Charts.Add(chart1);
}
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    ' テストデータの設定
    FpSpread1.ActiveSheet.Cells(0, 1).Value = "S1"
    FpSpread1.ActiveSheet.Cells(0, 2).Value = "S2"
    FpSpread1.ActiveSheet.Cells(1, 0).Value = "1Q"
    FpSpread1.ActiveSheet.Cells(2, 0).Value = "2Q"
    FpSpread1.ActiveSheet.Cells(3, 0).Value = "3Q"
    FpSpread1.ActiveSheet.Cells(4, 0).Value = "4Q"
    FpSpread1.ActiveSheet.Cells(1, 1).Value = 50
    FpSpread1.ActiveSheet.Cells(2, 1).Value = 30
    FpSpread1.ActiveSheet.Cells(3, 1).Value = 20
    FpSpread1.ActiveSheet.Cells(4, 1).Value = 40
    FpSpread1.ActiveSheet.Cells(1, 2).Value = 30
    FpSpread1.ActiveSheet.Cells(2, 2).Value = 15
    FpSpread1.ActiveSheet.Cells(3, 2).Value = 50
    FpSpread1.ActiveSheet.Cells(4, 2).Value = 20
    ' シリーズを設定
    Dim series1 As New FarPoint.Win.Chart.LineSeries()
    series1.SeriesNameDataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "Values", "Sheet1!$B$1:$B$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text)
    series1.Values.DataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "Values", "Sheet1!$B$2:$B$5")
    series1.CategoryNames.DataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "Values", "Sheet1!$A$2:$A$5", FarPoint.Win.Spread.Chart.SegmentDataType.Text)
    Dim series2 As New FarPoint.Win.Chart.LineSeries()
    series2.SeriesNameDataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "Values", "Sheet1!$C$1:$C$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text)
    series2.Values.DataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "Values", "Sheet1!$C$2:$C$5")
    series2.CategoryNames.DataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "Values", "Sheet1!$A$2:$A$5", FarPoint.Win.Spread.Chart.SegmentDataType.Text)
    ' 折れ線グラフを設定
    Dim plotArea As New FarPoint.Win.Chart.YPlotArea()
    plotArea.Location = New PointF(0.2F, 0.1F)
    plotArea.Size = New SizeF(0.55F, 0.7F)
    plotArea.Series.Add(series1)
    plotArea.Series.Add(series2)
    ' 凡例を設定
    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チャートにチャートモデルを設定
    Dim chart1 As New FarPoint.Win.Spread.Chart.SpreadChart()
    chart1.Size = New Size(250, 200)
    chart1.Location = New Point(200, 10)
    chart1.Model = model
    ' チャートの外枠を設定
    chart1.ShapeOutlineColor = Color.Black
    chart1.ShapeOutlineStyle = System.Drawing.Drawing2D.DashStyle.Solid
    chart1.ShapeOutlineThickness = 1
    ' シートにチャートを追加
    FpSpread1.ActiveSheet.Charts.Add(chart1)
End Sub
参照

 

 


© MESCIUS inc. All rights reserved.