09-07-2010 02:02 PM
Hi,
I have two double arrays declared and I like to plot x and y and x and x. I can do one at a time, how can I append it so that both x,y and x,x points are displayed. I tried using the plotXYmulitple command, but it requires 2D array. Do I have to convert my data into 2D array or there is an easier option? any help would be greatly appreciated.
Solved! Go to Solution.
09-08-2010 05:37 PM
Hello, Yes you will have to pass it a 2D array so your will need to create that out of your 1D array
09-16-2010 04:38 PM
Thanks Anna.
I tried that and here is the problem:
There is mismatch between PlotXYMultiple function in documentation and actual implementation. see below for the picture. You think it might be a possible bug? it seem xData and yData is swaped.
public void PlotXYMultiple(
double[] xData,
double[,] yData
}
09-19-2010 09:46 PM
That looks like a bug to me. I have submitted this to our developpers to repair. Thank you for briniging this to our attention.
09-20-2010 09:15 AM
Hello, my apologies, upon closer inspection I see that you are using PlotYXMultiple to demonstrate the tip strip but quoting PlotXYMultiple in the Help. Problem solved!
09-20-2010 01:26 PM
You are absolutely right! thats what happen you are coding two in the morning. I am posting my own solution below in case anyone else interested. But you know it will be nice if you can do mulitple ploting like matlab function plot(x,y,x,y) etc.
Thanks again!
Kashif
double[] xValues = new double[5] { 1, 2, 3, 4, 5 };
double[] y1Values = new double[5] { 1, 2, 3, 4, 5 };
double[] y2Values = new double[5] { 1, 4, 9, 16, 25 };
scatterGraph1.DefaultDataOrientation = DataOrientation.DataInColumns;
double[,] yValues = new double[xValues.Length, 2];
for (int i = 0; i < xValues.Length; i++)
{
yValues[i, 0] = y1Values[i];
yValues[i, 1] = y2Values[i];
}
scatterGraph1.PlotXYMultiple(xValues,yValues);
02-09-2011 11:42 AM
I would like to plot two sets of data points (X1, Y1) & (X2, Y2) on the scatter graph as soon as I receive them, psuedo real time plot. Below is the data I'm trying to plot. However the data doesn't look right. What do I need to do, so my two points are appended to their last points?
do
' read data to get Data1 & Data2
x1 = runLength.TotalMinutes
x2 = runLength.TotalMinutes
y1 = Data1(index)
y2 = Data2(index)
frmInfo.ScatterGraph1.PlotXYAppend(xVal, yVal)
loop while (flag)
02-09-2011 11:46 AM
correction in my last code
do
' read data to get Data1 & Data2
x(0) = runLength.TotalMinutes
x(1) = runLength.TotalMinutes
y(0) = Data1(index)
y(1) = Data2(index)
frmInfo.ScatterGraph1.PlotXYAppend(x, y)
loop while (flag)
02-10-2011 02:31 PM
Could you please be just a little more specific on what you mean by
"so my two points are appended to their last points"
What exactly should be appended to what? Or what do you expect the plot to look like?
02-10-2011 03:13 PM
What I'm looking for is a way to have two streams of data. One would be plotted on the primary Y axis, and the other would be plotted on the secondary Y axis. The data would be plotted onto the graph when it's received (so appending it to the graph). Attached is an example of what I'm looking for. (done in excel)