Add a formula column to your data table, using your function. Then add that column to the graph as a function. Here's an example with a simple linear regression
dt = New Table( "Test Linear Regression", Add Rows( 6 ),
New Column( "Column 1", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [1, 2, 3, 4, 5, 6] ) ),
New Column( "Column 2", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [1, 3, 2, 4, 3, 7] ) ),
New Column( "Column 3", Numeric, "Continuous", Format( "Best", 12 ),
Formula( 0.1333333 + 0.9142857 * :Column 1 ) )
);
gb = dt << Graph Builder(
Size( 522, 456 ),
Show Control Panel( 0 ),
Variables( X( :Column 1 ), Y( :Column 2 ), Y( :Column 3, Position( 1 ) ) ),
Elements(
Formula( X, Y( 2 ), Legend( 12 ) ),
Points( X, Y( 1 ), Legend( 13 ) )
),
SendToReport(
Dispatch( {}, "400", ScaleBox,
{Legend Model( 12,
Properties( 0, {Line Color( 19 )}, Item ID( "Column 3", 1 ) )
)}
)
)
);
Here's the formula column: