title: Chart creating dynamically. in .net, c#
body: <p>Does anybody have some experience working with charts in <code>.NET</code>? Specially I want to create them programmatically.</p>
  
  <pre><code>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.Windows.Forms.DataVisualization.Charting;
  using System.Diagnostics;
  
  namespace WindowsFormsApplication6
  {
    public partial class Form1 : Form
    {
      public Form1()
      {
          InitializeComponent();
      }
  
      private void Form1_Load(object sender, EventArgs e)
      {
          Random rnd = new Random();
          Chart mych = new Chart();
          mych.Series.Add("duck");
  
          mych.Series["duck"].SetDefault(true);
          mych.Series["duck"].Enabled = true;
          mych.Visible = true;
  
          for (int q = 0; q &lt; 10; q++)
          {
              int first = rnd.Next(0,10);
              int second = rnd.Next(0,10);
              mych.Series["duck"].Points.AddXY(first, second);
              Debug.WriteLine(first + "  " + second);
          }
          mych.Show();
          Controls.Add(mych);
          mych.Show();
      }
    }
  }
  </code></pre>
  
  <p>I'm trying to use <code>.NET (.net 4, Visual Studio 2010)</code> <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting(v=vs.110).aspx" rel="noreferrer">chart</a>, but the random generated data set, doesn't appear. The chart remained blank. I searched for examples and only found ones like  <a href="http://codeabout.wordpress.com/2011/05/15/easy-way-to-plot-graphs-in-c-and-visual-studio-2010/" rel="noreferrer"> this </a>, and, yes with manual "drag" method it works. I have no idea why the data I programmatically generate doesn't appear.  </p>