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
 Plot, color, legend !

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
billaravi Posted - 05/17/2005 : 01:59:53 AM
Origin Version (7.0):
Operating System:XP Pro

Hi
Iam using the following code to plot data from different xy columns of a worksheet into a single layer of a graph. How can make a plot so that each set of xy data is displayed in a different color on the plot.

Also i would like add a legend to the plot after adding every xy dataset to the plot.

many thanks in advance
ravi

// Create a graph using custom template
GraphPage grphData;
string strGrphTemplate = strProjectPath + "Automate.otp";
int nOptionG = CREATE_VISIBLE_SAME;
bool bRetG = grphData.Create(strGrphTemplate, nOptionG);

int i;

for(i=0; i<=ncols-1; i=i+2)
{
// Declare a curve object using x,y columns of worksheet
Curve crvData(wksData, i, i+1);

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

// Plot data curve to active layer
int nPlot = grphLayer.AddPlot(crvData, IDM_PLOT_SCATTER);
grphLayer.Rescale();
};
1   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 05/17/2005 : 09:54:48 AM
Hi,

One way to make the group plot is to add the entire worksheet to the layer instead of one curve at a time, and this will work fine if your worksheet is set up with column designations such as XYXYXY...etc which seems to be the case here.

So you could code it as:

GraphLayer grphLayer = grphData.Layers();
grphLayer.AddPlot(wksData, IDM_PLOT_SCATTER);
grphLayer.Rescale();
grphLayer.LT_execute("legend;");



Note that in the above code segment, the add legend to the graph, the "legend" script command is being issued - there is no direct access to legend from OC at this point.

Now, if you wish to add one plot at a time, you can still do that and then after adding all plots, you can use the GroupPlots() method of GraphLayer class to group them, and then follow up with the script legend command to add/update legend.

Easwar
OriginLab


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