Graphique fantômeD'accord, je suis perplexe à ce sujet mais je ne trouve pas de conclusion logique. J'espère que quelqu'un pourra au moins expliquer pourquoi je reçois ce que je reçois, même si cela ne répond pas à mes besoins.
dt = Open ();
col_list = dt << get column names(string);
remove from(col_list, 1); // Remove time[sec] from list
cols_to_plot = {};
offset_list = {};
offset_cols = {};
// Define the graph builder commands in an expression for use by the OK button
graph_expr = expr(
for (i = 1, i <= nitems(cols_to_plot), i++,
new_name = cols_to_plot[i] || "-Chemical Cal";
insertinto(offset_cols, new_name);
dt << new column(new_name, Numeric, "Continuous", Format( "Best", 12 ),
Formula( as column(dt, cols_to_plot[i]) * offset_list[i] ) );
);
// Now for the graph - build a text string and then execute it
gb_text = "\[gb = graph builder(
show control panel(0),
variables(
X( :Name( "Time[sec]" ) ),]\";
elements_txt = " ),
Elements( Line( X, ";
For( i = 1, i <= N Items( cols_to_plot ), i++,
If( i == 1,
// then
gb_text = gb_text || Eval Insert( "\!N\[ Y( :Name( "^offset_cols[i]^" ) ), ]\" )
,
// else
gb_text = gb_text || Eval Insert( "\!N\[ Y( :Name( "^offset_cols[i]^" ), Position( 1 ) ),]\" )
);
elements_txt = elements_txt || Eval Insert( "Y ( ^i^ ), " );
);
elements_txt = elements_txt ||
"Legend( 7 ) ),
Points( X, ";
For( i = 1, i <= N Items( cols_to_plot ), i++,
If( i == 1,
// then
gb_text = gb_text || Eval Insert( "\!N\[ Y( :Name( "^offset_cols[i]^" ) ), ]\" )
,
// else
gb_text = gb_text || Eval Insert( "\!N\[ Y( :Name( "^offset_cols[i]^" ), Position( 1 ) ),]\" )
);
elements_txt = elements_txt || Eval Insert( "Y ( ^i^ ), " );
);
elements_txt = elements_txt ||
"Legend(8)))";
gb_text = gb_text || elements_txt || "); ";
Eval( Parse( gb_text ) );
);
nw = new window("Graph Chemicals",
panel box("Select channels to graph",
lineup box(ncol(2),
text box("Column"), text box("Chemical Cal"),
cb1 = checkbox("Ch1"), ch1_neb = number edit box(),
cb2 = checkbox("Ch2"), ch2_neb = number edit box(),
cb3 = checkbox("Ch3"), ch3_neb = number edit box(),
cb4 = checkbox("Ch4"), ch4_neb = number edit box(),
cb5 = checkbox("Ch5"), ch5_neb = number edit box(),
cb6 = checkbox("Ch6"), ch6_neb = number edit box(),
cb7 = checkbox("Ch7"), ch7_neb = number edit box(),
cb8 = checkbox("Ch8"), ch8_neb = number edit box(),
cb9 = checkbox("Ch9"), ch9_neb = number edit box(),
),
),
panelbox("Actions",
hlistbox(
okb = button box("OK",
if (cb1 << get(1),
insertinto(cols_to_plot, col_list[8]);
offset_value = ch1_neb << get;
insertinto(offset_list, offset_value);
);
if (cb2 << get(1),
insertinto(cols_to_plot, col_list[9]);
offset_value = ch2_neb << get;
insertinto(offset_list, offset_value);
);
if (cb3 << get(1),
insertinto(cols_to_plot, col_list[10]);
offset_value = ch3_neb << get;
insertinto(offset_list, offset_value);
);
if (cb4 << get(1),
insertinto(cols_to_plot, col_list[11]);
offset_value = ch4_neb << get;
insertinto(offset_list, offset_value);
);
if (cb5 << get(1),
insertinto(cols_to_plot, col_list[12]);
offset_value = ch5_neb << get;
insertinto(offset_list, offset_value);
);
if (cb6 << get(1),
insertinto(cols_to_plot, col_list[13]);
offset_value = ch6_neb << get;
insertinto(offset_list, offset_value);
);
if (cb7 << get(1),
insertinto(cols_to_plot, col_list[14]);
offset_value = ch7_neb << get;
insertinto(offset_list, offset_value);
);
if (cb8 << get(1),
insertinto(cols_to_plot, col_list[15]);
offset_value = ch8_neb << get;
insertinto(offset_list, offset_value);
);
graph_expr;
nw << close window;
),
canb = button box("Cancel", nw << close window;
),
)
),
);
// Pre-check checkboxes if column exists
for (i = 1, i <= nitems(col_list), i++,
if (col_list[i] == "Ch1", cb1 << set(1, 1),
col_list[i] == "Ch2", cb2 << set(1, 1),
col_list[i] == "Ch3", cb3 << set(1, 1),
col_list[i] == "Ch4", cb4 << set(1, 1),
col_list[i] == "Ch5", cb5 << set(1, 1),
col_list[i] == "Ch6", cb6 << set(1, 1),
col_list[i] == "Ch7", cb7 << set(1, 1),
col_list[i] == "Ch8", cb8 << set(1, 1),
col_list[i] == "Ch9", cb9 << set(1, 1),
);
);Le script est ceci, le but est de créer un seul graphique affichant les lignes et les points pouvant utiliser quel que soit le nombre de colonnes que je sélectionne dans la fenêtre (modifié par le facteur d'étalonnage chimique), ce script le fait, et pour une raison quelconque, je suis aussi obtenir un graphe lisse erroné, avec des points, pour lesquels je ne trouve aucune explication. Je ne peux que supposer que cela est dû à la duplication du script variable, mais je ne sais pas comment l'éliminer ou l'adapter et obtenir les résultats souhaités.

Voici à quoi ressemble le graphe non désiré, et voici ce que le script indique devrait être tracé après que j'ai exécuté le script

Je ne trouve nulle part dans le script qui explique comment ce script fluide est généré, mais le voilà. J'ai essayé d'ajouter une troisième ligne pour un graphe lisse pour voir s'il supprimait ou écrasait le graphe indésirable sans succès, et j'essayais d'écrire également les définitions de la légende suivante, sans succès, puisqu'il ne figurait pas dans le script. le script ne le reconnaîtra pas.
Quoi qu'il en soit, j'espère que quelqu'un aura une idée, merci d'avance pour votre aide!
Re: Ghost Graphdt = Open ();
col_list = dt << get column names(string);
remove from(col_list, 1); // Remove time[sec] from list
cols_to_plot = {};
offset_list = {};
offset_cols = {};
// Define the graph builder commands in an expression for use by the OK button
graph_expr = expr(
for (i = 1, i <= nitems(cols_to_plot), i++,
new_name = cols_to_plot[i] || "-Chemical Cal";
insertinto(offset_cols, new_name);
dt << new column(new_name, Numeric, "Continuous", Format( "Best", 12 ),
Formula( as column(dt, cols_to_plot[i]) * offset_list[i] ) );
);
// Now for the graph - build a text string and then execute it
gb_text = "\[gb = graph builder(
show control panel(0),
variables(
X( :Name( "Time[sec]" ) ),]\";
elements_txt = " ),
Elements( Line( X, ";
For( i = 1, i <= N Items( cols_to_plot ), i++,
If( i == 1,
// then
gb_text = gb_text || Eval Insert( "\!N\[ Y( :Name( "^offset_cols[i]^" ) ), ]\" )
,
// else
gb_text = gb_text || Eval Insert( "\!N\[ Y( :Name( "^offset_cols[i]^" ), Position( 1 ) ),]\" )
);
elements_txt = elements_txt || Eval Insert( "Y ( ^i^ ), " );
);
elements_txt = elements_txt ||
"Legend( 7 ) ),
Points( X, ";
For( i = 1, i <= N Items( cols_to_plot ), i++,
elements_txt = elements_txt || Eval Insert( "Y ( ^i^ ), " );
);
elements_txt = elements_txt ||
"Legend(8)))";
gb_text = gb_text || elements_txt || "); ";
Eval( Parse( gb_text ) );
);
nw = new window("Graph Chemicals",
panel box("Select channels to graph",
lineup box(ncol(2),
text box("Column"), text box("Chemical Cal"),
cb1 = checkbox("Ch1"), ch1_neb = number edit box(),
cb2 = checkbox("Ch2"), ch2_neb = number edit box(),
cb3 = checkbox("Ch3"), ch3_neb = number edit box(),
cb4 = checkbox("Ch4"), ch4_neb = number edit box(),
cb5 = checkbox("Ch5"), ch5_neb = number edit box(),
cb6 = checkbox("Ch6"), ch6_neb = number edit box(),
cb7 = checkbox("Ch7"), ch7_neb = number edit box(),
cb8 = checkbox("Ch8"), ch8_neb = number edit box(),
cb9 = checkbox("Ch9"), ch9_neb = number edit box(),
),
),
panelbox("Actions",
hlistbox(
okb = button box("OK",
if (cb1 << get(1),
insertinto(cols_to_plot, col_list[8]);
offset_value = ch1_neb << get;
insertinto(offset_list, offset_value);
);
if (cb2 << get(1),
insertinto(cols_to_plot, col_list[9]);
offset_value = ch2_neb << get;
insertinto(offset_list, offset_value);
);
if (cb3 << get(1),
insertinto(cols_to_plot, col_list[10]);
offset_value = ch3_neb << get;
insertinto(offset_list, offset_value);
);
if (cb4 << get(1),
insertinto(cols_to_plot, col_list[11]);
offset_value = ch4_neb << get;
insertinto(offset_list, offset_value);
);
if (cb5 << get(1),
insertinto(cols_to_plot, col_list[12]);
offset_value = ch5_neb << get;
insertinto(offset_list, offset_value);
);
if (cb6 << get(1),
insertinto(cols_to_plot, col_list[13]);
offset_value = ch6_neb << get;
insertinto(offset_list, offset_value);
);
if (cb7 << get(1),
insertinto(cols_to_plot, col_list[14]);
offset_value = ch7_neb << get;
insertinto(offset_list, offset_value);
);
if (cb8 << get(1),
insertinto(cols_to_plot, col_list[15]);
offset_value = ch8_neb << get;
insertinto(offset_list, offset_value);
);
graph_expr;
nw << close window;
),
canb = button box("Cancel", nw << close window;
),
)
),
);
// Pre-check checkboxes if column exists
for (i = 1, i <= nitems(col_list), i++,
if (col_list[i] == "Ch1", cb1 << set(1, 1),
col_list[i] == "Ch2", cb2 << set(1, 1),
col_list[i] == "Ch3", cb3 << set(1, 1),
col_list[i] == "Ch4", cb4 << set(1, 1),
col_list[i] == "Ch5", cb5 << set(1, 1),
col_list[i] == "Ch6", cb6 << set(1, 1),
col_list[i] == "Ch7", cb7 << set(1, 1),
col_list[i] == "Ch8", cb8 << set(1, 1),
col_list[i] == "Ch9", cb9 << set(1, 1),
);
);C'est un miracle, mais cela fonctionne, je savais que cela avait quelque chose à voir avec la redondance, mais je ne pouvais pas trouver comment supprimer un segment sans le casser, le comprendre enfin! Maintenant, si seulement je pouvais le faire pour ajuster la taille du point afin qu'il soit juste une ligne XD
Re: Ghost GraphGraph Builder(
Show Control Panel( 0 ),
Variables(
X( :Name( "Time[sec]" ) ),
Y( :Name( "CH2-Chemical Cal" ) ),
Y( :Name( "CH5-Chemical Cal" ), Position( 1 ) ),
Y( :Name( "CH6-Chemical Cal" ), Position( 1 ) ),
Y( :Name( "CH5-Chemical Cal" ), Position( 1 ) ),
Y( :Name( "CH6-Chemical Cal" ), Position( 1 ) )
),
Elements(
Line( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 7 ) ),
Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 8 ) )
),
SendToReport( Dispatch( {}, "Graph Builder", FrameBox, {Marker Size( 0 )} ) )
);
Il est intéressant de noter qu'après avoir supprimé le graphe erroné, le premier canal (qui se duplique) n'a qu'une variable Y alors que les deux autres le sont toujours, mais ne créent pas le graphe erroné. le graphique a pour but de pouvoir créer le nombre de lignes dont j'ai besoin, avec la possibilité de sélectionner le segment de crête du graphique pour faciliter l'identification de la valeur de crête, tout en conservant l'aspect de la ligne, car il est plus facile d'afficher le nombre souhaité. apparence. Puisque line ne vous permet pas de sélectionner un point sur la ligne, des points sont nécessaires pour cette fonctionnalité, mais non nécessaire sur le plan visuel.
Désolé pour le retard, les vacances de Thanksgiving ont été longues, j'espère que le tien a été agréable ^. ^
Re: Ghost GraphDamion,
Veuillez mettre à jour la publication avec le code du générateur de graphique correspondant au graphique souhaité. Depuis que vous avez créé la colonne, faites-le avec pointer et cliquer (l'interface graphique).
J'ai l'impression que tu veux quelque chose comme ça
Graph Builder(
Show Control Panel( 0 ),
Variables(
X( :Name( "Time[sec]" ) ),
Y( :Name( "CH2" ) ),
Y( :Name( "CH2-Chemical Cal" ), Position(1) )
),
Elements(
Position( 1, 1 ),
Line( X, Y(1), Y(2) Legend( 7 ) ),
Points( X, Y(1), Y(2) Legend( 8 ) ) //maybe remove Y(2) from points?
),
);
Cela recouvrirait les deux courbes. Je devine juste ??
Re: Ghost GraphJe suppose que cela fait partie du problème, mais si j’exécute exactement le même script avec un seul graphe (qu’il s’agisse de points ou de lignes), il ne crée pas le graphe supplémentaire.
dt = Open ();
col_list = dt << get column names(string);
remove from(col_list, 1); // Remove time[sec] from list
cols_to_plot = {};
offset_list = {};
offset_cols = {};
// Define the graph builder commands in an expression for use by the OK button
graph_expr = expr(
for (i = 1, i <= nitems(cols_to_plot), i++,
new_name = cols_to_plot[i] || "-Chemical Cal";
insertinto(offset_cols, new_name);
dt << new column(new_name, Numeric, "Continuous", Format( "Best", 12 ),
Formula( as column(dt, cols_to_plot[i]) * offset_list[i] ) );
);
// Now for the graph - build a text string and then execute it
gb_text = "\[gb = graph builder(
show control panel(0),
variables(
X( :Name( "Time[sec]" ) ),]\";
elements_txt = " ),
Elements( Line( X, ";
For( i = 1, i <= N Items( cols_to_plot ), i++,
If( i == 1,
// then
gb_text = gb_text || Eval Insert( "\!N\[ Y( :Name( "^offset_cols[i]^" ) ), ]\" )
,
// else
gb_text = gb_text || Eval Insert( "\!N\[ Y( :Name( "^offset_cols[i]^" ), Position( 1 ) ),]\" )
);
elements_txt = elements_txt || Eval Insert( "Y ( ^i^ ), " );
);
// add in the marker and transparency code
elements_txt = elements_txt ||
"Legend( 7 ) ), Points( X, Y, Legend(8))),
SendToReport(
Dispatch(
{},
\!"400\!",
ScaleBox,
{Legend Model(
8,
Properties( 0, {Marker Size( 0 ), Transparency( 0 )}, Item ID( \!""
|| offset_cols[1] || "\!", 1 ) )
)}
)
)";
gb_text = gb_text || elements_txt || "); ";
Eval( Parse( gb_text ) );
);
nw = new window("Graph Chemicals",
panel box("Select channels to graph",
lineup box(ncol(2),
text box("Column"), text box("Chemical Cal"),
cb1 = checkbox("Ch1"), ch1_neb = number edit box(),
cb2 = checkbox("Ch2"), ch2_neb = number edit box(),
cb3 = checkbox("Ch3"), ch3_neb = number edit box(),
cb4 = checkbox("Ch4"), ch4_neb = number edit box(),
cb5 = checkbox("Ch5"), ch5_neb = number edit box(),
cb6 = checkbox("Ch6"), ch6_neb = number edit box(),
cb7 = checkbox("Ch7"), ch7_neb = number edit box(),
cb8 = checkbox("Ch8"), ch8_neb = number edit box(),
cb9 = checkbox("Ch9"), ch9_neb = number edit box(),
),
),
panelbox("Actions",
hlistbox(
okb = button box("OK",
if (cb1 << get(1),
insertinto(cols_to_plot, col_list[8]);
offset_value = ch1_neb << get;
insertinto(offset_list, offset_value);
);
if (cb2 << get(1),
insertinto(cols_to_plot, col_list[9]);
offset_value = ch2_neb << get;
insertinto(offset_list, offset_value);
);
if (cb3 << get(1),
insertinto(cols_to_plot, col_list[10]);
offset_value = ch3_neb << get;
insertinto(offset_list, offset_value);
);
if (cb4 << get(1),
insertinto(cols_to_plot, col_list[11]);
offset_value = ch4_neb << get;
insertinto(offset_list, offset_value);
);
if (cb5 << get(1),
insertinto(cols_to_plot, col_list[12]);
offset_value = ch5_neb << get;
insertinto(offset_list, offset_value);
);
if (cb6 << get(1),
insertinto(cols_to_plot, col_list[13]);
offset_value = ch6_neb << get;
insertinto(offset_list, offset_value);
);
if (cb7 << get(1),
insertinto(cols_to_plot, col_list[14]);
offset_value = ch7_neb << get;
insertinto(offset_list, offset_value);
);
if (cb8 << get(1),
insertinto(cols_to_plot, col_list[15]);
offset_value = ch8_neb << get;
insertinto(offset_list, offset_value);
);
graph_expr;
nw << close window;
),
canb = button box("Cancel", nw << close window;
),
)
),
);
// Pre-check checkboxes if column exists
for (i = 1, i <= nitems(col_list), i++,
if (col_list[i] == "Ch1", cb1 << set(1, 1),
col_list[i] == "Ch2", cb2 << set(1, 1),
col_list[i] == "Ch3", cb3 << set(1, 1),
col_list[i] == "Ch4", cb4 << set(1, 1),
col_list[i] == "Ch5", cb5 << set(1, 1),
col_list[i] == "Ch6", cb6 << set(1, 1),
col_list[i] == "Ch7", cb7 << set(1, 1),
col_list[i] == "Ch8", cb8 << set(1, 1),
col_list[i] == "Ch9", cb9 << set(1, 1),
);
);et cela ne devrait vraiment pas générer un Y supplémentaire, c'est un if alors sinon, donc un seul de ceux-ci devrait être généré, mais je pense que c'est parce que j'ai dupliqué le if alors pour le placer dans le deuxième graphique et cela crée ce fantôme, qui Je pense est pris en charge lorsque vous regardez le script généré à partir de cette version
Graph Builder(
Show Control Panel( 0 ),
Variables(
X( :Name( "Time[sec]" ) ),
Y( :Name( "CH2-Chemical Cal" ) ),
Y( :Name( "CH2-Chemical Cal" ) )
),
Elements(
Position( 1, 1 ),
Line( X, Y, Legend( 7 ) ),
Points( X, Y, Legend( 8 ) )
),
Elements(
Position( 1, 2 ),
Points( X, Y, Legend( 9 ) ),
Smoother( X, Y, Legend( 10 ) )
)
);
parce que cela ajoute non seulement le lisseur et le second graphique, mais aussi un second graphe de points avec le lisseur
J'ai essayé d'enlever le
|| Eval Insert ( "Y (^ i ^)," )
après les éléments dans le script et il l'a fondamentalement transformé en une ligne verticale (et produit toujours le graphique de lissage et de points, comme par magie)
Re: Ghost GraphIl semble que vous ayez du code dupliqué (un copier-coller supplémentaire?) Pour les noms inutiles. Vous avez besoin des deux éléments, mais le nom Y une fois. Le nom dupliqué dessine à nouveau Y (1) et l'élément par défaut est l'élément le plus lisse.
Ci-dessous est de BigClass. La prochaine JSL est le code en double de votre script.
Graph Builder(
Size( 528, 454 ),
Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 3 ) ), Line( X, Y, Legend( 5 ) ) )
)
For( i = 1, i <= N Items( cols_to_plot ), i++,
If( i == 1,
// then
gb_text = gb_text || Eval Insert( "\!N\[ Y( :Name( "^offset_cols[i]^" ) ), ]\" )
,
// else
gb_text = gb_text || Eval Insert( "\!N\[ Y( :Name( "^offset_cols[i]^" ), Position( 1 ) ),]\" )
);
elements_txt = elements_txt || Eval Insert( "Y ( ^i^ ), " );
);