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
 legend
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ovince

Yugoslavia
Posts

Posted - 10/22/2006 :  2:16:42 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
hi All

I have a problem to make a legend. I have vectors of float and I could not manage to put these numbers
into the legend. I did this

LT_set_var("A", vecfL[4]);
LT_set_var("B", vecfL[3]);
LT_execute("lab -r Legend;");
LT_execute("legend -s;");
LT_execute("type $(A);");
LT_execute("type $(B);");
LT_execute("legend.text$='\l(1) $(A)
\l(2) $(B)';");


what I do wrong?

Thanks
oliver

rlewis

Canada
253 Posts

Posted - 10/22/2006 :  3:55:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
How about the following approach ...
 
bool Update_Legend(vector<string> strLegend)
{
GraphLayer gL=Project.ActiveLayer();
if(gL.IsValid()==false)
{
return (false);
}
LT_execute("Legend");
GraphObject goLegend;
goLegend=gL.GraphObjects("Legend");
if(goLegend.IsValid()==false)
{
return (false);
}
goLegend.Text="";
int NumLines=strLegend.GetSize();
for (int i=0;i<NumLines;i++)
{
goLegend.Text+=strLegend[i];
if(i<NumLines-1)
{
goLegend.Text+="\r\n";
}
}
return (true);
}

bool vector_To_Legend()
{
vector<string> strLegend;
vector<float>vctArray={1.1,2.2,3.3,4.4};
int ArraySize=vctArray.GetSize();
strLegend.SetSize(ArraySize);
string strText;
for(int i=0; i<ArraySize;i++)
{
strText.Format("%f",vctArray[i]);
strLegend[i]=strText;
}
if(Update_Legend(strLegend)==true)
{
return (true);
}
return (false);
}

Go to Top of Page

ovince

Yugoslavia
Posts

Posted - 10/22/2006 :  4:11:26 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply


thanks many rlewis
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