📄 twoway_iarrow_parse.class
字号:
// twoway_iarrow_parse
//
// A parser for adding immediate arrows. Works with twoway.ado.
// WIP, just labels now, on its way to becoming arrows.
*! version 1.0.0 13oct2002
version 8
class {
.ptlist = ""
} , inherit(twoway_yxview_parse)
// ---------------------------------------------------------------------------
program parse
.must_create_serset = 1
.viewtype = "scatter"
.allow_anything = 1 // side signal
.n = 1 // number of plots
.Super.parse `0'
if `"`.wtype'"' != "" {
di as error "weights not allowed"
exit 198
}
// process points
local pts `"`.anything'"'
gettoken x pts : pts
gettoken y pts : pts
while `"`x'"' != `""' {
capture numlist "`x' `y'" , max(2) min(2) // x-y point
if _rc {
di as error `"invalid point, `x' `y'"'
exit 198
}
// optional position
gettoken pos pts : pts , match(pfnd) quotes
if "`pfnd'" != "" {
capture numlist "`pos'" , max(1) min(1) range(>=0 <=12)
if _rc {
di as error `"invalid position, `pos'"'
exit 198
}
gettoken txtq pts : pts , quotes
}
else {
local txtq `"`pos'"'
local pos
}
gettoken txt : txtq // optional text label
if `"`txt'"' == `"`txtq'"' {
local xnxt `txt'
local txt
}
else {
gettoken xnxt pts : pts
}
local ptlist `"`ptlist' `"`x' `y' "`pos'" 1 `"`txt'"'"'"'
local x `"`xnxt'"'
gettoken y pts : pts
}
.ptlist = `"`ptlist'"'
end
/* -------------------------------------------------------------------------*/
/*
Creates a new serset and the view and returns its reference.
Assumes that the data in memory is the same as when parse was called.
Allows a touse(varname) option that further restricts the sample,
restricts beyond the held .if and .in
Additional options to the .serset.new command may be specified, but
this is unlikely to be necessary.
If must_create_serset == 1, then this command MUST be used,
otherwise the serset may be created by other means.
*/
program log_create_serset
/*
syntax , LOG(name) SERSETNAME(string) [ TOUSE(passthru) * ]
.`log'.Arrpush __NOLOG__ twoway__lfit_serset , ///
sersetname(`sersetname') touse(\`touse1') x(`x') y(`y') ///
min(`.min') max(`.max') points(`.points') atobs(`.atobs') ///
predopts(`.predict_opts') regopts(`.regress_opts') ///
xtrans(`.xtrans') morevars(`rest') weight(`.wtype'`.wtexp')
.`log'.Arrpush LogMapping .`sersetname' // make _fr_runlog place
// mapping statement into
// permanent log.
*/
.wtype = "" // so .Super.log_create_view will
.wtexp = "" // not try to add weight to serset
end
program log_edits
args log view i
.Super.log_edits `log' `view' `i'
.`log'.Arrpush .`view'.delegate_draw = "ilabels"
if `"`.ptlist'"' != `""' {
.`log'.Arrpush .`view'.Declare point_list = `"`.ptlist'"'
}
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -