Click here to Skip to main content
16,019,043 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am facing problem while makeing bar chart using asp:chart control .
I want to make the height of chart control auto so that i can show the bar height auto with fix with 700px;
Thanks
Posted

1 solution

C#
DataTable dtcount = dal.GetDataTable("select count(*) as counter from ABC where id='" + Request.QueryString["pid"] + "'");
            if (dtcount.Rows.Count > 0)
            {
                /*Code for showing result in aspx page*/
                Chart1.Height = new System.Web.UI.WebControls.Unit(Convert.ToDouble(dtcount.Rows[0]["counter"].ToString())*50,System.Web.UI.WebControls.UnitType.Pixel);

            }
            else
            {
                Chart1.Height = new System.Web.UI.WebControls.Unit(0, System.Web.UI.WebControls.UnitType.Pixel);
            }
            Chart1.Width = new System.Web.UI.WebControls.Unit(700, System.Web.UI.WebControls.UnitType.Pixel);

:)Enjoy
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900