<commit_before><?xml version="1.0" encoding="utf-8"?>
<!--
/*
    Weave (Web-based Analysis and Visualization Environment)
    Copyright (C) 2008-2011 University of Massachusetts Lowell

    This file is a part of Weave.

    Weave is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License, Version 3,
    as published by the Free Software Foundation.

    Weave is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Weave.  If not, see <http://www.gnu.org/licenses/>.
*/
-->
<SimpleVisTool xmlns="weave.visualization.tools.*" 
	     xmlns:mx="http://www.adobe.com/2006/mxml"
	     xmlns:ui="weave.ui.*" 
		 xmlns:userControls="weave.ui.userControls.*"
		 layout="absolute">
	<mx:Script>
		<![CDATA[
			import weave.api.getCallbackCollection;
			import weave.api.linkBindableProperty;
			import weave.api.registerLinkableChild;
			import weave.api.ui.IVisTool;
			import weave.core.LinkableVariable;
			import weave.core.UIUtils;
			import weave.ui.SelectableAttributesCheckBoxList;
			import weave.utils.ColumnUtils;
			import weave.utils.ProbeTextUtils;
			import weave.visualization.plotters.PieChartPlotter;

			WeaveAPI.ClassRegistry.registerImplementation(IVisTool, PieChartTool, "Pie Chart");
			
			public var _plotter:PieChartPlotter = null;
			
			override protected function inConstructor():void
			{
				super.inConstructor();
				// lock dynamic objects into place
				_plotter = initializePlotters(PieChartPlotter, false);
				
				visualization.plotManager.enableAutoZoomToExtent.value = true;
				visualization.plotManager.enableFixedAspectRatio.value = true;
				visualization.enableZoomAndPan.value = false;

				getCallbackCollection(visualization.plotManager.zoomBounds).addImmediateCallback(this, invalidateAxes);
				getCallbackCollection(_plotter).addImmediateCallback(this, invalidateAxes);
				invalidateAxes();
				
				// see if there is a matching column in probe headers
				var headers:Array = ProbeTextUtils.probeHeaderColumns.getObjects();
				for (var i:int = 0; i < headers.length; i++)
				{
					if (ColumnUtils.getKeyType(headers[i]) == ColumnUtils.getKeyType(_plotter.data))
					{
						_plotter.label.requestLocalObjectCopy(headers[i]);
						break;
					}
				}
				
				visualization.plotManager.marginTop.value = "65";
				visualization.plotManager.marginBottom.value = "65";
				visualization.plotManager.marginLeft.value = "85";
				visualization.plotManager.marginRight.value = "85";
			}
			
			override public function initSelectableAttributes(input:Array):void
			{
				ColumnUtils.initSelectableAttributes([_plotter.data], input);
			}
			
			override protected function childrenCreated():void
			{
				super.childrenCreated();
			}
			
			public const attributesToIncludeInProbe:LinkableVariable = registerLinkableChild(this, new LinkableVariable(Array, null, null), handleAttributesToIncludeInProbe, true);
			private function handleAttributesToIncludeInProbe():void
			{
				visualization.additionalProbeColumns = SelectableAttributesCheckBoxList.getSelectedAttributeColumns(this, attributesToIncludeInProbe);
			}
			[Deprecated] public function set includeToolAttributesInProbe(value:Boolean):void
			{
				attributesToIncludeInProbe.setSessionState(value ? getSelectableAttributeNames() : []);
			}
			
			private function invalidateAxes():void
			{
				handlePanelTitleChange();
			}

			override public function get defaultPanelTitle():String
			{
				return lang("Pie Chart of {0}", ColumnUtils.getTitle(_plotter.data));
			}
		]]>
	</mx:Script>
