Permalink
Browse files

git-svn-id: https://flexapps.svn.sourceforge.net/svnroot/flexapps/cen…

…sus2@622 381d3abc-5231-0410-a0e4-b068e20cbb11
  • Loading branch information...
1 parent 2ee76a1 commit 0954324ab8fd9a99abe1eaf5b1de06d34512d985 jlward4 committed Dec 24, 2009
@@ -1,10 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties mainApplicationPath="census2.mxml" version="3">
- <compiler additionalCompilerArguments="-locale en_US" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="false" outputFolderLocation="/home/jamesw/projects/census2/server/WebContent" outputFolderPath="bin-debug" rootURL="http://localhost:8080/census2/index.html?" sourceFolderPath="src" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
+ <compiler additionalCompilerArguments="-locale en_US -licenses.license flexbuilder3 137740017147979634978523" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="false" outputFolderLocation="/home/jamesw/projects/census2/server/WebContent" outputFolderPath="bin-debug" rootURL="http://localhost:8080/census2/index.html?" sourceFolderPath="src" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="3">
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/player/9/playerglobal.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="4" path="">
+ <modifiedEntries>
+ <libraryPathEntry index="4" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/rpc.swc" useDefaultLinkType="false">
+ <crossDomainRsls>
+ <crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="rpc_3.5.0.12683.swz"/>
+ <crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="rpc_3.5.0.12683.swf"/>
+ </crossDomainRsls>
+ </libraryPathEntry>
+ <libraryPathEntry kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/datavisualization.swc" useDefaultLinkType="true">
+ <crossDomainRsls>
+ <crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="datavisualization_3.5.0.12683.swz"/>
+ <crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="datavisualization_3.5.0.12683.swf"/>
+ </crossDomainRsls>
+ </libraryPathEntry>
+ </modifiedEntries>
<excludedEntries>
<libraryPathEntry kind="3" linkType="2" path="${PROJECT_FRAMEWORKS}/libs/player/{targetPlayerMajorVersion}/playerglobal.swc" useDefaultLinkType="false"/>
</excludedEntries>
@@ -0,0 +1,3 @@
+#Tue Nov 17 20:44:02 MST 2009
+eclipse.preferences.version=1
+upgradeSDK/fb253292=
@@ -15,12 +15,17 @@
import mx.events.StyleEvent;
import mx.utils.ObjectUtil;
import mx.controls.Alert;
+
+ [Bindable]
+ private var chartArrayCollection:ArrayCollection = new ArrayCollection();
private function changeTheme(theme:String):void
{
currentTheme = theme;
var eventDispatcher:IEventDispatcher = StyleManager.loadStyleDeclarations(currentTheme + ".swf");
eventDispatcher.addEventListener(StyleEvent.COMPLETE, function(event:StyleEvent):void {
+
+
if (!visible)
{
visible = true;
@@ -88,9 +93,42 @@
private function updateCharts():void
{
- recordsPerSecondChartView.dataProvider = results;
- transferSizeChartView.dataProvider = results;
- clientSideMemoryChartView.dataProvider = results;
+ for each (var item:Object in results)
+ {
+ updateChartDataProviderItem(item);
+ }
+ }
+
+ private function updateChartDataProviderItem(item:Object):void
+ {
+ var recordExists:Boolean = false;
+ for each (var chartItem:Object in chartArrayCollection)
+ {
+ if (item.id == chartItem.id)
+ {
+ recordExists = true;
+
+ updateChartItem(chartItem, item);
+
+ break;
+ }
+ }
+
+ if (!recordExists)
+ {
+ chartArrayCollection.addItem({id: item.id});
+ updateChartDataProviderItem(item);
+ }
+ }
+
+ private function updateChartItem(chartItem:Object, item:Object):void
+ {
+ for (var k:String in item)
+ {
+ chartItem[k] = item[k];
+ }
+
+ chartArrayCollection.itemUpdated(chartItem);
}
private function startTest(test:Object):void
@@ -143,20 +181,13 @@
<census2:ChannelConfig id="channelConfig">
<census2:message>
- trace("testId = " + event.message.body.testId + " resultType = " + event.message.body.resultType + " resultData = " + event.message.body.resultData);
-
updateResult(event.message.body.testId, event.message.body.resultType, new Number(event.message.body.resultData));
</census2:message>
</census2:ChannelConfig>
<mx:HTTPService id="srv" url="tests.xml">
<mx:result>
tests = event.result.tests.test;
-
- for each (var test:Object in tests)
- {
- resetResults(test);
- }
</mx:result>
</mx:HTTPService>
@@ -176,13 +207,13 @@
enabled="{testList.selectedItem != null}" useHandCursor="{testList.selectedItem != null}" buttonMode="true"
paddingLeft="6" toolTip="Select a test to run">
<mx:click>
- resetResults(testList.selectedItem);
- startTest(testList.selectedItem);
+ resetResults(testList.selectedItem);
+ startTest(testList.selectedItem);
</mx:click>
</mx:Button>
</mx:HBox>
<mx:Spacer height="10"/>
- <mx:List id="testList" width="90%" height="100%" dataProvider="{tests}" styleName="leftInnerContainer">
+ <mx:List id="testList" width="90%" height="100%" dataProvider="{tests}" styleName="leftInnerContainer" doubleClickEnabled="true">
<mx:itemRenderer>
<mx:Component>
<mx:HBox paddingTop="0" paddingBottom="0" verticalScrollPolicy="off" horizontalScrollPolicy="off"
@@ -192,6 +223,10 @@
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
+ <mx:itemDoubleClick>
+ resetResults(testList.selectedItem);
+ startTest(testList.selectedItem);
+ </mx:itemDoubleClick>
</mx:List>
<mx:Spacer height="10"/>
<controls:LabelLink>
@@ -206,7 +241,7 @@
<mx:TabBar id="tabBar" width="100%" selectedIndex="0" horizontalGap="2" top="0">
<mx:dataProvider>
<mx:String>Intro Video</mx:String>
- <mx:String>Rows / Second</mx:String>
+ <mx:String>Performance</mx:String>
<mx:String>Transfer Size</mx:String>
<mx:String>Client-side Memory</mx:String>
</mx:dataProvider>
@@ -231,9 +266,9 @@
<mx:Canvas width="100%" height="100%">
</mx:Canvas>
- <views:RecordsPerSecondChartView id="recordsPerSecondChartView" width="100%" height="100%" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10"/>
- <views:TransferSizeChartView id="transferSizeChartView" width="100%" height="100%" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10"/>
- <views:ClientSideMemoryChartView id="clientSideMemoryChartView" width="100%" height="100%" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10"/>
+ <views:RecordsPerSecondChartView id="recordsPerSecondChartView" width="100%" height="100%" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" dataProvider="{chartArrayCollection}"/>
+ <views:TransferSizeChartView id="transferSizeChartView" width="100%" height="100%" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" dataProvider="{chartArrayCollection}"/>
+ <views:ClientSideMemoryChartView id="clientSideMemoryChartView" width="100%" height="100%" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" dataProvider="{chartArrayCollection}"/>
</mx:ViewStack>
<mx:HRule id="leftSideBorder" styleName="tabDivider" y="{tabBar.height - 3}" x="1"/>
<mx:HRule id="rightSideBorder" styleName="tabDivider" y="{tabBar.height - 3}"/>
@@ -16,18 +16,19 @@ You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-package org.jamesward.census.views
+package com.jamesward.census2.charts
{
import flash.display.Graphics;
import flash.geom.Rectangle;
+
import mx.charts.ChartItem;
import mx.charts.chartClasses.GraphicsUtilities;
+import mx.charts.series.items.BarSeriesItem;
import mx.core.IDataRenderer;
import mx.graphics.IFill;
import mx.graphics.IStroke;
import mx.skins.ProgrammaticSkin;
-import mx.charts.series.items.BarSeriesItem;
public class BarItemRenderer extends ProgrammaticSkin implements IDataRenderer
{
@@ -58,53 +59,50 @@ public class BarItemRenderer extends ProgrammaticSkin implements IDataRenderer
super.updateDisplayList(unscaledWidth, unscaledHeight);
var fill:IFill = GraphicsUtilities.fillFromStyle(getStyle("fill"));
- var stroke:IStroke = getStyle("stroke");
-
- var w:Number = stroke ? stroke.weight / 2 : 0;
-
- var modifiedHeight:Number = height - 2 * w;
-
+
var s:Number = 1;
if (_data is BarSeriesItem)
{
- if (_data.item.rows != undefined)
- {
- s = _data.item.rows / 20000;
- }
- if (s < .2)
+ if (_data.item.numRows != undefined)
{
- s = .2;
+ // find the item with the most rows
+ var mostRows:Number = 0
+
+ for each (var d:Object in _data.element.dataProvider)
+ {
+ if (d.numRows > mostRows)
+ {
+ mostRows = d.numRows;
+ }
+ }
+
+ s = _data.item.numRows / mostRows;
}
}
- modifiedHeight = modifiedHeight * s;
+
+ if (s < .05)
+ {
+ s = .05;
+ }
+
+ var modifiedHeight:Number = height * s;
var startY:Number = (height - modifiedHeight) / 2;
- var rc:Rectangle = new Rectangle(w, startY, width - 2 * w, modifiedHeight);
+ var rc:Rectangle = new Rectangle(2, startY, width, modifiedHeight);
var g:Graphics = graphics;
g.clear();
g.moveTo(rc.left,rc.top);
- if (stroke)
- {
- stroke.apply(g);
- }
-
- if (fill)
- {
- fill.begin(g,rc);
- }
-
+ fill.begin(g,rc);
+
g.lineTo(rc.right,rc.top);
g.lineTo(rc.right,rc.bottom);
g.lineTo(rc.left,rc.bottom);
g.lineTo(rc.left,rc.top);
- if (fill)
- {
- fill.end(g);
- }
+ fill.end(g);
}
}
@@ -16,17 +16,22 @@ You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-package org.jamesward.census.views
+package com.jamesward.census2.charts
{
+import flash.display.CapsStyle;
import flash.display.Graphics;
+import flash.display.LineScaleMode;
import flash.geom.Rectangle;
-import mx.graphics.IFill;
+
import mx.charts.chartClasses.ChartElement;
import mx.charts.chartClasses.GraphicsUtilities;
+import mx.graphics.IFill;
import mx.graphics.SolidColor;
-[Style(name="fill", type="mx.graphics.IFill", inherit="no")]
+[Style(name="borderFillColor", type="uint", format="Color", inherit="yes")]
+
+[Style(name="fillColor", type="uint", format="Color", inherit="yes")]
public class ChartBackgroundFill extends ChartElement
{
@@ -42,15 +47,10 @@ public class ChartBackgroundFill extends ChartElement
super.updateDisplayList(unscaledWidth, unscaledHeight);
graphics.clear();
- graphics.beginFill(0x111111);
- graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
- graphics.endFill();
- graphics.beginFill(0x151515);
- graphics.drawRect(1, 1, unscaledWidth - 1, unscaledHeight - 1);
+ graphics.lineStyle(1, getStyle("borderFillColor"));
+ graphics.beginFill(getStyle("fillColor"));
+ graphics.drawRect(1, 1, unscaledWidth - 2, unscaledHeight - 2);
graphics.endFill();
-
- //GraphicsUtilities.fillRect(graphics, -1, -1, unscaledWidth + 1, unscaledHeight + 1, new SolidColor(0x111111));
- //GraphicsUtilities.fillRect(graphics, 0, 0, unscaledWidth, unscaledHeight, _fill);
}
override public function mappingChanged():void
@@ -0,0 +1,66 @@
+package com.jamesward.census2.charts
+{
+ import mx.charts.AxisRenderer;
+ import mx.graphics.Stroke;
+
+ [Style(name="axisStrokeColor", type="uint", format="Color", inherit="yes")]
+ [Style(name="axisStrokeWeight", type="Number", format="Length", inherit="yes")]
+
+ [Style(name="minorTickStrokeColor", type="uint", format="Color", inherit="yes")]
+ [Style(name="minorTickStrokeWeight", type="Number", format="Length", inherit="yes")]
+
+ [Style(name="tickStrokeColor", type="uint", format="Color", inherit="yes")]
+ [Style(name="tickStrokeWeight", type="Number", format="Length", inherit="yes")]
+
+ public class StyledAxisRenderer extends AxisRenderer
+ {
+
+ public function StyledAxisRenderer()
+ {
+ super();
+
+ setStyle("tickPlacement", "none");
+ setStyle("showLine", false);
+ }
+
+ override public function styleChanged(styleProp:String):void
+ {
+ super.styleChanged(styleProp);
+
+ var stylesUpdated:Boolean = false;
+
+ if ((styleProp != "axisStroke") && (styleProp != "minorTickStroke") && (styleProp != "tickStroke"))
+ {
+ if ((getStyle("axisStrokeColor") != null) && (getStyle("axisStrokeColor") != null))
+ {
+ var axisStroke:Stroke = new Stroke(getStyle("axisStrokeColor"), getStyle("axisStrokeColor"));
+ setStyle("axisStroke", axisStroke);
+
+ stylesUpdated = true;
+ }
+
+ if ((getStyle("minorTickStrokeColor") != null) && (getStyle("minorTickStrokeWeight") != null))
+ {
+ var minorTickStroke:Stroke = new Stroke(getStyle("minorTickStrokeColor"), getStyle("minorTickStrokeWeight"));
+ setStyle("minorTickStroke", minorTickStroke);
+
+ stylesUpdated = true;
+ }
+
+ if ((getStyle("tickStrokeColor") != null) && (getStyle("tickStrokeWeight") != null))
+ {
+ var tickStroke:Stroke = new Stroke(getStyle("tickStrokeColor"), getStyle("tickStrokeWeight"));
+ setStyle("tickStroke", tickStroke);
+
+ stylesUpdated = true;
+ }
+
+ if (stylesUpdated)
+ {
+ invalidateDisplayList();
+ }
+ }
+ }
+
+ }
+}
Oops, something went wrong.

0 comments on commit 0954324

Please sign in to comment.