It sets a modifier, like to specify that a symbol size or color in a scatter plot, comes from another column.
int SetModifier(int nDesig, Column &col)
Returns the previous modifier index, or 0 if previously the property was not a modifier value, or an error if the return value < -13000.
EX1
// have a worksheet active and import Samples\Graphing\group.dat into it. void DataPlot_SetModifier_ex1() { Worksheet wks = Project.ActiveLayer(); if( !wks ) { out_str("Pls activate worksheet with group.dat data"); return; } GraphPage gp; gp.Create("bubble"); GraphLayer gl = Project.ActiveLayer(); DataRange dr; dr.Add(wks, 0, "X"); dr.Add(wks, 1, "Y"); int nPlot = gl.AddPlot(dr, IDM_PLOT_SCATTER); DataPlot dp = gl.DataPlots(0); Column col = wks.Columns(1); dp.SetModifier(COLDESIG_SIZE, col); gl.Rescale(); }
EX2
// create an XY scatter plot with colormap from other columns // have a worksheet that has at least three columns active before execution void DataPlot_SetModifier_ex2() { Worksheet wks = Project.ActiveLayer(); DataRange dr; dr.Add(wks, 0, "X"); dr.Add(wks, 1, "Y"); GraphPage gp; gp.Create("Origin"); GraphLayer gl = gp.Layers(); gl.AddPlot(dr, IDM_PLOT_SCATTER); DataPlot dp = gl.DataPlots(0); if( !dp ) return; Column col(wks, 2); dp.SetModifier(COLDESIG_COLOR, col); gl.Rescale(); }
EX3
// assum a worksheet has 3 columns // make a scatter plot with first 2 columns // and use the 3rd column as plot label void DataPlot_SetModifier_ex3() { Worksheet wks = Project.ActiveLayer(); if(!wks) return; Column col(wks, 2); if(!col) return; DataRange dr; dr.Add(wks, 0, "X"); dr.Add(wks, 1, "Y"); GraphPage gp; gp.Create("Origin"); GraphLayer gl = gp.Layers(); gl.AddPlot(dr, IDM_PLOT_SCATTER); gl.Rescale(); DataPlot dp = gl.DataPlots(0); if(!dp) return; dp.SetModifier(COLDESIG_PLOTLABEL_FORM, col); vector<int> vnDesigs; vector<string> saNames; dp.GetModifiers(vnDesigs, saNames); vector<uint> vecIndex; if(vnDesigs.Find(vecIndex, COLDESIG_PLOTLABEL_FORM) > 0) { printf("label form = %s\n", saNames[ vecIndex[0] ]); } }
origin.h