waterfall-by-OC
Last Update: 1/4/2016
Please refer to the following example code:
//The function below is to plot a waterfall //When bYColMap = TRUE, it will plot a waterfall color map to Y. // When bYColMap = FALSE, it will plot a waterfall color map to Z. void plot_waterfall(BOOL bYColMap = TRUE, int nEndYCol = -1) { Worksheet wks = Project.ActiveLayer(); if( !wks ) return; if( nEndYCol < 0 ) // -1 means to the end column nEndYCol = wks.GetNumCols() - 1; // create a graph window GraphPage gp; gp.Create("Waterfal"); GraphLayer gl = gp.Layers(0); // get the first layer // prepare DataRange DataRange dr; dr.Add(wks, 0, "X"); // col(1): x column for(int nYCol = 1; nYCol <= nEndYCol; nYCol++) dr.Add(wks, nYCol, "Y"); // add y columns into dr DataRange // do plot gl.AddPlot(dr, IDM_PLOT_LINE); // set colormap GroupPlot group; group = gl.Groups(0); if( group ) { Tree tr; tr.Line.Color.nVal = bYColMap ? 0x60FFFF : 0x500000 | ( ModifyColBeg + 1 ); if( 0 == group.UpdateThemeIDs(tr) ) group.ApplyFormat(tr, true, true); } gl.Rescale(); }
Keywords:waterfall, Origin C