private void RenderBarGraph(BarGraph graph, HtmlTextWriter html) { BarGraphRenderer barGraph = new BarGraphRenderer(Color.White); barGraph.RenderMode = graph.RenderMode; barGraph._regions = graph.Regions; barGraph.SetTitles(graph.xTitle, null); if (graph.yTitle != null) { barGraph.VerticalLabel = graph.yTitle; } barGraph.FontColor = Color.Black; barGraph.ShowData = (graph.Interval == 1); barGraph.VerticalTickCount = graph.Ticks; string[] labels = new string[graph.Items.Count]; string[] values = new string[graph.Items.Count]; for (int i = 0; i < graph.Items.Count; ++i) { ChartItem item = graph.Items[i]; labels[i] = item.Name; values[i] = item.Value.ToString(); } barGraph._interval = graph.Interval; barGraph.CollectDataPoints(labels, values); Bitmap bmp = barGraph.Draw(); string fileName = graph.FileName + ".png"; bmp.Save(Path.Combine(this.m_OutputDirectory, fileName), ImageFormat.Png); html.Write("<!-- "); html.AddAttribute(HtmlAttr.Href, "#"); html.AddAttribute(HtmlAttr.Onclick, String.Format("javascript:window.open('{0}.html','ChildWindow','width={1},height={2},resizable=no,status=no,toolbar=no')", SafeFileName(this.FindNameFrom(graph)), bmp.Width + 30, bmp.Height + 80)); html.RenderBeginTag(HtmlTag.A); html.Write(graph.Name); html.RenderEndTag(); html.Write(" -->"); html.AddAttribute(HtmlAttr.Cellpadding, "0"); html.AddAttribute(HtmlAttr.Cellspacing, "0"); html.AddAttribute(HtmlAttr.Border, "0"); html.RenderBeginTag(HtmlTag.Table); html.RenderBeginTag(HtmlTag.Tr); html.AddAttribute(HtmlAttr.Class, "tbl-border"); html.RenderBeginTag(HtmlTag.Td); html.AddAttribute(HtmlAttr.Width, "100%"); html.AddAttribute(HtmlAttr.Cellpadding, "4"); html.AddAttribute(HtmlAttr.Cellspacing, "1"); html.RenderBeginTag(HtmlTag.Table); html.RenderBeginTag(HtmlTag.Tr); html.AddAttribute(HtmlAttr.Colspan, "10"); html.AddAttribute(HtmlAttr.Width, "100%"); html.AddAttribute(HtmlAttr.Align, "center"); html.AddAttribute(HtmlAttr.Class, "header"); html.RenderBeginTag(HtmlTag.Td); html.Write(graph.Name); html.RenderEndTag(); html.RenderEndTag(); html.RenderBeginTag(HtmlTag.Tr); html.AddAttribute(HtmlAttr.Colspan, "10"); html.AddAttribute(HtmlAttr.Width, "100%"); html.AddAttribute(HtmlAttr.Align, "center"); html.AddAttribute(HtmlAttr.Class, "entry"); html.RenderBeginTag(HtmlTag.Td); html.AddAttribute(HtmlAttr.Width, bmp.Width.ToString()); html.AddAttribute(HtmlAttr.Height, bmp.Height.ToString()); html.AddAttribute(HtmlAttr.Src, fileName); html.RenderBeginTag(HtmlTag.Img); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); bmp.Dispose(); }
private void RenderBarGraph(BarGraph graph, HtmlTextWriter html) { BarGraphRenderer barGraph = new BarGraphRenderer(Color.White); barGraph.RenderMode = graph.RenderMode; barGraph._regions = graph.Regions; barGraph.SetTitles(graph.xTitle, null); if (graph.yTitle != null) barGraph.VerticalLabel = graph.yTitle; barGraph.FontColor = Color.Black; barGraph.ShowData = (graph.Interval == 1); barGraph.VerticalTickCount = graph.Ticks; string[] labels = new string[graph.Items.Count]; string[] values = new string[graph.Items.Count]; for (int i = 0; i < graph.Items.Count; ++i) { ChartItem item = graph.Items[i]; labels[i] = item.Name; values[i] = item.Value.ToString(); } barGraph._interval = graph.Interval; barGraph.CollectDataPoints(labels, values); Bitmap bmp = barGraph.Draw(); string fileName = graph.FileName + ".png"; bmp.Save(Path.Combine(this.m_OutputDirectory, fileName), ImageFormat.Png); html.Write("<!-- "); html.AddAttribute(HtmlAttr.Href, "#"); html.AddAttribute(HtmlAttr.Onclick, String.Format("javascript:window.open('{0}.html','ChildWindow','width={1},height={2},resizable=no,status=no,toolbar=no')", SafeFileName(this.FindNameFrom(graph)), bmp.Width + 30, bmp.Height + 80)); html.RenderBeginTag(HtmlTag.A); html.Write(graph.Name); html.RenderEndTag(); html.Write(" -->"); html.AddAttribute(HtmlAttr.Cellpadding, "0"); html.AddAttribute(HtmlAttr.Cellspacing, "0"); html.AddAttribute(HtmlAttr.Border, "0"); html.RenderBeginTag(HtmlTag.Table); html.RenderBeginTag(HtmlTag.Tr); html.AddAttribute(HtmlAttr.Class, "tbl-border"); html.RenderBeginTag(HtmlTag.Td); html.AddAttribute(HtmlAttr.Width, "100%"); html.AddAttribute(HtmlAttr.Cellpadding, "4"); html.AddAttribute(HtmlAttr.Cellspacing, "1"); html.RenderBeginTag(HtmlTag.Table); html.RenderBeginTag(HtmlTag.Tr); html.AddAttribute(HtmlAttr.Colspan, "10"); html.AddAttribute(HtmlAttr.Width, "100%"); html.AddAttribute(HtmlAttr.Align, "center"); html.AddAttribute(HtmlAttr.Class, "header"); html.RenderBeginTag(HtmlTag.Td); html.Write(graph.Name); html.RenderEndTag(); html.RenderEndTag(); html.RenderBeginTag(HtmlTag.Tr); html.AddAttribute(HtmlAttr.Colspan, "10"); html.AddAttribute(HtmlAttr.Width, "100%"); html.AddAttribute(HtmlAttr.Align, "center"); html.AddAttribute(HtmlAttr.Class, "entry"); html.RenderBeginTag(HtmlTag.Td); html.AddAttribute(HtmlAttr.Width, bmp.Width.ToString()); html.AddAttribute(HtmlAttr.Height, bmp.Height.ToString()); html.AddAttribute(HtmlAttr.Src, fileName); html.RenderBeginTag(HtmlTag.Img); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); bmp.Dispose(); }
private void RenderBarGraph(BarGraph graph, XmlWriter html) { BarGraphRenderer barGraph = new BarGraphRenderer(Color.White) { RenderMode = graph.RenderMode, _regions = graph.Regions }; barGraph.SetTitles(graph.xTitle, null); if (graph.yTitle != null) { barGraph.VerticalLabel = graph.yTitle; } barGraph.FontColor = Color.Black; barGraph.ShowData = (graph.Interval == 1); barGraph.VerticalTickCount = graph.Ticks; string[] labels = new string[graph.Items.Count]; string[] values = new string[graph.Items.Count]; for (int i = 0; i < graph.Items.Count; ++i) { ChartItem item = graph.Items[i]; labels[i] = item.Name; values[i] = item.Value.ToString(); } barGraph._interval = graph.Interval; barGraph.CollectDataPoints(labels, values); Bitmap bmp = barGraph.Draw(); string fileName = graph.FileName + ".png"; bmp.Save(Path.Combine(m_OutputDirectory, fileName), ImageFormat.Png); html.WriteValue("<!-- "); html.WriteStartElement("a"); html.WriteAttributeString("href", "#"); html.WriteAttributeString("onclick", string.Format("javascript:window.open('{0}.html','ChildWindow','width={1},height={2},resizable=no,status=no,toolbar=no')", SafeFileName(FindNameFrom(graph)), bmp.Width + 30, bmp.Height + 80)); html.WriteValue(graph.Name); html.WriteEndElement(); html.WriteValue(" -->"); html.WriteStartElement("table"); html.WriteAttributeString("cellpadding", "0"); html.WriteAttributeString("cellspacing", "0"); html.WriteAttributeString("border", "0"); html.WriteStartElement("tr"); html.WriteStartElement("td"); html.WriteAttributeString("class", "tbl-border"); html.WriteStartElement("table"); html.WriteAttributeString("width", "100%"); html.WriteAttributeString("cellpadding", "4"); html.WriteAttributeString("cellspacing", "1"); html.WriteStartElement("tr"); html.WriteStartElement("td"); html.WriteAttributeString("colspan", "10"); html.WriteAttributeString("width", "100%"); html.WriteAttributeString("align", "center"); html.WriteAttributeString("class", "header"); html.WriteValue(graph.Name); html.WriteEndElement(); html.WriteEndElement(); html.WriteStartElement("tr"); html.WriteStartElement("td"); html.WriteAttributeString("colspan", "10"); html.WriteAttributeString("width", "100%"); html.WriteAttributeString("align", "center"); html.WriteAttributeString("class", "entry"); html.WriteStartElement("img"); html.WriteAttributeString("width", bmp.Width.ToString()); html.WriteAttributeString("height", bmp.Height.ToString()); html.WriteAttributeString("src", fileName); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); bmp.Dispose(); }