void InitChart_AppRunsByDay(DbConnection conn, DBWorker worker) { DbCommand cmd = conn.CreateCommand(); string dateFormatStr = worker.GetConvertDateToStringExpression("StartTime", worker.GetDateFormatString_yyyy_mm_dd()); InitQueryForUsageReportTable("select " + dateFormatStr + " as RunDate, count(s.ID) as NumSessions, avg(" + worker.GetDateDiffExpression("StartTime", "EndTime", "s") + ") as Dur from " + svc.UsageReportTableName + " as s ", cmd, " group by " + dateFormatStr); DataTable dt = LoadDataTableFromCommand(cmd); AddDurationColumnFromSeconds(dt, "Duration", 2); Chart1.DataSource = dt; Chart1.Series["Series1"].XValueMember = "RunDate"; Chart1.Series["Series1"].YValueMembers = "NumSessions"; Chart1.Series["Series1"].Label = "#VALY\n(#PERCENT)"; Chart1.Series["Series1"].ChartType = SeriesChartType.Line; SetAxisProperties(Chart1.ChartAreas[0].AxisX, "Number Of Runs"); ChartArea ca = Chart1.ChartAreas.Add("duration"); Series s = Chart1.Series.Add("duration"); s.ChartArea = "duration"; s.XValueMember = "RunDate"; s.YValueMembers = "Duration"; s.YValueType = ChartValueType.DateTime; s.IsValueShownAsLabel = true; s.LabelFormat = "HH:mm"; ca.AxisY.Minimum = 0; ca.AxisY.LabelStyle.Format = "HH:mm"; ca.AxisY.LabelStyle.Enabled = true; SetAxisProperties(ca.AxisX, "Avg Duration"); AlignChartAreaTo(ca, Chart1.ChartAreas[0].Name); Chart1.DataBind(); }