如何在创建条形图时设置图表控件的高度自动 [英] How to set chart control height auto while creating bar type chart
本文介绍了如何在创建条形图时设置图表控件的高度自动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用asp:chart控件制作条形图时,我遇到了问题.
我想将图表控件的高度设为自动,以便可以自动显示带有700px的固定条高;
谢谢
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
推荐答案
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
这篇关于如何在创建条形图时设置图表控件的高度自动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文