在C#winform中什么原因可能导致chart图不出现(程序应该没问题)
publicvoidCreatchart2(stringwax)//损耗率饼形图{//chart4.Series.Clear();stringdbPath=@"D:\历年...
public void Creatchart2(string wax)//损耗率饼形图 { //chart4.Series.Clear(); string dbPath = @"D:\历年高考分数.db"; string sq = @"Data Source=" + dbPath; m = new SQLiteConnection(sq); m.Open(); SQLiteDataAdapter mAdapter = new SQLiteDataAdapter("select " + wax + ",Volume1 from 饼形图1", m); DataSet ds = new DataSet(); mAdapter.Fill(ds); DataTable dt = ds.Tables[0]; //设置图表的数据源 //string[] g = new string[] { "温度", "振动", "紫外线", "臭氧" }; chart4.Series[0].ChartType = SeriesChartType.Doughnut; chart4.Series[0].XValueMember = "Volume1";//图例文字 chart4.Series[0].YValueMembers = wax;//饼形图上数据 chart4.Series[0].XValueType = ChartValueType.String;//防止图例文本显示为0 chart4.Series[0].IsValueShownAsLabel = true;// //Chart1.Series[0].IsXValueIndexed = false; chart4.Series[0].Label = "#PERCENT"; chart4.Series[0].LegendText = "#VALX"; //Chart1.Series[0].ToolTip = "#VALX"; chart4.Series["Series1"].Label = "#PERCENT{P2}"; chart4.DataBind(); chart4.BringToFront(); m.Close(); }单拿出来做一个项目(就一个窗口),不需要主窗口传wax值时,可以出图(如下图)当此程序在子窗口时,需要主窗口传wax值时,不出图了请问是哪里出问题了
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询