title: Hide lines in Chart
body: <p><img src="https://i.stack.imgur.com/nGPNI.png" alt="enter image description here"></p>
  
  <p>I want to remove indicated particular three vertical lines from graph except last line.</p>
  
  <pre><code>public void ProcessRequest(HttpContext context)
      {
          try
          {
              string Identification = context.Request.QueryString["identification"].ToString().Trim();
              DateTime BaseDate = Convert.ToDateTime(context.Request.QueryString["baseDate"]);
              Guid? UserId = Guid.Parse(context.Request.QueryString["userId"]);
              Guid CustomerGuid = Guid.Parse(context.Request.QueryString["customerGuid"]);
  
              RootDataOperations root = new RootDataOperations();
              int FedID = root.GetFedIDByCustomerGuid(CustomerGuid);
  
              Chart Chart1 = new Chart();
              ChartArea chartArea = new ChartArea("ChartArea1");
  
              Chart1.ChartAreas.Add("ChartArea1");
  
              int width = 600, height = 500;
              Chart1.Width = width;
              Chart1.Height = height;
  
              Chart1.ChartAreas[0].AxisX.IsLabelAutoFit = true;
              Chart1.ChartAreas[0].AxisX.LabelAutoFitMinFontSize = 10;
              Chart1.ChartAreas[0].AxisX.LabelAutoFitMaxFontSize = 10;
  
  
  
              DataTable table = new DataTable();
              DataOperations data = new DataOperations(FedID, Guid.Empty);
              List&lt;UserQuarterlyTopPerformerComparison&gt; userQuarterlyTopPerformerComparison = new List&lt;UserQuarterlyTopPerformerComparison&gt;();
              userQuarterlyTopPerformerComparison = data.GetUserQuarterlyTopPerformerComparison(Identification, UserId.Value, BaseDate);
  
              DataTable dt = ToDataTable&lt;UserQuarterlyTopPerformerComparison&gt;(userQuarterlyTopPerformerComparison);
  
              if (dt.Rows.Count &gt; 0)
              {
                  Legend legend = new Legend();
                  legend.Docking = Docking.Top;
                  legend.Alignment = StringAlignment.Center;
                  legend.IsTextAutoFit = false;
                  Chart1.Legends.Add(legend);
                  Chart1.Legends[0].Enabled = true;
  
                  var IEtable = (dt as System.ComponentModel.IListSource).GetList();
  
                  Chart1.DataBindTable(userQuarterlyTopPerformerComparison, "Quarter");
  
                  //string userName = dt.Rows[0]["CUNAME"].ToString() + " (Current User)";
                  Guid currentuser = UserId.Value;
                  string userName = data.GetUserByID(currentuser).Name1 + " (Current User)";
  
                  string cuname = string.Empty;
                  int i = 0;
  
                  Dictionary&lt;string, Color&gt; dictionary = new Dictionary&lt;string, Color&gt;();
                  dictionary.Add(userName, System.Drawing.Color.DimGray);
  
                  List&lt;DataRow&gt; distinctUsers = dt.DefaultView.ToTable(true, "TU1NAME", "TU2NAME", "TU3NAME").AsEnumerable().Distinct().ToList();
  
                  int count = 0;
                  foreach (DataRow dr in distinctUsers)
                  {
                      Color colour = System.Drawing.Color.White;
                      int drCount = 0;
                      foreach (object oObject in dr.ItemArray)
                      {
                          if (dr[drCount].ToString() != "" &amp;&amp; !dictionary.ContainsKey(dr[drCount].ToString()))
                          {
                              if (count == 0)
                              {
                                  colour = System.Drawing.Color.Green;
                              }
                              if (count == 1)
                              {
                                  colour = System.Drawing.Color.Red;
                              }
                              if (count == 2)
                              {
                                  colour = System.Drawing.Color.Purple;
                              }
                              if (count == 3)
                              {
                                  colour = System.Drawing.Color.RoyalBlue;
                              }
                              if (count == 4)
                              {
                                  colour = System.Drawing.Color.AliceBlue;
                              }
                              if (count == 5)
                              {
                                  colour = System.Drawing.Color.Azure;
                              }
                              if (count == 6)
                              {
                                  colour = System.Drawing.Color.Beige;
                              }
                              if (count == 7)
                              {
                                  colour = System.Drawing.Color.Chocolate;
                              }
                              if (count == 8)
                              {
                                  colour = System.Drawing.Color.Coral;
                              }
                              if (count == 9)
                              {
                                  colour = System.Drawing.Color.Cyan;
                              }
                              if (count == 10)
                              {
                                  colour = System.Drawing.Color.DarkKhaki;
                              }
                              if (count == 11)
                              {
                                  colour = System.Drawing.Color.DarkOrange;
                              }
  
                              dictionary.Add(dr[drCount].ToString(), colour);
  
                              count++;
  
                          }
                          drCount++;
                      }
                  }
  
  
                  Legend legend1 = null;
                  foreach (string key in dictionary.Keys)
                  {
                      legend1 = new Legend();
                      legend1.Docking = Docking.Top;
  
                      legend1.Alignment = StringAlignment.Center;
                      legend1.IsTextAutoFit = false;
                      Chart1.Legends.Add(legend1);
                      Chart1.Legends[1].CustomItems.Add(new LegendItem(key, dictionary[key], ""));
                  }
  
                  foreach (Series series in Chart1.Series)
                  {
                      series.ChartType = SeriesChartType.Bar;
                      Chart1.Legends[0].Enabled = false;
                  }
  
                  if (distinctUsers.Count &gt;= 1)
                  {
                      Chart1.Series[0].Points[0].Color = dictionary[userName];
                      Chart1.Series[0].Points[0].Label = userName;
                      if (dt.Rows[0]["TU1NAME"].ToString() != "")
                      {
                          Chart1.Series[1].Points[0].Color = dictionary[dt.Rows[0]["TU1NAME"].ToString()];
                          Chart1.Series[1].Points[0].Label = dt.Rows[0]["TU1NAME"].ToString()+" (Top 1)";
                      }
                      if (dt.Rows[0]["TU2NAME"].ToString() != "")
                      {
                          Chart1.Series[2].Points[0].Color = dictionary[dt.Rows[0]["TU2NAME"].ToString()];
                          Chart1.Series[2].Points[0].Label = dt.Rows[0]["TU2NAME"].ToString() + " (Top 2)";
                      }
                      if (dt.Rows[0]["TU3NAME"].ToString() != "")
                      {
                          Chart1.Series[3].Points[0].Color = dictionary[dt.Rows[0]["TU3NAME"].ToString()];
                          Chart1.Series[3].Points[0].Label = dt.Rows[0]["TU3NAME"].ToString() + " (Top 3)";
                      }
  
                      if (distinctUsers.Count &gt;= 2)
                      {
                          Chart1.Series[0].Points[1].Color = dictionary[userName];
                          Chart1.Series[0].Points[1].Label = userName;
                          if (dt.Rows[1]["TU1NAME"].ToString() != "")
                          {
                              Chart1.Series[1].Points[1].Color = dictionary[dt.Rows[1]["TU1NAME"].ToString()];
                              Chart1.Series[1].Points[1].Label = dt.Rows[1]["TU1NAME"].ToString() + " (Top 1)";
                          }
                          if (dt.Rows[1]["TU2NAME"].ToString() != "")
                          {
                              Chart1.Series[2].Points[1].Color = dictionary[dt.Rows[1]["TU2NAME"].ToString()];
                              Chart1.Series[2].Points[1].Label = dt.Rows[1]["TU2NAME"].ToString() + " (Top 2)";
                          }
                          if (dt.Rows[1]["TU3NAME"].ToString() != "")
                          {
                              Chart1.Series[3].Points[1].Color = dictionary[dt.Rows[1]["TU3NAME"].ToString()];
                              Chart1.Series[3].Points[1].Label = dt.Rows[1]["TU3NAME"].ToString() + " (Top 3)";
                          }
  
                          if (distinctUsers.Count &gt;= 3)
                          {
                              Chart1.Series[0].Points[2].Color = dictionary[userName];
                              Chart1.Series[0].Points[2].Label = userName;
                              if (dt.Rows[2]["TU1NAME"].ToString() != "")
                              {
                                  Chart1.Series[1].Points[2].Color = dictionary[dt.Rows[2]["TU1NAME"].ToString()];
                                  Chart1.Series[1].Points[2].Label = dt.Rows[2]["TU1NAME"].ToString() + " (Top 1)";
                              }
                              if (dt.Rows[2]["TU2NAME"].ToString() != "")
                              {
                                  Chart1.Series[2].Points[2].Color = dictionary[dt.Rows[2]["TU2NAME"].ToString()];
                                  Chart1.Series[2].Points[2].Label = dt.Rows[2]["TU2NAME"].ToString() + " (Top 2)";
                              }
                              if (dt.Rows[2]["TU3NAME"].ToString() != "")
                              {
                                  Chart1.Series[3].Points[2].Color = dictionary[dt.Rows[2]["TU3NAME"].ToString()];
                                  Chart1.Series[3].Points[2].Label = dt.Rows[2]["TU3NAME"].ToString() + " (Top 3)";
                              }
                          }
                      }
  
                  }
  
  
  
                  string fileLoacation = HttpContext.Current.Server.MapPath("Images") + "/test.png";
                  int counter = 1;
                  while (System.IO.File.Exists(fileLoacation))
                  {
                      fileLoacation = HttpContext.Current.Server.MapPath("Images") + "/test" + counter + ".png";
                      counter++;
                  }
                  Chart1.SaveImage(fileLoacation, ChartImageFormat.Png);
  
                  Image img = Image.FromFile(fileLoacation);
                  Image _img = new Bitmap(width, height, img.PixelFormat);
                  Graphics g = Graphics.FromImage(_img);
                  g.DrawImage(img, 0, 0, width, height);
                  g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
                  g.Dispose();
                  img.Dispose();
                  MemoryStream str = new MemoryStream();
                  _img = _img.GetThumbnailImage(width, height, null, IntPtr.Zero);
                  _img.Save(str, System.Drawing.Imaging.ImageFormat.Png);
                  _img.Dispose();
                  str.WriteTo(context.Response.OutputStream);
                  str.Dispose();
                  str.Close();
                  System.IO.File.Delete(fileLoacation);
                  context.Response.ContentType = ".png";
  
                  //string strGridVal = string.Empty;
                  //strGridVal = "&lt;table border=\"1\"&gt;";
                  //for (int i = 0; i &lt; dt.Rows.Count; i++)
                  //{
                  //    strGridVal += "&lt;tr&gt;&lt;td&gt;" + dt.Rows[i][2].ToString()+ "&lt;/td&gt;&lt;/tr&gt;";
                  //}
                  //strGridVal += "&lt;/table&gt;";
                  //context.Response.ContentType = "text/html";
                  //context.Response.Write(strGridVal);
                  //context.Response.ContentType = dt.ToString();
              }
          }
          catch (Exception ex)
          {
              System.Diagnostics.Trace.WriteLine(ex);
          }
          finally
          {
              context.Response.End();
          }
  
      }
  </code></pre>