protected void Page_Load(object sender, System.EventArgs e) { // Set return type to png image format Response.ContentType = "image/png"; string xValues, yValues; // Get input parameters from query string xValues = Request.QueryString["xValues"]; yValues = Request.QueryString["yValues"]; if (xValues != null && yValues != null) { Bitmap bmp; MemoryStream memStream = new MemoryStream(); BarGraph bar = new BarGraph(Color.White); // Set bar color for 7 days for (int i = 0; i < 7; i++) { bar.SetColor(i, Color.Sienna); } // Graph settings bar.VerticalTickCount = 2; bar.ShowLegend = false; bar.ShowData = true; bar.Height = 119; bar.Width = 195; bar.TopBuffer = 5; bar.BottomBuffer = 15; bar.FontColor = Color.Gray; bar.CollectDataPoints(xValues.Split("|".ToCharArray()), yValues.Split("|".ToCharArray())); bmp = bar.Draw(); // Render BitMap Stream Back To Client bmp.Save(memStream, ImageFormat.Png); memStream.WriteTo(Response.OutputStream); } }