Minimum Origin Version Required: Origin80 SR0
Example Data
New a worksheet, make sure worksheet page name is "Book1", copy the following example data to worksheet.
Col(A) Col(B) Col(C) Col(D) A 30 196.087 1 B 0 197.747 1 C 10 1.693 2 D 0 -2.194 2 E 10 33.214 4 F 10 -35.101 4 G 0 -16.713 6 H 0 15.993 6
Example Code
Run the following function to plot a float column, and set the color of columns depend on column D.
void float_column_plot_ex() { WorksheetPage wksPage("Book1"); Worksheet wks = wksPage.Layers(0); if( wks ) { DataRange dr; dr.Add(wks, 0, "X"); dr.Add(wks, 1, "Y"); dr.Add(wks, 2, "Y"); GraphPage gp; gp.Create("FLOATCOL"); GraphLayer gl = gp.Layers(0); if( gl.AddPlot(dr, IDM_PLOT_COLUMN_FLOAT) >= 0 ) { gl.Rescale(); // Set column D as color index const int nIndexingBegin = 100; int nFillColor = nIndexingBegin + 2; // column D is the 3rd Y column, Origin C index offset is 0, so add 2 here. Tree tr; tr.Root.Columns.Column1.Pattern.Fill.FillColor.nVal = nFillColor; if( 0 == gl.UpdateThemeIDs(tr.Root) ) { bool bRet = gl.ApplyFormat(tr, true, true); } } } }