cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
ReneeBay
Level II

Help with adding chart/graphic exporting commands to JSL script: high resolution, vector format

Hello,

 

Is there relatively simple scripting language I can add to my bar chart JSL file as a novice JSL user that will export to a high resolution, vector format...preferably without all the "extra stuff" that comes with the selecting and copy/paste approach I currently use? I paste to Illustrator which works ok, but I still have to do a lot of clean up in Illustrator including (but not limited to) weird things like the left axis tic marks needing to be moved back to their original place after they seem to get "displaced" during the paste phase...?

 

I have a few of these that I need to make so the pasting (or even exporting straight from Graph Builder) is not ideal.

 

If not (or even if so), advice about the best approach to pasting with minimal clean-up would be appreciated!

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ron_horne
Super User (Alumni)

Re: Help with adding chart/graphic exporting commands to JSL script: high resolution, vector format

Hi @ReneeBay 

can this work for you?


// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );


// Launch platform: Distribution
output = Distribution(
	Nominal Distribution( Column( :age ) ),
	Nominal Distribution( Column( :sex ) ),
	Continuous Distribution( Column( :height ) )
);

output << save picture ("C:\Users\Smart\Desktop\output1.svg");

otherwise have a look at the reference in this discussion:
https://community.jmp.com/t5/Discussions/JSL-Saving-picture-in-SVG-format/td-p/253434

let us know if it works for you

 

 

 

View solution in original post

5 REPLIES 5
ron_horne
Super User (Alumni)

Re: Help with adding chart/graphic exporting commands to JSL script: high resolution, vector format

Hi @ReneeBay 

can this work for you?


// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );


// Launch platform: Distribution
output = Distribution(
	Nominal Distribution( Column( :age ) ),
	Nominal Distribution( Column( :sex ) ),
	Continuous Distribution( Column( :height ) )
);

output << save picture ("C:\Users\Smart\Desktop\output1.svg");

otherwise have a look at the reference in this discussion:
https://community.jmp.com/t5/Discussions/JSL-Saving-picture-in-SVG-format/td-p/253434

let us know if it works for you

 

 

 

ReneeBay
Level II

Re: Help with adding chart/graphic exporting commands to JSL script: high resolution, vector format

Thanks and Hello,

 

I guess I accidentally hit "solution", but actually this didn't work for me yet, but I'm not sure I have the syntax perfect. What I have pasted below is a selection of the script with your suggestion at the bottom. I've tried a few iterations of comma and semi-colon, etc...placement but I still don't get a file to export, just Graph Builder opening...Any other suggestions?!

SendToReport(
Dispatch(
{},
"DataYear",
ScaleBox,
{Min( 2009.5 ), Max( 2019.5 ), Inc( 1 ), Minor Ticks( 1 ),
Label Row( {Automatic Font Size( 0 ), Set Font Size( 10 )} )}
),
Dispatch(
{},
"Polychaeta",
ScaleBox,
{Format( "Fixed Dec", Use thousands separator( 1 ), 15, 0 ), Max( 27000 ),
Label Row(
{Automatic Font Size( 0 ), Automatic Tick Marks( 0 ), Show Minor Ticks( 0 ),
Set Font Size( 10 )}
)}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
2,
Properties( 0, {Fill Color(RGB color(255,255,0))} ),
Properties( 1, {Fill Color(RGB color(137,68,68))} ),
Properties( 2, {Fill Color(RGB color(255,115,223) )} ),
Properties( 3, {Fill Color(RGB color(0,77,168))} ),
Properties( 4, {Fill Color(RGB color(169,0,230))} ),
Properties( 5, {Fill Color(RGB color(56,168,0))} ),
Properties( 6, {Fill Color(RGB color(230,0,0))} ),
Properties( 7, {Fill Color(RGB color(255,170,0))} ),
Properties( 8, {Fill Color(RGB color(115,223,255))} ),
Properties( 9, {Fill Color(RGB color(156,156,156))} )
)}
),
Dispatch( {}, "graph title", TextEditBox, {Set Font Size( 14 ), Set Text( "Chirikov" )} ),
Dispatch( {}, "X title", TextEditBox, {Set Font Size( 12 ), Set Text( "Year" )} ),
Dispatch( {}, "Y title", TextEditBox, {Set Font Size( 12 ), Set Text( "Abundance (#/m2)" )} )
)
)
(output << save picture ("P:\JMP\test.pdf"));
);
ron_horne
Super User (Alumni)

Re: Help with adding chart/graphic exporting commands to JSL script: high resolution, vector format

Hi @ReneeBay ,

the script you provide is partial.

try running this script first just to see if it works for you in terms of producing an svg file from the platform you are using.

// Open Data Table: Big Class.jmp
Open( "$SAMPLE_DATA/Big Class.jmp" );

// create a graph 
output = Graph Builder(
	Size( 528, 458 ),
	Show Control Panel( 0 ),
	Fit to Window( "Off" ),
	Variables( X( :weight ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
);

// save output as SVG
output << save picture ("C:\Users\Smart\Desktop\output1.svg");

the key components in this script are giving the graph a name: "output = graph..."

and then saving it using the following command "output<< save picture...."

 

ReneeBay
Level II

Re: Help with adding chart/graphic exporting commands to JSL script: high resolution, vector format

Hello,

 

That script independently did work! I was able to open the SVG in Illustrator, but the chart content wasn't visible, so I tried PDF and that worked. But when I try to add it to my script, I get this error below. I tried putting the output portion of your script in a couple of different places in mine and while that got around the error message, it did not produce a graphic...

 

I have it placed at the end of my script with enough parentheses to not get the error message, but also do not get a graphic...

 

error: "unexpected "output". Perhaps there is a missing "," or ")"

 

Thanks for any continued help!

 

)}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
2,
Properties( 0, {Fill Color(RGB color(255,255,0))} ),
Properties( 1, {Fill Color(RGB color(137,68,68))} ),
Properties( 2, {Fill Color(RGB color(255,115,223) )} ),
Properties( 3, {Fill Color(RGB color(0,77,168))} ),
Properties( 4, {Fill Color(RGB color(169,0,230))} ),
Properties( 5, {Fill Color(RGB color(56,168,0))} ),
Properties( 6, {Fill Color(RGB color(230,0,0))} ),
Properties( 7, {Fill Color(RGB color(255,170,0))} ),
Properties( 8, {Fill Color(RGB color(115,223,255))} ),
Properties( 9, {Fill Color(RGB color(156,156,156))} )
)}
),
Dispatch( {}, "graph title", TextEditBox, {Set Font Size( 14 ), Set Text( "Chirikov" )} ),
Dispatch( {}, "X title", TextEditBox, {Set Font Size( 12 ), Set Text( "Year" )} ),
Dispatch( {}, "Y title", TextEditBox, {Set Font Size( 12 ), Set Text( "Abundance (#/m2)" )}
// save output as PDF
(output << save picture ("P:\Graphics\JMP\test1.pdf"));
)
)
)
);

 

 

txnelson
Super User

Re: Help with adding chart/graphic exporting commands to JSL script: high resolution, vector format

First quick glance, you appear to have dropped a closing ")" after your last Dispatch.

 

It is hard to tell if there are other issues because you did not include all of the platforms statements.

Jim