MS Chart Control - Pie Chart Transparency

I am trying to show a pie chart as transparent. Ideally, this should look like the 3rd graph on the left of this page ( link ).

So far, I have been trying to set transparency on the chart.

<asp:ChartArea Name="ChartArea1" BackColor="64, 165, 191, 228" BackGradientStyle="TopBottom" BackSecondaryColor="Transparent" BorderColor="64, 64, 64, 64" ShadowColor="Transparent"> 

I also tried installing it from codebehind:

  protected void pieChart_Customize(object sender, EventArgs e) { foreach (Series s in pieChart.Series) { s.Color = Color.FromArgb(128, s.Color); } } 

However, none of these approaches work. Has anyone been able to set transparency in this type of chart management?

+4
source share
4 answers

I found the answer on MSDN: link

Here is the exact code that ended for me:

  protected void Page_Load(object sender, EventArgs e) { pieChart.Series[0].Palette = ChartColorPalette.SemiTransparent; } 
+2
source

It works:

 protected void Button1_Click(object sender, EventArgs e) { Chart1.Series[0].Points[0].Color = Color.FromArgb(100, Color.Blue); } 

Link: http://msdn.microsoft.com/en-us/library/1hstcth9%28v=vs.110%29.aspx

+3
source

The only way to get the same color is to use the default palette and set the alpha for all points to 220 (this is the number they use in all samples):

Use this code to get the desired effect after you have set all the points:

 myChart.ApplyPaletteColors(); foreach (var series in myChart.Series) { foreach (var point in series.Points) { point.Color = Color.FromArgb(220, point.Color); } } 
+2
source

Thanks! because i had the same problem. Now I fixed my application and now it works! I use:

 myChart.ApplyPaletteColors(); foreach (var series in myChart.Series) { foreach (var point in series.Points) { point.Color = Color.FromArgb(220, point.Color); } } 

Quote Header

Thanks!:)

-1
source

Source: https://habr.com/ru/post/1347126/


All Articles