The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Setting line colormap

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
couturier Posted - 02/23/2024 : 08:07:14 AM
Origin Ver. and Service Release (Select Help-->About Origin): 2024
Operating System:10

Very basic question but couldn't find any solution
I have a line plot which I want to colormap according to another column (or vector)
I can setup my colormap with dp.SetColormap or dataplot_set_colormap() but how do I link the colormamp to the column ?
couldn't find the right option in dp.SetModifier()
2   L A T E S T    R E P L I E S    (Newest First)
couturier Posted - 02/27/2024 : 12:03:59 PM
thanks a lot
minimax Posted - 02/26/2024 : 04:01:02 AM
Hi Antoine,

You will need to use ApplyFormat() instead, like following:


void DataPlot_SetColorByCol_ex()
{
	//wks with 3 columns
	int nXCol = 0, nYCol = 1, nCCol = 2;
	Worksheet wks = Project.ActiveLayer();
	DataRange dr;	
	dr.Add(wks, nXCol, "X");
	dr.Add(wks, nYCol, "Y");
	
	//make a line plot
	GraphPage gp;
	gp.Create("Origin");
	GraphLayer gl = gp.Layers();	
	gl.AddPlot(dr, IDM_PLOT_LINE);
        DataPlot dp = gl.DataPlots(0); 
	if( !dp )
		return;
	
	//set line color by theme
	OQCOLOR oqColor;
	okutil_get_ocolor_by_col(&oqColor, nCCol, nYCol, COLTYPE_COLOR_COLORMAP);
	Tree trFormat;
	trFormat.Root.Line.Color.nVal = oqColor;
	int iRet = dp.UpdateThemeIDs(trFormat.Root, "Error", "Unknown tag");
	bool bRet = dp.ApplyFormat(trFormat, true, true);     
	
	gl.Rescale();
}


We will check how to improve the document, so it will be easier to find out okutil_get_ocolor_by_col().

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000