protected void Page_Load(object sender, EventArgs e) { Response.Clear(); Response.ContentType = "image/png"; byte[] outbyte = ResourceChart.RenderLegendItem(Server.MapPath(@"~/styles/IbnFramework/ResourceChartStyle.xml"), Request["Type"]); Response.OutputStream.Write(outbyte, 0, outbyte.Length); Response.End(); }
private void Menu_File_SaveImage_Click(object sender, EventArgs e) { if (SaveImageDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { ResourceChart.SaveImage(SaveImageDialog.FileName, ChartImageFormat.Png); } catch (Exception ex) { Utility.ErrorReporter.SendErrorReport(ex, "資源チャート画像の保存に失敗しました。"); } } }
private void ResourceChart_MouseDown(object sender, MouseEventArgs e) { if (e.Button != System.Windows.Forms.MouseButtons.Left) { return; } var hittest = ResourceChart.HitTest(e.X, e.Y, ChartElementType.LegendItem); if (hittest.Object != null) { var legend = (LegendItem)hittest.Object; ResourceChart.Series[legend.SeriesName].Enabled ^= true; } SetYBounds(); }
private void BindLegend() { tblLegend.Rows.Clear(); string[] items = ResourceChart.GetLegendItems(); foreach (string item in items) { TableRow tr = new TableRow(); TableCell tc1 = new TableCell(); TableCell tc2 = new TableCell(); tc1.VerticalAlign = VerticalAlign.Top; tc2.VerticalAlign = VerticalAlign.Top; Image img = new Image(); img.ImageUrl = String.Format("~/Projects/ResourceChartLegendImage.aspx?Type={0}", item); tc1.Controls.Add(img); Label lbl = new Label(); lbl.Text = LocRM.GetString("TimeType" + item); tc2.Controls.Add(lbl); tr.Cells.Add(tc1); tr.Cells.Add(tc2); tblLegend.Rows.Add(tr); } }
protected void Page_Load(object sender, EventArgs e) { byte[] data = null; bool dataIsXml = Request["Xml"] != null; // users List <int> list = new List <int>(); string users = Request["Users"]; if (!string.IsNullOrEmpty(users)) { string[] parts = users.Split(','); foreach (string part in parts) { int userId = int.Parse(part, CultureInfo.InvariantCulture); list.Add(userId); } } // object types List <ObjectTypes> objectTypes = new List <ObjectTypes>(); string objectTypesString = Request["ObjectTypes"]; if (!string.IsNullOrEmpty(objectTypesString)) { string[] parts = objectTypesString.Split(','); foreach (string part in parts) { ObjectTypes objectType = (ObjectTypes)int.Parse(part, CultureInfo.InvariantCulture); objectTypes.Add(objectType); } } // vastScale bool vastScale = false; string vast = Request["Vast"]; if (!string.IsNullOrEmpty(vast)) { vastScale = bool.Parse(vast); } // startDate DateTime startDate = DateTime.Now.Date; string dateString = Request["StartDate"]; if (!string.IsNullOrEmpty(dateString)) { startDate = DateTime.ParseExact(dateString, "yyyy-MM-dd", CultureInfo.InvariantCulture); } // curDate DateTime curDate = Security.CurrentUser.CurrentTimeZone.ToLocalTime(DateTime.UtcNow); string curDateString = Request["CurDate"]; if (!string.IsNullOrEmpty(curDateString)) { curDateString = Server.UrlDecode(curDateString); curDate = DateTime.ParseExact(curDateString, "yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture); } // highlighted Items List <KeyValuePair <int, int> > highlightedItems = new List <KeyValuePair <int, int> >(); string hObjects = Request["HObjects"]; string hTypes = Request["HTypes"]; if (!string.IsNullOrEmpty(hObjects) && !string.IsNullOrEmpty(hTypes)) { string[] objects = hObjects.Split(','); string[] types = hTypes.Split(','); if (objects.Length == types.Length) { for (int i = 0; i < objects.Length; i++) { highlightedItems.Add(new KeyValuePair <int, int>( int.Parse(objects[i], CultureInfo.InvariantCulture), int.Parse(types[i], CultureInfo.InvariantCulture) )); } } } //if (Project.IsWebGanttChartEnabled()) data = ResourceChart.Render(vastScale, curDate, startDate, list.ToArray(), objectTypes.ToArray(), highlightedItems, dataIsXml, Server.MapPath(@"~/styles/IbnFramework/ResourceChartStyle.xml"), ParseInteger("X", 0), ParseInteger("Y", 0), ParseInteger("ItemsPerPage", 100), ParseInteger("PageNumber", 0)); if (data != null && data.Length > 0) { Response.Clear(); Response.Cache.SetNoStore(); if (dataIsXml) { Response.ContentType = "text/xml"; } else { Response.ContentType = "image/png"; } Response.OutputStream.Write(data, 0, data.Length); Response.End(); } else { Response.Redirect("~/Layouts/Images/Blank.gif", true); } }