0
我可以輕鬆創建兩個單獨的圖表,但我想將它們添加到一個圖表中。一個在上面,另一個在下面。那我該怎麼做?使用窗口圖表形式在彼此下面添加兩個圖表
這是我迄今爲止嘗試過的代碼,但它只在頂部繪製一個圖表。
// Chart chart1 = new Chart();
Chart chart1 = new Chart()
{
Width = 500,
Height = 1000
};
chart1.Legends[0].Docking = Docking.Bottom;
ChartArea chartArea = new ChartArea() { Name = "ChartArea0" };
//Remove X-axis grid lines
chartArea.AxisX.MajorGrid.LineWidth = 0;
//Remove Y-axis grid lines
chartArea.AxisY.MajorGrid.LineWidth = 0;
//Chart Area Back Color
chart1.ChartAreas.Add(chartArea);
chart1.Palette = ChartColorPalette.SeaGreen;
// Set title.
chart1.Titles.Add(" GIS");
// Add series.
for (int i = 0; i < seriesEXpArray.Length; i++)
{
// Add series.
Series series = chart1.Series.Add(seriesEXpArray[i]);
series.ChartArea= "ChartArea0";
// Add point.
series.Points.Add(ExppointsArray[i]);
}
chartArea = new ChartArea() { Name = "ChartArea1" };
//Remove X-axis grid lines
chartArea.AxisX.MajorGrid.LineWidth = 0;
//Remove Y-axis grid lines
chartArea.AxisY.MajorGrid.LineWidth = 0;
//Chart Area Back Color
chart1.ChartAreas.Add(chartArea);
// Add series.
for (int i = 0; i < seriesUserCommenArray.Length; i++)
{
// Add series.
Series series = chart1.Series.Add(seriesUserCommenArray[i]);
series.ChartArea = "ChartArea1";
// Add point.
series.Points.Add(UserCommentpointsArray[i]);
}
謝謝你的幫助。它的工作 –