Text alignment

Created at 25 Jan 2024, 23:23
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
AT

AttilaCsenge

Joined 08.10.2023

Text alignment
25 Jan 2024, 23:23


Hi guys

I'm struggling with the texts. Just want to align them another way or rotate, but dont find anything useful in the docs. Would be grateful if you help me. thanks in advance.


@AttilaCsenge
Replies

firemyst
28 Jan 2024, 11:55

What kind of text?

You don't say what kind of text you're wanting to align.

If you mean from the Chart.DrawText method, here's an example for you:

 ChartText ct = Chart.DrawText("position" + index, "hello world", entryPrice, textLocation, lineColor);
 ct.IsBold = true;
 ct.VerticalAlignment = VerticalAlignment.Center;
 ct.HorizontalAlignment = HorizontalAlignment.Left;
 ct.ZIndex = 15; //So it's above other objects on the chart and we can see it.

@firemyst

AttilaCsenge
29 Jan 2024, 16:16 ( Updated at: 30 Jan 2024, 06:34 )

RE: What kind of text?

firemyst said: 

You don't say what kind of text you're wanting to align.

If you mean from the Chart.DrawText method, here's an example for you:

 ChartText ct = Chart.DrawText("position" + index, "hello world", entryPrice, textLocation, lineColor); ct.IsBold = true; ct.VerticalAlignment = VerticalAlignment.Center; ct.HorizontalAlignment = HorizontalAlignment.Left; ct.ZIndex = 15; //So it's above other objects on the chart and we can see it.

Thank you for your quick response. This is exactly what i wanted to do with DrawText. 


@AttilaCsenge

AttilaCsenge
29 Jan 2024, 16:16 ( Updated at: 30 Jan 2024, 06:34 )

RE: What kind of text?

firemyst said: 

You don't say what kind of text you're wanting to align.

If you mean from the Chart.DrawText method, here's an example for you:

 ChartText ct = Chart.DrawText("position" + index, "hello world", entryPrice, textLocation, lineColor); ct.IsBold = true; ct.VerticalAlignment = VerticalAlignment.Center; ct.HorizontalAlignment = HorizontalAlignment.Left; ct.ZIndex = 15; //So it's above other objects on the chart and we can see it.

Thank you for your quick response. This is exactly what i wanted to do with DrawText. 


@AttilaCsenge

AttilaCsenge
29 Jan 2024, 16:16 ( Updated at: 30 Jan 2024, 06:34 )

RE: What kind of text?

firemyst said: 

You don't say what kind of text you're wanting to align.

If you mean from the Chart.DrawText method, here's an example for you:

 ChartText ct = Chart.DrawText("position" + index, "hello world", entryPrice, textLocation, lineColor); ct.IsBold = true; ct.VerticalAlignment = VerticalAlignment.Center; ct.HorizontalAlignment = HorizontalAlignment.Left; ct.ZIndex = 15; //So it's above other objects on the chart and we can see it.

Thank you for your quick response. This is exactly what i wanted to do with DrawText. 


@AttilaCsenge

karatedog
05 Aug 2024, 15:19 ( Updated at: 06 Aug 2024, 05:38 )

RE: What kind of text?

firemyst said: 

You don't say what kind of text you're wanting to align.

That might be because newbies like me don't have a clue what kind of Text are out there, and coming from other programming languages the immediate practice is, it should not matter, it is Text at the end.

The documentation is lacking, badly organized and probably not maintained, I get constant warnings for obsolete methods when copying examples from the documentation.

This forum post was the single answer to my question as well, otherwise I would not even imagine that half of the properties for Text object is defined with the DrawText method and other half is defined on the base class properties. This is not just ugly, it makes the learning curve extremely steep. 

Thanks for the info!

 


@karatedog

PanagiotisCharalampous
06 Aug 2024, 05:49

RE: RE: What kind of text?

karatedog said: 

firemyst said: 

You don't say what kind of text you're wanting to align.

That might be because newbies like me don't have a clue what kind of Text are out there, and coming from other programming languages the immediate practice is, it should not matter, it is Text at the end.

The documentation is lacking, badly organized and probably not maintained, I get constant warnings for obsolete methods when copying examples from the documentation.

This forum post was the single answer to my question as well, otherwise I would not even imagine that half of the properties for Text object is defined with the DrawText method and other half is defined on the base class properties. This is not just ugly, it makes the learning curve extremely steep. 

Thanks for the info!

 

Hi there,

Please let us know which examples are obsolete so that we can update them.

Best regards,

Panagiotis


@PanagiotisCharalampous

karatedog
26 Aug 2024, 14:37

RE: RE: RE: What kind of text?

PanagiotisCharalampous said: 

Hi there,

Please let us know which examples are obsolete so that we can update them.

Best regards,

Panagiotis

Hey Panagiotis,

I found a lot of examples that referred to MarketSeries to which I got a warning at build time that it is obsolete.

Thank you
karatedog


@karatedog

PanagiotisCharalampous
27 Aug 2024, 06:24

RE: RE: RE: RE: What kind of text?

karatedog said: 

PanagiotisCharalampous said: 

Hi there,

Please let us know which examples are obsolete so that we can update them.

Best regards,

Panagiotis

Hey Panagiotis,

I found a lot of examples that referred to MarketSeries to which I got a warning at build time that it is obsolete.

Thank you
karatedog

Hi there,

Please provide the links.

Best regards,

Panagiotis


@PanagiotisCharalampous