本文介绍了如何将zedgraph图表与mysql数据库连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好所有成员

我在将ZedGraph图表与mysql数据库链接时遇到问题
请,如果有人有一个主意,请帮助我.

hello all members

I''ve got problem with linking ZedGraph chart with linking to mysql database
please if somebody have got an idea, please help me.

             private void Form1_Resize( object sender, EventArgs e )
		{
			SetSize();
		}
		private void SetSize()
		{
		zedGraphControl1.Location = new Point( 10, 10 );
	        zedGraphControl1.Size = new Size( ClientRectangle.Width - 20,	                                 ClientRectangle.Height - 20 );
		}
		// Respond to form 'Load' event
		private void Form1_Load( object sender, EventArgs e )
		{			
			CreateGraph( zedGraphControl1 );
			SetSize();
		}
		// Build the Chart
		private void CreateGraph( ZedGraphControl zgc )
		{
			GraphPane myPane = zgc.GraphPane;
			int iNbProduits = 0;
			//Détermination du nombre de produits
			_bd.Command.CommandText = "SELECT COUNT(*) " +
				"FROM Client";
			_bd.Reader = _bd.Command.ExecuteReader();
			if (_bd.Reader.Read()) {
				iNbProduits = int.Parse(_bd.Reader[0].ToString());
			}
			_bd.Reader.Close();
			string[] labels = new string[iNbProduits];
	          	PointPairList list1 = new PointPairList();
//		        double[] y = new double[iNbProduits];
			_bd.Command.CommandText = "SELECT `Nom`, `solde`" +
				"FROM Client";
			_bd.Reader = _bd.Command.ExecuteReader();
			for (int i=0; i<iNbProduits; i++) {
				if(_bd.Reader.Read()) {
				labels[i] = _bd.Reader["nom"].ToString();
			double y=double.Parse(_bd.Reader["solde"].ToString());
//			y [i]= Math.Sin( (double)_bd.Reader["solde"]);
			//list1.Add(y,y);
				}//if
			}//for i
			_bd.Reader.Close();
	       LineItem myCurve = myPane.AddCurve( "solde",
			                      list1, Color.Red,SymbolType.Diamond );
 			zgc.AxisChange();
		}


所以问题恰恰在于链接到数据库的一部分!!


so problem exactly in the part of linking to database!!
http://www.codeproject.com/KB/graphics/zedgraph.aspx

推荐答案


这篇关于如何将zedgraph图表与mysql数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 13:19