GfxSetZOrder and GfxSetOverlayMode

@awilson Thanks again for your efforts.

Nice try :slight_smile: At first I thought, that I have missed something, because at first glance your new code seemed to achieve what I want, but then I realised, that you have used a kind of trick to hide only this vertical line area :wink: I want to use 100% of the chart area - and as I have shown above - it’s doable! If I replace your line:

GfxSetZOrder( 128 );
GfxGradientRect( pxWidth-200, 0, pxWidth, pxheight, colorwhite, colorwhite );

with:

GfxSetZOrder( 128 );
GfxGradientRect( 0, 0, pxWidth, pxheight, colorwhite, colorwhite );
// Or simply GfxFillSolidRect (0, 0, pxWidth, pxheight, colorWhite);

… to extend the filled area, the white area covers all other drawings because 128 is the top layer. All others are behind it. So we are again “back to square one”. In this case also the only way of determining which elements are displayed in front and which are behind, is the order in which they appear in the code. And I have already been using similar solution via GfxSetOverlayMode(2). It is even a simpler one, because I don’t have to draw any rectangle to hide other elements.

Once again, thanks a lot :slight_smile:

1 Like

@beppe I agree. If Tomasz says that there is no other way apart from presented above, of course I will accept that. As I have shown - I already have properly working solutions. I am just looking for a way of simplyfing complex codes.

It would be very useful in such cases to be able to “switch off” this vertical line. Everything else seems to be working fine and using GfxSetZOrder() is so simple. I may suggest implementing such option/feature to the feedback centre. I would really appreciate hearing @Tomasz’s opinion about that.

Thanks a lot!

1 Like

The thing is that these two functions provide similar functionality (Z-ordering) and they are mutually exclusive as one would interfere with another. The thing is however that overlay mode 2 is in fact “special case” which means, don’t draw anything and I think it would be beneficial to treat it as “special” and allow it to be called in one and only allowed position - on top of the formula. Something to consider in next version.

1 Like

Tomasz, thank you for the reply!

Of course all new features are welcomed by the users :slight_smile: but I am not sure if I understood correctly. is it possible to allow users to take advantage of different GFxSetZOrder() and be able to “switch off” this vertical line which seems to be the only element which makes using ZOrders in such cases impossible?

Thank you

1 Like

Sure just add this:

SetChartOptions( 0, chartHideQuoteMarker ); 
1 Like

I've tried, but the vertical line still persists :disappointed_relieved: :wink: It is not a quote Marker.

Przechwytywanie

If it is crosshair you need to press Ctrl+H. But it may be also divider between Y axis area and the chart area. If that is the case you can’t control it using SetChartOptions at the moment.

1 Like

No it is not a crosshair. It is a line between the chart area and Y axis area.

Przechwytywanie

Would it be possible to allow users to switch off this line in such cases? It would be really useful. Will you consider implementing it? :wink: Should I submit it to the feedback centre?

1 Like

ami

Title = "";
pxwidth  = Status( "pxwidth" );
pxheight = Status( "pxheight" );
	
//GfxSetZOrder( 128 );
//GfxGradientRect( pxWidth-200, 0, pxWidth, pxheight, colorwhite, colorwhite );

GfxZOrderOn = Param( "GfxZOrder",0, 0, 3, 1);

if( GfxZOrderOn == 0 ) {
	Zred = 3;
	ZGreen = 2;
	ZOrange = 1;
} else if( GfxZOrderOn == 1 ) {
	Zred = 3;
	ZGreen = 1;
	ZOrange = 2;
} else if( GfxZOrderOn == 2 ) {
	Zred = 2;
	ZGreen = 1;
	ZOrange = 3;
} else {
	Zred = 1;
	ZGreen = 2;
	ZOrange = 3;
}
GfxSetZOrder( Zred );
GfxGradientRect( 110, 70, 250, 250, colorWhite, colorRed );
GfxSetZOrder( ZGreen );
GfxGradientRect( 120, 70, 300, 300, colorWhite, colorGreen );
GfxSetZOrder( ZOrange );
GfxGradientRect( 140, 70, 250, 350, colorWhite, colorOrange );

How to NOT draw the line of Y axis ?

1 Like

Try this:

SetChartOptions(GetChartID(),chartHideQuoteMarker);

Anthony

1 Like

Did you try and change the color of the axis line to the color of the chart area ?

1 Like

I already wrote what I would do in previous reply

1 Like

Tomasz, I’m sorry, I was asking, because I don’t know the inner workings of AB and I’m not sure if the above solution would be beneficial in situations which I have presented. Maybe it is exactly the solution which I am looking for - I just don’t know. Maybe because it’s late (almost 2 a.m. in Warsaw), maybe because I’ve cought a cold, have a fewer and I’ve been working all day long inspite of feeling terrible, maybe because I’ve been trying all day to explain what I mean by providing different examples and still see, that some users don’t understand what I am after. But as allways thank you Tomasz for your efforts, and all other users for trying to help! I appreciate that.

Regards

1 Like

@awilson, @Anthony

The vertical line near the right border of the chart is neither Quote Marker nor Crosshair. Crosshair can be switched on/off by pressing Ctrl+H or via Menu --> View --> Crosshair. The Quote Marker is not even displayed when there is no Plot() in the code. If there is a Plot() Quote Marker can be switched off using SetChartOptions( 0, chartHideQuoteMarker );

