2
我使用DevExpress for WinForms(免費的),我使用的是3D餅圖。 我已經有一個使用Windows版本的圖表,我所做的只是傳遞四個變量作爲圖表在圖表中需要的值。 這是我目前使用的代碼。piechart使用devexpress,傳遞變量的值
double[] yValues = { bottom, bmid, tmid, top};
string[] xNames = { "Greater than 200", "Between 200-100", "Between 100-50", "Below 50" };
chart1.Series[0].Points.DataBindXY(xNames, yValues);
現在,我做了一個圖表DevExpress的,並試圖使用:
Devchart1.series[0].points
但points.databind
不存在。 有誰知道我如何使用WinForms綁定數據?
UPDATE 這裏有一些我嘗試過的東西(註釋掉)。
double[] yValues = { bottom, bmid, tmid, top};
string[] xNames = { "Greater than 200", "Between 200-100", "Between 100-50", "Below 50" };
chart1.Series[0].Points.DataBindXY(xNames, yValues);
DataTable chartTable = new DataTable("Table1");
// Add two columns to the table.
chartTable.Columns.Add("Names", typeof(string));
chartTable.Columns.Add("Value", typeof(Int32));
chartTable.Rows.Add("Below 50", top);
chartTable.Rows.Add("Between 50-100", tmid);
chartTable.Rows.Add("Between 100-200", bmid);
chartTable.Rows.Add("Greater than 200", top);
Series series1 = new Series("Series1", ViewType.Pie3D);
chartControl2.Series.Add(series1);
series1.DataSource = chartTable;
series1.ArgumentScaleType = ScaleType.Qualitative;
series1.ArgumentDataMember = "names";
series1.ValueScaleType = ScaleType.Numerical;
series1.ValueDataMembers.AddRange(new string[] { "Value" });
//((Pie3DSeriesView)series1.View). = true;
//((pie)chartControl2.Diagram).AxisY.Visible = false;
chartControl2.Legend.Visible = false;
// Dock the chart into its parent and add it to the current form.
chart1.Dock = DockStyle.Fill;
:: UPDATE2 :: 繼承人與此代碼與值101,22,20和15。
更新我的代碼,到目前爲止,香港專業教育學院嘗試了一些東西,但IETHER,在運行錯誤時間抱怨無效的參數,或沒有顯示顯示 – lemunk
嘗試像例子中創建'DataTable',並綁定它 – Stecya
好ive運行程序沒有錯誤,但當我點擊按鈕時,三維餅圖決定顯示(我認爲是)默認值我已經進入了財產並刪除了所有系列,以確保沒有衝突。 有什麼想法?虐待更新您的代碼我有 – lemunk