title: C#: How to change the color of specific lines in a chart?
body: <p>I do not want to change the whole series like this:</p>
  
  <pre><code>chart1.Series["test1"].Color = Color.Red;
  </code></pre>
  
  <p>Instead, I want to change the color of individual lines, like this:</p>
  
  <pre><code>private void dispatcherTimer_Tick(object sender, EventArgs e)
  {
      var r = new Random();
      int i = chart1.Series["test1"].Points.AddXY(r.Next(0, 10), r.Next(0, 10));
  
      try
      {
          chart1.Series["test1"].Points[i - 1].Color = Color.LightPink;
          chart1.Series["test1"].Points[i - 2].Color = Color.LightPink;
          chart1.Series["test1"].Points[i - 3].BorderDashStyle = ChartDashStyle.Dash;
          chart1.Series["test1"].Points[i - 4].BorderDashStyle = ChartDashStyle.Dash;
           chart1.Series["test1"].Points.RemoveAt(i - 5);
      }
      catch { }
  }
  </code></pre>
  
  <p>However, this is not working and I don't understand why.</p>