Bonjour,
Je travaille avec JMP et j'ai besoin d'aide pour créer un journal interactif. Mon objectif est d'inclure une fonctionnalité qui permet aux utilisateurs de sélectionner et de mettre en évidence des lots spécifiques dans un graphique. Voici les détails du script et ce que j'essaie d'accomplir :
Names Default To Here(1);
Current Data Table(dt);
dt << New Column("Time Point Months", Formula(Round(:Time Point Days / 30.438), 2));
// Loop for each parameter
For(i = 1, i <= N Items(numPar), i++,
col1 = Col Box("");
col2 = Col Box("");
col3 = Col Box("");
// Create all batches plot
gb = Graph Builder(
invisible,
Size(500, 500),
Variables(X(:Time Point Months), Y(:Result), Overlay(:Batch)),
Elements(Points(X, Y))
);
gb << Local Data Filter(
Add Filter(
columns(:Component, :Batch, :Source Table),
Where(:Component == numPar[i]),
Where(:Batch == {cyc, bat}),
Where(:Source Table == dt_name)
)
);
dt << Clear Select();
gbb = Report(gb)[GraphBuilderBox(1)];
gbb << Add Element(1, 1, {Type("Line Of Fit"), X, Y, Confidence of Fit(0), Equation(0)});
// Set Y axis
minval = Min(
:Result[dt << get rows where(
:Component == numPar[i] & :Batch == cyc & :Source Table == dt_name | :Batch == bat
& :Component == numPar[i] & :Source Table == dt_name
)]
) * 0.95;
maxval = Max(
:Result[dt << get rows where(
:Component == numPar[i] & :Batch == cyc & :Source Table == dt_name | :Batch == bat
& :Component == numPar[i] & :Source Table == dt_name
)]
) * 1.05;
maxvalts = Max(
:Time Point Months[dt << get rows where(
:Component == numPar[i] & :Batch == cyc & :Source Table == dt_name | :Batch == bat
& :Component == numPar[i] & :Source Table == dt_name
)]
) * 1.05;
gbb[AxisBox(1)] << Min(-0.1);
gbb[AxisBox(1)] << Max(maxvalts);
gbb[AxisBox(2)] << Min(minval);
gbb[AxisBox(2)] << Max(maxval);
gbb[AxisBox(2)] << inc((maxval - minval) / 10);
// Set Y axis label
unitList = Associative Array(
:Result Unit[dt << get rows where(
:Component == numPar[i] & :Batch == cyc & :Source Table == dt_name | :Batch == bat
& :Component == numPar[i] & :Source Table == dt_name
)]
) << Remove("") << Get Keys;
If(N Items(unitList) == 1,
gbb[Text Edit Box(4)] << Set text(numPar[i] || " [" || unitList[1] || "]")
);
If(N Items(unitList) != 1,
gbb[Text Edit Box(4)] << Set text(numPar[i])
);
// Set graph title
gbb[Text Edit Box(1)] << Set text(numPar[i] || " vs. Time Point ");
gbba = Report(gb);
col1 << Append(gbba);
gb << close window;
For(k = 1, k <= N Items(cyc), k++,
check = dt << get rows where(
:Component == numPar[i] & :Batch == cyc[k] & :Source Table == dt_name | :Batch ==
bat[k] & :Component == numPar[i] & :Source Table == dt_name
);
If(N Items(check) > 0,
gb = Graph Builder(
invisible,
Size(500, 500),
Variables(X(:Time Point Months), Y(:Result), Overlay(:Batch)),
Elements(Points(X, Y))
);
gb << Local Data Filter(
Add Filter(
columns(:Component, :Batch, :Source Table),
Where(:Component == numPar[i]),
Where(:Batch == {cyc[k], bat[k]}),
Where(:Source Table == dt_name)
)
);
dt << Clear Select();
gbb = Report(gb)[GraphBuilderBox(1)];
gbb << Add Element(
1,
1,
{Type("Line Of Fit"), X, Y, Confidence of Fit(0), Equation(0)}
);
minval = Min(
:Result[dt << get rows where(
:Component == numPar[i] & :Batch == cyc[k] & :Source Table == dt_name |
:Batch == bat[k] & :Component == numPar[i] & :Source Table == dt_name
)]
) * 0.95;
maxval = Max(
:Result[dt << get rows where(
:Component == numPar[i] & :Batch == cyc[k] & :Source Table == dt_name |
:Batch == bat[k] & :Component == numPar[i] & :Source Table == dt_name
)]
) * 1.05;
maxvalts = Max(
:Time Point Months[dt << get rows where(
:Component == numPar[i] & :Batch == cyc[k] & :Source Table == dt_name |
:Batch == bat[k] & :Component == numPar[i] & :Source Table == dt_name
)]
) * 1.05;
gbb[AxisBox(1)] << Min(-0.1);
gbb[AxisBox(1)] << Max(maxvalts);
gbb[AxisBox(2)] << Min(minval);
gbb[AxisBox(2)] << Max(maxval);
gbb[AxisBox(2)] << inc((maxval - minval) / 10);
unitList = Associative Array(
:Result Unit[dt << get rows where(
:Component == numPar[i] & :Batch == cyc[k] & :Source Table == dt_name |
:Batch == bat[k] & :Component == numPar[i] & :Source Table == dt_name
)]
) << Remove("") << Get Keys;
If(N Items(unitList) == 1,
gbb[Text Edit Box(4)] << Set text(numPar[i] || " [" || unitList[1] || "]")
);
If(N Items(unitList) != 1,
gbb[Text Edit Box(4)] << Set text(numPar[i])
);
gbb[Text Edit Box(1)] << Set text(numPar[i] || " vs. Time Point ");
gbba = Report(gb);
col2 << Append(gbba);
gb << close window;
gb2 = Graph Builder(
invisible,
Size(500, 500),
Variables(X(:Time Point Months), Y(:Difference), Color(:Batch)),
Elements(Points(X, Y))
);
gb2 << Local Data Filter(
Add Filter(
columns(:Component, :Batch, :Source Table),
Where(:Component == numPar[i]),
Where(:Batch == cyc[k]),
Where(:Source Table == dt5_name)
)
);
dt4 << Clear Select();
gbb2 = Report(gb2)[GraphBuilderBox(1)];
gbb2 << Add Element(1, 1, {Type("Line"), X, Y});
l_idx = dt4 << Get rows where(dt4:Component == numPar[i] & :Batch == cyc[k]);
ul = Min(dt4:HC[l_idx]);
If(Is Missing(ul),
If(
Min(
:Difference[dt << get rows where(
:Component == numPar[i] & :Batch == cyc[k] & :Source Table ==
dt5_name
)]
) == 0,
minval = -5;
maxval = 5;
,
minval = Min(
:Difference[dt << get rows where(
:Component == numPar[i] & :Batch == cyc[k] & :Source Table ==
dt5_name
)]
) * 0.95;
maxval = Max(
:Difference[dt << get rows where(
:Component == numPar[i] & :Batch == cyc[k] & :Source Table ==
dt5_name
)]
) * 1.05;
)
,
minval = Min(
:Difference[dt << get rows where(
:Component == numPar[i] & :Batch == cyc[k] & :Source Table == dt5_name
)],
-ul
) * 1.05;
maxval = Max(
:Difference[dt << get rows where(
:Component == numPar[i] & :Batch == cyc[k] & :Source Table == dt5_name
)],
ul
) * 1.05;
);
If(!Is Missing(ul),
gbb2[AxisBox(2)] << Add Ref Line(ul, "solid", "black", Char(Round(ul, 2)));
gbb2[AxisBox(2)] << Add Ref Line(-ul, "solid", "black", Char(Round(-ul, 2)));
);
gbb2[AxisBox(2)] << Add Ref Line(0, "Dashed");
gbb2[AxisBox(2)] << Min(minval);
gbb2[AxisBox(2)] << Max(maxval);
gbb2[AxisBox(2)] << inc((maxval - minval) / 10);
gbba2 = Report(gb2);
col3 << Append(gbba2);
gb2 << close window;
);
);
results << append(ob = Outline Box(numPar[i], V List Box(col1, H List Box(col2, col3))));
ob << close;
);
Edit (jthi 2024-08-26) : Ajout du formatage JSL
- Menu déroulant interactif: I want to create a dropdown menu that lists the unique batch values (
:Batch column) in my data table.
- Fonctionnalité de mise en évidence : lorsqu'un utilisateur sélectionne un lot dans le menu déroulant, les points correspondants dans le graphique doivent être mis en évidence.
- Intégration dans un journal : Le menu déroulant et le graphique doivent être intégrés dans un journal qui peut être enregistré et partagé.
Certaines parties de ce script ont-elles fonctionné à un moment donné ?
Oui, le script fonctionne:)