How can i set a custom color as border color for the ASP.NET 3.5 chart control series in code behind(C#) ? I need a codebehind implementation of the following (which is in ASPX)
<ChartAreas>
<asp:ChartArea Name="ChartArea1开发者_Go百科" AlignmentOrientation="All">
<AxisX>
<MajorGrid LineColor="#EEEEEE" />
<MinorGrid LineColor="#EEEEEE" />
</AxisX>
<AxisY>
<MajorGrid LineColor="#EEEEEE" />
<MinorGrid LineColor="#EEEEEE" />
</AxisY>
</asp:ChartArea>
</ChartAreas>
I want to change the MajorGrid line color in my codebehind as RGB(125,135,111)
Make sure you give your Charts an ID and runat="server"...
<asp:Chart ID="ChartTest" runat="server" Width="800px" Height="300px">
</asp:Chart>
Then you can directly access the LineColor properties:
ChartTest.ChartAreas[0].AxisY2.LineColor = Color.Black;
Or using a custom colour (from a Hex string):
Color customColour = System.Drawing.ColorTranslator.FromHtml("EEEEEE");
ChartTest.ChartAreas[0].AxisY2.LineColor = customColour
精彩评论