protected void Button1_Click(object sender, EventArgs e) { PrintingSystemBase ps = new PrintingSystemBase(); ps.ExportOptions.Pdf.DocumentOptions.Author = "Test"; PrintableComponentLinkBase link1 = new PrintableComponentLinkBase(ps); link1.Component = ASPxPivotGridExporter1; PrintableComponentLinkBase link2 = new PrintableComponentLinkBase(ps); WebChartControl1.DataBind(); link2.Component = ((IChartContainer)WebChartControl1).Chart; CompositeLinkBase compositeLink = new CompositeLinkBase(ps); compositeLink.Links.AddRange(new object[] { link1, link2 }); using (MemoryStream stream = new MemoryStream()) { compositeLink.ExportToPdf(stream); Response.Clear(); Response.Buffer = false; Response.AppendHeader("Content-Type", "application/pdf"); Response.AppendHeader("Content-Transfer-Encoding", "binary"); Response.AppendHeader("Content-Disposition", "attachment; filename=test.pdf"); Response.BinaryWrite(stream.ToArray()); Response.End(); } ps.Dispose(); }
public void SetGraph(string paramGraph, string DeviceName) { DataTable dt = VSWebBL.ConfiguratorBL.DominoServerDetails_BL.Ins.SetGraph(paramGraph, DeviceName); Series series = null; if (series == null) { series = new Series("DominoServer", ViewType.Spline); series.Visible = true; series.ArgumentDataMember = dt.Columns["Date"].ToString(); ValueDataMemberCollection seriesValueDataMembers = (ValueDataMemberCollection)series.ValueDataMembers; seriesValueDataMembers.AddRange(dt.Columns["StatValue"].ToString()); WebChartControl1.Series.Add(series); XYDiagram seriesXY = (XYDiagram)WebChartControl1.Diagram; seriesXY.AxisX.Title.Text = "Time"; seriesXY.AxisX.Title.Visible = true; seriesXY.AxisY.Title.Text = "Performance"; seriesXY.AxisY.Title.Visible = true; WebChartControl1.Legend.Visible = false; //WebChartControl1.Series[0].ValueDataMembers = dt.Columns["StatValue"].ToString(); WebChartControl1.DataSource = dt; WebChartControl1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { // Cpecify ScaleTypes WebChartControl1.Series[0].ArgumentScaleType = ScaleType.Qualitative; WebChartControl1.Series[0].ValueScaleType = ScaleType.DateTime; WebChartControl1.Series[1].ArgumentScaleType = ScaleType.Qualitative; WebChartControl1.Series[1].ValueScaleType = ScaleType.DateTime; (WebChartControl1.Series[1].Label as RangeBarSeriesLabel).Position = RangeBarLabelPosition.Inside; // Bound series to data WebChartControl1.DataSource = GanttData.CreateData(); WebChartControl1.Series[0].ArgumentDataMember = "GanntTask"; WebChartControl1.Series[0].ValueDataMembers.AddRange(new string[] { "GanntStart", "GanntEnd" }); // Create argument descriptions for the summary function. SummaryFunctionArgumentDescription argument1Description = new SummaryFunctionArgumentDescription("GanntStart", ScaleType.DateTime); SummaryFunctionArgumentDescription argument2Description = new SummaryFunctionArgumentDescription("GanntEnd", ScaleType.DateTime); SummaryFunctionArgumentDescription argument3Description = new SummaryFunctionArgumentDescription("GanttPercentageComplete", ScaleType.Numerical); // Register the summary function in a chart. WebChartControl1.RegisterSummaryFunction("CalcPercentageComplete", "CalcPercentageComplete", 2, new SummaryFunctionArgumentDescription[] { argument1Description, argument2Description, argument3Description }, CalcPercentageComplete); WebChartControl1.Series[1].ArgumentDataMember = "GanntTask"; WebChartControl1.Series[1].SummaryFunction = "CalcPercentageComplete([GanntStart], [GanntEnd], [GanttPercentageComplete])"; // Don't forget this !:) WebChartControl1.DataBind(); }
protected void WebChartControl1_CustomCallback(object sender, DevExpress.XtraCharts.Web.CustomCallbackEventArgs e) { if (e.Parameter == "GridChanged") { WebChartControl1.DataBind(); } }
private void BindChartToData(DataSet dataSet) { // Create a series Series series = new Series("TaskList", ViewType.Gantt); series.ArgumentScaleType = ScaleType.Qualitative; series.ValueScaleType = ScaleType.DateTime; // Bind series to data series.DataSource = dataSet.Tables[0]; series.ArgumentDataMember = "Task"; series.ValueDataMembers.AddRange(new string[] { "Start", "End" }); WebChartControl1.Series.Add(series); // Adjust series label options ((RangeBarSeriesLabel)series.Label).Position = RangeBarLabelPosition.Inside; series.Label.ResolveOverlappingMode = ResolveOverlappingMode.Default; series.Label.PointOptions.ValueDateTimeOptions.Format = DateTimeFormat.Custom; series.Label.PointOptions.ValueDateTimeOptions.FormatString = "MM'/'dd'/'yyyy"; // Adjust axes options ((XYDiagram)WebChartControl1.Diagram).AxisY.Label.DateTimeOptions.Format = DateTimeFormat.Custom; ((XYDiagram)WebChartControl1.Diagram).AxisY.Label.DateTimeOptions.FormatString = "MM'/'dd"; ((XYDiagram)WebChartControl1.Diagram).AxisY.Label.Staggered = true; ((XYDiagram)WebChartControl1.Diagram).AxisX.GridLines.Visible = true; ((XYDiagram)WebChartControl1.Diagram).AxisY.Range.SideMarginsEnabled = false; WebChartControl1.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right; WebChartControl1.DataBind(); }
private void BindChartToData() { // Create a series Series series = new Series("Series", ViewType.Line); series.ArgumentScaleType = ScaleType.DateTime; series.ValueScaleType = ScaleType.Numerical; ((LineSeriesView)series.View).LineMarkerOptions.Size = 20; // Bind series to data series.DataSource = ManualDataSet.RetrieveDataCache().Tables[0]; series.ArgumentDataMember = "MyDateTime"; series.ValueDataMembers.AddRange(new string[] { "MyData" }); WebChartControl1.Series.Add(series); // Adjust X axis options ((XYDiagram)WebChartControl1.Diagram).AxisX.DateTimeOptions.Format = DateTimeFormat.Custom; ((XYDiagram)WebChartControl1.Diagram).AxisX.DateTimeOptions.FormatString = "HH:mm:ss"; ((XYDiagram)WebChartControl1.Diagram).AxisX.Label.Staggered = true; ((XYDiagram)WebChartControl1.Diagram).AxisX.DateTimeMeasureUnit = DateTimeMeasurementUnit.Hour; //((XYDiagram)WebChartControl1.Diagram).AxisX.GridSpacingAuto = false; //((XYDiagram)WebChartControl1.Diagram).AxisX.GridSpacing = 1; WebChartControl1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { WebChartControl1.DataSourceID = "AccessDataSource1"; WebChartControl1.SeriesDataMember = "Year"; WebChartControl1.SeriesTemplate.ArgumentDataMember = "Region"; WebChartControl1.SeriesTemplate.ValueDataMembers.AddRange(new string[] { "GSP" }); WebChartControl1.SeriesTemplate.View = new SideBySideBarSeriesView(); WebChartControl1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string Name = Request.QueryString["Name"]; string Type = Request.QueryString["Type"]; DataTable statustab = VSWebBL.DashboardBL.DashboardBL.Ins.GetStatusChart(Name, Type); WebChartControl1.DataSource = statustab; WebChartControl1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { DbStuff dsf = new DbStuff(); var device = dsf.GetDevices(); ddlDevices.DataSource = device; ddlDevices.DataValueField = "DeviceId"; ddlDevices.DataTextField = "DeviceAllias"; ddlDevices.DataBind(); WebChartControl1.DataSource = FinancialData.GetUSDJPYData(); WebChartControl1.DataBind(); }
protected void Page_PreRender(object sender, EventArgs e) { List <nwind.Products> list = new List <nwind.Products>(); for (int i = ASPxGridView1.VisibleStartIndex; i < ASPxGridView1.SettingsPager.PageSize + ASPxGridView1.VisibleStartIndex; i++) { if (!ASPxGridView1.IsGroupRow(i)) { list.Add((nwind.Products)ASPxGridView1.GetRow(i)); } } WebChartControl1.DataSource = list; WebChartControl1.DataBind(); }
protected void ASPxGridView1_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridViewColumnDataEventArgs e) { if (e.Column.FieldName == "LineChartValueUnbound") { Series seriesValue = (Series)e.GetListSourceFieldValue("LineChartValues"); WebChartControl1.Series.Clear(); WebChartControl1.Series.Add(seriesValue); using (MemoryStream s = new MemoryStream()) { WebChartControl1.ExportToImage(s, ImageFormat.Jpeg); Bitmap bitmap = (Bitmap)Image.FromStream(s); ImageConverter converter = new ImageConverter(); e.Value = (byte[])converter.ConvertTo(bitmap, typeof(byte[])); } } }
protected void WebChartControl1_CustomCallback(object sender, DevExpress.XtraCharts.Web.CustomCallbackEventArgs e) { var list = new List <DataRowView>(); for (int i = 0; i < ASPxGridView1.VisibleRowCount; i++) { if (!ASPxGridView1.IsGroupRow(i)) { list.Add((DataRowView)ASPxGridView1.GetRow(i)); } } Session["DataSource"] = list; WebChartControl1.DataSource = list; WebChartControl1.DataBind(); }
protected void Page_PreRender(object sender, EventArgs e) { if (!IsPostBack) { Session["DataSource"] = AccessDataSource1; } if (Session["DataSource"] is AccessDataSource) { WebChartControl1.DataSource = (AccessDataSource)Session["DataSource"]; } else { WebChartControl1.DataSource = (List <DataRowView>)Session["DataSource"]; } WebChartControl1.DataBind(); }
private void BindSimpleChartToData() { // Cpecify ScaleTypes WebChartControl1.SeriesTemplate.ArgumentScaleType = ScaleType.DateTime; WebChartControl1.SeriesTemplate.ValueScaleType = ScaleType.Numerical; // Bound series template to data WebChartControl1.DataSource = GetSimpleChartDataCache().Tables[0]; WebChartControl1.SeriesDataMember = "MyRow"; WebChartControl1.SeriesTemplate.ArgumentDataMember = "MyDateTime"; WebChartControl1.SeriesTemplate.ValueDataMembers.AddRange(new string[] { "MyData" }); // Adjust AxisX ((XYDiagram)WebChartControl1.Diagram).AxisX.DateTimeOptions.Format = DateTimeFormat.ShortDate; ((XYDiagram)WebChartControl1.Diagram).AxisX.DateTimeMeasureUnit = DateTimeMeasurementUnit.Day; WebChartControl1.DataBind(); }
private void ShowOrderDetails() { // Create series Series orderDetailsSeries = new Series("OrderDetails", ViewType.Bar); // Cpecify ScaleTypes orderDetailsSeries.ArgumentScaleType = ScaleType.Qualitative; orderDetailsSeries.ValueScaleType = ScaleType.Numerical; // Bound series to data orderDetailsSeries.DataSource = (Session["DrillDownDataSet"] as DrillDownDataSet).Order_Details; orderDetailsSeries.ArgumentDataMember = "OrderID"; orderDetailsSeries.ValueDataMembers.AddRange(new string[] { "UnitPrice" }); WebChartControl1.Series.Clear(); WebChartControl1.Series.Add(orderDetailsSeries); WebChartControl1.DataBind(); }
private void ShowProducts() { // Create series Series productsSeries = new Series("Products", ViewType.Bar); // Cpecify ScaleTypes productsSeries.ArgumentScaleType = ScaleType.Qualitative; productsSeries.ValueScaleType = ScaleType.Numerical; // Bound series to data productsSeries.DataSource = (Session["DrillDownDataSet"] as DrillDownDataSet).Products; productsSeries.ArgumentDataMember = "ProductName"; productsSeries.ValueDataMembers.AddRange(new string[] { "UnitPrice" }); WebChartControl1.Series.Clear(); WebChartControl1.Series.Add(productsSeries); WebChartControl1.DataBind(); }
private void ShowCategories() { // Create series Series categoriesSeries = new Series("Categories", ViewType.Bar); // Cpecify ScaleTypes categoriesSeries.ArgumentScaleType = ScaleType.Qualitative; categoriesSeries.ValueScaleType = ScaleType.Numerical; // Bound series to data categoriesSeries.DataSource = (Session["DrillDownDataSet"] as DrillDownDataSet).Categories; categoriesSeries.ArgumentDataMember = "CategoryName"; categoriesSeries.ValueDataMembers.AddRange(new string[] { "CategoryID" }); WebChartControl1.Series.Clear(); WebChartControl1.Series.Add(categoriesSeries); WebChartControl1.DataBind(); }
private void ExportToXls() { btn_search_Click(null, null); PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link1 = new PrintableComponentLink(); //link1.Component = ASPxPivotGridExporter1; link1.PrintingSystem = ps; PrintableComponentLink link2 = new PrintableComponentLink(); WebChartControl1.DataBind(); link2.Component = ((IChartContainer)WebChartControl1).Chart; link2.PrintingSystem = ps; CompositeLink compositeLink = new CompositeLink(); compositeLink.Links.AddRange(new object[] { link1, link2 }); compositeLink.PrintingSystem = ps; compositeLink.CreateDocument(); compositeLink.PrintingSystem.ExportOptions.Pdf.DocumentOptions.Author = "Test"; using (MemoryStream stream = new MemoryStream()) { compositeLink.PrintingSystem.ExportToPdf(stream); byte[] bt = stream.GetBuffer(); if (bt.Length > 0) { Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.Buffer = true; Response.ContentType = "application/xls"; Response.AddHeader("Content-Length", bt.Length.ToString()); Response.AddHeader("Content-Disposition", "inline; filename=123.xls"); Response.BinaryWrite(bt); } } ps.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { NorthwindDataContext dataContext = new NorthwindDataContext(); //productsQuery will have a IQueryable<Category> type var productsQuery = from category in dataContext.Categories where category.CategoryID == 1 join product in dataContext.Products on category equals product.Category select new { Category = category.CategoryName, Product = product.ProductName, Price = product.UnitPrice }; DevExpress.XtraCharts.Series series = new DevExpress.XtraCharts.Series("Series1", DevExpress.XtraCharts.ViewType.RadarArea); series.DataSource = productsQuery; series.ArgumentDataMember = "Product"; series.ValueDataMembers.AddRange(new string[] { "Price" }); WebChartControl1.Series.Add(series); WebChartControl1.DataBind(); ((DevExpress.XtraCharts.RadarDiagram)WebChartControl1.Diagram).AxisY.Range.MaxValue = 50; } }
protected void Page_Load(object sender, EventArgs e) { Class1 cet = new Class1(); cet.Test(); //WebChartControl1.DataSource = DevAV.GetTotalSales(); WebChartControl1.DataSource = DevAV.GetTotalSales(cet.Test()); WebChartControl1.DataBind(); var keys = DevAV.CategorizedProducts.Keys; categories = new List <string>(keys.Count); foreach (string category in DevAV.CategorizedProducts.Keys) { categories.Add(category); } XYDiagram diagram = WebChartControl1.Diagram as XYDiagram; if (diagram != null) { diagram.AxisX.Label.Font = new Font(diagram.AxisX.Label.Font, FontStyle.Underline); } }
private void ExportToPdf() { PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link1 = new PrintableComponentLink(); //link1.Component = ASPxPivotGridExporter1; link1.PrintingSystem = ps; PrintableComponentLink link2 = new PrintableComponentLink(); WebChartControl1.DataBind(); link2.Component = ((IChartContainer)WebChartControl1).Chart; link2.PrintingSystem = ps; CompositeLink compositeLink = new CompositeLink(); compositeLink.Links.AddRange(new object[] { link1, link2 }); compositeLink.PrintingSystem = ps; compositeLink.CreateDocument(); compositeLink.PrintingSystem.ExportOptions.Pdf.DocumentOptions.Author = "Test"; using (MemoryStream stream = new MemoryStream()) { compositeLink.PrintingSystem.ExportToPdf(stream); Response.Clear(); Response.Buffer = false; Response.AppendHeader("Content-Type", "application/pdf"); Response.AppendHeader("Content-Transfer-Encoding", "binary"); Response.AppendHeader("Content-Disposition", "attachment; filename=test.pdf"); Response.BinaryWrite(stream.GetBuffer()); Response.End(); } ps.Dispose(); }
protected void btn_search_Click(object sender, EventArgs e) { string PartyTo = SafeValue.SafeString(search_PartyTo.Value, ""); if (PartyTo == "") { return; } //if (search_DateFrom.Date < new DateTime(1900, 1, 1)) //{ // search_DateFrom.Date = DateTime.Now.AddYears(-1); //} //if (search_DateTo.Date < search_DateFrom.Date) //{ // search_DateTo.Date = search_DateFrom.Date.AddYears(1); //} if (search_DateType.Text == "Year") { search_DateFrom_Month.Value = 1; search_DateTo_Month.Value = 12; } DateTime DateFrom = new DateTime(SafeValue.SafeInt(search_DateFrom_Year.Value, DateTime.Now.Year), SafeValue.SafeInt(search_DateFrom_Month.Value, DateTime.Now.Month), 1); DateTime DateTo = new DateTime(SafeValue.SafeInt(search_DateTo_Year.Value, DateTime.Now.Year), SafeValue.SafeInt(search_DateTo_Month.Value, DateTime.Now.Month), 1).AddMonths(1).AddDays(-1); int sumYear = DateTo.Date.Year - DateFrom.Year; int sumMonth = sumYear * 12 + (DateTo.Month - DateFrom.Month + 1); if (sumMonth <= 0) { return; } string sql = ""; if (search_DateType.Text.Equals("Month")) { if (search_Type.Text.Equals("Ar")) { sql = string.Format(@"select SUM(case doctype when 'IV' then LocAmt when 'DN' then LocAmt when 'CN' then -LocAmt else 0 end) as Amt, CONVERT(char(7),docdate,111)+'/01' as Date from XAArInvoice where PartyTo='{0}' and DocDate between '{1}' and '{2}' group by CONVERT(char(7),docdate,111)", PartyTo, DateFrom, DateTo); } else { sql = string.Format(@"select SUM(case doctype when 'PL' then LocAmt when 'SD' then LocAmt when 'VO' then LocAmt when 'SC' then -LocAmt else 0 end) as Amt, CONVERT(char(7),docdate,111)+'/01' as Date from XAApPayable where PartyTo='{0}' and DocDate between '{1}' and '{2}' group by CONVERT(char(7),docdate,111)", PartyTo, DateFrom, DateTo); } sql = @"select ISNULL(temp.Amt,0) as Amt,convert(char(7),showDate.Date,111) as Date from (select DATEADD(month,Tops-1,'" + DateFrom.Year + "-" + DateFrom.Date.Month + @"-1') as Date from (select top " + sumMonth + @" ROW_NUMBER() over(order by id) as Tops from sysobjects) as Tops) as ShowDate left outer join (" + sql + @") as temp on datediff(day,temp.Date,ShowDate.Date)=0 order by convert(char(7),showDate.Date,111)"; } else { if (search_Type.Text.Equals("Ar")) { sql = string.Format(@"select SUM(case doctype when 'IV' then LocAmt when 'DN' then LocAmt when 'CN' then -LocAmt else 0 end) as Amt, CONVERT(char(4),docdate,111)+'/01/01' as Date from XAArInvoice where PartyTo='{0}' and DocDate between '{1}' and '{2}' group by CONVERT(char(4),docdate,111)", PartyTo, DateFrom, DateTo); } else { sql = string.Format(@"select SUM(case doctype when 'PL' then LocAmt when 'SD' then LocAmt when 'VO' then LocAmt when 'SC' then -LocAmt else 0 end) as Amt, CONVERT(char(4),docdate,111)+'/01/01' as Date from XAApPayable where PartyTo='{0}' and DocDate between '{1}' and '{2}' group by CONVERT(char(4),docdate,111)", PartyTo, DateFrom, DateTo); } sql = @"select ISNULL(temp.Amt,0) as Amt,convert(char(4),showDate.Date,111) as Date from (select DATEADD(year,Tops-1,'" + DateFrom.Year + @"-1-1') as Date from (select top " + (sumYear + 1) + @" ROW_NUMBER() over(order by id) as Tops from sysobjects) as Tops) as ShowDate left outer join (" + sql + @") as temp on datediff(day,temp.Date,ShowDate.Date)=0 order by convert(char(4),showDate.Date,111)"; } DataTable dt = ConnectSql.GetTab(sql); WebChartControl1.DataSource = dt; WebChartControl1.DataBind(); WebChartControl1.Titles.RemoveAt(0); DevExpress.XtraCharts.ChartTitle title = new DevExpress.XtraCharts.ChartTitle(); title.Text = "[" + search_PartyTo.Text + "] Billing Chart (" + search_Type.Text + ")"; WebChartControl1.Titles.Add(title); }
public void PopulateCharts() { string Name = Session["Type"].ToString(); DataTable dtUrlResponsetime = VSWebBL.DashboardBL.URLHealthBL.Ins.GetResponseTimeGraphdata(Name); DataTable dtUrlAvailability = VSWebBL.DashboardBL.URLHealthBL.Ins.GetAvailabilityGraphdata(Name); WebChartControl1.Series.Clear(); WebChartControl2.Series.Clear(); ChartTitle ct = new ChartTitle(); ct.Text = Name; if (WebChartControl1.Titles.Count > 0) { WebChartControl1.Titles.Clear(); } WebChartControl1.Titles.Add(ct); if (WebChartControl2.Titles.Count > 0) { WebChartControl2.Titles.Clear(); } WebChartControl2.Titles.Add(ct); Series series = null; series = new Series("URL RP Server", ViewType.Line); //series = new Series("URL Avail", ViewType.Bar); series.Visible = true; series.DataSource = dtUrlResponsetime; series.ArgumentDataMember = dtUrlResponsetime.Columns["Date"].ToString(); ValueDataMemberCollection seriesValueDataMembers = (ValueDataMemberCollection)series.ValueDataMembers; seriesValueDataMembers.AddRange(dtUrlResponsetime.Columns["StatValue"].ToString()); WebChartControl1.Series.Add(series); ((XYDiagram)WebChartControl1.Diagram).PaneLayoutDirection = PaneLayoutDirection.Horizontal; XYDiagram seriesXY = (XYDiagram)WebChartControl1.Diagram; seriesXY.AxisY.Title.Text = "Response Time (ms)"; seriesXY.AxisY.Title.Visible = true; seriesXY.AxisX.Title.Text = "Time"; seriesXY.AxisX.Title.Visible = true; WebChartControl1.Legend.Visible = false; //((LineSeriesView)series.View).AxisX = 100; //((SplineSeriesView)series.View).LineMarkerOptions.Size = 4; //((SplineSeriesView)series.View).LineMarkerOptions.Color = Color.White; //((LineSeriesView)series.View).LineStyle.Thickness = 1; ((LineSeriesView)series.View).LineMarkerOptions.Size = 8; ((LineSeriesView)series.View).LineMarkerOptions.Color = Color.White; AxisBase axis = ((XYDiagram)WebChartControl1.Diagram).AxisX; //axis.DateTimeGridAlignment = DateTimeMeasurementUnit.Day; // axis.NumericOptions.Format=DevExpress.XtraCharts.NumericFormat.Number; axis.GridSpacingAuto = false; axis.MinorCount = 15; //axis.GridSpacing = 5; axis.Range.SideMarginsEnabled = false; axis.GridLines.Visible = false; //axis.DateTimeOptions.Format = DateTimeFormat.Custom; //axis.DateTimeOptions.FormatString = "MM/dd HH:MM"; ((LineSeriesView)series.View).Color = Color.Blue; AxisBase axisy = ((XYDiagram)WebChartControl1.Diagram).AxisY; axisy.Range.AlwaysShowZeroLevel = false; axisy.Range.SideMarginsEnabled = true; axisy.GridLines.Visible = true; Series series1 = null; series1 = new Series("URL Avail", ViewType.Line); series1.DataSource = dtUrlAvailability; series1.ArgumentDataMember = dtUrlAvailability.Columns["Date"].ToString(); series1.Visible = true; ((LineSeriesView)series1.View).LineMarkerOptions.Size = 8; ((LineSeriesView)series1.View).LineMarkerOptions.Color = Color.White; ((LineSeriesView)series1.View).Color = Color.Blue; ValueDataMemberCollection seriesValueDataMembers1 = (ValueDataMemberCollection)series1.ValueDataMembers; seriesValueDataMembers1.AddRange(dtUrlAvailability.Columns["StatValue"].ToString()); WebChartControl2.Series.Add(series1); WebChartControl2.Legend.Visible = false; // ((SideBySideBarSeriesView)series1.View).ColorEach = true; //AxisBase axisx = ((XYDiagram)deviceTypeWebChart.Diagram).AxisX; XYDiagram seriesXY1 = (XYDiagram)WebChartControl2.Diagram; // seriesXY.AxisX.Title.Text = "Date and Time"; //seriesXY.AxisX.Title.Visible = true; seriesXY1.AxisX.Label.ResolveOverlappingOptions.AllowRotate = false; seriesXY1.AxisY.Title.Text = "Hourly Up Percent"; seriesXY1.AxisY.Title.Visible = true; seriesXY1.AxisX.Title.Text = "Time"; seriesXY1.AxisX.Title.Visible = true; //((SideBySideBarSeriesView)series1.View).BarWidth = 5; //((SideBySideBarSeriesView)series1.View).BarDistanceFixed = 10; AxisBase axisy1 = ((XYDiagram)WebChartControl2.Diagram).AxisY; axisy1.GridLines.Visible = true; axisy1.Range.AlwaysShowZeroLevel = false; AxisBase axis1 = ((XYDiagram)WebChartControl2.Diagram).AxisX; axis1.GridSpacingAuto = false; axis1.MinorCount = 15; // axis1.GridSpacing = 5; //axis1.DateTimeOptions.FormatString = "MM/dd HH:MM"; axis1.GridLines.Visible = false; WebChartControl1.DataSource = dtUrlResponsetime; WebChartControl1.DataBind(); WebChartControl2.DataSource = dtUrlAvailability; WebChartControl2.DataBind(); WebChartControl1.Visible = true; WebChartControl2.Visible = true; }
public void SetGraphforCluster(string Name, string fromdate, string todate) { WebChartControl1.Series.Clear(); DataTable dtClusterHealth = VSWebBL.DashboardBL.ClusterHealthBL.Ins.Getgraphdata(Name, fromdate, todate); if (dtClusterHealth.Rows.Count > 0) { WebChartControl1.SeriesDataMember = "ServerName"; WebChartControl1.SeriesTemplate.ArgumentDataMember = "Date"; WebChartControl1.SeriesTemplate.ValueDataMembers.AddRange(new string[] { "StatValue" }); WebChartControl1.SeriesTemplate.View = new SideBySideBarSeriesView(); WebChartControl1.SeriesTemplate.ChangeView(ViewType.Line); LineSeriesView view = (LineSeriesView)WebChartControl1.SeriesTemplate.View; // WebChartControl1.LoadingPanelText = Name; ChartTitle ct = new ChartTitle(); ct.Text = Name; if (WebChartControl1.Titles.Count > 0) { WebChartControl1.Titles.Clear(); } //10/9/2013 NS modified WebChartControl1.Titles.Add(ct); /* * Series series = null; * series = new Series("Cluster Server", ViewType.Line); * series.Visible = true; * series.DataSource = dtClusterHealth; * series.ArgumentDataMember = dtClusterHealth.Columns["Date"].ToString(); * * ValueDataMemberCollection seriesValueDataMembers = (ValueDataMemberCollection)series.ValueDataMembers; * seriesValueDataMembers.AddRange(dtClusterHealth.Columns["StatValue"].ToString()); * WebChartControl1.Series.Add(series); */ //((XYDiagram)WebChartControl1.Diagram).PaneLayoutDirection = PaneLayoutDirection.Horizontal; XYDiagram seriesXY = (XYDiagram)WebChartControl1.Diagram; seriesXY.PaneLayoutDirection = PaneLayoutDirection.Horizontal; seriesXY.AxisY.Title.Text = "Replica.Cluster.SecondsOnQueue"; seriesXY.AxisY.Title.Visible = true; seriesXY.AxisX.Title.Text = "Date/Time"; seriesXY.AxisX.Title.Visible = true; seriesXY.AxisX.Label.ResolveOverlappingOptions.AllowRotate = false; WebChartControl1.Legend.Visible = false; //((LineSeriesView)series.View).AxisX = 100; //((SplineSeriesView)series.View).LineMarkerOptions.Size = 4; //((SplineSeriesView)series.View).LineMarkerOptions.Color = Color.White; view.LineMarkerOptions.Size = 4; view.LineMarkerOptions.Color = Color.White; view.Color = Color.Blue; //view.MarkerVisibility = DefaultBoolean.False; AxisBase axis = ((XYDiagram)WebChartControl1.Diagram).AxisX; //4/18/2014 NS commented out for VSPLUS-312 //axis.DateTimeGridAlignment = DateTimeMeasurementUnit.Hour; axis.DateTimeMeasureUnit = DateTimeMeasurementUnit.Minute; axis.DateTimeOptions.Format = DateTimeFormat.General; //10/9/2013 NS modified axis.GridSpacingAuto = true; //axis.MinorCount = 15; //axis.GridSpacing = 50; axis.Range.SideMarginsEnabled = false; axis.GridLines.Visible = false; //axis.DateTimeOptions.Format = DateTimeFormat.Custom; //axis.DateTimeOptions.FormatString = "HH:mm"; AxisBase axisy = ((XYDiagram)WebChartControl1.Diagram).AxisY; axisy.Range.AlwaysShowZeroLevel = false; axisy.Range.SideMarginsEnabled = true; axisy.GridLines.Visible = true; //10/9/2013 NS uncommented lines below WebChartControl1.DataSource = dtClusterHealth; WebChartControl1.DataBind(); } //DevExpress.Web.ASPxWebControl.RedirectOnCallback("DominoServerDetailsPage2.aspx?Name=" + Name + ""); }
protected void btn_search_Click(object sender, EventArgs e) { if (search_DateType.Text == "Year") { search_DateFrom_Month.Value = 1; search_DateTo_Month.Value = 12; } DateTime search_DateFrom = new DateTime(SafeValue.SafeInt(search_DateFrom_Year.Value, DateTime.Now.Year), SafeValue.SafeInt(search_DateFrom_Month.Value, DateTime.Now.Month), 1); DateTime search_DateTo = new DateTime(SafeValue.SafeInt(search_DateTo_Year.Value, DateTime.Now.Year), SafeValue.SafeInt(search_DateTo_Month.Value, DateTime.Now.Month), 1).AddMonths(1).AddDays(-1); if (search_XAxis.Text.Equals("Date")) { WebChartControl1.SeriesDataMember = "Custom"; WebChartControl1.SeriesTemplate.ArgumentDataMember = "Date"; WebChartControl1.SeriesTemplate.ToolTipPointPattern = @"Date:{HINT}<br/>Value:{V}"; } else { WebChartControl1.SeriesDataMember = "Date"; WebChartControl1.SeriesTemplate.ArgumentDataMember = "Custom"; WebChartControl1.SeriesTemplate.ToolTipPointPattern = @"Date:{HINT}<br/>Custom:{A}<br/>Value:{V}"; } int sumYear = search_DateTo.Date.Year - search_DateFrom.Date.Year; int sumMonth = sumYear * 12 + (search_DateTo.Date.Month - search_DateFrom.Date.Month + 1); string sql_where_cust = search_CustomerId.Text.Trim().Length > 0 ? " and CustomerId='" + search_CustomerId.Text + "'" : ""; string sql_select_cust = search_XAxis.Text.Equals("Date") ? "''" : "CustomerId"; string sql_group_cust = search_XAxis.Text.Equals("Date") ? "" : ",CustomerId"; string sql = ""; string sql_Cust_Date = ""; if (search_RefType.Text == "Import") { if (search_DateType.Text.Equals("Month")) { sql = string.Format(@"select cast(SUM(case when job.Weight/1000-job.Volume>0 then job.Weight/1000 else job.Volume end) as numeric(21,3)) as value,CONVERT(char(7),ref.Eta,111)+'/01' as Date ,{3} as Custom from SeaImport as job left outer join SeaImportRef as ref on job.RefNo=ref.RefNo where ref.Eta between '{0}' and '{1}'{2} group by CONVERT(char(7),ref.Eta,111){4}", search_DateFrom.Date, search_DateTo.Date, sql_where_cust, sql_select_cust, sql_group_cust); } else { sql = string.Format(@"select cast(SUM(case when job.Weight/1000-job.Volume>0 then job.Weight/1000 else job.Volume end) as numeric(21,3)) as value,CONVERT(char(4),ref.Eta,111)+'/01/01' as Date ,{3} as Custom from SeaImport as job left outer join SeaImportRef as ref on job.RefNo=ref.RefNo where ref.Eta between '{0}' and '{1}'{2} group by CONVERT(char(4),ref.Eta,111){4}", search_DateFrom.Date, search_DateTo.Date, sql_where_cust, sql_select_cust, sql_group_cust); } if (!search_XAxis.Text.Equals("Date")) { sql_Cust_Date = string.Format(@"select distinct job.CustomerId as Custom from SeaImport as job left outer join SeaImportRef as ref on job.RefNo=ref.RefNo where Eta between '{0}' and '{1}'{2} and ISNULL(CustomerId,'')<>''", search_DateFrom.Date, search_DateTo.Date, sql_where_cust); } } else { if (search_RefType.Text == "Export") { if (search_DateType.Text.Equals("Month")) { sql = string.Format(@"select cast(SUM(case when job.Weight/1000-job.Volume>0 then job.Weight/1000 else job.Volume end) as numeric(21,3)) as value,CONVERT(char(7),ref.Etd,111)+'/01' as Date ,{3} as Custom from SeaExport as job left outer join SeaExportRef as ref on job.RefNo=ref.RefNo where ref.Etd between '{0}' and '{1}' {2} and ref.refType like 'SE%' group by convert(char(7),ref.Etd,111){4}", search_DateFrom.Date, search_DateTo.Date, sql_where_cust, sql_select_cust, sql_group_cust); } else { sql = string.Format(@"select cast(SUM(case when job.Weight/1000-job.Volume>0 then job.Weight/1000 else job.Volume end) as numeric(21,3)) as value,CONVERT(char(4),ref.Etd,111)+'/01/01' as Date ,{3} as Custom from SeaExport as job left outer join SeaExportRef as ref on job.RefNo=ref.RefNo where ref.Etd between '{0}' and '{1}' {2} and ref.refType like 'SE%' group by convert(char(4),ref.Etd,111){4}", search_DateFrom.Date, search_DateTo.Date, sql_where_cust, sql_select_cust, sql_group_cust); } if (!search_XAxis.Text.Equals("Date")) { sql_Cust_Date = string.Format(@"select distinct job.CustomerId as Custom from SeaExport as job left outer join SeaExportRef as ref on job.RefNo=ref.RefNo where Etd between '{0}' and '{1}'{2} and ISNULL(job.CustomerId,'')<>'' and ref.refType like 'SE%'", search_DateFrom.Date, search_DateTo.Date, sql_where_cust); } } else { if (search_DateType.Text.Equals("Month")) { sql = string.Format(@"select cast(SUM(case when job.Weight/1000-job.Volume>0 then job.Weight/1000 else job.Volume end) as numeric(21,3)) as value,CONVERT(char(7),ref.Etd,111)+'/01' as Date ,{3} as Custom from SeaExport as job left outer join SeaExportRef as ref on job.RefNo=ref.RefNo where ref.Etd between '{0}' and '{1}' {2} and ref.refType like 'SC%' group by convert(char(7),ref.Etd,111){4}", search_DateFrom.Date, search_DateTo.Date, sql_where_cust, sql_select_cust, sql_group_cust); } else { sql = string.Format(@"select cast(SUM(case when job.Weight/1000-job.Volume>0 then job.Weight/1000 else job.Volume end) as numeric(21,3)) as value,CONVERT(char(4),ref.Etd,111)+'/01/01' as Date ,{3} as Custom from SeaExport as job left outer join SeaExportRef as ref on job.RefNo=ref.RefNo where ref.Etd between '{0}' and '{1}' {2} and ref.refType like 'SC%' group by convert(char(4),ref.Etd,111){4}", search_DateFrom.Date, search_DateTo.Date, sql_where_cust, sql_select_cust, sql_group_cust); } if (!search_XAxis.Text.Equals("Date")) { sql_Cust_Date = string.Format(@"select distinct job.CustomerId as Custom from SeaExport as job left outer join SeaExportRef as ref on job.RefNo=ref.RefNo where Etd between '{0}' and '{1}'{2} and ISNULL(job.CustomerId,'')<>'' and ref.refType like 'SC%'", search_DateFrom.Date, search_DateTo.Date, sql_where_cust); } } } if (search_DateType.Text.Equals("Month")) { if (search_XAxis.Text.Equals("Date")) { sql = @"select ISNULL(job.value,0) as value,ISNULL(convert(char(7),job.Date,111),convert(char(7),showDate.Date,111)) as Date,isnull(party.Name,'') as Custom from ( select DATEADD(month,Tops-1,'" + search_DateFrom.Date.Year + "-" + search_DateFrom.Date.Month + @"-1') as Date from (select top " + sumMonth + @" ROW_NUMBER() over(order by id) as Tops from sysobjects) as Tops) as ShowDate left outer join (" + sql + @") as job on datediff(day,job.Date,ShowDate.Date)=0 left outer join XXParty as party on party.PartyId=job.Custom order by ISNULL(convert(char(7),job.Date,111),convert(char(7),showDate.Date,111))"; } else { sql = @"select isnull(party.Name,'')+'('+Cust.Custom+')' as Custom,CONVERT(char(7),Cust.Date,111) as Date,ISNULL(job.value,0) as value from( select * from(" + sql_Cust_Date + @") as Cust left outer join (select DATEADD(month,Tops-1,'" + search_DateFrom.Date.Year + "-" + search_DateFrom.Date.Month + @"-1') as Date from (select top " + sumMonth + @" ROW_NUMBER() over(order by id) as Tops from sysobjects) as Tops) as Tops on 1=1) as Cust left outer join (" + sql + @") as job on job.Date=Cust.Date and job.Custom=Cust.Custom left outer join XXParty as party on party.PartyId=Cust.Custom"; } } else { if (search_XAxis.Text.Equals("Date")) { sql = @"select ISNULL(job.value,0) as value,ISNULL(convert(char(4),job.Date,111),convert(char(4),showDate.Date,111)) as Date,isnull(party.Name,'') as Custom from ( select DATEADD(year,Tops-1,'" + search_DateFrom.Date.Year + @"-1-1') as Date from (select top " + (sumYear + 1) + @" ROW_NUMBER() over(order by id) as Tops from sysobjects) as Tops) as ShowDate left outer join (" + sql + @") as job on datediff(day,job.Date,ShowDate.Date)=0 left outer join XXParty as party on party.PartyId=job.Custom order by ISNULL(convert(char(4),job.Date,111),convert(char(4),showDate.Date,111))"; } else { sql = @"select isnull(party.Name,'')+'('+Cust.Custom+')' as Custom,CONVERT(char(4),Cust.Date,111) as Date,ISNULL(job.value,0) as value from( select * from(" + sql_Cust_Date + @") as Cust left outer join (select DATEADD(year,Tops-1,'" + search_DateFrom.Date.Year + "-" + search_DateFrom.Date.Month + @"-1') as Date from (select top " + (sumYear + 1) + @" ROW_NUMBER() over(order by id) as Tops from sysobjects) as Tops) as Tops on 1=1) as Cust left outer join (" + sql + @") as job on job.Date=Cust.Date and job.Custom=Cust.Custom left outer join XXParty as party on party.PartyId=Cust.Custom"; } } DataTable dt = ConnectSql.GetTab(sql); WebChartControl1.DataSource = dt; WebChartControl1.DataBind(); }