Hi, 

 

This is REAL NEAT addition!.

 

Two questions: 

 

1)

in the samples below there is multiple usage of the command
GfxSetOverlayMode(); 

 

Can several of these be interleaved within the code and as a
result the Gfx() following these will be plotted some on op
others underneath (transparent) for individual sections? (I
don't seem to get it to work)

 

2)

If you select text pointsize X, how do you compensate its
vertical position to line up its center height with a value
Y, independent of chart size?

 

Joseph Biran
____________________________________________

 

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Tomasz
Janeczko
Sent: Wednesday, April 30, 2008 8:32 AM
To: [email protected]
Subject: [amibroker] AmiBroker 5.09.0 BETA released [. New
fields in Status() function: pxchart* Chart coordinates! ]

 

Hello,

 

AmiBroker 5.09.0 BETA released

 
<http://www.amibroker.com/devlog/2008/04/30/amibroker-5090-b
eta-released/>
http://www.amibroker.com/devlog/2008/04/30/amibroker-5090-be
ta-released/

 

CHANGES FOR VERSION 5.09.0 (as compared to 5.08.0)

*       MDI Tab order is now saved in the layout
*       Added interface to BugsLayerUtil.dll for optional
call stack / symbol dump report in crash recovery window
Now there is a detailed call stack and CPU register state in
the bottom of the crash report. This should allow
quicker/easier fixes of any crashes
*       New fields in Status() function: pxchart* 

Status("pxchartleft") - returns x-coordinate of top-left
corner of chart area
Status("pxcharttop") - returns y-coordinate of top-left
corner of chart area
Status("pxchartright") - returns x-coordinate of
bottom-right corner of chart area
Status("pxchartbottom") - returns y-coordinate of
bottom-right corner of chart area
Status("pxchartwidth") - returns width chart area
(right-left)
Status("pxchartheight") - returns width chart area
(bottom-top)
Chart co-ordinates are useful because they automatically
take into account selected axis font size, whether date axis
is on or off
and other settings (New Look chart style)
All co-ordinates are in screen pixels. Note that top, left
coordinates may not be zero as chart rectangle is smaller
than underlying window because there is an extra space
(padding) around chart. 


// Test code:
Title = StrFormat("left=%g, top=%g, right=%g, bottom=%g,
width=%g, height=%g", 
left=Status("pxchartleft"), 
top=Status("pxcharttop"), 
right=Status("pxchartright"), 
bottom=Status("pxchartbottom"), 
Status("pxchartwidth"), 
Status("pxchartheight") ); 
GfxSetOverlayMode(1); 
GfxRectangle(Left,top, right, bottom);

============ Overlay sample ================
_SECTION_BEGIN("GfxOverlaySampleNew"); 

function GetVisibleBarCount() 
{ 
 lvb = Status("lastvisiblebar"); 
 fvb = Status("firstvisiblebar"); 

 return Min( Lvb - fvb, BarCount - fvb ); 
} 

function GfxConvertBarToPixelX( bar ) 
{ 
 lvb = Status("lastvisiblebar"); 
 fvb = Status("firstvisiblebar"); 
 pxchartleft = Status("pxchartleft"); 
 pxchartwidth = Status("pxchartwidth"); 

 return pxchartleft + bar  * pxchartwidth / ( Lvb - fvb + 1
); 
} 

function GfxConvertValueToPixelY( Value ) 
{ 
 local Miny, Maxy, pxchartbottom, pxchartheight; 

 Miny = Status("axisminy"); 
 Maxy = Status("axismaxy"); 

 pxchartbottom = Status("pxchartbottom"); 
 pxchartheight = Status("pxchartheight"); 

 return pxchartbottom - floor( 0.5 + ( Value - Miny ) *
pxchartheight/ ( Maxy - Miny ) ); 
} 



Plot(C, "Price", colorBlack, styleHistogram ); 

GfxSetOverlayMode(0); 
GfxSelectSolidBrush( colorRed ); 
GfxSelectPen( colorRed ); 

AllVisibleBars = GetVisibleBarCount(); 
fvb = Status("firstvisiblebar"); 

for( i = 0; i < AllVisibleBars ; i++ ) 
{ 
   x = GfxConvertBarToPixelX( i ); 
   y = GfxConvertValueToPixelY( C[ i + fvb ] ); 

  GfxRectangle( x-1, y-1, x + 2, y+1 ); 
} 

//SetChartBkGradientFill( ColorRGB(200,200,200), ColorRGB(
255,255,255) ); 
_SECTION_END();

 

*       OLE: Name property is now writable, allowing
switchin currently selected symbol for the document

Example (JScript):
AB = new ActiveXObject("Broker.Application");
AB.ActiveDocument.Name = "MSFT"; // change the symbol for
current document to "MSFT" 


Best regards,
Tomasz Janeczko
amibroker.com

Reply via email to