about setting of plot  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
viresearch
Posts: 12
Joined: 21 Mar 2013

about setting of plot

Postby viresearch » 06 Jun 2013

power_line = AddPlot(new PlotAttributes("Power", EPlotShapes.Histogram, Color.Cyan));
Now I want to display the value (in percentage) upon the bar of the histogram. How can I do it?
Thanks first.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: about setting of plot

Postby Henry MultiСharts » 06 Jun 2013

Hello viresearch,

You can do that with a text drawing.

viresearch
Posts: 12
Joined: 21 Mar 2013

Re: about setting of plot

Postby viresearch » 06 Jun 2013

posele=posele*100;
posele=Math.Round(posele, 1);
ChartPoint top = new ChartPoint(Bars.TimeValue, Bars.HighValue);
ITextObject textObj = DrwText.Create(top, posele.ToString());
textObj.VStyle = ETextStyleV.Above;

I use above codes to display the number. It displays in the instrument. But I want it to be displayed in the indicator (above the histogram). So I think I need to set ChartPoint(Bars.TimeValue, Bars.HighValue).

How can I let the text displayed in the indicator?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: about setting of plot

Postby Henry MultiСharts » 07 Jun 2013

You need to use a different constructor:

Code: Select all

ITextObject textObj = DrwText.Create(top, posele.ToString(), true);

viresearch
Posts: 12
Joined: 21 Mar 2013

Re: about setting of plot

Postby viresearch » 09 Jun 2013

You may create an indicator and try following,

posele=Bars.High[0];
posele=posele*100;
posele=Math.Round(posele, 1);
ChartPoint top = new ChartPoint(Bars.TimeValue, Bars.HighValue);

ITextObject textObj = DrwText.Create(top, posele.ToString(), true);
textObj.VStyle = ETextStyleV.Above;

I try the above codes. But in the indicator, no number is displayed above the histograms.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: about setting of plot

Postby Henry MultiСharts » 10 Jun 2013

This script will plot the text on Bars.HighValue. Do you expect it on this price value on your histogram plot? Please check the price value you are using to plot the text.

viresearch
Posts: 12
Joined: 21 Mar 2013

Re: about setting of plot

Postby viresearch » 10 Jun 2013

I want the number to be displayed on the top of histogram in the indicator. How can I achieve it? The above setting can't let the number displayed.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: about setting of plot

Postby Henry MultiСharts » 10 Jun 2013

Which value does your indicator plot? You need to use the same value as text location.
Please go to Format->Drawings->Format drawing->Properties to check where your drawings are currently plotted.

Everything works as expected on my end:

Code: Select all

m_adxvalue.Value = m_adx1[0];
Plot1.Set(0, m_adxvalue.Value);
ChartPoint top = new ChartPoint(Bars.TimeValue, m_adx1[0]);
ITextObject textObj = DrwText.Create(top, String.Format("{0}",Bars.CurrentBar ), true);
textObj.VStyle = ETextStyleV.Above;
Image
Attachments
histogram_text.png
(89.52 KiB) Downloaded 999 times

viresearch
Posts: 12
Joined: 21 Mar 2013

Re: about setting of plot

Postby viresearch » 11 Jun 2013

Based on the example, I build an indicator in the attachment. You may try it, and I still can't let the number displayed on the histogram.
Sorry for this question to take your time.
Attachments
atest.pln
(1.46 KiB) Downloaded 494 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: about setting of plot  [SOLVED]

Postby Henry MultiСharts » 11 Jun 2013

Try this one.
Attachments
atest_1.pln
(1.46 KiB) Downloaded 498 times


Return to “MultiCharts .NET”