Using Manco.Chart for .NET with ASP.NET
C# sample solution.
Visual Basic .NET sample solution.

Its actually not too difficult, but little tricky. Below you can find brief description how you can do it.

  1. Create ASP.NET where youd like put chart image.
  2. Drag and drop Web Form Image control to your page. The following code will appear in your YourForm.aspx file:
    <asp:Image id="chartImage" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 24px" runat="server" Width="464px" Height="392px" ImageUrl=""></asp:Image>
  3. Currently you can create ASP.NET page that will create actual chart. Lets name it as CreateChartForm.aspx. You can use any query string parameters to identify desirable chart type, its size and parameters. Put desirable URL to the ImageUrl attribute of the <asp:Image> element in your main page. Currently it could looks like the following:
    <asp:Image id="chartImage" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 24px" runat="server" Width="464px" Height="392px" ImageUrl="CreateChartForm.aspx?width=464&height=392"></asp:Image>
  4. Now prepare code for CreateChartForm.aspx. This page will not have any controls or html content on it. It will have only executable part. Below you can find C# sample code.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using Manco.Chart;
using Manco.Chart.Data;
using Manco.Chart.Layouts;

public partial class Pages_Demo_ShowChart : System.Web.UI.Page
	protected void Page_Load(object sender, EventArgs e)
		// Get char width and height from the query string
		string sWidth = Request.QueryString["width"];
		string sHeight = Request.QueryString["height"];

		Size imageSize = new Size(200, 200);
			imageSize.Width = int.Parse(sWidth);
		catch (Exception)

			imageSize.Height = int.Parse(sHeight);
		catch (Exception)

                // Create instance of the Chart Control
                ChartControl.LicenseFilePath = this.Server.MapPath("~/License");
                ChartControl control = new ChartControl();
                m_ChartControl.BackColor = Color.White;
                m_ChartControl.HttpServer = this.Server;
                m_ChartControl.Size = imageSize;

                int liCategoryCount = 3; //
                    Set desirable number of the categories
                int liSeriesCount = 3; //
                    Set desirable number of the series
// Declare array of doubles double[,] ldaData = new double[liCategoryCount, liSeriesCount];
double ldMin = 5; double ldMax = 30;
// Fill array with data here Random rnd = new Random(); for( int i = 0; i < liCategoryCount; i++) { for( int j = 0; j < liSeriesCount; j++) { ldaData[i,j] = ldMin + (ldMax - ldMin) * rnd.NextDouble(); } }
// Create IChartDataSource object IChartDataSource loDataSource = new ArrayDataSource(ldaData, DataOrientation.CategoryInRow);
// Load data to the chart m_ChartControl.Charts[0].LoadData(loDataSource, false, true); // Load chart theme // Check if we have Chart Theme stored in the session XmlDocument xmlThemeDocument; xmlThemeDocument = (XmlDocument)Session["Theme"]; if (xmlThemeDocument == null) { xmlThemeDocument = new XmlDocument(); ResourceLoader.WebServer = this.Server; Stream stream = ResourceLoader.GetFileStream(this.Server.MapPath("~/DemoChart.xml")); xmlThemeDocument.Load(stream); stream.Close(); } m_ChartControl.LoadTheme(xmlThemeDocument.DocumentElement); // Drow chart m_ChartControl.Init3DRenderer(); m_ChartControl.Draw(); // make a memory stream to work with the image bytes MemoryStream imageStream = new MemoryStream(); // put the chart image into the memory stream m_ChartControl.Image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png); // make byte array the same size as the image byte[] imageContent = new Byte[imageStream.Length]; // rewind the memory stream imageStream.Position = 0; // load the byte array with the image imageStream.Read(imageContent, 0, (int)imageStream.Length); imageStream.Close(); // return byte array to caller with image type Response.ContentType = "image/png"; Response.BinaryWrite(imageContent); // Don't forget to dispose chart control after use. m_ChartControl.Dispose(); } }