Hallo,
Ich arbeite mit JMP und brauche Hilfe beim Erstellen eines interaktiven Journals. Mein Ziel ist es, eine Funktion einzubauen, mit der Benutzer bestimmte Stapel in einem Diagramm auswählen und hervorheben können. Hier sind die Details des Skripts und was ich erreichen möchte:
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;
);
Bearbeiten (jthi 26.08.2024): JSL-Formatierung hinzugefügt
- Interaktives Dropdown-Menü: I want to create a dropdown menu that lists the unique batch values (
:Batch column) in my data table.
- Hervorhebungsfunktion : Wenn ein Benutzer einen Stapel aus dem Dropdown-Menü auswählt, sollten die entsprechenden Punkte im Diagramm hervorgehoben werden.
- Einbetten in ein Journal : Das Dropdown-Menü und das Diagramm sollten in ein Journal eingebettet werden, das gespeichert und geteilt werden kann.
Haben Teile dieses Skripts irgendwann funktioniert?
Ja, das Skript funktioniert:)