BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
DamionSparhawk

Contributor

Joined:

Jul 13, 2018

Ghost Graph

Okay, I've puzzled through this but not finding a logical conclusion, hopefully someone out there can at least explain why I'm getting what I'm getting, even if it doesn't solve my needs.

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),
	);
);

Script is this, purpose is to create a single graph displaying both line and points which can utalize whatever number of columns I select in the window (modified by the chemical calibration factor) this script does that, and yet for whatever reason I'm also getting an erroneous smooth graph, with points, which I can find no explanation for. I can only assume it's due to the duplication of the variable script, but I don't know how to eliminate or tailor that and get the results I want.

 

smoother.PNG

 

This is what the undesired graph looks like, and here's what the script shows should be graphed after I run the script

nosmooth.png

I cannot find anywhere on the script that explains how that smooth script is being generated, but there it is. I tried to add in a third line for a smooth graph to see if it would remove or overwrite the unwanted graph without success, and tried to write in definitions for the next legend also with no success, since it isn't in the script the script won't recognize it.

Anyway, hopefully someone will have an idea, thanks in advance for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
DamionSparhawk

Contributor

Joined:

Jul 13, 2018

Solution

Re: Ghost Graph

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++,
		
		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),
	);
);

It's a miracle, but it works, I knew it had something to do with the redundancy but I couldn't figure out how to remove a segment without breaking it, finally figured it out! Now if only I can get it to adjust the dot size so it's just a line XD

 

5 REPLIES 5
gzmorgan0

Super User

Joined:

Jul 25, 2016

Re: Ghost Graph

It appears you have duplicated code ( an extra copy paste?) for the names that is not necessary.  You need the two elements, but the Y name once.  The duplicated name is drawing Y(1) again and the default is the smoother element

 

Below is from BigClass. The next JSL is the duplicate code from your 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^ ), " );
	);
DamionSparhawk

Contributor

Joined:

Jul 13, 2018

Re: Ghost Graph

I suspect that is part of the problem, but if I run the exact same script with just the single graph (whether points or line doesn't matter) it doesn't create the additional graph.

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),
	);
);

and it really shouldn't be generating an extra Y, it's an if then else, so only one of those should be generated, but I think it's because I duplicated the if then to put in the second graph and it's creating this ghost, which I think is supported when you look at the generated script from that build

 

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 ) )
	)
);

because it's adding not just the smoother and the second graph, but also a second points graph with the smoother

 

 

I tried removing the

|| Eval Insert( "Y ( ^i^ ), " )

from after the elements in the script and it basically turned it into a vertical line (and still produced the smoother and points graph, magically)

gzmorgan0

Super User

Joined:

Jul 25, 2016

Re: Ghost Graph

Damion,

Please update the post with the graph builder code for the graph you want. Since you have created the column, do it with point and click (the GUI).

 

From your email I am getting teh impression you want something like this

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?
	),
);

This would overlay the two curves. I am just guessing??

DamionSparhawk

Contributor

Joined:

Jul 13, 2018

Re: Ghost Graph

Graph 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 )} ) )
);

ideal graph.PNG

 

Interestingly after I remove the erroneous graph, the first channel (which is getting duplicated) only has one Y variable while the other two still do, but do not create the erroneous graph. the purpose of the graph is to be able to create however many lines I need with the ability to select the peak segment of the graph for ease of identifying the peak value, while having the line appearance, since that is the easiest to view the desired appearance. Since line does not allow you to select a point on the line, points are required for that functionality, but visually uneccessary.

 

Sorry for the delay, Thanksgiving holiday was lengthy, I hope yours was pleasant ^.^

Highlighted
DamionSparhawk

Contributor

Joined:

Jul 13, 2018

Solution

Re: Ghost Graph

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++,
		
		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),
	);
);

It's a miracle, but it works, I knew it had something to do with the redundancy but I couldn't figure out how to remove a segment without breaking it, finally figured it out! Now if only I can get it to adjust the dot size so it's just a line XD