Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Sir, the solution provided by you worked fine for waveformgraph. But I tried similar code on scattergraph. But it didn't work.

Is there any limitation on the type of graph that we can use in the code that you have given? I want to know the different graphs that are supported by the code?
0 Kudos
Message 1 of 2
(3,296 Views)
(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
0 Kudos
Message 2 of 2
(3,296 Views)