03-27-2015 09:46 AM
Hello,
I looked at all examples that came with NIMS 2013 and also searched these forums but can't find what I'm looking for.
I have a WPF C# application that needs to display an additional plot in real time on the same graph for each button click.
Basically, I click a button and my app measures certain signals and plots them in real time (where X = GHz, Y = dB). X always has a fixed range and my app stops reading once it sweeps the range.
I need to do N number of these button clicks but plot all readings on the same graph in different colors. Just to be extra clear, only one plot will be updated in real time and others (previous clicks) will just stay there for history.
I know that I can do:
double[,] data = new double[16, 256];
... fill them in memory and then do
Graph.DataSource = data;
But it's not in real time and I will need a trigger (another button) to call Graph.DataSource = data;
I also know that I can do:
ChartCollection<double, double> data = new ChartCollection<double, double>();
data.Append(X, Y);
But I get System.ArgumentOutOfRangeException, Index values must be strictly increasing exception because every plot starts with the same number.
What would be the solution here?
Thank you!
Solved! Go to Solution.
03-27-2015 12:51 PM
Since you have multiple plots updating independently, I would recommend using separate data sources for each plot and adding them to the Data
collection, rather than pre-allocating one collection and assigning it to DataSource
. Since it sounds like you want to update the graph with individual values as they are acquired, you should be able to use a separate chart collection for each plot. For example:
// Add the data as a new plot in the graph.
var data = new ChartCollection<double, double>();
Graph.Data.Add( data );
...
// Fill chart with samples as sweep data is acquired.
data.Append( X, Y );
Since the X values are only for a single plot, and do not loop back when you perform multiple sweeps, you should not have an issue with the out-of-range exception.
03-27-2015 01:49 PM - edited 03-27-2015 01:50 PM
Thank you very much! That did it.
You guys have a great product and amazing support (from driver troubleshiting to coding) but the pricing is unfortunately over the top so I don't know if my company will go with it (I purchased the Standard Edition never expecting this).
We don't need much... we only need to display a handful of line graphs and a 2-3 color "intensity" graphs but for some reason the cheapest licence per user is $920. We will end up having up to $100K+ just for basic charts and I wish the licensing was broken up into multiple tiers based on what features you want to use.
In any case, I really appreciate your fast response and all your help. Maybe I will end up finding some workaround for our software suite and convince my company that NI is the best way to go.
Thank you.
03-31-2015 03:32 PM - edited 03-31-2015 03:33 PM
Hi kirko7,
I wanted to make sure you were aware of the different licensing options for Measurement Studio development, starting at $508: http://www.ni.com/mstudio/buy/
However, I think the best thing to do is discuss your needs with our technical sales team. They can discuss the funcitonality in each Measurement Studio edition and recommend flexible licensing options that can help save costs. There are various contact methods here: http://www.ni.com/contact-us/
03-31-2015 03:35 PM
Thanks,
Actrually I got a call yesterday from the sales team and they explained to me that whoever quoted me $925 per computer wasn't correct. The application I deploy is free.. as it should be. I have no idea where that quote came from. I never intended to use NI Measurements Studio on computers other than my dev station and the build machine.
So it's all good now 🙂
Thank you for getting back anyway.