[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Multi-Colored Chart Backgrounds



PureBytes Links

Trading Reference Links

Hello Aron, I figured out how to add the RGB custom colors to your
code. See the code below. It shows a very pleasing 3 gradient color
chart background that I am currently using. Coding and learning is
good. Thanks again.

//3 Gradient Color

_SECTION_BEGIN("3 color gradient");

priceAxesWidth=68;
dateAxesHeight=17;
TitleHeight=17;

pxwidth = Status("pxwidth");
pxheight = Status("pxheight");

chartwidth = pxwidth-priceAxesWidth;
chartheight = pxheight-dateAxesHeight;

topColor=ParamColor("topColor",ColorRGB(121,234,135) );
centerColor=ParamColor("centerColor", ColorRGB(245,242,120));
botColor=ParamColor("BottomColor", ColorRGB( 156,233,239));
priceAxesColor=ParamColor("priceAxesColor", colorWhite );
dateAxesColor=ParamColor("dateAxesColor", colorWhite);

relPos=Param("centerPosition%",50,0,100,1)/100;
centerHeight=chartheight*Param("centerHeight%",10,0,100,1)/100;
x0=0;
y0=Max(TitleHeight,chartheight*relPos-centerHeight/2);
x1=chartwidth;
y1=Min(chartheight,chartheight*relPos+centerHeight/2);

GfxSetBkMode( 1 );
GfxSetOverlayMode(1);
GfxGradientRect(0,0,chartwidth,TitleHeight, colorWhite ,colorWhite);
GfxGradientRect(chartwidth,0,pxwidth,pxheight, priceAxesColor
,priceAxesColor);
GfxGradientRect(0,chartheight,chartwidth,pxheight, dateAxesColor
,dateAxesColor);
GfxGradientRect(x0,y0,x1,y1, CenterColor ,CenterColor );
GfxGradientRect(0,TitleHeight,chartwidth, y0,topColor, CenterColor );
GfxGradientRect(0,y1,chartwidth, chartheight,  CenterColor ,botColor);

_SECTION_END();



--- In amibroker@xxxxxxxxxxxxxxx, "electricwally77" <soundmaker@xxx>
wrote:
>
> Hello Aron, I ran your code and it worked great. The center color
> widened and is more balanced along with the top and bottom colors. I'm
> working with the code now and would like to know how to manipulate the
> code to produce say a 5 color gradient, what would the other two color
> positions be called? In other words we have Top Color, Center Color
> and BottomColor. What would the parameters be for 5 color positions? 
> 
> I'm realizing just how powerful this AFL code can be. Also, is this
> coding you sent me presented in the Amibroker 5.20 users guide or
> elsewhere on Amibroker's web site?. I'd like to learn to understand
> better what you coded and how to code these background colors. You
> have lots of interesting code here.
> 
> I'm understanding how to manipulate the colors (somewhat). I can't
> place the RGB ( Yellow - 252,249,103) in your code. It wants either a
> single number (like violet - 38) or a color name (colorViolet). Then
> again perhaps I just don't understand how to manipulate it further to
> produce the custom RGB colors (as obtained in the color palette
> editor). Thanks for your kind help.
> 
> --- In amibroker@xxxxxxxxxxxxxxx, Aron <apforex@> wrote:
> >
> > electricwally77 wrote:
> > > Aron, Great job on the three color gradient. I have been playing
with
> > > your code and can't seem to code the center color so it blends into
> > > the top and bottom (much like the top and bottom color blend). Right
> > > now, as the code is written, it shows the center color as more of a
> > > tighter range of blend than the top and bottom. 
> > >
> > > In other words, the center color is more focused in on the center. I
> > > hope I am explaining this correctly. I certainly can live with the
> > > code the way it is written but if you have a way to "open" up the
> > > center color so it blends more like the top and bottom, I would
> > > appreciate the help. Thanks again. Wally 
> > >   
> > You can now widen the center , move it up and down
> > as well as control title, date an price axes colors:
> > 
> > 
> > |_SECTION_BEGIN("3 color gradient");
> > 
> > priceAxesWidth=68;
> > dateAxesHeight=17;
> > TitleHeight=17;
> > 
> > pxwidth = Status("pxwidth");
> > pxheight = Status("pxheight");
> > 
> > chartwidth = pxwidth-priceAxesWidth;
> > chartheight = pxheight-dateAxesHeight;
> > 
> > topColor=ParamColor("topColor",*colorLightBlue*);
> > centerColor=ParamColor("centerColor", *colorWhite* );
> > botColor=ParamColor("BottomColor", *colorLightBlue* );
> > priceAxesColor=ParamColor("priceAxesColor", *colorWhite* );
> > dateAxesColor=ParamColor("dateAxesColor", *colorWhite*);
> > 
> > relPos=Param("centerPosition%",50,0,100,1)/100;
> > centerHeight=chartheight*Param("centerHeight%",10,0,100,1)/100;
> > x0=0;
> > y0=Max(TitleHeight,chartheight*relPos-centerHeight/2);
> > x1=chartwidth;
> > y1=Min(chartheight,chartheight*relPos+centerHeight/2);
> > 
> > GfxSetBkMode( 1 );
> > GfxSetOverlayMode(1);
> > GfxGradientRect(0,0,chartwidth,TitleHeight, *colorWhite*
,*colorWhite*);
> > GfxGradientRect(chartwidth,0,pxwidth,pxheight, priceAxesColor 
> > ,priceAxesColor);
> > GfxGradientRect(0,chartheight,chartwidth,pxheight, dateAxesColor 
> > ,dateAxesColor);
> > GfxGradientRect(x0,y0,x1,y1, CenterColor ,CenterColor );
> > GfxGradientRect(0,TitleHeight,chartwidth, y0,topColor, CenterColor );
> > GfxGradientRect(0,y1,chartwidth, chartheight,  CenterColor ,botColor);
> > 
> > _SECTION_END();| ||
> >
>



------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/