FAQ-810 Wie erstelle ich ein Wasserfalldiagramm mit Origin C?

Letztes Update: 04.01.2016

Bitte verwenden Sie den folgenden Beispielcode:

//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(); }


Schlüsselwörter:Wasserfall, Origin C