Author |
Topic  |
|
ovince
Yugoslavia
Posts |
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 |
|
Deanna
China
Posts |
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 |
 |
|
ovince
Yugoslavia
Posts |
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 |
 |
|
Mike Buess
USA
3037 Posts |
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 |
 |
|
|
Topic  |
|
|
|