<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic programmatically adding plots in Measurement Studio for .NET Languages</title>
    <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/programmatically-adding-plots/m-p/695794#M6830</link>
    <description>&lt;DIV&gt;&lt;/DIV&gt;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:&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public NationalInstruments.UI.ScatterPlot currentPlot = null;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void AddPlot(ref NationalInstruments.UI.IScatterGraph sg, Color c)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NationalInstruments.UI.ScatterPlot currentPlot&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = new NationalInstruments.UI.ScatterPlot(sg.XAxes[0], sg.YAxes[0]);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; scatterGraph.Plots.Add(currentPlot);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void Form1_Load(object sender, EventArgs e)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AddPlot(ref scatterGraph, Color.LightSalmon);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;If I try removing the "ref", the &lt;B&gt;AddPlot()&lt;/B&gt; function works, but "currentPlot" becomes null after that function exits. How do I make this work?&lt;BR /&gt;</description>
    <pubDate>Thu, 24 Apr 2008 21:02:05 GMT</pubDate>
    <dc:creator>bmihura</dc:creator>
    <dc:date>2008-04-24T21:02:05Z</dc:date>
    <item>
      <title>programmatically adding plots</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/programmatically-adding-plots/m-p/695794#M6830</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;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:&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public NationalInstruments.UI.ScatterPlot currentPlot = null;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void AddPlot(ref NationalInstruments.UI.IScatterGraph sg, Color c)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NationalInstruments.UI.ScatterPlot currentPlot&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = new NationalInstruments.UI.ScatterPlot(sg.XAxes[0], sg.YAxes[0]);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; scatterGraph.Plots.Add(currentPlot);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void Form1_Load(object sender, EventArgs e)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AddPlot(ref scatterGraph, Color.LightSalmon);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;If I try removing the "ref", the &lt;B&gt;AddPlot()&lt;/B&gt; function works, but "currentPlot" becomes null after that function exits. How do I make this work?&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Apr 2008 21:02:05 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/programmatically-adding-plots/m-p/695794#M6830</guid>
      <dc:creator>bmihura</dc:creator>
      <dc:date>2008-04-24T21:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: programmatically adding plots</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/programmatically-adding-plots/m-p/696157#M6831</link>
      <description>Nevermind, I figured it out.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 25 Apr 2008 12:48:44 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/programmatically-adding-plots/m-p/696157#M6831</guid>
      <dc:creator>bmihura</dc:creator>
      <dc:date>2008-04-25T12:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: programmatically adding plots</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/programmatically-adding-plots/m-p/696176#M6832</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;Hi bmihura&lt;SPAN class="noindex"&gt;,&lt;BR /&gt;&lt;BR /&gt;The Code wont compile because the method AddPlot() expects a reference to an object of type IScatterGraph and you are providing it with a reference to object of type ScatterGraph.&amp;nbsp; Not using 'ref' would fix this problem(and there is no requirement to use the 'ref' keyword here).&lt;BR /&gt;And 'currentplot' is becoming null because you have declared two 'currentplot' variables. One is the class variable and the other is the local variable in the method AddPlot(). You are changing the local variable in the AddPlot() method and the class variable 'currentplot' is never set. Do not declare another 'currentplot' variable inside the method AddPlot().&lt;BR /&gt;Hope this helps.&lt;BR /&gt;
   &lt;/SPAN&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 25 Apr 2008 13:11:09 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/programmatically-adding-plots/m-p/696176#M6832</guid>
      <dc:creator>Haseeb</dc:creator>
      <dc:date>2008-04-25T13:11:09Z</dc:date>
    </item>
  </channel>
</rss>

