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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Sparklines
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Chris2

20 Posts

Posted - 09/13/2010 :  10:20:07 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Windows Vista
Origin 8.1.

Hello,

how can I show the Sparklines in each column?
In Laptalk I just can write

sparklines;

However in Origin C I have no idea.

Hope you can help me!

rlewis

Canada
253 Posts

Posted - 09/13/2010 :  8:11:24 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can always make a call to the xFunction Sparklines using code something like ...

#include <xfbase.h>
bool ShowSparkLines(int StartCol=0, int EndCol=-1)
{
	/*
		StartCol ... First column for the operation ... default first column the worksheet
		EndCol   ... Last column for the operation ... default last column of the worksheet
	
	*/
	Worksheet Wks=Project.ActiveLayer();
	if(EndCol<0)
	{
		EndCol=Wks.GetNumCols()-1;
	}
	if(Wks.IsValid()==true && StartCol>=0 && StartCol<=EndCol && StartCol<Wks.GetNumCols())
	{
		string strXFname="SparkLines";
		XFBase xfSparkLines(strXFname);
		if(xfSparkLines)
		{
			if(xfSparkLines.SetArg("c1",StartCol)==true && xfSparkLines.SetArg("c2",EndCol)==true && xfSparkLines.SetArg("sel",0)==true)
			{
				return(xfSparkLines.Evaluate());
				
			}
		}
	}
	return (false);
}


Edited by - rlewis on 09/13/2010 8:27:07 PM
Go to Top of Page

Penn

China
644 Posts

Posted - 09/13/2010 :  11:14:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

There is a more simple way to do that, by using the LT_execute function.

void test_sparklines()
{
	string strCommand = "sparklines sel:=0 c1:=1 c2:=3;";
	LT_execute(strCommand);
}


Penn
Go to Top of Page

Chris2

20 Posts

Posted - 09/14/2010 :  04:09:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

thanks for your answer. This helps me a lot.
But how is it possible to set the sparklines in one specefic worksheet and not in the active sheet?
Go to Top of Page

Penn

China
644 Posts

Posted - 09/14/2010 :  04:56:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Please refer to the sparklines document. The parameter iw can be used to specify a worksheet.

Penn
Go to Top of Page

Chris2

20 Posts

Posted - 09/14/2010 :  06:33:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The parameter iw just works to me if I can write the number of the book directly. But in my case the specified Book isn't always the same.
Here is a part of my code (I hope you can understand my problem if you see it):

string strEinheit;
wksFunction.GetCell(iRow, 7, strEinheit);
WorksheetPage wksPage3("Book" + strEinheit);
Worksheet wksDest = wksPage3.Layers("Sheet1");

//this is the Book and Sheet I want to refer to

I tried already the following but nothing works.

string strCommand = "sparklines iw:=wksDest! sel:=0 c1:=a c2:=a;";

string strCommand = "sparklines iw:=[Book + strEinheit]Sheet1! sel:=0 c1:=a c2:=a;";


Go to Top of Page

DataConv

Germany
60 Posts

Posted - 09/14/2010 :  08:32:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello Chris2,
Maybe the LT syntax you are using is wrong?
string strCommand = "sparklines iw:=[Book + strEinheit]Sheet1! sel:=0 c1:=a c2:=a;";

My proposal would be:
string strCommand = "sparklines iw:=[Book%(strEinheit)]Sheet1! sel:=0 c1:=a c2:=a;";

or
string strCommand = "sparklines iw:=[Book" + strEinheit + "]Sheet1! sel:=0 c1:=a c2:=a;";

Edited by - DataConv on 09/14/2010 08:33:19 AM
Go to Top of Page

Chris2

20 Posts

Posted - 09/15/2010 :  02:11:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Your second suggestion works perfekt!
Thank you very much!
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000