You can use native C++ data types as much as you like, but ultimately you will have to create Measurement Studio C++ vector/matrix types to display the data in the graph. The vector/matrix types provide constructors that make this very easy. For example, here's a modified version of the example that I posted before that uses C++ double arrays to create the data and converts the arrays to vector/matrix types at the last minute to plot the data:
m_graph3D.ViewMode = CNiGraph3D::ViewXYPlane;
m_graph3D.ViewDistance = 0.7;
CNiPlot3D plot = m_graph3D.Plots.Item(1);
plot.Style = CNiPlot3D::Surface;
plot.ColorMapAutoScale = false;
plot.ColorMapInterpolate = true;
plot.ColorMapLog = false;
plot.ColorMapStyle = CNiPlot3D::Co
lorSpectrum;
// Create dual sine surface data with native C++ double types.
const int SIZE = 41;
double xData[SIZE], yData[SIZE], zData[SIZE][SIZE];
int i, j;
for (i = 0; i < SIZE; ++i)
xData[i] = yData[i] = ((i - 20.0) / 20.0) * CNiMath::Pi;
for (i = 0; i < SIZE; ++i)
{
for (j = 0; j < SIZE; ++j)
zData[j][i] = sin(xData[i]) * cos(yData[j]) + 2.0;
}
// Convert the native C++ double arrays to NI data types for visualization.
CNiReal64Vector xVector(SIZE, xData);
CNiReal64Vector yVector(SIZE, yData);
CNiReal64Matrix zMatrix(SIZE, SIZE, *zData);
m_graph3D.Plot3DSurface(xVector, yVector, zMatrix);
- Elton