title: Creating Stacked Bar Column Chart with CODE BEHIND
body: <p>I need to create a Stacked column chart as shown in the picture. 
  X-Axis : Component name
  Y-Axis : Number of bugs
  Stacks : For each component I need to create stacked charts which tell me:
      ---> For each component category(Audio/Video) I need to say that I have x number of HIGH , MEDIUM, LOW, SHOWSTOPPER bugs.</p>
  
  <p>I have the data in the format of :
  Category NAME ||
    BUG TYPE : numbers
    BUG TYPE : numbers
    BUG TYPE : numbers
    BUG TYPE : numbers</p>
  
  <p>Sample Data: 
  AUDIO::=> 
    high: 30
    medium: 17
    low: 1
  VIDEO::=>
    high: 1
  PERIPHERAL::=>
    medium: 15
    high: 14
    low: 1
    showstopper: 1
  SENSOR::=>
    medium: 2</p>
  
  <p>These data displayed above were created with some LINQ queries. So it is not in a dictionary. The Code to create the data above:</p>
  
  <pre><code>var dbQuery = from bug in RawListData
                group bug by new { bug.category, bug.customer_priority } into grouped
                select new { 
                    Category = grouped.Key.category,
                    Priority = grouped.Key.customer_priority,
                    Count = grouped.Count()
                };
  
              var query = dbQuery.ToLookup(result =&gt; result.Category,
                                           result =&gt; new { result.Priority, result.Count });
  
  
              foreach (var result in query)
              {
                  //Console.WriteLine("{0}: ", result.Key);
                  System.Diagnostics.Debug.WriteLine(" : ", result.Key);
                  foreach (var subresult in result)
                  {
                      //Console.WriteLine("  {0}: {1}", subresult.Priority, subresult.Count);
                      System.Diagnostics.Debug.WriteLine("  {0}: {1}", subresult.Priority, subresult.Count);
                  }
              }
  </code></pre>
  
  <p>Please note that some categories don't have values for each of the bug types. </p>
  
  <p>I know how to do this in XAML. I want to do this in "code behind". Any pointers on this would be appreciated. The code I sued to create the graph is plain XAML: </p>
  
  <pre><code>&lt;asp:Chart ID="Chart2" runat="server" ImageLocation="~/FolderLocation/Chart_#SEQ(1000,0)" ImageStorageMode="UseImageLocation" ImageType="Png" IsSoftShadows="true"&gt;
  
        &lt;series&gt;
          &lt;asp:Series Name="Championships" YValueType="Int32" ChartType="StackedColumn" &gt; 
           &lt;Points&gt; 
              &lt;asp:DataPoint AxisLabel="Audio" YValues="17" /&gt; 
              &lt;asp:DataPoint AxisLabel="Video" YValues="15" /&gt; 
              &lt;asp:DataPoint AxisLabel="Peripheral" YValues="6" /&gt;            
           &lt;/Points&gt; 
          &lt;/asp:Series&gt; 
          &lt;asp:Series Name="Championships2" YValueType="Int32" ChartType="StackedColumn" &gt; 
           &lt;Points&gt; 
              &lt;asp:DataPoint AxisLabel="Audio" YValues="2" /&gt; 
              &lt;asp:DataPoint AxisLabel="Video" YValues="5" /&gt; 
              &lt;asp:DataPoint AxisLabel="Peripheral" YValues="16" /&gt; 
           &lt;/Points&gt; 
          &lt;/asp:Series&gt; 
          &lt;asp:Series Name="Championships3" YValueType="Int32" ChartType="StackedColumn" &gt; 
           &lt;Points&gt; 
              &lt;asp:DataPoint AxisLabel="Audio" YValues="10" /&gt; 
              &lt;asp:DataPoint AxisLabel="Video" YValues="3" /&gt; 
              &lt;asp:DataPoint AxisLabel="Peripheral" YValues="16" /&gt; 
  
           &lt;/Points&gt; 
          &lt;/asp:Series&gt; 
          &lt;asp:Series Name="Championships4" YValueType="Int32" ChartType="StackedColumn" &gt; 
           &lt;Points&gt; 
              &lt;asp:DataPoint AxisLabel="Audio" YValues="10" /&gt; 
              &lt;asp:DataPoint AxisLabel="Video" YValues="3" /&gt; 
              &lt;asp:DataPoint AxisLabel="Peripheral" YValues="16" /&gt; 
           &lt;/Points&gt; 
          &lt;/asp:Series&gt; 
        &lt;/series&gt;
              &lt;chartareas&gt;
                  &lt;asp:ChartArea Name="ChartArea1"&gt;
                      &lt;Area3DStyle Enable3D="True" /&gt;
                  &lt;/asp:ChartArea&gt;
              &lt;/chartareas&gt;
          &lt;/asp:Chart&gt;
  </code></pre>
  
  <p>I would also like to display the number of bugs on each stack component.</p>
  
  <p>How do I create this stacked chart by writing code and not in XAML?</p>