Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
Level IV

## How to revere order in axis of graph builder in JSL ?

Hello,

I am creating a heatmap with Graph builder.

I try to find a way to reverse the order of the axis by scripting but I cannot (although in the GUI, it is straight forward).

What I have so far is:

And I want it to be:

Thanks a lot.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User

## Re: How to revere order in axis of graph builder in JSL ?

Send the message directly to the Axisbox.

gb = Graph Builder(Variables(X(:Column), Y(:Row), Color(:Value)), Elements(Heatmap(X, Y, Legend(7))));

Report(gb)[Axisbox(1)] << {Min(0), Max(9), Inc(1)};

Report(gb)[Axisbox(2)] << {Min(0), Max(15), Inc(1), reversed scale};

6 REPLIES 6
Highlighted
Super User

## Re: How to revere order in axis of graph builder in JSL ?

Send the message directly to the Axisbox.

gb = Graph Builder(Variables(X(:Column), Y(:Row), Color(:Value)), Elements(Heatmap(X, Y, Legend(7))));

Report(gb)[Axisbox(1)] << {Min(0), Max(9), Inc(1)};

Report(gb)[Axisbox(2)] << {Min(0), Max(15), Inc(1), reversed scale};

Highlighted
Level IV

## Re: How to revere order in axis of graph builder in JSL ?

Magic ! it works !

Do you know to which object I can send a message to change the gradient Label levels and properties ?

{Label Levels( [620 640 660 680 700 725 750 775 800] ),

Thanks

Highlighted
Level II

## Re: How to revere order in axis of graph builder in JSL ?

Hi, you can do this:

gb<<SendToReport(

Dispatch({},

"400",

ScaleBox,

{Legend Model(

1,

Properties(

0,

{Label Levels( [620 640 660 680 700 725 750 775 800] ),

)}

)

)}

)

);

Cheers

Highlighted
Super User

## Re: How to revere order in axis of graph builder in JSL ?

That seems to be more intricate. I would copy portions of the generated code from a manually designed graph.

This should work:

gb << Dispatch(

{},

"400",

ScaleBox,

{Legend Model(

5,

Properties(

0,

{gradient({Scale Values([620 640 660 680 700 725 750 775 800]), Reverse Labels(1)})}

)

)}

);

Highlighted
Level IV

## Re: How to revere order in axis of graph builder in JSL ?

That's what I do so far, but it is not very elegant .

Highlighted
Level II

## Re: How to revere order in axis of graph builder in JSL ?

Well, to be consistent with the solution MS gave you about AxisBox, it should be something like:

Report(gb)[legend box(1)]<< {Label Levels( [620 640 660 680 700 725 750 775 800] ), Reverse Gradient( 1 ) }

but it doesn't work, and if you run

show properties(Report(gb)[legend box(1)])

you'll see that you have far less possibilities compared to

show properties(Report(gb)[axis box(1)])

Sorry I can't help more...

Article Labels

There are no labels assigned to this post.