Hello all,
I am writing a JMP script that creates a window with check boxes and drop down menus. These menus are used to select conditions which can then be used to run reports and generate graphs. One of the graphs I am making has a different number of lines on it depending on how many check boxes are selected. I've successfully been able to generate the graph with all of the lines no matter which check boxes are selected. The problem I am having is with the legend. The first data set always appears with points showing up in the legend as well as the line. All the rest of the data sets on that graph have online their line represented on the legend. To fix this, normally I would double click on the legend, manually uncheck the points on the legend that I do not want displayed, and then copy the script to make this happen automatically. When there are 4 sets of data on the graph the script will look something like this after i make my changes to the legendbox:
SendToReport(
Dispatch(
{},
"400",
LegendBox,
{Position( {-1, -3, -3, -3, 0, 1, 2, 3} )}
)
... //(other Dispatch() commands)
)
I have other commands going to the graph such as axis label name changes so this appears among other Dispatch() commands within the SendToReport() command. The problem I am having is that I cannot get the list inside of the Postion() command to change depending on the number of check boxes selected. I can hard code the correct list but then the code only works for that number of selected check boxes. For example if i set the list as {-1, -3, -3, 0, 1, 2} then the code only works correctly when I have 3 check boxes selected. I created a variable that changes to the correct list depending on the number of check boxes selected (and verified that it is being assigned correctly) but when I put the variable inside the Position() function the code does not make the change I want it to. The code below assigns the correct list to the variable PL depending on how many check boxes are clicked (the variables inside the SUM() function represent the outputs of the checkboxes).
PL = If(
Sum(IW27, II09, II44, II08, II42, IW29, CC23, IW24) == 1, {-1, 0 },
Sum(IW27, II09, II44, II08, II42, IW29, CC23, IW24) == 2, {-1, -3, 0, 1},
Sum(IW27, II09, II44, II08, II42, IW29, CC23, IW24) == 3, {-1, -3, -3, 0, 1, 2},
Sum(IW27, II09, II44, II08, II42, IW29, CC23, IW24) == 4, {-1, -3, -3, -3, 0, 1, 2, 3},
Sum(IW27, II09, II44, II08, II42, IW29, CC23, IW24) == 5, {-1, -3, -3, -3, -3, 0, 1, 2, 3, 4},
Sum(IW27, II09, II44, II08, II42, IW29, CC23, IW24) == 6, {-1, -3, -3, -3, -3, -3, 0, 1, 2, 3, 4, 5},
Sum(IW27, II09, II44, II08, II42, IW29, CC23, IW24) == 7, {-1, -3, -3, -3, -3, -3, -3, 0, 1, 2, 3, 4, 5, 6},
Sum(IW27, II09, II44, II08, II42, IW29, CC23, IW24) == 8, {-1, -3, -3, -3, -3, -3, -3, -3, 0, 1, 2, 3, 4, 5, 6, 7},
);
I have verified that this code is assigning the correct list to the variable. When I plug in the variable as follows it does not remove the points label from the legend box as I would like it to, and when I copy the script of the graph that I've generated the Dispatch() command to the legendbox is missing.
Dispatch(
{},
"400",
LegendBox,
{Position( PL )}
)
I have used variables in similar ways before, but I always reference one number in the list rather than try to insert an entire list (e.g. PL[1]). I have tried many variations of this but none have worked so far (PL[], {PL}, {PL[]}).
Please help me figure out what I am doing wrong. Please let me know if anything is unclear and I can provide any more detail that is needed to help answer the question. This is a very minor problem in the grand scheme of things but it is driving me crazy and I am having trouble moving past it without finding a solution. Help!