2013-03-25 58 views
0

我必須使用MS圖表功能繪製XY圖表。要求繪製五個不同的點(每個點具有不同的X和Y座標以及不同的標記樣式)。因此,在這種情況下,需要繪製X和Y點。使用質譜圖以編程方式繪製點圖表時出現錯誤

請幫助我做到這一點。我嘗試使用'點'圖表,但不知何故它不適用於我。

在此先感謝。

回答

0

事情是這樣的......

 //// initialize an array of doubles for Y values 
     double[] yval = { 5, 6, 4, 6, 3 }; 
     // initialize an array of strings for X values 
     double[] xval = { 1, 4, 6, 8, 9 }; 
     // bind the arrays to the X and Y values of data points in the "ByArray" series 
     chart1.Series["Series1"].Points.DataBindXY(xval, yval); 
     chart1.Series["Series1"].ChartType = SeriesChartType.Point; 
     chart1.Series["Series1"].Points[0].MarkerStyle = MarkerStyle.Square; 
     chart1.Series["Series1"].Points[1].MarkerStyle = MarkerStyle.Cross; 
     chart1.Series["Series1"].Points[2].MarkerStyle = MarkerStyle.Triangle; 
     chart1.Series["Series1"].Points[3].MarkerStyle = MarkerStyle.Circle; 
     chart1.Series["Series1"].Points[4].MarkerStyle = MarkerStyle.Star4; 
相關問題