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

📄 bygraph_g.class

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 CLASS
📖 第 1 页 / 共 3 页
字号:
		}
	}

	if "`d'" == "y" & 0`.style.outer_yaxes.istrue' &		///
	   (! 0`.graphs[1].isofclass bargraph_g' | 0`.graphs[1].is_scale `d'') {
		local minc = `.plotregion1.mincol_oflist `plotregions''
		local maxc = `.plotregion1.maxcol_oflist `plotregions''

		foreach ax of local axes {
			if 0`.plotregion1.mincolof `ax'' < `minc' |	///
			   0`.plotregion1.maxcolof `ax'' > `maxc' {
				.plotregion1.`ax'.draw_view.set_true
//				.plotregion1.`ax'.set_labels_onoff	///
//					`.style.outer_ylabels.stylename'
//				.plotregion1.`ax'.set_ticks_onoff	///
//					`.style.outer_yticks.stylename'
			}
		}
	}

/*
	if `.style.alternate_axes.istrue' {
		.set_alt_outer_axes
		exit						// Exit
	}

	if 0`.style.alternate_yaxes.istrue' {
		if "`left'" == "" | "`right'" == "" {
			local alt 1
		}
		else {
			local alt 0
			di in green "alternate ignored, bygraphs have "	\\\
				"both left and right axes"
		}
	}
*/

end
*/



// ---------------------------------------------------------------------------
//  programs to set styles for ALL x and/or y axes.  If style/setting is 
//  blank uses the setting from the current .style

program set_axes_shown
	args d style					// optional

	if "`d'" == "" {				// set both
		.set_axes_shown x `style'
		.set_axes_shown y `style'
		exit						// exit
	}

	if 0`.graphs[1].isofclass bargraph_g' & ! 0`.graphs[1].is_scale `d'' {
		exit
	}

	if "`style'" == "" {				// setting from style
		local style `.style.indiv_`d'axes.stylename'
	}
	else {
		.style.editstyle indiv_`d'axes(`style') editcopy
	}

	.SetListStyle "" ".draw_view.setstyle, style(`style')"		///
		`.`d'axes_list'
end

program set_axes_titles
	args d style					// optional

	if "`d'" == "" {				// set both
		.set_axes_titles x `style'
		.set_axes_titles y `style'
		exit						// exit
	}

	if "`style'" == "" {				// setting from style
		local style `.style.indiv_`d'titles.stylename'
	}
	else {
		.style.editstyle indiv_`d'titles(`style') editcopy
	}

	.SetListStyle "" ".title.draw_view.setstyle, style(`style')"	///
		`.`d'axes_list'
end

program set_axes_labels
	args d style					// optional

	if "`d'" == "" {				// set both
		.set_axes_labels x `style'
		.set_axes_labels y `style'
		exit						// exit
	}

	if "`style'" == "" {				// setting from style
		local style `.style.indiv_`d'labels.stylename'
	}
	else {
		.style.editstyle indiv_`d'labels(`style') editcopy
	}

	.SetListStyle "" ".set_labels_onoff `style'" `.`d'axes_list'
end


program set_axes_ticks
	args d style					// optional

	if "`d'" == "" {				// set both
		.set_axes_ticks x `style'
		.set_axes_ticks y `style'
		exit						// exit
	}

	if "`style'" == "" {				// setting from style
		local style `.style.indiv_`d'ticks.stylename'
	}
	else {
		.style.editstyle indiv_`d'ticks(`style') editcopy
	}

	.SetListStyle "" ".set_ticks_onoff `style'" `.`d'axes_list'
end


program set_rescaled
	args d style					// optional

	if "`d'" == "" {				// set both
		.set_rescaled x `style'
		.set_rescaled y `style'
		exit						// exit
	}

	if "`style'" == "" {				// setting from style
		local style `.style.indiv_`d'rescale.stylename'
	}
	else {
		.style.editstyle indiv_`d'rescale(`style') editcopy
	}

	if 0`.style.indiv_`d'rescale.istrue' {
		.SetListStyle "" ".reset_scales `d'" `.plotregion_list'
		.SetListStyle "" ".set_ticks only_default" `.`d'axes_list'
	}
	else {
	    foreach axis in `.`d'axes_list' {
		tokenize `.axis_allrange `axis' `d''
		.SetListStyle ""					///
			".plotregion.`d'scale.set, min(`1') max(`2')" `axis'
		.SetListStyle "" ".set_ticks only_default" `axis'
	    }
	}
end


// ---------------------------------------------------------------------------
//  programs to set styles for all sub/bygraphs.  If style/setting is 
//  blank uses the setting from the current .style

program set_margins
	args style

	if "`style'" == "" {
		local style `.style.indiv_margin.stylename'
		if ( "`style'" == "" ) local style `.style.indiv_margin.setting'

	}
	else {
		.style.editstyle indiv_margin(`style') editcopy
	}

	.SetListStyle "" ".editstyle margin(`style') editcopy" style
end


// ---------------------------------------------------------------------------
//  Set the views to "shrink" according to the current settings.  Shrink means
//  that the views are fullviews, noshrink that they are subviews inheriting
//  the relative sizes of the whole bygraph.

program set_shrink

	if 0`.style.shrink_plotregion.istrue' {		// plregion is view
		.plotregion1.subview.set_false
	}
	else {						// plregion is subview
		.plotregion1.subview.set_true
	}

	if 0`.style.shrink_indiv.istrue' {		// graphs are views
		forvalues i=1/0`.graphs.arrnels' {
			.graphs[`i'].subview.set_false
		}
	}
	else {						// graphs are subviews
		forvalues i=1/0`.graphs.arrnels' {
			.graphs[`i'].subview.set_true
		}
	}
