Change the font style of Pie Chart by setting Font Property in Series in ASP.Net

Last Reply one year ago By Rucha

Posted one year ago


    public void CreateChartFastMoving()
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["InvoiceApp"].ToString());
            DataTable dsbox = new DataTable();
            SqlCommand cmd = new SqlCommand("DisplayTopSellingProductUserSide", con);
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            Chart1.DataSource = dsbox;
     	    Chart1.ChartAreas[0].AxisX.LabelStyle.Font = new System.Drawing.Font("Arial", 12f, FontStyle.Bold);


I am getting trouble to apply font style in chart control.

I want to change the font style of pie chart which shows productname using asp chart control.

I apply following for that.

"Chart1.ChartAreas[0].AxisX.LabelStyle.Font = new System.Drawing.Font("Arial", 12f, FontStyle.Bold);"

But it do not aafect it shows default font.

What can i do?Please suggest.

Thanks in advance.

Posted one year ago

Hello Kalpesh,

Thanks you so much for your fast reply.

But it doesnt work.

Finally i got answer.

 Set font property in series like below.

 Font="Times New Roman, 11pt, style=Bold, Italic"


                        <asp:Series Name="TopSellingProduct" XValueMember="ProductName" YValueMembers="TotalQty"
                            IsVisibleInLegend="true" ChartType="Pie"  Label="#VALX(#VAL)"  CustomProperties="BarLabelStyle=Right" IsValueShownAsLabel="True"  Font="Times New Roman, 11pt, style=Bold, Italic" >