<!DOCTYPE rkplugin>
<document>
	<code file="histogram_options.php"/>
	<help file="histogram_options.rkh"/>
	<logic>
		<external id="varname" default=""/>
		<external id="allow_freq" default="true"/>
		<external id="allow_barlabels" default="true"/>
		<external id="allow_addtoplot" default="true"/>

		<connect client="freq.visible" governor="allow_freq"/>
		<connect client="barlabels.visible" governor="allow_barlabels"/>
		<connect client="addtoplot.visible" governor="allow_addtoplot"/>

		<set id="histbordercol.argument" to=", border="/>

		<convert id="isbreaks_cells" sources="histbreaksFunction.string" mode="equals" standard="cells"/>
		<connect client="histbreaks_ncells.enabled" governor="isbreaks_cells"/>

		<convert id="isbreaks_vec" sources="histbreaksFunction.string" mode="equals" standard="vec"/>
		<connect client="histbreaks_veclength.enabled" governor="isbreaks_vec"/>

		<convert id="isbreaks_int" sources="histbreaksFunction.string" mode="equals" standard="int"/>
		<convert id="isbreaks_intORvec" mode="or" sources="isbreaks_int;isbreaks_vec"/>
		<connect client="include_lowest.enabled" governor="isbreaks_intORvec"/>

		<convert id="isdensityGT0" mode="range" sources="density.int" min="1" />
		<convert id="ishistlty_notblank" sources="histlinetype.string" mode="notequals" standard="blank" />
		<convert id="ishistlty_blank" sources="histlinetype.string" mode="equals" standard="blank" />

		<connect client="density.enabled" governor="ishistlty_notblank"/>

		<convert id="isdensityGT0ishistlty_notblank" mode="and" sources="isdensityGT0;ishistlty_notblank" />
		<connect client="angle.enabled" governor="isdensityGT0ishistlty_notblank"/>-->

		<connect client="frame_histborderoptions.enabled" governor="ishistlty_notblank"/>
		<connect client="histbordercol.color.enabled" governor="doborder.state" />

		<convert id="isdensity_non0" sources="density.int" mode="notequals" standard="0" />

		<connect client="frame_histfilloptions.enabled" governor="isdensity_non0"/>
		<connect client="histfillcol.color.enabled" governor="usefillcol.state" />

		<connect client="usefillcol.enabled" governor="ishistlty_notblank"/>
		<connect client="usefillcol.state" governor="ishistlty_blank"/>

	</logic>
	<dialog label="Default histogram options">
		<row>
			<column>
				<checkbox id="addtoplot" label="Add bars to current plot" checked="false"/>
				<checkbox id="freq" label="Frequency" checked="false" value_unchecked="0" />
				<checkbox id="barlabels" label="Bar labels" checked="false"/>
				<stretch/>
				<frame id="frame_breaks" label="Histogram Breakpoints">
					<radio id="histbreaksFunction" label="Method" >
						<option value="Sturges" label="Sturges"  checked="true" />
						<option value="Scott" label="Scott" />
						<option value="FD" label="Friedman-Diaconis" />
						<option value="cells" label="A single number" />
						<option value="int" label="Integer numbers" />
						<option value="vec" label="Vector of break points" />
					</radio>
					<row>
						<spinbox id="histbreaks_ncells" label="Suggested cells" type="integer" min="1" initial="10"/>
						<spinbox id="histbreaks_veclength" label="Vector length" type="integer" min="1" initial="10"/>
					</row>
					<checkbox id="rightclosed" label="Right closed" checked="true"/>
					<row>
					<checkbox id="include_lowest" label="Include in lowest cell" checked="true"/>
					<text id="inclow_text">(For vector valued breaks)</text>
				</row>
				</frame>
			</column>
			<column>
				<frame id="frame_histlineoptions" label="Histogram Line options">
					<dropdown id="histlinetype" label="Line type for histogram" >
						<option value="blank" label="Blank (No lines)" />
						<option value="solid" label="Solid" checked="true"/>
						<option value="dashed" label="Dashed" />
						<option value="dotted" label="Dotted" />
						<option value="dotdash" label="Dot-Dash" />
						<option value="longdash" label="Long-dash" />
						<option value="twodash" label="Two-dash" />
					</dropdown>
					<spinbox id="density" label="Density of shading lines" type="integer" min="-1" initial="-1" default_precision="1"/>
					<spinbox id="angle" label="Angle of shading lines" min="0" max = "360" initial="45" default_precision="0"/>
				</frame>
				<frame id="frame_histborderoptions" label="Histogram Border options">
					<checkbox id="doborder" label="Draw border" checked="true"/>
					<embed id="histbordercol" component="rkward::color_chooser" label="Color"/>
				</frame>
				<frame id="frame_histfilloptions" label="Histogram Fill options">
					<checkbox id="usefillcol" label="Use Fill color" checked="false"/>
					<embed id="histfillcol" component="rkward::color_chooser" label="Color"/>
				</frame>
			</column>
		</row>
	</dialog>
</document>
