title: How to change the colors of bars in Column chart in asp.net
body: <p>Hello Everyone!!!
                    I am designing a column chart from database table ..Now i need each column(bar) of the chart to have different color so that we can have different legends but i am not able to achieve it.Here is my c# code....</p>
  
  <pre><code>string conn = "Server=localhost;Port=3306;Database=dma;UID=root;Pwd=techsoft;pooling=false";
      MySqlDataAdapter adp = new MySqlDataAdapter("select ConfID,NoOfCalls from chart1", conn);
      DataSet ds = new DataSet();
      adp.Fill(ds);
  
      //2.Set the style/Settings for X and Y axis
      Chart1.Font.Size = FontUnit.Medium;
      Chart1.Series["Series1"].XValueType = ChartValueType.Int32;
      Chart1.Series["Series1"].YValueType = ChartValueType.Int32;
      Chart1.ChartAreas[0].AxisY.Title = "No. Of calls";
      Chart1.ChartAreas[0].AxisX.Title = "ConferenceId";
  
  
      //3.Define the chart type
      Chart1.Series["Series1"].ChartType = SeriesChartType.Column;
      //4.Add the actual values from the dataset to X &amp; Y co-ordinates
      for (int i = 0; i &lt; ds.Tables[0].Rows.Count; i++)
      {
          Chart1.Series["Series1"].Points.AddXY(ds.Tables[0].Rows[i]["ConfID"], ds.Tables[0].Rows[i]["NoOfCalls"]);
      }
  </code></pre>
  
  <p>And here is my aspx page code for chart...</p>
  
  <pre><code>&lt;asp:Chart id="Chart1" runat="server" Width="572px" Height="339px" 
      BorderDashStyle="Solid" BorderWidth="2px" BorderColor="#B54001" 
      onload="Chart1_Load1"&gt;
      &lt;Legends&gt;
          &lt;asp:Legend Name="Legend1"&gt;
          &lt;/asp:Legend&gt;
      &lt;/Legends&gt;
  &lt;BorderSkin SkinStyle="None" BackGradientStyle="None" BackSecondaryColor="SeaShell" BorderColor="#6198dc"       BorderDashStyle="Solid" BorderWidth="1" BackColor="White"&gt;&lt;/BorderSkin&gt;     
     &lt;Series&gt;
         &lt;asp:Series MarkerSize="3" BackGradientStyle="HorizontalCenter" BorderWidth="1" 
             Name="Series1" MarkerStyle="Circle" BorderColor="180, 26, 59, 105" 
             Color="220, 65, 140, 240"                  ShadowOffset="0" Legend="Legend1"&gt;&lt;/asp:Series&gt;
     &lt;/Series&gt;   
  
     &lt;ChartAreas&gt;
          &lt;asp:ChartArea Name="ChartArea1" BorderWidth="0" BackColor="White" ShadowColor="Transparent"&gt;
              &lt;AxisY LineColor="64, 220, 64, 64" LineDashStyle="Solid" LineWidth="2"&gt;
                         &lt;LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" /&gt;
                         &lt;MajorGrid LineColor="64, 220, 64, 64" /&gt;
                   &lt;/AxisY&gt;
                   &lt;AxisX LineColor="64, 220, 64, 64" LineDashStyle="Solid" LineWidth="2"&gt;
                         &lt;LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" /&gt;
                         &lt;MajorGrid LineColor="64, 220, 64, 64" /&gt;
                   &lt;/AxisX&gt;
            &lt;/asp:ChartArea&gt;
     &lt;/ChartAreas&gt;
  </code></pre>
  
  <p></p>
  
  <p>Plz guys help me.Thanx in advance..</p>