Chart Axis Color

back to the basics again for me.

I am making a few color templates so that one can toggle between different color themes for the chart.

Now I have a dark theme and a light theme however for the axis colors I know only how to change them via the preferences. Could not find if we can also change the axis colors from AFL. I looked at setchartoptions, setoptions, couldn’t find it. Not sure if it is possible. Anyone know? Thanks

Ed, you may use SetChartBkColor for that.

SetChartBkColor(colorsolid) ;//solid fill or axes color
SetChartBkGradientFill(gradtopcol, gradbotcol, gradtitlecol) ;// chart area color

Font color can be set from preferences only though.

1 Like

thanks fx, yes this can be used, although it is visually not very nice but it will do.

I get an axis that look liks, see chart below. Maybe will try out some variations.

thanks again


you can do like this for example if you use gfxsetcoordsmode setting to 1.
For setting 0 would have to use Status() pixel codes.

Note: gfxsetcoordsmode has 4 modes to choose from.

SetChartBkColor(colorBlack) ;//solid fill or axes color
SetChartBkGradientFill(colorWhite, colorWhite, colorBlack) ;// chart area color

Plot( C, "Price", colorDefault, styleCandle );

bi = BarIndex();
fvb = FirstVisibleValue( bi );
lvb = LastVisibleValue( bi );

GfxSetCoordsMode( 1 );

GfxFillSolidRect( lvb, C[lvb-10],  lvb-10,  Max( Status( "axisminY" ), C[lvb-10]-100 ), colorBlue );

thanks fx,

yes maybe I’ll do that that I limit the gfx drawing also in the y-direction. I have done that already along the x-axis, that should be good enough,

regards, Ed

coming back to this chart axis color.

i would say it would be nice to be able to set it from AFL, or if that is not possible it would be nice to be able to have a function like GetAxisColor();

Or is there something like that already?

my issue is that when writing code for others one would like to leave their settings as they are and then have my code adjust the colors to their color settings.

1 Like

I agree. That would be very useful. I would like to make up a couple of color themes but there does not seem to be any way to set the axis color via AFL.