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(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)