public void bindChartDetail()
{
objUser = (UserEntity)Session["User"];
if (objUser == null)
{
Response.Redirect("~/Default.aspx");
}
DateTime fromDate;
DateTime toDate;
String strDomainName = "";
if (ddlDomainName.SelectedIndex > 0)
{
strDomainName = ddlDomainName.SelectedItem.Text.ToString();
}
else
{
strDomainName = lblDomainName.Text;
}
if (txtFromDate.Text != "")
{
fromDate = DateTime.ParseExact(txtFromDate.Text, "dd-MM-yyyy", null);
}
else
{
fromDate = toDate = System.DateTime.Now;
}
if (txtToDate.Text != "")
{
toDate = DateTime.ParseExact(txtToDate.Text, "dd-MM-yyyy", null);
}
else
{
toDate = System.DateTime.Now;
}
ReportBL objReport = new ReportBL();
PagedDataSource rptPager = null;
DataTable dt = null;
try
{
dt = new DataTable();
dt = objReport.USERWISEACCOUNTINGINFORMATIONWITHINBOUNDOUTBOUND(strDomainName, 0, fromDate, toDate);
if (dt == null)
{
if (dt.Rows.Count > 0)
{
byte[] YPointMember = new byte[dt.Rows.Count];
ChartAreas[0].AxisX.LabelStyle.Format = "HH:mm:ss";
//DateTime[] YPointMember = new DateTime[dt.Rows.Count];
for (int count = 0; count < dt.Rows.Count; count++)
{
YPointMember[count] = Convert.ToByte(dt.Rows[count]["INBOUND"]);
//YPointMember[count] = (dt.Rows[count]["connectdatetime"]);
}
Chart1.Series[0].Points.DataBindXY(YPointMember);
Chart1.Series[0].BorderWidth = 1;
Chart1.Series[0].ChartType = SeriesChartType.Line;
}
我的数据库中有两个字段:inbound
和date
。我希望以24小时格式在x轴上显示date
,但我不知道因为我是图表控件的新手。
答案 0 :(得分:0)
你可以试试这个
ChartAreas[0].AxisX.LabelStyle.Format = "HH:mm:ss.fff";