何が原因かわかりませんが以下のようにコードから設定したらどうでしょうか。
csharp:"C#"
1using System.Drawing;
2using System.Windows.Forms;
3using System.Windows.Forms.DataVisualization.Charting;
4
5namespace ChartSecondAxisSample
6{
7 public partial class Form1 : Form
8 {
9 // 第1系列のデータ
10 private double[] _firstDatas = new double[]{10, 8, 6, 8, 10, 12, 14, 16, 18, 20, 18};
11 // 第2系列のデータ
12 private double[] _secondDatas = new double[] { -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10 };
13
14 public Form1()
15 {
16 InitializeComponent();
17
18 // ※ 系列はあらかじめGUIから追加しています
19
20 // 各系列の軸タイプを設定
21 chart.Series[0].YAxisType = AxisType.Primary;
22 chart.Series[1].YAxisType = AxisType.Secondary;
23 //第1軸の最大最小
24 chart.ChartAreas[0].AxisY.Maximum = 30;
25 chart.ChartAreas[0].AxisY.Minimum = 0;
26 //第2軸の最大最小
27 chart.ChartAreas[0].AxisY2.Maximum = 20;
28 chart.ChartAreas[0].AxisY2.Minimum = -20;
29 // 色設定
30 chart.Series[0].Color = Color.Red;
31 chart.Series[1].Color = Color.Blue;
32
33
34 // データセット
35 for (var i = 0; i < _firstDatas.Length; i++)
36 {
37 // 系列1
38 chart.Series[0].Points.Add(new DataPoint(i, _firstDatas[i]));
39 // 系列2
40 chart.Series[1].Points.Add(new DataPoint(i, _secondDatas[i]));
41 }
42 }
43 }
44}
これにより以下の表示になります。
YAxisTypeプロパティが適切に設定できていないことが原因なような気がしております。
ご確認ください。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/01/05 08:19
2018/01/05 09:00