Hello all, newbie here:
im working with a set of data in a process that i am expecting to repeat many many times, as such i'm trying to automate the set up as best i can. For the moment i'm working on some data presentation, ansd i need your help in making a graph's axis titles variable depending on the content of cells.
as an example i have the data below :
![MachineCapybara_3-1669388412498.png MachineCapybara_3-1669388412498.png](https://community.jmp.com/t5/image/serverpage/image-id/47635iDA8C06B0125B607C/image-size/medium?v=v2&px=400)
from this data i want to plot a graph showing "Res" for each "Col A" value, as well as a series of reference lines showing "Ref" (and its boundary conditions "+/-uref" and "rob" and its boundary conditions "+/- urob".
Currently the script is as follows:
dt = Current Data Table();
Graph Builder(
Size( 743, 472 ),
Show Control Panel( 0 ),
Variables(
X( :COLA, Order By( :Res, Ascending, Order Statistic( "Mean" ) ) ),
Y( :Res ),
Interval( :Ures )
),
Elements( Points( X, Y, Legend( 7 ) ) ),
SendToReport(
Dispatch(
{},
"COLA",
ScaleBox,
{Label Row(
{Label Orientation( "Vertical" ), Set Font Size( 12 ),
Set Font Style( "Italique" )}
)}
),
Dispatch(
{},
"Res",
ScaleBox,
{Min(), Max(), Inc(), Minor Ticks( 1 ),
Add Ref Line( dt[1, 11], "Solid", "Dark Blue", "", 1 ),
Add Ref Line( dt[1, 9], "Dotted", "Dark Blue", "", 1 ),
Add Ref Line( dt[1, 10], "Dotted", "Dark Blue", "", 1 ),
Add Ref Line( dt[1, 4], "Solid", "Dark Red", "", 1 ),
Add Ref Line( {dt[1, 7], dt[1, 8]}, "Solid", "Medium Dark Red", "", 1, 0.15 ),
Add Ref Line( dt[1, 7], "Dotted", "Dark Red", "", 1 ),
Add Ref Line( dt[1, 8], "Dotted", "Dark Red", "", 1 )}
),
Dispatch( {}, "graph title", TextEditBox, {Set Text( "Analyte res" )} ),
Dispatch( {}, "X title", TextEditBox, {Set Text( "COLA" )} ),
Dispatch( {}, "Y title", TextEditBox, {Set Text( "Units of Res (g/m3)" )} ),
Dispatch( {}, "400", LegendBox, {Legend Position( {7, [-1, -3]} )} )
)
);
Which works fine and is flexible enough to be able to modify the reference lines in the graph according to the cell values as required.
Now, what i'd like is also for the titles to be able to do the same thing as the reference lines. So ideally i could add an initial column in my jmp table, which we will call "info" which has the information on the studied analyte (name, units used for measurement, etc...) and i'd like for the graph's title (and axes) to pull the information out from these cells (like the reference lines are currently doing) and use this info in the text.
For example, if in my "info" column i have "Zr4+" i'd like the final graph to go and look for this cell and use it to label itself or one of its axes.Such that i can then change the cell to "Br7-" and the next time i run the script, the new graph will be labelled with "Br7-".
Is it possible to do this?
bonus points if the variable can be inserted in a longer text, eg the y axis is "Zr 4+ (mg/l)" and then changes to "Br7- (mg/l)"