Menu

#20 LinePlot behind Gridlines? "Bug"

open
nobody
None
5
2004-12-05
2004-12-05
UInt
No

In the following code, the lineplot is plotted behind the
grid lines.. If trying to put the add command after the
creation of the grid there is a "logical" exception:
An unhandled exception of
type 'System.NullReferenceException' occurred in nplot.dll
Additional information: Object reference not set to an
instance of an object.
Logical, since it does not know the data!
So I have to add the line twice to get get the lineplot
infront of the grid... Would this not be easy to fix? Since
I am new to this I dont know the importance? I dont
know how a print would turn out but I guess the data
should be on top.. and it is not..

Code: VS c++.net
pltTime->Clear(); //private:
NPlot::Windows::PlotSurface2D * pltTime;

//Make a dataset
int npoints = pltTime->get_Width();
int offset = pltTime->get_Height()/2;
System::Int16 ys[] = new System::Int16[npoints];
//Populate the ys-data
for (int i=0; i<npoints; i++)
{ys[i] = offset * Math::Cos(0.05*i) ; }
//Create a Lineplot to plot
LinePlot *lq = new LinePlot();
lq->Color = Color::Red;
lq->OrdinateData = ys; //Set the lineplot data to the y-
data
//Put the lineplot in the Time plot surface
pltTime->Add( lq ); //must be before grid-but behind..
//if after add mygrid= exception..

pltTime->Title = "TIME Plot";
pltTime->XAxis1->Label = "Time microSec.";
pltTime->YAxis1->Label = "Amplitude miliVolt";
Grid *myGrid = new Grid();
myGrid->VerticalGridType = Grid::GridType::Fine;
myGrid->HorizontalGridType = Grid::GridType::Coarse;
pltTime->Add(myGrid);

Discussion


Log in to post a comment.

MongoDB Logo MongoDB