Running O3G.exe in a layout

Amibroker has a very nice 3D plotting program to display optimization results. We can launch this program using ShellExecute():

O3GTrigger = ParamTrigger( "Run O3G", "RUN" );
if( O3GTrigger ) shellexecute( "O3G.exe","","");

image

I think its time to add Real-Time 3D-charting to my layouts and have the following questions:

  1. Where does the O3G program get its data from? Where, and in what format, can I save my data so that the O3G program finds and displays it?

  2. Is there any way to display the 3D chart in a Chart-Window as part of a Layout and refresh it in real-time?

  3. How do I execute/refresh the O3G display in the same window, i.e., without opening a new window? Can it be called with any arguments?

I realize that there may be some reasons not to do this (CPU load, threading, etc.) however I can deal with those.

PS. If my basic questions upset you in any way please do not respond. Thank you.

Have a great day!

1 Like

General side note about 3D viewer of AB (directed to any user):

Quote source: https://groups.yahoo.com/neo/groups/amibroker/conversations

1 Like

@Beaver -

  1. It takes data from input file which by default is optimize.csv. It is comma separated file holding X, Y coordinates and Z value in each line.

    x1, y1, z1
    x2, y2, z2
    x3, y3, z3

    and so on....

    Note that x/y coordinates must form "a grid", otherwise display may be weird.

  2. No it is not part of layout. It is separate program/window.

  3. You can't refresh it in real time because it does not reload changed file unless you do this manually

@fxshrat -

yes it is part of AmiBroker toolset and it should be used in conjunction with AmiBroker, but this means that as long as you generate files with AmIBroker and use it together with AmiBroker, you are perfectly fine. So for example if you generated csv files using AFL fopen/fputs/fclose and use generated file in O3G.exe then it is perfectly OK.

2 Likes

Thank you fxshrat!

Just to clarify, the O3G application I have in mind is specifically for Amibroker and would add an extra dimension to its charting capabilities.

Sooner or later 3D charting will become a common feature in TA so, since the 3D engine is already there, it might be a good time to explore what can be done here.

Thank you Tomasz, this is great information to start working with and it brings me halfway to basic 3D functionality.

Two solutions come to mind to make this idea fully functional:

  1. Amibroker can display a browser research window, would it be possible to run O3G in that browser window?

  2. I also believe it is possible to close an MS window running a small script from afl. Perhaps that method could be used to close the O3G window so that a new 3D plot can be displayed?

I welcome comments from anyone. Thanks!

Quite frankly it would be a lot easier if I just added periodic refresh to O3G instead of trying to "workaround" the refresh using various creative inventions :sunglasses: (No web research can't run exe files).

2 Likes

Well, what can I say :slightly_smiling_face: that would, of course, be fantastic.

Perhaps the refresh could default to when the file date changes. This might work nicely with Auto-Repeat AA operations.

Hello, perhaps someone can tell me what I am doing wrong. My optimize.csv file wouldn't load into the O3G so I wrote the simplified test program listed below. The datafile it generates looks good:

image
...
image

However, whenever I launch the O3G program it opens with its default data displayed. Is there something else I have to do to have O3G recognize my file? It is not locked as I can open it with other programs.

Many thanks for any help you can give!

function AddLineToFile( filepath, Msg )
{
    fh = 0;

    if( Msg != "" )
    {
        fn = filepath;
        fh = fopen( Fn , "a" );

        if( fh == 0 ) fh = fopen( fn, "w" );

        if( fh )
        {
            fputs( Msg + "\n", fh );
            fclose( fh );
        }
    }

    return fh;
}

filepath = "D:\\Amibroker2018\\Optimize.csv";

CreateFile 	= paramtrigger( "Create csv file", "CREATE FILE" );
Launch3DVAP = paramtrigger( "Launch O3G", "DISPLAY 3D CHART" );

if( CreateFile )
{
    fdelete( filepath );
    AddLineToFile( filepath, "z,x,y" ); // Open file with header

    for( x = 0, z = 0; x < 10; x++ )
    {
        for( y = 0; y < 10; y++, z++ )
        {
            csvline = "" + z + "," + x + "," + y;
            AddLineToFile( filepath, csvline ); // add rows to file
        }

    }
}

if( Launch3DVAP ) shellexecute( "O3G.exe", "", "" );
3 Likes

At last line change

if( Launch3DVAP ) ShellExecute( "O3G.exe", "", "" );

to

if( Launch3DVAP ) ShellExecute( "O3G.exe", filepath, "" );
2 Likes

Fantastic! Works like a charm!

Thanks, fxshrat!

Have a great day!