end


// ---------------------------------------------------------------------------
//  Sets the gmetric multiplyer.

program set_iscale
	local scale `0'

	.plotregion1.scale_gmetric `=ceil(sqrt(`.full_n'))'		///
		`.`c(curscm)'.special.by_knot1'				///
		`.`c(curscm)'.special.by_slope1'			///
		`.`c(curscm)'.special.by_slope2'

	if `"`scale'"' != `""' {
		tempname rsz
		.`rsz' = .numstyle.new, style(`.plotregion1.gmetric_mult')
		.`rsz'.setstyle , style(`scale')
		.plotregion1.gmetric_mult = `.`rsz'.val'
	}
end


// ---------------------------------------------------------------------------
//  Applies the supplied edit to all sub/bygraphs.  This edit may be a
//  .style.setstyle command, a .style.editstyle, or any other legal edit to a
//  graph.

program apply_edit_to_all
	forvalues i=1/0`.graphs.arrnels' {
		.graphs[`i'].`0'
	}
end

// ---------------------------------------------------------------------------
//  Find full min/max true range for all scales of the bygraphs in the 
//  specified dimension.  Note, this includes all axes.

program allrange
	args d

	local min =  1e300
	local max = -1e300
	forvalues i = 1/0`.n' {
		foreach plreg in `.plotregion_list' {
		    local min = min(`min',				///
			0`.graphs[`i'].`plreg'.`d'scale.min')
		    local max = max(`max',				///
			0`.graphs[`i'].`plreg'.`d'scale.max')
		}
	}

	class exit "`min' `max'"
end


// ---------------------------------------------------------------------------
//  Find full min/max true range for all bygraph scales of the specified axis.

program axis_allrange
	args axis d

	local min =  1e300
	local max = -1e300
	forvalues i = 1/0`.n' {
		.graphs[`i'].`axis'.plotregion.`d'scale.add_views

		local min = min(`min',				///
			0`.graphs[`i'].`axis'.plotregion.`d'scale.min')
		local max = max(`max',				///
			0`.graphs[`i'].`axis'.plotregion.`d'scale.max')
	}

	class exit "`min' `max'"
end


// ---------------------------------------------------------------------------
program SetByList
	gettoken mac   0      : 0
	gettoken colon bylist : 0

	local ct : word count `bylist'

	if `ct' < 2 {
		c_local `mac' `"`.LabOrName `bylist''"'
		exit
	}

	tokenize `bylist'

	if `ct' == 2 {
		c_local `mac' "`.LabOrName `1'' and `.LabOrName `2''"
		exit
	}

	local list `1'
	forvalues i=2/`=`ct'-1' {
		local list `"`list', `.LabOrName ``i'''"'
	}
	local list `"`list', and `.LabOrName ``ct'''"'

	c_local `mac' `"`list'"'
end

program LabOrName

	local nm : variable label `0'

	if `"`nm'"' == `""' {
		local nm `0'
	}

	class exit `"`nm'"'
end


// ---------------------------------------------------------------------------
//  _setsyle_  member programs to set styles in .style that have side effects

program _setstyle_margin

	if "`0'" == "`.style.indiv_margin.stylename'" {
		exit
	}

	.style.editstyle indiv_margin(`0') editcopy

	if 0`.style.indiv_as_whole.istrue' {
		.set_margins
	}
	else {
		.set_placement
	}
end

program _set_xor
	args attribute opt noopt

	if (`.style.styledex' != 0) .style.remake_as_copy

	.style.`attribute'.set_xor "`opt'" "`noopt'"

end


// ---------------------------------------------------------------------------
program draw

	if 0`.graphs[1].style.aspect_ratio.val' == 0 {
		.Super.draw `0'
		exit
	}
				// Sub-graphs have a fixed aspect ratio
					// handle subgraphs

	forvalues i = 1/0`.graphs.arrnels' {
		.graphs[`i']._reinit_stretches
		.graphs[`i'].set_spacers_fixed
	}

	._draw_quietly `0'				

	forvalues i = 1/0`.graphs.arrnels' {
		.graphs[`i']._reinit_stretches
		.graphs[`i']._setup_aspect_ratio

		.graphs[`i'].set_spacers_fixed
	}

	if "`.graphs[1].plotregion1.ystretch.setting'" == "fixed" {
		.plotregion1.ystretch.set fixed
		if 0`.graphs[1].style.aspect_pos.issouth_orcenter'	///
			.spacert.ystretch.set free
		if 0`.graphs[1].style.aspect_pos.isnorth_orcenter'	///
			.spacerb.ystretch.set free
	}
	else {
		.plotregion1.xstretch.set fixed
		if 0`.graphs[1].style.aspect_pos.iswest_orcenter'	///
			.spacerr.xstretch.set free
		if 0`.graphs[1].style.aspect_pos.iseast_orcenter'	///
			.spacerl.xstretch.set free
	}

	.Super.draw `0'
end

program _draw_quietly
	tempname holds
	.`holds' = {}
	._hold_for_aspect `holds'

	capture .Super.draw `0'
	local rc = _rc

	._reset_for_aspect `holds'

	if (`rc')  exit `rc'
end

⌨️ 快捷键说明

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