I am trying to use JSL to construct a plot similar to the one shown above. My attempt is below. Where I am stuck is that I don't want the marker legend to use the overlay variable, but to use lgd2. The solution needs to work for various number of categories for "lgd1" and "lgd2".
dt = New Table( "example",
Add Rows( 18 ),
Set Header Height( 60 ),
New Column( "lgd1",
Character,
"Nominal",
Set Values(
{"A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "C", "C",
"C", "C", "C", "C"}
),
Set Display Width( 63 )
),
New Column( "lgd2",
Numeric,
"Nominal",
Format( "Best", 12 ),
Set Values( [1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2] )
),
New Column( "value",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 1, 2, 1.5, 1.5, 2, 2, 2, 3, 2, 4, 3, 4, 4.5, 5, 4, 6, 5.5] )
),
New Column( "X",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3] )
),
New Column( "Group",
Character,
"Nominal",
Set Values(
{"A-1", "A-1", "A-1", "A-2", "A-2", "A-2", "B-1", "B-1", "B-1", "B-2",
"B-2", "B-2", "C-1", "C-1", "C-1", "C-2", "C-2", "C-2"}
)
)
);
DT << Graph Builder(
Size( 500, 500 ),
Show Control Panel( 0 ),
Fit to Window( "Off" ),
Variables( X( :X ), Y( :value ), Overlay( :Group ), Color( :lgd1 ) ),
Elements( Line( X, Y, Legend( 1 ) ), Points( X, Y, Legend( 2 ) ) ),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
1,
Properties( 0, {Marker Size( 5 )}, Item ID( "A", 1 ) ),
Properties( 1, {Marker Size( 5 )}, Item ID( "B", 1 ) )
), Legend Model(
2,
Properties( 3, {Marker Size( 5 )}, Item ID( "A-1", 1 ) ),
Properties( 4, {Marker Size( 5 )}, Item ID( "A-2", 1 ) ),
Properties(
5,
{Marker( "Circle" ), Marker Size( 5 )},
Item ID( "B-1", 1 )
),
Properties(
6,
{Marker( "Plus" ), Marker Size( 5 )},
Item ID( "B-2", 1 )
),
Properties(
7,
{Marker( "Circle" ), Marker Size( 5 )},
Item ID( "C-1", 1 )
),
Properties(
8,
{Marker( "Plus" ), Marker Size( 5 )},
Item ID( "C-2", 1 )
)
)}
),
Dispatch(
{},
"400",
LegendBox,
{Legend Position( {1, [0, 1, 2], 2, [-1, -1, -1, 3, 4, 5, 6, 7, 8]} ),
Position( {0, 1, 2, -1, -1, -1, 3, 4, 5, 6, 7, 8} )}
)
)
);