<editorFactory>
<mx:Component>
	<ui:ControlPanel>
		<mx:Script>
			<![CDATA[
				import weave.api.linkBindableProperty;
			]]>
		</mx:Script>
		<mx:VBox id="attributesPanel" label="{lang('Attributes for Pie Chart')}">
			<ui:DynamicColumnComponent label="{lang('Wedge size')}" creationComplete="(event.target as DynamicColumnComponent).dynamicObject = outerDocument._plotter.data"/>
			<ui:DynamicColumnComponent label="{lang('Wedge color')}" creationComplete="(event.target as DynamicColumnComponent).columnWrapper = outerDocument._plotter.fill.color"/>
			<ui:DynamicColumnComponent id="labelColumInput" label="{lang('Label Column')}" creationComplete="(event.target as DynamicColumnComponent).dynamicObject = outerDocument._plotter.label"/>
			<mx:HBox width="100%">
				<mx:Label text="{lang('Label angle')}" fontWeight="bold"/>
				<mx:HSlider
						snapInterval="0.25" minimum="0" maximum="1" liveDragging="true" tickInterval="0.25"
						dataTipFormatFunction="{function(v:Number):String { return lang('{0}%', Math.round(100 * v)); }}"
						creationComplete="linkBindableProperty(outerDocument._plotter.labelAngleRatio, event.target, 'value')"/>
			</mx:HBox>
			<mx:HBox width="100%">
				<mx:Label text="{lang('Inner radius')}" fontWeight="bold"/>
				<mx:HSlider
						snapInterval="0.05" minimum="0" maximum="1" liveDragging="true" tickInterval="0.25"
						creationComplete="linkBindableProperty(outerDocument._plotter.innerRadius, event.target, 'value')"/>
			</mx:HBox>
		</mx:VBox>
		<mx:VBox label="{lang('Mouseover info')}">
			<ui:SelectableAttributesCheckBoxList id="selectedAttrList" creationComplete="selectedAttrList.setup(outerDocument, outerDocument.attributesToIncludeInProbe)"/>
		</mx:VBox>
	</ui:ControlPanel>
</mx:Component>
</editorFactory>
</SimpleVisTool>
<commit_msg>fixed bug where pie chart label column wasn't initialized by default<commit_after><?xml version="1.0" encoding="utf-8"?>
<!--
/*
    Weave (Web-based Analysis and Visualization Environment)
    Copyright (C) 2008-2011 University of Massachusetts Lowell

    This file is a part of Weave.

    Weave is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License, Version 3,
    as published by the Free Software Foundation.

    Weave is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Weave.  If not, see <http://www.gnu.org/licenses/>.
*/
-->
<SimpleVisTool xmlns="weave.visualization.tools.*" 
	     xmlns:mx="http://www.adobe.com/2006/mxml"
	     xmlns:ui="weave.ui.*" 
		 xmlns:userControls="weave.ui.userControls.*"
		 layout="absolute">
	<mx:Script>
		<![CDATA[
			import weave.api.getCallbackCollection;
			import weave.api.linkBindableProperty;
			import weave.api.registerLinkableChild;
			import weave.api.ui.IVisTool;
			import weave.core.LinkableVariable;
			import weave.core.UIUtils;
			import weave.ui.SelectableAttributesCheckBoxList;
			import weave.utils.ColumnUtils;
			import weave.utils.ProbeTextUtils;
			import weave.visualization.plotters.PieChartPlotter;

			WeaveAPI.ClassRegistry.registerImplementation(IVisTool, PieChartTool, "Pie Chart");
			
			public var _plotter:PieChartPlotter = null;
			
			override protected function inConstructor():void
			{
				super.inConstructor();
				// lock dynamic objects into place
				_plotter = initializePlotters(PieChartPlotter, false);
				
				visualization.plotManager.enableAutoZoomToExtent.value = true;
				visualization.plotManager.enableFixedAspectRatio.value = true;
				visualization.enableZoomAndPan.value = false;

				getCallbackCollection(visualization.plotManager.zoomBounds).addImmediateCallback(this, invalidateAxes);
				getCallbackCollection(_plotter).addImmediateCallback(this, invalidateAxes);
				invalidateAxes();
				
				// see if there is a matching column in probe headers
				var headers:Array = ProbeTextUtils.probeHeaderColumns.getObjects();
				for (var i:int = 0; i < headers.length; i++)
				{
					if (ColumnUtils.getKeyType(headers[i]) == ColumnUtils.getKeyType(_plotter.data))
					{
						_plotter.label.requestLocalObjectCopy(headers[i]);
						break;
					}
				}
				
				visualization.plotManager.marginTop.value = "65";
				visualization.plotManager.marginBottom.value = "65";
				visualization.plotManager.marginLeft.value = "85";
				visualization.plotManager.marginRight.value = "85";
			}
			
			override public function initSelectableAttributes(input:Array):void
			{
				ColumnUtils.initSelectableAttributes([_plotter.data, _plotter.label], input);
			}
			
			override protected function childrenCreated():void
			{
				super.childrenCreated();
			}
			
			public const attributesToIncludeInProbe:LinkableVariable = registerLinkableChild(this, new LinkableVariable(Array, null, null), handleAttributesToIncludeInProbe, true);
			private function handleAttributesToIncludeInProbe():void
			{
				visualization.additionalProbeColumns = SelectableAttributesCheckBoxList.getSelectedAttributeColumns(this, attributesToIncludeInProbe);
			}
			[Deprecated] public function set includeToolAttributesInProbe(value:Boolean):void
			{
				attributesToIncludeInProbe.setSessionState(value ? getSelectableAttributeNames() : []);
			}
			
			private function invalidateAxes():void
			{
				handlePanelTitleChange();
			}

			override public function get defaultPanelTitle():String
			{
				return lang("Pie Chart of {0}", ColumnUtils.getTitle(_plotter.data));
			}
		]]>
	</mx:Script>
