using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; namespace WindowsFormsApplication1 { public partial class Form1 : Form { List<CustomersPoco> listCustomers = new List<CustomersPoco>(); northwndEntities n = new northwndEntities(); public Form1() { InitializeComponent(); LoadCustomers(); } public void LoadCustomers() { listCustomers = (from c in n.Customers let cCount = ( from o in n.Orders where c.CustomerID == o.CustomerID select o ).Count() select new CustomersPoco { ContactName c.ContactName, NbOrdre cCount }).ToList(); chart1.Series[0].XValueMember = "ContactName"; chart1.Series[0].YValueMembers = "NbOrdre"; ReLoadCustomers(this,null); } private void ReLoadCustomers(object sender, EventArgs e) { chart1.DataSource = listCustomers; chart1.DataBind(); } private void chart1_Click(object sender, EventArgs e) { timer1.Interval = 2000; timer1.Enabled = !timer1.Enabled; } private void timer1_Tick(object sender, EventArgs e) { Random r = new Random(); foreach (var item in listCustomers) { item.NbOrdre = (int)r.Next(1, 30); } EventHandler reLoadCustomers = new EventHandler(ReLoadCustomers); this.Invoke(reLoadCustomers, new object[] { null, null }); } } public class CustomersPoco { public string ContactName { get; set; } public int NbOrdre { get; set; } } }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionchart1.Series("Series1").XValueMember = "ContactName"; chart1.Series("Series1").YValueMembers = "NbOrdre"; chart1.Series("Series2").XValueMember = "ContactName"; chart1.Series("Series2").YValueMembers = "CA";
var sr = new StreamReader(NomFichier); string line ; while((line = sr.ReadLine()) != null) { listBox1.Items.Add(line);//NB c'est pour le test :-) }
For i = debut To nblignes - 1 S0(j) = j * dt temp = Val(T(i).Split(" ") S1(j) = temp(tnumoc + 2)) S2(j) = temp(tnumoc + 0)) S3(j) = temp(tnumoc + 1)) j = j + 1 Next i