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
 How to change the name of a graph

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
yulisunflower Posted - 10/28/2009 : 4:23:37 PM
Origin 7.5 sr6
Operating System:Windows Vista
I wrote a small program to plot the fitting results of my data, I would like to name each graph by the column name of the data plotted instead of Graph1, Graph2 and so on. Any idea how to do that? My code is like this:

void AutoPlot(int ncol)
{
Worksheet wksData; // Declare Worksheet (Layer) object
Column col; // Declare Column object

int iColNum;
string strColName;

wksData = Project.ActiveLayer();// get the active layer, which is the fitted worksheet

for (iColNum=1;iColNum<=ncol;iColNum++)
{
// *** Use Worksheet class Columns collection to get second column and check column name ***
//col = wksData.Columns(iColNum); // Get second column in worksheet (0 based index)
//strColName = col.GetName(); // Get column name to check (just for fun)

//creat a graph
GraphPage grphData;
bool bRetG = grphData.Create("PCH2"); // use the "PCH2" template for graph

// Point to active layer in current graph page
GraphLayer grphLayer = grphData.Layers();

// Declare a curve object using x,y columns of worksheet
Curve crvData(wksData, 0, iColNum);
Curve crvFit(wksData,0,iColNum+ncol*2);

// Plot data curve to active layer
int nPlot = grphLayer.AddPlot(crvData, IDM_PLOT_LINESYMB);
int mplot = grphLayer.AddPlot(crvFit, IDM_PLOT_SCATTER);
grphLayer.Rescale();


}
}

Thanks a lot

Yu
2   L A T E S T    R E P L I E S    (Newest First)
yulisunflower Posted - 10/29/2009 : 3:51:31 PM
That works! Thanks you very much.

Yu
Iris_Bai Posted - 10/28/2009 : 9:36:37 PM
Hi,

You can use PageBase::Rename(LPCSTR lpcszNewName, BOOL bAskIfAlreadyUsed = FALSE). For example,

grphData.Rename(strColName);


Iris

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