Drag Marker
Scripting Index for Drag Marker
Summary: Runs data collection and visualization by creating a new window with a graph, enabling drag marker functionality, capturing mouse coordinates, and generating a table with X and Y values.
Code:
//make data points on graph, then put in table
//basically, Scripting Index for Drag Marker() & Mouse Trap() + a button to make a table
Names Default To Here( 1 );
mat_x = [];
mat_y = [];
New Window( "Data Maker",
g = Graph(
Drag Marker( mat_x, mat_y );
Mousetrap(
{},
mat_x = mat_x |/ Matrix( {x} );
mat_y = mat_y |/ Matrix( {y} );
);
),
Button Box ("Make Data Table",
dt = New Table ("Data",
New Column ("X", values (mat_x)),
New Column ("Y", values (mat_y))
)
)
);
Code Explanation:
- Set default names context.
- Initialize empty matrices for X and Y.
- Create new window titled "Data Maker".
- Add graph object to window.
- Enable drag marker for graph.
- Set up mouse trap for graph.
- Capture mouse coordinates X and Y.
- Append captured X coordinates to matrix.
- Append captured Y coordinates to matrix.
- Add button "Make Data Table" to window.
- Create new table named "Data".
- Add column "X" with matrix values.
- Add column "Y" with matrix values.