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
 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
ovince Posted - 10/29/2006 : 05:10:16 AM
hi

I am trying to make a legend using data from the output file (10 numbers in it). First I plot like this:

===========================================
int k = gly.AddPlot( crv, IDM_PLOT_SCATTER );
DataPlot dpLine = gly.DataPlots(k);
dpLine.Curve.Symbol.Type.nVal = 3;
===========================================



Thereafter I make a Legend like this



============================================
FILE *stream;
stream = fopen( name_path, "r" );

string head, sLegend, tmps;
head = "\g(t)\-(B)\+(c) / \g(t)\-(B)\+(l):";
sLegend=head;
for (m=0; m<10; m++)
{
fscanf( stream,"%s\n", cTmp);
string ts(cTmp, 5);
//fscanf( stream,"%s\n", tmps);
//string ts = tmps.Left(5);
printf("%s\n", ts);
sLegend.Format("%s\n\l(%d) %s",sLegend,m+1,ts);
}
fclose( stream );

gly.LT_execute("legend"); // create legend
GraphObject goLegend = gly.GraphObjects("legend");
if( goLegend.IsValid() ) goLegend.Text = sLegend;
=======================================================


I obtain this figure





What is the reason that the decimal numbers are not indexed with 1, 2 .... 10 in the Legend? Interestingly, this works fine if I use


dpLine.Curve.Line.Color.nVal = k;

where k runs from 1 to 10 in the for loop

What I do wrong?

thanks
oliver
3   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 10/30/2006 : 12:28:04 AM
Hi Oliver,

Removing the extra '\' in front of %d will fix it... sLegend.Format("%s\n%d:\t%s",sLegend,m+1,ts);

Mike Buess
Origin WebRing Member
ovince Posted - 10/29/2006 : 10:50:06 PM
thank you Deanna,

I made this change

string head, sLegend, tmps;
head = "\g(t)\-(B)\+(c) / \g(t)\-(B)\+(l):";
sLegend=head;
for (m=0; m<10; m++)
{
fscanf( stream,"%s\n", cTmp);
string ts(cTmp, 5);
sLegend.Format("%s\n\%d:\t %s",sLegend,m+1,ts);
}
fclose( stream );


I get somthing like this which I hardly understand why





I affect every second Legend label. Why is that?

Oliver
Deanna Posted - 10/29/2006 : 9:05:42 PM
I think the reason is that the graph layer has only one data plot. If this is true, the easiest solution is to change this line:
sLegend.Format("%s\n\l(%d) %s",sLegend,m+1,ts);
to:
sLegend.Format("%s\n\%d %s",sLegend,m+1,ts);


Deanna
OriginLab Technical Services

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