- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How can I annotate the background with different colors across different Y-axes?
The following JSL can annotate the region of 100 to 120 on the X-axis with a different color, but it cannot span across different Y-axes. How can I modify it to annotate different variable on Y-axes with different background colors for different variables?
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Variables(X(:weight), Y(:height),Y(:age)),
Elements(Points(X, Y, Legend(3))),
SendToReport(
Dispatch(
{},
"weight",
ScaleBox,
{Add Ref Line(100, "Solid", "blue", "", 5),
Add Ref Line(120, "Solid", "blue", "", 5)}
)
)
);
rep = gb << report;
framebox = rep[frame box(1)];
framebox << Add Graphics Script(
Transparency(0.5);
Fill Color("Gray");
Rect(100, Y Origin() + Y Range(), 120, Y Origin() , 1)
);
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I annotate the background with different colors across different Y-axes?
You have multiple FrameBoxes when you have multiple axis (or groups or wraps or pages), so you can for example add separate graphic script to each of them. Simplified version below
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Variables(X(:weight), Y(:height), Y(:age)),
Elements(Points(X, Y, Legend(3)))
);
rep = gb << report;
fbs = rep << XPath("//FrameBox");
fbs[1] << Add Graphics Script(
Transparency(0.5);
Fill Color("Gray");
Rect(100, Y Origin() + Y Range(), 120, Y Origin(), 1);
);
fbs[2] << Add Graphics Script(
Transparency(0.5);
Fill Color("Green");
Rect(100, Y Origin() + Y Range(), 120, Y Origin(), 1);
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I annotate the background with different colors across different Y-axes?
If I remember correctly... (currently) easiest method is to read it from the data table using Summary table or Summarize.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I annotate the background with different colors across different Y-axes?
You have multiple FrameBoxes when you have multiple axis (or groups or wraps or pages), so you can for example add separate graphic script to each of them. Simplified version below
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Variables(X(:weight), Y(:height), Y(:age)),
Elements(Points(X, Y, Legend(3)))
);
rep = gb << report;
fbs = rep << XPath("//FrameBox");
fbs[1] << Add Graphics Script(
Transparency(0.5);
Fill Color("Gray");
Rect(100, Y Origin() + Y Range(), 120, Y Origin(), 1);
);
fbs[2] << Add Graphics Script(
Transparency(0.5);
Fill Color("Green");
Rect(100, Y Origin() + Y Range(), 120, Y Origin(), 1);
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I annotate the background with different colors across different Y-axes?
Additional Question: How can I draw a color box if the X-axis is of data type "text"?
For example, I want to mark the range from TIM to JOE with a specific color.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Variables(X(:name), Y(:height), Y(:age)),
Elements(Points(X, Y, Legend(3)))
);
rep = gb << report;
fbs = rep << XPath("//FrameBox");
fbs[1] << Add Graphics Script(
Transparency(0.5);
Fill Color("Gray");
Rect("TIM", Y Origin() + Y Range(), "JOE", Y Origin(), 1);
);
fbs[2] << Add Graphics Script(
Transparency(0.5);
Fill Color("Green");
Rect("TIM", Y Origin() + Y Range(), "JOE", Y Origin(), 1);
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I annotate the background with different colors across different Y-axes?
You have to figure out the correct x-axis values and then utilize those
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Variables(X(:name), Y(:height), Y(:age)),
Elements(Points(X, Y, Legend(3)))
);
rep = gb << report;
fbs = rep << XPath("//FrameBox");
fbs[1] << Add Graphics Script(
Transparency(0.5);
Fill Color("Gray");
Rect(17, Y Origin() + Y Range(), 37, Y Origin(), 1);
);
fbs[2] << Add Graphics Script(
Transparency(0.5);
Fill Color("Green");
Rect(17, Y Origin() + Y Range(), 37, Y Origin(), 1);
);
This can be easy or sometimes very difficult, but you can get the idea by checking X-axis settings and labels
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I annotate the background with different colors across different Y-axes?
How can I use JSL to read the mapping of LABEL and VALUE in the current X-axis? I can't find a method to read the LABEL and corresponding VALUE on the current X-axis.
I would like to use MATCH on the text label to obtain the VALUE, and then highlight the specific range of values with a colored box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I annotate the background with different colors across different Y-axes?
If I remember correctly... (currently) easiest method is to read it from the data table using Summary table or Summarize.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I annotate the background with different colors across different Y-axes?
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Variables(X(:name), Y(:height), Y(:age)),
Elements(Points(X, Y, Legend(3))),
Local Data Filter(
Add Filter(
columns( :name ),
Where(
:name == {"ALFRED", "ALICE", "AMY", "BARBARA", "CAROL", "CHRIS",
"CLAY"}
),
Display( :name, N Items( 15 ), Find( Set Text( "" ) ) )
)
),
);
rep = gb << report;
fbs = rep << XPath("//FrameBox");
fbs[1] << Add Graphics Script(
Transparency(0.5);
Fill Color("Gray");
Rect(2, Y Origin() + Y Range(), 4, Y Origin(), 1);
);
fbs[2] << Add Graphics Script(
Transparency(0.5);
Fill Color("Green");
Rect(2, Y Origin() + Y Range(), 4, Y Origin(), 1);
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I annotate the background with different colors across different Y-axes?
If you have local filter to manage it will most likely get more complicated. Which range do you wish to color? What happens when user filters that out or one end of it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I annotate the background with different colors across different Y-axes?
Yes, it does become more complex with the presence of Local data filter. Therefore, I would like to know if there are any techniques to obtain the current items on the X-axis of the Graph or to read the selected options of the Local data filter in order to calculate the mapping table for the current Value and Label.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I annotate the background with different colors across different Y-axes?
You can get different types of values from local data filter and then you can parse/utilize those
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Car Poll.jmp");
dist = dt << Distribution(
Nominal Distribution(Column(:country))
);
ldf = dist << Local Data Filter(
Add Filter(columns(:sex), Where(:sex == "Female")),
Mode(Show(1), Include(1))
);
Show(ldf << get script, ldf << Get where clause, ldf << Get Filtered Rows);
Remember to check for the special case where no rows are being filtered