cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
HV0508
Level III

Line turns to smoother when created from JSL script.

Can anyone help me identify what am I doing wrong here 

Graph Builder(
	Size(984, 563),
	Show Control Panel(1),
	Variables(X(:X), Y(As Column(Y))),
	Elements(Line(X, Y, Legend(3), Connection("Curve")), Points(X, Y, Legend(4)))
)


My line turns to a smoother , I want it to touch all the points with a curve connection . I created the chart from console of JMP and it worked fine , I even copied the JSL from the session script but turns out whenever I run it through JSL it gives me a smoother .


I have one more question - The smoother gets drawn on continuous Numeric column . I though maybe changing it to nominal might have some impact and it did not get created at all(no line nor the smoother) . Does line not work on nominal type Numeric column ? 

12 REPLIES 12
jthi
Super User

Re: Line turns to smoother when created from JSL script.

You are using Curve connection and not Line so that gives you smoothing. Also it might not be able to connect all the points if there are many values for same X-axis values unless you enable Row order.

Without row order

jthi_0-1740667748906.png

With row order (I did sort the data by weight first)

jthi_1-1740667774919.png

 

-Jarmo
HV0508
Level III

Re: Line turns to smoother when created from JSL script.


This is what I achieve when using code - .

HV0508_5-1740668168720.png

 


HV0508_0-1740667945239.png

 

But when manually I add a line



HV0508_1-1740667991275.png

Next - I change the connection to curve

 

HV0508_2-1740668030076.pngHV0508_3-1740668046105.png

HV0508_4-1740668132774.png

 



I achieve what I desire . A curve touching all of my points .


So how can I achieve this via my code?

 

jthi
Super User

Re: Line turns to smoother when created from JSL script.

Smoother (with points) is the default for some column selections, that could be the reason why JMP is using it for your graph. How does JMP created script look like if you get it from the smoother version?

 

For me this seems work ok.

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(7),
	Compress File When Saved(1),
	New Column("Column 1", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 4, 5, 6, 7])),
	New Column("Column 2", Numeric, "Continuous", Format("Best", 12), Set Values([100, 89, 60, 50, 40, 20, 10]))
);

gb = dt << Graph Builder(
	Size(528, 454),
	Show Control Panel(0),
	Variables(X(:Column 1), Y(:Column 2)),
	Elements(Points(X, Y, Legend(3)), Line(X, Y, Legend(6), Connection("Curve")))
);

jthi_0-1740668430283.png

-Jarmo
HV0508
Level III

Re: Line turns to smoother when created from JSL script.

This doesn't work for me . 
I tried it again . 
I did not create a smoother manually . I created Line and added points to it and changed it to curve. Copied the script (same as the one in description) . But the same script is creating smoother not Line.

Q- When you run your script, what do you see on the control panel on the left side Points and Line? or Points and Smoother? For me , I see points and smoother on running my Line script.
Can you try adding more points to your code little in zigzag form and then run your script ? 

jthi
Super User

Re: Line turns to smoother when created from JSL script.

Which JMP version are you running? I'm running 18.1.2. Did you try running my script? Can you provide your data table?

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(10),
	Compress File When Saved(1),
	New Column("Column 1", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])),
	New Column("Column 2", Numeric, "Continuous", Format("Best", 12), Set Values([100, 80, 90, 60, 70, 40, 30, 35, 20, 10]))
);

gb = dt << Graph Builder(
	Variables(X(:Column 1), Y(:Column 2)),
	Elements(Points(X, Y, Legend(3)), Line(X, Y, Legend(6), Connection("Curve")))
);

jthi_0-1740670344995.png

 

-Jarmo
HV0508
Level III

Re: Line turns to smoother when created from JSL script.

My JMP version is 

HV0508_0-1740670971504.png


I have renamed the columns , and also deleted the other columns except my X and Y . Check if this works for you .

jthi
Super User

Re: Line turns to smoother when created from JSL script.

Seems fine?

jthi_0-1740671612136.png

 

Names Default To Here(1);

dt = Open("$DOWNLOADS/data_jmp.jmp");

gb = dt << Graph Builder(
	Variables(X(:X), Y(:Y)),
	Elements(Line(X, Y, Legend(5), Connection("Curve")), Points(X, Y, Legend(6)))
);
-Jarmo
HV0508
Level III

Re: Line turns to smoother when created from JSL script.

Yeah same is working for me individually  , why is it not working from a loop . What is wrong . Can you check this script once - 

createDashboard = Function({dtMaxF, dtMaxR, normMeanColsF, normMeanColsR, direction}, 
 
	New Window(direction || " Dashboard",
		Tab Box(
			"Maximum Values",
			V List Box(
				For(i = 1, i <= N Items(normalizedColumns), i++,
					Graph Builder(
						Size(984, 563),
						Show Control Panel(1),
						Variables(X(:X), Y(As Column(normalizedColumns[i]))),
						Elements(
							Line(X, Y, Legend(5), Connection("Curve")),
							Points(X, Y, Legend(6))
						)
					)
				)
			),
			"Normalized Average Values",
			V List Box(
				For(i = 1, i <= N Items(normMeanColsF), i++,
					Graph Builder(
						Size(984, 563),
						Show Control Panel(1),
						Variables(X(:X), Y(As Column(normMeanColsF[i]))),
						Elements(
							Line(X, Y, Legend(5), Connection("Curve")),
							Points(X, Y, Legend(6))
						)
					)
				),
				For(i = 1, i <= N Items(normMeanColsR), i++,
					Graph Builder(
						Size(984, 563),
						Show Control Panel(1),
						Variables(X(:X), Y(As Column(normMeanColsR[i]))),
						Elements(
							Line(X, Y, Legend(5), Connection("Curve")),
							Points(X, Y, Legend(6))
						)
					)
				)
			)
		)
	)
);
 
 
createDashboard(
	dtMaxForward, dtMaxReverse, normalizedMeanColumns, normalizedMeanColumns, "Analysis"
);
jthi
Super User

Re: Line turns to smoother when created from JSL script.

What at dtMaxF, dtMaxR used for in the function? Where is normalizedColumns coming from to the function?

-Jarmo

Recommended Articles