Text on an vertical line (Dummy question?)

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 times

Text on an vertical line (Dummy question?)

Postby arjfca » 30 Apr 2012

Hello

I draw vertical line using

Code: Select all

//
   Value1 = TL_New_S(D,Time_S,H+(Offset),D,Time_S,H*100);
   //Value2 = TL_SetExtRight(Value1,True);
   TL_SetColor(Value1,Red);
   TL_SetStyle(Value1,Tool_dashed);
   TL_SetSize(Value1,0.5);

How do I write text or string to make sure the it is at the top or at the bottom of my window chart vertical line?

Martin

User avatar
TJ
Posts: 6602
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 971 times
Been thanked: 1910 times

Re: Text on an vertical line (Dummy question?)

Postby TJ » 30 Apr 2012

Code: Select all

var:
my.line(-1),
my.text(-1),
begin.date(0), begin.time(0), begin.price(0),
end.date(0), end.time(0), end.price(0);

my.line = TL_New_S( begin.date, begin.Time, begin.price,
                    end.date, end.Time,  end.price);

   TL_SetColor(my.line, Red);
   TL_SetStyle(my.line, Tool_dashed);
   TL_SetSize(my.line, 0.5);

// put text at the beginning of the line
my.text = text_new_s( begin.date, begin.Time, begin.price, "TEXT");




if you have the habit of not using generic variable names (ie. value1, var1, condition1),
you will have a better chance of seeing things through...
These users thanked the author TJ for the post:
arjfca

arjfca
Posts: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 times

Re: Text on an vertical line (Dummy question?)

Postby arjfca » 30 Apr 2012

Hehe your the lucky one to have seen a code with Value1 from me.
I usually never use value1. Just use it for a fast implantation of my idea.

Thanks for the reminding. I appreciate

Martin :)
These users thanked the author arjfca for the post:
TJ

User avatar
TJ
Posts: 6602
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 971 times
Been thanked: 1910 times

Re: Text on an vertical line (Dummy question?)

Postby TJ » 30 Apr 2012

arjfca wrote:Hehe your the lucky one to have seen a code with Value1 from me.
I usually never use value1. Just use it for a fast implantation of my idea.

Thanks for the reminding. I appreciate

Martin :)


Hehe your the lucky one, I don't usually respond to codes with Value1 in it.

arjfca
Posts: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 times

Re: Text on an vertical line (Dummy question?)

Postby arjfca » 30 Apr 2012

Here is some clarification of what I want to achieved

I want to implement code that will show a time line on my chart. I want to be able to see what is the reference of the line. Here is a snap picture of a manually implanted Time Line

Now, How do I code that. I got the line, but not the text. As the text need to be always visible, I need it to float at a fixed position, at the bottom of the chart window.

Martin
Attachments
Time Line.gif
Time Line.gif (27.6 KiB) Viewed 372 times

User avatar
TJ
Posts: 6602
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 971 times
Been thanked: 1910 times

Re: Text on an vertical line (Dummy question?)

Postby TJ » 30 Apr 2012

arjfca wrote:Here is some clarification of what I want to achieved

I want to implement code that will show a time line on my chart. I want to be able to see what is the reference of the line. Here is a snap picture of a manually implanted Time Line

Now, How do I code that. I got the line, but not the text. As the text need to be always visible, I need it to float at a fixed position, at the bottom of the chart window.

Martin


Someone (maybe JoshM) wrote a function to do that.
Check in the User Contributed forum.



ps. next time I won't respond to any requests without a diagram.
These users thanked the author TJ for the post:
arjfca

User avatar
JoshM
Posts: 2089
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1525 times
Been thanked: 1486 times
Contact:

Re: Text on an vertical line (Dummy question?)

Postby JoshM » 02 May 2012

arjfca wrote:I want to implement code that will show a time line on my chart. I want to be able to see what is the reference of the line. Here is a snap picture of a manually implanted Time Line

