Subscribe Bookmark RSS Feed

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

samir

Community Trekker

Joined:

May 20, 2016

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

Please see script attached.

What I have so far is:

11865_pastedImage_0.png

And I want it to be:

11866_pastedImage_1.png

Thanks a lot.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

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
Solution

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

samir

Community Trekker

Joined:

May 20, 2016

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

Reverse Gradient( 1 )}

Thanks

heloiseheraud

Community Trekker

Joined:

Feb 14, 2016

Hi, you can do this:

gb<<SendToReport(

            Dispatch({},

                "400",

                ScaleBox,

                {Legend Model(

                      1,

                      Properties(

                          0,

                          {gradient(

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

                                          Reverse Gradient( 1 ) }

                            )}

                      )

                )}

         )

);

Cheers

ms

Super User

Joined:

Jun 23, 2011

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

        )

    )}

);

samir

Community Trekker

Joined:

May 20, 2016

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

heloiseheraud

Community Trekker

Joined:

Feb 14, 2016

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...