Selecting Chart Scale automatically


I've currently got a formula that plots lines on a chart in either linear scale or log scale. To do this it uses the following formula

ChartScale = ParamToggle("Chart Scale", "Linear|Log",0);
if( ChartScale == 0 )

and then later in that formula I have

y = IIf( chartScale == 0,  GfxConvertValueToPixelYLog( yVal ) ,GfxConvertValueToPixelY( yVal ) );

Is there any way that I can do away with the Paramtoggle so that If I change the scale of the chart via Parameters - Axes - Type and then linear or log, then the formula will recognise that the chart is set to a certain scale and adjust to that scale?

What do I reference to if I want the formula to change based on the settings in the Parameters window?

if ( ?? )



Go to View - Logarithmic Scale of menu bar. That setting is per chart pane setting. Click on pane you want to set to log. view to then select previously mentioned menu bar setting.


Hi fxshrat

I can currently change the chart scale by doing that. What I'm trying to do is have my formula settings adjust to either my settings for LOG or my settings for LINEAR every time I do what you have just suggested. At the moment they change from a linear plot to a log plot based on my paramtoggle. I would like to remove the paramtoggle and have the formula adjust according the View -Logarithmic . Is that possible. Is there something in afl that I can refer to?


You do not need such user function for Gfx drawing of price.
There is inbuilt native function GfxSetCoordsMode(). So for y expressed as price use mode 1 or 2.
GfxSetCoordsMode will recognize log setting.

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

GfxSelectPen( colorRed, 1, 0 );	
GfxMoveTo( 0, y = LastValue(C) );
GfxLineTo( Status("pxchartwidth"), y );

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