Now, How do I code that.

I don't think is possible; I suppose we need a new PowerLanguage keyword for that like Text_RotateFont(numeric degrees) - with the existing Text Drawing words I don't see a way (but I also would like to do this! :) )

You could 'chop up' the string into little segments and place these above each other, like

2
-
5
-
2
0
1
2
-
8
:
5
4
:
2
5

(for May 2nd, 2012, 8:54:25)

But that's not very pretty and good readable.

I Googled for a font with 90 degrees turned letters, but I couldn't find any. Otherwise, if such a font exists, you could use the Text_SetFontName to use that font, giving you the tilted letters.
These users thanked the author JoshM for the post:
arjfca

arjfca
Posts: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 times

Re: Text on an vertical line (Dummy question?)

Postby arjfca » 02 May 2012

I will post a new request for this tool on Project Management. All the code is already in MC as it is possible to do it manually. All needed is a keyword to link to it.

Martin

SP
Posts: 445
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 280 times

Re: Text on an vertical line (Dummy question?)

Postby SP » 02 May 2012

Martin,

you could use the printtext_s function from NW27 posted here viewtopic.php?f=5&t=9785

Code: Select all

input: Plottime  (115500);
vars: TLText(0);
if time_s = Plottime  then 
TLText = printtext_s (d,Plottime  ,GetAppInfo(aiLowestDispValue ),1,1,red,10,true,
FormatDate("dd-MM-yyyy",ELDateToDateTime(date))+" "+
FormatTime("HH:mm:ss",ELTimeToDateTime_s(Plottime  ) ),false);
Attachments
TL Text.jpg
TL Text.jpg (30.07 KiB) Viewed 374 times
These users thanked the author SP for the post:
arjfca

User avatar
Henry MultiСharts
Posts: 8521
Joined: 25 Aug 2011
Has thanked: 1213 times
Been thanked: 2741 times

Re: Text on an vertical line (Dummy question?)

Postby Henry MultiСharts » 02 May 2012

Confirmed, there is no such keyword to plot text vertically.
These users thanked the author Henry MultiСharts for the post:
arjfca

arjfca
Posts: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 times

Re: Text on an vertical line (Dummy question?)

Postby arjfca » 02 May 2012

Henry Multicharts wrote:Confirmed, there is no such keyword to plot text vertically.

Request to provide such keyword as been done

Please vote for it

https://www.multicharts.com/pm/viewissue ... _no=MC-938

Martin
These users thanked the author arjfca for the post:
JoshM

User avatar
JoshM
Posts: 2089
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1525 times
Been thanked: 1486 times
Contact:

Re: Text on an vertical line (Dummy question?)

Postby JoshM » 03 May 2012

Thanks Martin for making the feature request, I've added my vote to it. :)

On a related note, is it possible to set the alignment of the text inside the box? For example, in Excel this would look like (with the alignment buttons highlighted in orange):

Image

Off course, I've looked at the text drawing functions in the wiki, but didn't see a way to do this - am I overlooking something?
Attachments
scr.03-05-2012 09.41.18.png
scr.03-05-2012 09.41.18.png (17.47 KiB) Viewed 517 times
These users thanked the author JoshM for the post:
arjfca

arjfca
Posts: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 times

Re: Text on an vertical line (Dummy question?)

Postby arjfca » 03 May 2012

JoshM wrote:Thanks Martin for making the feature request, I've added my vote to it. :)

On a related note, is it possible to set the alignment of the text inside the box? For example, in Excel this would look like (with the alignment buttons highlighted in orange):

Image

Off course, I've looked at the text drawing functions in the wiki, but didn't see a way to do this - am I overlooking something?


Josh, you could add your request or comment to my own request. Go to the page and in the bottom, there is a link to add commentary


https://www.multicharts.com/pm/viewissue ... _no=MC-938

Martin :)
These users thanked the author arjfca for the post:
JoshM


Return to “MultiCharts”