I don’t exactly understand what you mean, but my intention is to use 100% area of the chart window. I don’t want to leave any blank areas. I also use the Y-axis area which normally is used to display Y scale.

That is also not an option, for the reason mentioned above.

I have also shown that I already have a 100% working solution meeting my criteria. I presented how one of such codes work a couple months ago in this post: AmiBroker - much more than just ordinary technical analysis software I am really satisfied with them. I use this and similar solutions every single day for news trading, event driven trading, simple news flow analysis - like searching the news for some keywords etc.

So why did I create this thread? Because for now the only way of achieving what I want is using GfxSetOverlayMode(2) or GfxSetZOrder(128) and usually GfxSetBkMode(1). Only then I can get rid of/obscure/cover this vertical Y-axis line. But in such case the only way of deciding which displayed elements are in front and which are behind is the order in which gfx lines appear in the code. It’s logical and poses no problem in case of simple codes, but requires some effort and might be challenging in case of complex ones with for example different interactive elements. It is exactly like with standard Plots with or without GxfSetZOrder(). You can plot whatever you want without using GxfSetZOrder() but in some cases it is much more comfortable to be able to use different Z layers. For this reason GxfSetZOrder() was implemented by Tomasz many years ago. I was hoping, that I will also be able to take advantage of different Z layers in my Gfx codes. The only problem seems to be this vertical line, which I cannot get rid of. There was a chance, that there is some SetOption() call which I am not aware of. But Tomasz confirmed, that currently the user cannot just switch off this line. For this reason I asked Tomasz to consider allowing users to switch off this line in cases similar to presented above. If @Tomasz decides to implement such feature, it will be great. If not I will be still using GfxSetOverlayMode(2).

Thank you for your input.

Regards.

1 Like

Version 6.29 will make one simple change: that vertical line will be drawn with ZOrder = 0 (instead of Z order 128). So you will be able to cover it with rectangle drawn with ZOrder = 1 and use remaining Zorders to control the drawing order of remaining elements of your chart.

This has been decided to do so because GfxSetZOrder internally switches "overlay mode" to entirely new level (=3) that is totally different from mode 2.

5 Likes

Tomasz, thank you very much for that! That should solve the issue. Being able to use GfxSetZOrder in such codes (especially if they are complex), will make a big difference :slight_smile:

1 Like

Hello @Tomasz. I decided to revive this thread because recently I've been working on some new codes in which I wanted to make use of different ZOrders in my solely Gfx codes and it turned out that I can't do that because only using the last one - GFXSetZOrder (128) I can cover the chart's title ( in this case CDR - Test GfxSetZOrder). When I started this thread I had similar problem with the vertical line separating the chart area from the Y-axis area but You solved it implementing changes in AB 6.29. Frankly I'm not sure why I'm having such problem with hiding the chart's title in AB 6.38 because I would surely spot it in 6.29. So it would be great if similarily to the vertical line, the chart's title was drawn with ZOrder = 0 instead of 128.

One remark to other users. As described in the above thread, I'm of course aware of the fact that easiest way of coding gfx only charts is using GfxSetOverlayMode(2) (only low-level graphics is displayed - no charts, no grids, etc) - but then we can't use different gfx layers which are very useful when the code is complex. Some examples:

GfxSetZOrder(127);
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxGradientRect(0, 0, pxwidth, pxheight, colorGrey40, colorWhite);

GfxSetZOrder127


GfxSetZOrder(128);
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxGradientRect(0, 0, pxwidth, pxheight, colorGrey40, colorWhite);

GfxSetZOrder128


Because You wrote in another thread that the new version is coming soon I would like to mention one more thing which you might consider implementing.

Currently the user can choose if he/she wants to use Crosshair by selecting Menu --> View --> Crosshair or by pressing Ctrl + H. That is very convenient for most users. Personally I always use Crosshair when working with standard charts. The problem is I also have some solely gfx codes (like trading panels or chart panes displaying market news etc - an example below) in my layout and I am constantly switching between them. In case of gfx only codes, crosshair doesn't help and is rather annoying and should be off. So in addition to the option of switching Crosshair on/off globally I suggest adding AFL option allowing to switch Crosshair on/off locally in each pane - similar to SetChartOptions( chartDisableTooltips | chartDisableYAxisCursor | chartHideQuoteMarker etc ) When implemented user could have crosshair displayed on standard charts and only mouse pointer (without crosshair) in gfx panes.

Currently I switched the standard Crosshair off and wrote a simple custom Crosshair using RequestMouseMoveRefresh() which I use only in selected charts. It works really well, but as always - original solutions are always the best :slight_smile:

TradingNewsPanelMM


Tomasz - thank you one more time for making AmiBroker so versatile. I really enjoy using it and coding in AFL. Which other software on the market allows an amateur coder like me creating such cool and useful (for me) stuff! :slight_smile:

Simply use

Title=""; // NO title at all - so you don't need to cover it
1 Like

Tomasz, thank you for the tip. As usual - the simplest solutions are the best. I thought I tried it before but I was wrong :wink:

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.