⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gridline_g.class

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 CLASS
字号:
/*                                 gridline

	a view of a grid or x/y line

        This is a subview.  When drawn, assumes that the appropriate x and y
        scales have already been set.

	View is tightly tied to its plotregion, and of little use without it.

*/
*! version 1.0.3  02dec2003

version 8

class {
	z		= 0				// x or y point
	ord		= .ordstyle.new
	plotregion 	= ""				// key of our plotregion

	style		= .gridlinestyle.new
} , inherit(subview)


/*--------------------------------------------------------------------------*/
/*
	Usage:  .gridline.new z0 [ , style(stylename) styleref(name|key)]

	if reference is specified the style is assigned by reference rather
	than by copying (by value)
*/

program define new

	syntax anything ,						///
		Ordinate(string) PLOTRegion(string)			///
		[ Style(passthru) STYLEREF(passthru) datesok * ]

	if ! 0`.`plotregion'.isofclass plotregion' {
		di as error "invalid plotregion for xline or yline"
		exit 198
	}

	if "`datesok'" != "" {
		.`plotregion'.get_time_format
		local fmt `r(fmt)'
	}
	else {
		local anything `anything'
	}

	capture numlist `"`anything'"' , max(1) min(1)
	local rc = _rc
	local numlist `r(numlist)'
	if `rc' & "`datesok'" != "" {
		_date2elapsed , format(`fmt') datelist(`anything')
		local tfmt `s(fmt)'
		local numlist `s(args)'
		capture numlist "`numlist'" , max(1) min(1)
		local rc = _rc
	}
	if `rc' {
		if "`tfmt'" == "" {
			di as error `"invalid number, `anything'"'
		}
		else {
			di as err ///
`"invalid argument,"' ///
`"`anything' must be a number or valid argument for `tfmt'() function"'
		}
		exit 198
	}

	.z   = `numlist'
	.ord.setstyle, style(`ordinate')
	.plotregion = "`.`plotregion'.objkey'"

	if "`style'" == "" & "`styleref'" == "" {
		local style style(scheme)
	}

	.setstyle , `style' `styleref' `options'
end

/*--------------------------------------------------------------------------*/

program swap_ord
	if "`.ord.stylename'" == "x" {
		.ord.setstyle, style(y)
	}
	else {
		.ord.setstyle, style(x)
	}
end

/*--------------------------------------------------------------------------*/

program define draw

	if (0`.style.linestyle.blank_line')  exit

	.style.linestyle.setgdifull

	local ord `.ord.stylename'
	local ordw = cond("`ord'"== "x", "y", "x")

	local margin `.plotregion'.style.margin

	local w0 0
	local w1 0`.`.plotregion'.`ordw'size_ren'

	if 0`.style.extend_low.istrue' {
		local side = cond("`ord'"== "x", "bottom", "left")
		local w0 = `w0' - 0`.`margin'.gm`side''
	}
	if 0`.style.extend_high.istrue' {
		local side = cond("`ord'"== "x", "top", "right")
		local w1 = `w1' + 0`.`margin'.gm`side''
	}

			// maybe add a free x and y transform in the global
			// space that can be used by anyone.

	tempname transform			// must hold transform
	.`transform' = .transform.new , dimension(`ord')
	.`transform'.get_from_gdi
						// set gdi transforms 
	.`.plotregion'.`ord'scale.setgdi `.`.plotregion'.`ord'size_ren'

	if "`ord'" == "x" {
		gdi line `.z' `w0' `.z' `w1'
	}
	else {
		gdi line `w0' `.z' `w1' `.z' 
	}

	.`transform'.reset			// reset the transform
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -