10-03-2007 09:17 AM
Hello everyone,
I wonder if anyone can help me?
I am working in C# 2005 writing Windows Forms, using MCC Measurement Studio version 8.0.1.334
I am trying to draw a histogram. After a lot of searching, I found that I could get a reasonable plot using a ScatterPlot.
My code generates the correct data but the scatterplot appears to invent additional values.
My code:
namespace TestScatterGraph
{
public partial class Form1 : Form
{
private double Lower = 0;
private double Upper = 0;
private double[] Data = new double[] { 1, 3, 2, 3, 3, 3, 8, 2, 2 };
private double[] CentreValues;
private double[] dHistData;
int[] HistData;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ArrayOperation.MaxMin1D(Data,out Upper,out Lower);
HistData = Statistics.Histogram(Data, Lower, Upper, 10, out CentreValues);
dHistData = (double[])DataConverter.Convert(HistData, typeof(double[]));
scatterPlot1.PlotXY(CentreValues , dHistData);
}
}
}
My graph
The lines don't align very well with the X Axis, but the main problem is that whilst there are only 4 values in the original data, and in CentreValues and dHist, there are 6 values displayed on the graph.
So, the obvious question is; what am I doing wrong?
As a secondary question, has there been a new version of MCC MStudio, in line with the new NI version?
Many thanks
John822179
Live long, prosper and understand Measurement Studio?
10-04-2007 03:42 AM
I have found be experimentation, that this value needs to be at least 10 times the number of points in the source data set.
Many thanks
John822179
Live long, prosper and understand Measurement Studio?