title: Changing the label color on a Pie Chart using System.Web.UI.DataVisualization.Charting namespace
body: <p>I am trying to use the System.Web.UI.DataVisualization.Charting namespace to generate a pie chart and I got it to do mostly what I want.  The Theme I'm using has the following code:</p>
  <pre><code>public static class ChartThemes
  {
      public const string Blue =
      @&quot;&lt;Chart ForeColor=&quot;&quot;#ffffff&quot;&quot; BackColor=&quot;&quot;#0000ff&quot;&quot; BackGradientStyle=&quot;&quot;TopBottom&quot;&quot;         BackSecondaryColor=&quot;&quot;White&quot;&quot; BorderColor=&quot;&quot;26, 59, 105&quot;&quot; BorderlineDashStyle=&quot;&quot;Solid&quot;&quot; BorderWidth=&quot;&quot;2&quot;&quot; Palette=&quot;&quot;none&quot;&quot; PaletteCustomColors=&quot;&quot;#0000FF; #0055ff; #5599ff;&quot;&quot;&gt;
      &lt;Titles&gt;
          &lt;Title ForeColor=&quot;&quot;#ffffff&quot;&quot; Name=&quot;&quot;main&quot;&quot; Font=&quot;&quot;Arial Black, 16pt, style=Bold&quot;&quot; /&gt;
      &lt;/Titles&gt;
      &lt;ChartAreas&gt;
          &lt;ChartArea Name=&quot;&quot;Default&quot;&quot; _Template_=&quot;&quot;All&quot;&quot; BackColor=&quot;&quot;64, 165, 191, 228&quot;&quot; BackGradientStyle=&quot;&quot;TopBottom&quot;&quot; BackSecondaryColor=&quot;&quot;White&quot;&quot; BorderColor=&quot;&quot;64, 64, 64, 64&quot;&quot; BorderDashStyle=&quot;&quot;Solid&quot;&quot; ShadowColor=&quot;&quot;Transparent&quot;&quot;&gt;
              &lt;AxisY LineColor=&quot;&quot;64, 64, 64, 64&quot;&quot; TitleForeColor=&quot;&quot;#ffffff&quot;&quot; TitleFont=&quot;&quot;Arial Black, 8pt&quot;&quot;&gt;
                  &lt;MajorGrid Interval=&quot;&quot;Auto&quot;&quot; LineColor=&quot;&quot;#00ff00&quot;&quot; /&gt;
                  &lt;LabelStyle Font=&quot;&quot;Trebuchet MS, 16pt, style=Bold&quot;&quot; ForeColor=&quot;&quot;#ffffff&quot;&quot; /&gt;
              &lt;/AxisY&gt;
              &lt;AxisX TitleForeColor=&quot;&quot;#ffffff&quot;&quot; TitleFont=&quot;&quot;Arial Black, 8pt&quot;&quot;&gt;
                  &lt;LabelStyle ForeColor=&quot;&quot;#ffffff&quot;&quot; /&gt;
                  &lt;MajorGrid Interval=&quot;&quot;Auto&quot;&quot; LineColor=&quot;&quot;#ff0000&quot;&quot; /&gt;
              &lt;/AxisX&gt;
              &lt;AxisX2&gt;
                  &lt;LabelStyle ForeColor=&quot;&quot;#ffffff&quot;&quot; /&gt;
              &lt;/AxisX2&gt;
              &lt;AxisY2&gt;
                  &lt;LabelStyle ForeColor=&quot;&quot;#ffffff&quot;&quot; /&gt;
              &lt;/AxisY2&gt;
          &lt;/ChartArea&gt;
      &lt;/ChartAreas&gt;
      &lt;Legends&gt;
          &lt;Legend _Template_=&quot;&quot;All&quot;&quot; BackColor=&quot;&quot;Transparent&quot;&quot; Font=&quot;&quot;Trebuchet MS, 8.25pt, style=Bold&quot;&quot; IsTextAutoFit=&quot;&quot;False&quot;&quot;  ForeColor=&quot;&quot;#ffffff&quot;&quot;/&gt;
      &lt;/Legends&gt;
      &lt;BorderSkin SkinStyle=&quot;&quot;Emboss&quot;&quot; /&gt;
    &lt;/Chart&gt;&quot;;
  }
  </code></pre>
  <p>Then I'm generating my pie chart like this:</p>
  <pre><code>public ActionResult PieChart()
  {
       var chart2 = new Chart(width: 600, height: 600, theme: Helpers.ChartThemes.Blue).AddTitle(&quot;Pie Chart&quot;,&quot;main&quot;)
      .AddSeries(&quot;Default&quot;, chartType: &quot;Pie&quot;, xValue: new[] { &quot;Pizza&quot;, &quot;Hamburgers&quot;, &quot;Hot Dogs&quot; }, yValues: new[] { 20, 20, 60 })
      .AddLegend()
      .GetBytes(&quot;png&quot;);
      return File(chart2, &quot;image/png&quot;);
   }
  </code></pre>
  <p>I then get a chart that looks like:</p>
  <p><img src="https://i.stack.imgur.com/viM0R.png" alt="Blue Pie Chart" /></p>
  <p>The problem is that I don't want the labels that appear on the pie segments themselves to be black, I want them to be white.  However, I cannot find much documentation on how to do it in XML or any other way.</p>
  <p>So my question is how to do I use the XML to change the color of the labels on the segments of the pie itself (the ones that appear black in the picture)?</p>