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
 LabTalk Forum
 Sparkline Color

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
Drbobshepherd Posted - 03/26/2012 : 09:58:44 AM
Origin Ver. and Service Release (Select Help-->About Origin): Origin Pro 8.6 SR2
Operating System: Windows XP and Vista

How do you program it so the sparklines for different columns are different colors? The Sparkines X-function doesn't have a color variable, but it does have one for template, so I am thinking of creating a graph template for each color I want. Is there a better way?

DrBobShepherd
2   L A T E S T    R E P L I E S    (Newest First)
Drbobshepherd Posted - 03/27/2012 : 6:20:42 PM
Thanks for your suggestion, but I think I will stick with my original idea and just create a graph template for each color, then apply the templates with sparkline X-function calls.
cpyang Posted - 03/26/2012 : 5:20:03 PM
I cannot find a quick LabTalk solution, but I put down this OC code in case it is useful to you

// example to show how to create/update sparklines on all 
// columns on the current worksheet with alternating blue/red colors
void sparkline_colors()
{
	DWORD dwCntrl = EMBEDGRAPH_IN_LABELS | EMBEDGRAPH_HIDE_AXES | EMBEDGRAPH_HIDE_LEGENDS | EMBEDGRAPH_HIDE_SPECTRUMS | EMBEDGRAPH_HIDE_TEXT_OBJS | EMBEDGRAPH_SPARKLINE;
	Worksheet wks = Project.ActiveLayer();
	if(!wks)
		return;
	
	//add this will require theme_utils.c to be added to workspace
	//int nRowHeight = 20
	//wks_set_col_label_heights(wks, RCLT_SPARKLINE, nRowHeight, false);
	
	waitCursor hrGlass;
	for(int nC = 0; nC < wks.GetNumCols(); nC++)
	{
		if(wks.Columns(nC).GetType() != OKDATAOBJ_DESIGNATION_Y || is_col_all_text(wks, nC) > 0)
			continue;
		
		GraphPage gp;
		DataPlot dp = plot_col(wks, nC, gp, IDM_PLOT_LINE, true, "sparkline_label", true, 0);
		int ncolor = nC%2? SYSCOLOR_BLUE:SYSCOLOR_RED;
		dp.SetColor(ncolor);
		wks.EmbedGraph(RCLT_SPARKLINE, nC, gp, dwCntrl);
	}
}


CP

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