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