(For the archives, this question refers to a
previous thread. The code that is referred to can be found there.)
There is no limitation on the type of graph that will work with this code. If you replace WaveformGraph with ScatterGraph and WaveformPlot with ScatterPlot, the code should work. For example, here's the HTTP handler example that I previously posted with ScatterGraph instead of WaveformGraph:
using NationalInstruments;
using NationalInstruments.UI;
using NationalInstruments.UI.WindowsForms;
using System;
using System.Drawing;
using System.Web;
using System.Web.UI;
namespace DynamicImageExample
{
public class DynamicImageHandler : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
WriteImage(context, ImageType.Png);
}
private static void WriteImage(HttpContext context, ImageType imageType)
{
if (context == null)
throw new ArgumentNullException("context");
if (imageType == null)
throw new ArgumentException("imageType");
HttpResponse response = context.Response;
response.ContentType = imageType.ContentType;
response.BufferOutput = false;
using (ScatterGraph graph = new ScatterGraph())
using (XAxis xAxis = new XAxis())
using (YAxis yAxis = new YAxis())
using (ScatterPlot plot = new ScatterPlot(xAxis, yAxis))
{
graph.XAxes.Add(xAxis);
graph.YAxes.Add(yAxis);
graph.Plots.Add(plot);
graph.ToStream(response.OutputStream, imageType);
}
}
}
}
This example requires Measurement Studio 7.1, but you can make similar changes to the Measurement Studio 7.0 code that was posted before and it should work.
- Elton