SPREAD for Windows Forms 15.0J 移行ガイド > 旧バージョンからの移行 > 旧バージョンとの相違点 > 5.0.2027.2008での変更点 > 複数のチャート間で同一データソースを使用することができない |
バージョン | ID | 機能分類 | 対応策 |
---|---|---|---|
5.0.2027.2008 | 70004 | チャート | ○ |
旧バージョンでは、1つのチャートデータソースを複数のシリーズで使用することが可能でしたが、新バージョンではチャートデータソースは1つのシリーズのみ使用可能です。(複数のシリーズに設定されている場合は、2つ目以降の設定が無視されます)
以下は、新バージョンでは許可されない設定方法です。
private void button1_Click(object sender, EventArgs e) { // sample data fpSpread1.ActiveSheet.SetArray(0, 0, new Object[,] { { null, "A", "B", "C", "D", "E" } }); fpSpread1.ActiveSheet.SetArray(1, 0, new Object[,] { { "S-1", 50, 25, 55, 30, 26 } }); // datasource FarPoint.Win.Spread.Chart.SeriesDataField df1 = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldSeriesName", "Sheet1!$A$2:$A$2", FarPoint.Win.Spread.Chart.SegmentDataType.Text); FarPoint.Win.Spread.Chart.SeriesDataField df2 = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldCategoryName", "Sheet1!$B$1:$F$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text); FarPoint.Win.Spread.Chart.SeriesDataField df3 = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldValue", "Sheet1!$B$2:$F$2"); // LineSeries FarPoint.Win.Chart.LineSeries series = new FarPoint.Win.Chart.LineSeries(); series.SeriesNameDataSource = df1; series.CategoryNames.DataSource = df2; series.Values.DataSource = df3; // BarSeries FarPoint.Win.Chart.BarSeries bseries = new FarPoint.Win.Chart.BarSeries(); // LineSeriesと同じデータソースを設定 bseries.SeriesNameDataSource = df1; bseries.CategoryNames.DataSource = df2; bseries.Values.DataSource = df3; // PlotArea FarPoint.Win.Chart.YPlotArea plotArea = new FarPoint.Win.Chart.YPlotArea(); plotArea.Location = new PointF(0.2f, 0.2f); plotArea.Size = new SizeF(0.6f, 0.6f); plotArea.Series.Add(series); // ChartModel FarPoint.Win.Chart.ChartModel model = new FarPoint.Win.Chart.ChartModel(); model.PlotAreas.Add(plotArea); // SpreadChart FarPoint.Win.Spread.Chart.SpreadChart chart1 = new FarPoint.Win.Spread.Chart.SpreadChart(); chart1.ChartName = "chart1"; chart1.Size = new Size(200, 180); chart1.Location = new Point(0, 60); chart1.Model = model; // PlotArea2 FarPoint.Win.Chart.YPlotArea plotArea2 = new FarPoint.Win.Chart.YPlotArea(); plotArea2.Location = new PointF(0.2f, 0.2f); plotArea2.Size = new SizeF(0.6f, 0.6f); plotArea2.Series.Add(bseries); // ChartModel 2 FarPoint.Win.Chart.ChartModel model2 = new FarPoint.Win.Chart.ChartModel(); model2.PlotAreas.Add(plotArea2); // SpreadChart 2 FarPoint.Win.Spread.Chart.SpreadChart chart2 = new FarPoint.Win.Spread.Chart.SpreadChart(); chart2.ChartName = "chart2"; chart2.Size = new Size(200, 180); chart2.Location = new Point(60, 60); chart2.Model = model2; fpSpread1.ActiveSheet.Charts.Clear(); fpSpread1.ActiveSheet.Charts.Add(chart1); fpSpread1.ActiveSheet.Charts.Add(chart2); fpSpread1.ActiveSheet.Charts.Remove(chart1); }
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' sample data fpSpread1.ActiveSheet.SetArray(0, 0, New [Object](,) {{Nothing, "A", "B", "C", "D", "E"}}) fpSpread1.ActiveSheet.SetArray(1, 0, New [Object](,) {{"S-1", 50, 25, 55, 30, 26}}) ' datasource Dim df1 As New FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldSeriesName", "Sheet1!$A$2:$A$2", FarPoint.Win.Spread.Chart.SegmentDataType.Text) Dim df2 As New FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldCategoryName", "Sheet1!$B$1:$F$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text) Dim df3 As New FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldValue", "Sheet1!$B$2:$F$2") ' LineSeries Dim series As New FarPoint.Win.Chart.LineSeries() series.SeriesNameDataSource = df1 series.CategoryNames.DataSource = df2 series.Values.DataSource = df3 ' BarSeries Dim bseries As New FarPoint.Win.Chart.BarSeries() ' LineSeriesと同じデータソースを設定 bseries.SeriesNameDataSource = df1 bseries.CategoryNames.DataSource = df2 bseries.Values.DataSource = df3 ' PlotArea Dim plotArea As New FarPoint.Win.Chart.YPlotArea() plotArea.Location = New PointF(0.2F, 0.2F) plotArea.Size = New SizeF(0.6F, 0.6F) plotArea.Series.Add(series) ' ChartModel Dim model As New FarPoint.Win.Chart.ChartModel() model.PlotAreas.Add(plotArea) ' SpreadChart Dim chart1 As New FarPoint.Win.Spread.Chart.SpreadChart() chart1.ChartName = "chart1" chart1.Size = New Size(200, 180) chart1.Location = New Point(0, 60) chart1.Model = model ' PlotArea2 Dim plotArea2 As New FarPoint.Win.Chart.YPlotArea() plotArea2.Location = New PointF(0.2F, 0.2F) plotArea2.Size = New SizeF(0.6F, 0.6F) plotArea2.Series.Add(bseries) ' ChartModel 2 Dim model2 As New FarPoint.Win.Chart.ChartModel() model2.PlotAreas.Add(plotArea2) ' SpreadChart 2 Dim chart2 As New FarPoint.Win.Spread.Chart.SpreadChart() chart2.ChartName = "chart2" chart2.Size = New Size(200, 180) chart2.Location = New Point(60, 60) chart2.Model = model2 fpSpread1.ActiveSheet.Charts.Clear() fpSpread1.ActiveSheet.Charts.Add(chart1) fpSpread1.ActiveSheet.Charts.Add(chart2) fpSpread1.ActiveSheet.Charts.Remove(chart1) End Sub
新バージョンでの回避方法は以下のとおりです。
private void button1_Click(object sender, EventArgs e) { // sample data fpSpread1.ActiveSheet.SetArray(0, 0, new Object[,] { { null, "A", "B", "C", "D", "E" } }); fpSpread1.ActiveSheet.SetArray(1, 0, new Object[,] { { "S-1", 50, 25, 55, 30, 26 } }); // datasource FarPoint.Win.Spread.Chart.SeriesDataField df1 = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldSeriesName", "Sheet1!$A$2:$A$2", FarPoint.Win.Spread.Chart.SegmentDataType.Text); FarPoint.Win.Spread.Chart.SeriesDataField df2 = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldCategoryName", "Sheet1!$B$1:$F$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text); FarPoint.Win.Spread.Chart.SeriesDataField df3 = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldValue", "Sheet1!$B$2:$F$2"); // BarSeries用のデータソースを作成 FarPoint.Win.Spread.Chart.SeriesDataField df1_2 = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldSeriesName", "Sheet1!$A$2:$A$2", FarPoint.Win.Spread.Chart.SegmentDataType.Text); FarPoint.Win.Spread.Chart.SeriesDataField df2_2 = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldCategoryName", "Sheet1!$B$1:$F$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text); FarPoint.Win.Spread.Chart.SeriesDataField df3_2 = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldValue", "Sheet1!$B$2:$F$2"); // LineSeries FarPoint.Win.Chart.LineSeries series = new FarPoint.Win.Chart.LineSeries(); series.SeriesNameDataSource = df1; series.CategoryNames.DataSource = df2; series.Values.DataSource = df3; // BarSeries FarPoint.Win.Chart.BarSeries bseries = new FarPoint.Win.Chart.BarSeries(); // LineSeriesと同じデータソースを設定 //bseries.SeriesNameDataSource = df1; //bseries.CategoryNames.DataSource = df2; //bseries.Values.DataSource = df3; bseries.SeriesNameDataSource = df1_2; bseries.CategoryNames.DataSource = df2_2; bseries.Values.DataSource = df3_2; // PlotArea FarPoint.Win.Chart.YPlotArea plotArea = new FarPoint.Win.Chart.YPlotArea(); plotArea.Location = new PointF(0.2f, 0.2f); plotArea.Size = new SizeF(0.6f, 0.6f); plotArea.Series.Add(series); // ChartModel FarPoint.Win.Chart.ChartModel model = new FarPoint.Win.Chart.ChartModel(); model.PlotAreas.Add(plotArea); // SpreadChart FarPoint.Win.Spread.Chart.SpreadChart chart1 = new FarPoint.Win.Spread.Chart.SpreadChart(); chart1.ChartName = "chart1"; chart1.Size = new Size(200, 180); chart1.Location = new Point(0, 60); chart1.Model = model; // PlotArea2 FarPoint.Win.Chart.YPlotArea plotArea2 = new FarPoint.Win.Chart.YPlotArea(); plotArea2.Location = new PointF(0.2f, 0.2f); plotArea2.Size = new SizeF(0.6f, 0.6f); plotArea2.Series.Add(bseries); // ChartModel 2 FarPoint.Win.Chart.ChartModel model2 = new FarPoint.Win.Chart.ChartModel(); model2.PlotAreas.Add(plotArea2); // SpreadChart 2 FarPoint.Win.Spread.Chart.SpreadChart chart2 = new FarPoint.Win.Spread.Chart.SpreadChart(); chart2.ChartName = "chart2"; chart2.Size = new Size(200, 180); chart2.Location = new Point(60, 60); chart2.Model = model2; fpSpread1.ActiveSheet.Charts.Clear(); fpSpread1.ActiveSheet.Charts.Add(chart1); fpSpread1.ActiveSheet.Charts.Add(chart2); fpSpread1.ActiveSheet.Charts.Remove(chart1); }
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' sample data fpSpread1.ActiveSheet.SetArray(0, 0, New [Object](,) {{Nothing, "A", "B", "C", "D", "E"}}) fpSpread1.ActiveSheet.SetArray(1, 0, New [Object](,) {{"S-1", 50, 25, 55, 30, 26}}) ' datasource Dim df1 As New FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldSeriesName", "Sheet1!$A$2:$A$2", FarPoint.Win.Spread.Chart.SegmentDataType.Text) Dim df2 As New FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldCategoryName", "Sheet1!$B$1:$F$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text) Dim df3 As New FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldValue", "Sheet1!$B$2:$F$2") Dim df1_2 As New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "DataFieldSeriesName", "Sheet1!$A$2:$A$2", FarPoint.Win.Spread.Chart.SegmentDataType.Text) Dim df2_2 As New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "DataFieldCategoryName", "Sheet1!$B$1:$F$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text) Dim df3_2 As New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "DataFieldValue", "Sheet1!$B$2:$F$2") ' LineSeries Dim series As New FarPoint.Win.Chart.LineSeries() series.SeriesNameDataSource = df1 series.CategoryNames.DataSource = df2 series.Values.DataSource = df3 ' BarSeries Dim bseries As New FarPoint.Win.Chart.BarSeries() '' LineSeriesと同じデータソースを設定 'bseries.SeriesNameDataSource = df1 'bseries.CategoryNames.DataSource = df2 'bseries.Values.DataSource = df3 bseries.SeriesNameDataSource = df1_2 bseries.CategoryNames.DataSource = df2_2 bseries.Values.DataSource = df3_2 ' PlotArea Dim plotArea As New FarPoint.Win.Chart.YPlotArea() plotArea.Location = New PointF(0.2F, 0.2F) plotArea.Size = New SizeF(0.6F, 0.6F) plotArea.Series.Add(series) ' ChartModel Dim model As New FarPoint.Win.Chart.ChartModel() model.PlotAreas.Add(plotArea) ' SpreadChart Dim chart1 As New FarPoint.Win.Spread.Chart.SpreadChart() chart1.ChartName = "chart1" chart1.Size = New Size(200, 180) chart1.Location = New Point(0, 60) chart1.Model = model ' PlotArea2 Dim plotArea2 As New FarPoint.Win.Chart.YPlotArea() plotArea2.Location = New PointF(0.2F, 0.2F) plotArea2.Size = New SizeF(0.6F, 0.6F) plotArea2.Series.Add(bseries) ' ChartModel 2 Dim model2 As New FarPoint.Win.Chart.ChartModel() model2.PlotAreas.Add(plotArea2) ' SpreadChart 2 Dim chart2 As New FarPoint.Win.Spread.Chart.SpreadChart() chart2.ChartName = "chart2" chart2.Size = New Size(200, 180) chart2.Location = New Point(60, 60) chart2.Model = model2 fpSpread1.ActiveSheet.Charts.Clear() fpSpread1.ActiveSheet.Charts.Add(chart1) fpSpread1.ActiveSheet.Charts.Add(chart2) fpSpread1.ActiveSheet.Charts.Remove(chart1) End Sub