<editorFactory>
<mx:Component>
	<ui:ControlPanel>
		<mx:Script>
			<![CDATA[
				import weave.api.linkBindableProperty;
			]]>
		</mx:Script>
		<mx:VBox id="attributesPanel" label="{lang('Attributes for Pie Chart')}">
			<ui:DynamicColumnComponent label="{lang('Wedge size')}" creationComplete="(event.target as DynamicColumnComponent).dynamicObject = outerDocument._plotter.data"/>
			<ui:DynamicColumnComponent label="{lang('Wedge color')}" creationComplete="(event.target as DynamicColumnComponent).columnWrapper = outerDocument._plotter.fill.color"/>
			<ui:DynamicColumnComponent id="labelColumInput" label="{lang('Label Column')}" creationComplete="(event.target as DynamicColumnComponent).dynamicObject = outerDocument._plotter.label"/>
			<mx:HBox width="100%">
				<mx:Label text="{lang('Label angle')}" fontWeight="bold"/>
				<mx:HSlider
						snapInterval="0.25" minimum="0" maximum="1" liveDragging="true" tickInterval="0.25"
						dataTipFormatFunction="{function(v:Number):String { return lang('{0}%', Math.round(100 * v)); }}"
						creationComplete="linkBindableProperty(outerDocument._plotter.labelAngleRatio, event.target, 'value')"/>
			</mx:HBox>
			<mx:HBox width="100%">
				<mx:Label text="{lang('Inner radius')}" fontWeight="bold"/>
				<mx:HSlider
						snapInterval="0.05" minimum="0" maximum="1" liveDragging="true" tickInterval="0.25"
						creationComplete="linkBindableProperty(outerDocument._plotter.innerRadius, event.target, 'value')"/>
			</mx:HBox>
		</mx:VBox>
		<mx:VBox label="{lang('Mouseover info')}">
			<ui:SelectableAttributesCheckBoxList id="selectedAttrList" creationComplete="selectedAttrList.setup(outerDocument, outerDocument.attributesToIncludeInProbe)"/>
		</mx:VBox>
	</ui:ControlPanel>
</mx:Component>
</editorFactory>
</SimpleVisTool>

{'fraction_non_alphanumeric': 0.11526855763427882, 'fraction_numerical': 0.008966290197430813, 'mean_word_length': 4.157847932414406, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 2, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4888619', 'n_tokens_mistral': 4031, 'n_tokens_neox': 3296, 'n_words': 685}