Make my own legend<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />I am creating a legend to show markers - currently it is trying (and failing) to repeat the legend built in, but I would like to extend it later.
The key line i the script is:
txtii=char(M1[ii,2])||" "||NmNow||" = "||char(M1[ii,1]);
This might put "8 C = -1" into text. I want it to be the 'marker of(8)' the symbol 'o' or whatever the marker state is. I believe these are unicode, so I think I just need to parse it correctly. Thanks for any ideas.
GetMarker=Expr(
mb1=mb << Get();
Mleg=dt << marker by column(column(nm[mb1]));
markernow=J(n row(dm),1,0);
For(ii=1, ii<= n row(dm), ii++,
markernow[ii] = Marker Of( Row State( ii ) );
);
Colnow=dt << get as matrix(column(nm[mb1]));
markerNow=ColNow||markerNow;
markerNow=markerNow[Rank(Colnow),0]||J(n row(markerNow),1,0);
markerNow[1,3]=1;
For(ii=2, ii<= n row(markerNow), ii++,
If(markerNow[ii,1]==markerNow[ii-1,1], markerNow[ii,3] = 0,markerNow[ii,3] = 1);
);
M1=markerNow[Loc(ColorNow[0,3]),1::2];
NmNow=nm[mb1];
// show(NmNow, colornow, C1);
Try(mTxtBx << delete);
For(ii=1, ii<= n row(M1), ii++,
txtii=char(M1[ii,2])||" "||NmNow||" = "||char(M1[ii,1]);
mTxtBx[ii]=Text Box(txtii);
mbp << append(mTxtBx[ii]);
);
);
Re: Make my own legendI followed this idea and:
Unicode = {
"253C", "2573", "25A1", "25C7", "25B3", "0059", "005A", "25CB",
"25AD", "25AF", "2217", "16EB", "25AC", "25AE", "25A0", "25C6",
"25BD", "25C1", "25B7", "25B2", "25BC", "25C0", "25B6", "1431",
"2164", "1438", "1433", "2502", "2212", "2215", "2216"
};// Unicode that is similar to markers numbered in JMPMarkerVal;
Try(mTxtBx << delete);
For(ii=1, ii<= n row(M1), ii++,
uni="\!" \!\\!!U" || unicode[JMPMarkerVal] || " \!"";
Show(ii, M1[ii,1], uni);
mTxtBx[ii]=HList Box(
mTxta[ii]=Text Box(parse(uni), < Text Box(": "||NmNow||" = "||char(M1[ii,1])),
);
mbp << append(mTxtBx[ii]); // mbp is a place holder in the window for the legend
);
Re: Make my own legendI do not think the 32 built-in symbols are unicode. But internally they seem to occupy the first 32 unicode characters, i.e. the non-printable ones. Try e.g. mval=43 and you will get a plus-sign, however not identical to the JMP symbol.
One idea: use a unicode table (like the one below) to mark the rows that best match the first 32 rows and put the them into an associative array that can be used in your script to translate Marker State to unicode symbols. (tip: many geometrical symbols from hex 2500)
New Table("markers galore", Add Rows(10260), New Column("Marker", Row State, "Row State", Formula(Marker State(Row()))), New Column("hex unicode", Character, "Nominal", Formula(Right(Hex(Row(), "integer"), 4))));
Re: Make my own legendThis section of script shows I am getting closer
MFont=Arg(Arg(Get Preferences(Marker Font),1),1); // Determine the font used for markers
uni="\!" \!\\!!U" || "03B1" || " \!"";
mval=1; // Change for a different symbol
// This will be used to get a value.
mval_h=hex(1,"integer");
mval_h4=substr(mval_h,length(mval_h)-3); //The unicode required is just the last 4 digits of the hexidecimal
show(mval_h4,length(mval_h4));
mval_unicode="\!"\!\\!!u" || mval_h4 || "\!""; // Unicode ready
dt1=new table("Correct - Symbol works",
add rows(1),
New Column( "Uni", Character, Nominal, Set Values( Insert({},mval_unicode) )),
);
Row State( Row() ) = Marker State( Parse( :Uni ) ) ;
// Note this works well - the marker is #1;
new window("Incorrect - symbol for the second box is empty",
V list Box(
Panel Box("uni "||char(uni),
Text Box(parse(uni)),
),
Panel Box("mval_unicode "||char(mval_unicode),
Text Box(parse(mval_unicode), <<Set Font(MFont)),
),
)
);
// Sadly, the symbol is not in the text box.