I'd like to programmatically add a plot to NI's scatterGraph. I try this code, but it won't compile where the "ref" call is:
public NationalInstruments.UI.ScatterPlot currentPlot = null;
private void AddPlot(ref NationalInstruments.UI.IScatterGraph sg, Color c)
{
NationalInstruments.UI.ScatterPlot currentPlot
= new NationalInstruments.UI.ScatterPlot(sg.XAxes[0], sg.YAxes[0]);
scatterGraph.Plots.Add(currentPlot);
}
private void Form1_Load(object sender, EventArgs e)
{
AddPlot(ref scatterGraph, Color.LightSalmon);
}
If I try removing the "ref", the
AddPlot() function works, but "currentPlot" becomes null after that function exits. How do I make this work?