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

How to order the x-axis of a Oneway Analyis by another column?

Hey all,

 

I have a typical JSL that makes graphs from a table with X-Y Oneway Analysis that defaults to ordering the X axis alphabetical/numerical. 

 

On my graphs I want the top most value(in the table) to be the furthest to the right on my plots. I have been right clicking then "Edit Value Order" to do this, but I would like to incorporate it in my JSL for my colleagues to be able to use as well. 

 

I went into Scripting help but was lost as to how I would set Row Order Levels in JSL.

 

 

Hobbi_1-1666036801266.png

 

Hobbi_0-1666036779509.png

 

2 REPLIES 2
txnelson
Super User

Re: How to order the x-axis of a Oneway Analyis by another column?

You can see how to set the different Column Properties by setting them interactively, and then using 

     << get Property()

retrieve what is required to use

     << set Property()

to use JSL to assign the values

So I set the order for the lot_id column interactively

txnelson_0-1666040319686.png

I then ran this script to get the structure required for the Value Ordering column property

names default to here(1);
dt=current data table();

orderList = dt:lot_id << get property("Value Order");

show(orderList);

it returned

orderList = {Custom Order({"lot09", "lot08", "lot07", "lot06", "lot05", "lot04", "lot03", "lot02", "lot01", "lot10", "lot11", "lot12", "lot13"}), Common Order(0)};

Therefore, the JSL required to set the Value Order property is

dt:lot_id << set property("Value Order", {Custom Order({"lot09", "lot08", "lot07", 
"lot06", "lot05", "lot04", "lot03", "lot02", 
"lot01", "lot10", "lot11", "lot12", "lot13"}), Common Order(0)});
Jim
ron_horne
Super User (Alumni)

Re: How to order the x-axis of a Oneway Analyis by another column?

Hi @Hobbi ,

@txnelson gave you the exact correct answer.

Yet, the best ordering options for an axis in a graph are available in Graph builder. There, you can order a categorical axis by a variety of summary statistics of other variables. as in the pictures.

 

Let us know if it works in for your application.

111.png222.png