How to align text?  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
arnie
Posts: 1593
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 511 times

How to align text?

Postby arnie » 12 Oct 2014

I'm debating here on how can we align text.

Using this code as an example

Code: Select all

input:
pct (14.5),
ytvol (21563),
tvol (156874),
nubar (45);



Plot1((NumToStr(pct,1) + "%" + spaces(4)
+ NumToStr(ytvol,0) + spaces(4)
+ NumToStr(tvol,0) + spaces(4)
+ NumToStr(nubar,0) + spaces(4)
+ FormatTime("HH:mm", datetime) + "h"));
The idea is to be used in the Scanner.
Looking a the bottom part of the attached image, we have a perfect aligned text. This is normal since all strings have the same length.
The problem is with the top part of the image where we have strings with different lengths which difficult the way we read the information. Our eyes need to zig-zag between the data.
My question is how can we align strings with different lengths so the final result be something like the bottom part of the image?

Image

I know there's a keyword STRLEN that should help in this case but I have no idea on how to apply it.
The idea would be to read the highest string length and then "plot" that length into the other strings, but how to do that?
Attachments
aligned.png
aligned.png (8.24 KiB) Viewed 628 times

SP
Posts: 453
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 283 times

Re: How to align text?  [SOLVED]

Postby SP » 12 Oct 2014

arnie,

if you use it only in the scanner you could use 5 plots, one for each text.

Or you code like this

Code: Select all

input:
pct (14.5),
ytvol (21563),
tvol (156874),
nubar (45);



Plot1((NumToStr(pct,1) + "%" + spaces(10-StrLen(NumToStr(ytvol,0) ))
+ NumToStr(ytvol,0) + spaces(10-StrLen(NumToStr(tvol,0) ))
+ NumToStr(tvol,0) + spaces(8-StrLen(NumToStr(nubar,0) ))
+ NumToStr(nubar,0) + spaces(4)
+ FormatTime("HH:mm", datetime) + "h"));

User avatar
arnie
Posts: 1593
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 511 times

Re: How to align text?

Postby arnie » 12 Oct 2014

arnie,
if you use it only in the scanner you could use 5 plots, one for each text.

Thanks SP.

Only now I noticed I can show each plot separately without having to plot several times the same study per cell.

Shame on me :oops:

robby40
Posts: 1
Joined: 15 Mar 2011
Has thanked: 1 time

Re: How to align text?

Postby robby40 » 12 Oct 2014

Or you code like this

Code: Select all

input:
pct (14.5),
ytvol (21563),
tvol (156874),
nubar (45);

Plot1((NumToStr(pct,1) + "%" + spaces(10-StrLen(NumToStr(ytvol,0) ))
+ NumToStr(ytvol,0) + spaces(10-StrLen(NumToStr(tvol,0) ))
+ NumToStr(tvol,0) + spaces(8-StrLen(NumToStr(nubar,0) ))
+ NumToStr(nubar,0) + spaces(4)
+ FormatTime("HH:mm", datetime) + "h"));
I also did not know you could do that. Nice tip/trick. Thanks SP.

User avatar
TJ
Posts: 7157
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 988 times
Been thanked: 2042 times

Re: How to align text?

Postby TJ » 12 Oct 2014

ps. the benefit of plotting them separately is, you can selectively change the background color of individual plots as enhanced visual alerts.

eg.

Code: Select all


if CLOSE > CLOSE[1] then SetPlotBGColor( 10, green )
else SetPlotBGColor( 10, white );

User avatar
arnie
Posts: 1593
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 511 times

Re: How to align text?

Postby arnie » 12 Oct 2014

Why does our studies have a black background?
We can't change the theme this way.

Image
Attachments
back.png
back.png (17.5 KiB) Viewed 715 times

User avatar
Henry MultiСharts
Posts: 9066
Joined: 25 Aug 2011
Has thanked: 1256 times
Been thanked: 2911 times

Re: How to align text?

Postby Henry MultiСharts » 13 Oct 2014

Why does our studies have a black background?
We can't change the theme this way.

Image
This issue will be resolved in MultiCharts 9.0 Release 2.

User avatar
arnie
Posts: 1593
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 511 times

Re: How to align text?

Postby arnie » 13 Oct 2014

Is there a way to build a trend cell based on our own study?

Image
Attachments
trend.png
trend.png (27.57 KiB) Viewed 742 times

User avatar
Henry MultiСharts
Posts: 9066
Joined: 25 Aug 2011
Has thanked: 1256 times
Been thanked: 2911 times

Re: How to align text?

Postby Henry MultiСharts » 14 Oct 2014

Is there a way to build a trend cell based on our own study?

Image
arnie, there is no such option at the moment.


Return to “MultiCharts”