Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE2
-rw-r--r--TODO7
-rwxr-xr-xindex.php39
-rw-r--r--libs/open-flash-chart/README.txt8
-rw-r--r--libs/open-flash-chart/actionscript/AreaHollow.as82
-rw-r--r--libs/open-flash-chart/actionscript/Background.as121
-rw-r--r--libs/open-flash-chart/actionscript/Bar3D.as118
-rw-r--r--libs/open-flash-chart/actionscript/BarArrow.as107
-rw-r--r--libs/open-flash-chart/actionscript/BarFade.as55
-rw-r--r--libs/open-flash-chart/actionscript/BarGlassStyle.as106
-rw-r--r--libs/open-flash-chart/actionscript/BarStyle.as137
-rw-r--r--libs/open-flash-chart/actionscript/Box.as164
-rw-r--r--libs/open-flash-chart/actionscript/ChartUtil.as271
-rw-r--r--libs/open-flash-chart/actionscript/Css.as248
-rw-r--r--libs/open-flash-chart/actionscript/ExPoint.as25
-rw-r--r--libs/open-flash-chart/actionscript/FilledBarStyle.as56
-rw-r--r--libs/open-flash-chart/actionscript/InnerBackground.as75
-rw-r--r--libs/open-flash-chart/actionscript/Keys.as117
-rw-r--r--libs/open-flash-chart/actionscript/LineDot.as78
-rw-r--r--libs/open-flash-chart/actionscript/LineHollow.as65
-rw-r--r--libs/open-flash-chart/actionscript/LineStyle.as129
-rw-r--r--libs/open-flash-chart/actionscript/Loading.as82
-rw-r--r--libs/open-flash-chart/actionscript/MinMax.as47
-rw-r--r--libs/open-flash-chart/actionscript/PieStyle.as275
-rw-r--r--libs/open-flash-chart/actionscript/README.txt16
-rw-r--r--libs/open-flash-chart/actionscript/Size.as11
-rw-r--r--libs/open-flash-chart/actionscript/Square.as19
-rw-r--r--libs/open-flash-chart/actionscript/String.prototype.replace.as42
-rw-r--r--libs/open-flash-chart/actionscript/Style.as28
-rw-r--r--libs/open-flash-chart/actionscript/Title.as101
-rw-r--r--libs/open-flash-chart/actionscript/Values.as181
-rw-r--r--libs/open-flash-chart/actionscript/XAxis.as206
-rw-r--r--libs/open-flash-chart/actionscript/XAxisLabels.as156
-rw-r--r--libs/open-flash-chart/actionscript/XLabelStyle.as31
-rw-r--r--libs/open-flash-chart/actionscript/XLegend.as72
-rw-r--r--libs/open-flash-chart/actionscript/YAxis.as142
-rw-r--r--libs/open-flash-chart/actionscript/YAxisLabels.as96
-rw-r--r--libs/open-flash-chart/actionscript/YLabelStyle.as68
-rw-r--r--libs/open-flash-chart/actionscript/YLegend.as69
-rw-r--r--libs/open-flash-chart/actionscript/YTicks.as21
-rw-r--r--libs/open-flash-chart/actionscript/open-flash-chart.as693
-rw-r--r--libs/open-flash-chart/actionscript/open-flash-chart.flabin0 -> 66048 bytes
-rw-r--r--libs/open-flash-chart/actionscript/prototype.drawCircle.as19
-rw-r--r--libs/open-flash-chart/actionscript/prototype.fillCircle.as22
-rw-r--r--libs/open-flash-chart/actionscript/rrectangle.as36
-rw-r--r--libs/open-flash-chart/data-files/data-1.txt11
-rw-r--r--libs/open-flash-chart/data-files/data-10.txt7
-rw-r--r--libs/open-flash-chart/data-files/data-11.txt14
-rw-r--r--libs/open-flash-chart/data-files/data-12.txt21
-rw-r--r--libs/open-flash-chart/data-files/data-13.txt14
-rw-r--r--libs/open-flash-chart/data-files/data-14.txt21
-rw-r--r--libs/open-flash-chart/data-files/data-15.txt7
-rw-r--r--libs/open-flash-chart/data-files/data-16.txt35
-rw-r--r--libs/open-flash-chart/data-files/data-17.txt17
-rw-r--r--libs/open-flash-chart/data-files/data-18.txt17
-rw-r--r--libs/open-flash-chart/data-files/data-19.txt18
-rw-r--r--libs/open-flash-chart/data-files/data-2.txt8
-rw-r--r--libs/open-flash-chart/data-files/data-20.txt17
-rw-r--r--libs/open-flash-chart/data-files/data-21.txt32
-rw-r--r--libs/open-flash-chart/data-files/data-22.txt43
-rw-r--r--libs/open-flash-chart/data-files/data-23.txt45
-rw-r--r--libs/open-flash-chart/data-files/data-25.txt1
-rw-r--r--libs/open-flash-chart/data-files/data-26.txt1
-rw-r--r--libs/open-flash-chart/data-files/data-27.txt1
-rw-r--r--libs/open-flash-chart/data-files/data-28.txt5
-rw-r--r--libs/open-flash-chart/data-files/data-29.txt13
-rw-r--r--libs/open-flash-chart/data-files/data-3.txt13
-rw-r--r--libs/open-flash-chart/data-files/data-30.txt1
-rw-r--r--libs/open-flash-chart/data-files/data-31.txt1
-rw-r--r--libs/open-flash-chart/data-files/data-32.txt1
-rw-r--r--libs/open-flash-chart/data-files/data-34.txt1
-rw-r--r--libs/open-flash-chart/data-files/data-35.txt1
-rw-r--r--libs/open-flash-chart/data-files/data-36.txt2
-rw-r--r--libs/open-flash-chart/data-files/data-37.txt1
-rw-r--r--libs/open-flash-chart/data-files/data-38.txt1
-rw-r--r--libs/open-flash-chart/data-files/data-39.txt1
-rw-r--r--libs/open-flash-chart/data-files/data-4.txt13
-rw-r--r--libs/open-flash-chart/data-files/data-5.txt10
-rw-r--r--libs/open-flash-chart/data-files/data-6.txt18
-rw-r--r--libs/open-flash-chart/data-files/data-7.txt10
-rw-r--r--libs/open-flash-chart/data-files/data-8.txt10
-rw-r--r--libs/open-flash-chart/data-files/data-9.txt5
-rw-r--r--libs/open-flash-chart/data-files/data.txt9
-rw-r--r--libs/open-flash-chart/data-files/logo.pngbin0 -> 1588 bytes
-rw-r--r--libs/open-flash-chart/data-files/nodata.txt9
-rw-r--r--libs/open-flash-chart/open-flash-chart.swfbin0 -> 40635 bytes
-rw-r--r--libs/open-flash-chart/php-ofc-library/README.txt16
-rw-r--r--libs/open-flash-chart/php-ofc-library/open_flash_chart_object.php2
-rw-r--r--libs/swfobject/README.txt12
-rw-r--r--libs/swfobject/swfobject.js233
-rw-r--r--modules/SmartyPlugins/function.url.php13
-rw-r--r--modules/Url.php30
-rw-r--r--modules/View.php3
-rw-r--r--modules/View/DataTableCloud.php85
-rw-r--r--modules/ViewDataTable.php (renamed from modules/View/DataTable.php)38
-rw-r--r--modules/ViewDataTable/Cloud.php234
-rw-r--r--modules/ViewDataTable/DataTableCloud.php85
-rw-r--r--modules/ViewDataTable/GenerateGraphData.php77
-rw-r--r--modules/ViewDataTable/Graph.php117
-rw-r--r--modules/ViewDataTable/HtmlAjax.php2
-rw-r--r--modules/Visualization/Chart.php48
-rw-r--r--modules/Visualization/ChartPie.php32
-rw-r--r--modules/Visualization/ChartVerticalBar.php26
-rw-r--r--modules/Visualization/Cloud.php (renamed from modules/View/Cloud.php)14
-rw-r--r--modules/Visualization/OpenFlashChart.php565
-rw-r--r--modules/iView.php6
-rw-r--r--plugins/Actions/Controller.php2
-rw-r--r--plugins/Home/Controller.php7
-rw-r--r--plugins/UserSettings/Controller.php44
-rw-r--r--plugins/UserSettings/templates/datatable.js3
-rw-r--r--plugins/UserSettings/templates/datatable_footer.tpl2
-rw-r--r--plugins/UserSettings/templates/graph.tpl18
-rw-r--r--plugins/UserSettings/templates/index.tpl1
-rw-r--r--tests/modules/ArchiveProcessing/Day.test.php3
-rw-r--r--themes/default/images/chart_bar.pngbin0 -> 541 bytes
-rw-r--r--themes/default/images/chart_pie.pngbin0 -> 918 bytes
116 files changed, 6200 insertions, 416 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000000..360f877de2
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,2 @@
+# GNU/GPL v2 or later
+see misc/license.txt \ No newline at end of file
diff --git a/TODO b/TODO
index c944cdc1d2..247f581b43 100644
--- a/TODO
+++ b/TODO
@@ -61,3 +61,10 @@ When commenting
- check warning PHP DOC for missing @package
- look for "[TAB]function " for missing public/private on methods
+RELEASE PROCESS
+===============
+Delete from the release
+- documentation/
+- libs/phpDocumentor
+- tmp
+
diff --git a/index.php b/index.php
index 7066ca942d..1bca877c06 100755
--- a/index.php
+++ b/index.php
@@ -37,42 +37,3 @@ $controller = new Piwik_FrontController;
$controller->init();
$controller->dispatch();
$controller->end();
-
-exit;
-
-//
-//main();
-
-function dump($var)
-{
- print("<pre>");
- var_export($var);
- print("</pre>");
-}
-
-?>
-
-<br>
-<br>
-<a href="piwik.php?idsite=1&download=http://php.net/get&name=test download/ the file">test download </a>
-<br>
-<a href="piwik.php?idsite=1&download=http://php.net/get">test download - without name var</a>
-<br>
-<a href="piwik.php?idsite=1&link=http://php.net/&name=php.net website">test link php</a>
-<br>
-<a href="piwik.php?idsite=1&link=http://php.net/">test link php - without name var</a>
-<br>
-<!-- Piwik -->
-<a href="http://piwik.org" title="Web analytics" onclick="window.open(this.href);return(false);">
-<script language="javascript" src="piwik.js" type="text/javascript"></script>
-<script type="text/javascript">
-<!--
- piwik_action_name = '';
- piwik_idsite = 1;
- piwik_url = "http://localhost/dev/piwiktrunk/piwik.php";
- piwik_log(piwik_action_name, piwik_idsite, piwik_url);
-//-->
-</script><object>
-<noscript><p>Web analytics<img src="http://localhost/dev/piwiktrunk/piwik.php" style="border:0" /></p>
-</noscript></object></a>
-<!-- /Piwik --> \ No newline at end of file
diff --git a/libs/open-flash-chart/README.txt b/libs/open-flash-chart/README.txt
new file mode 100644
index 0000000000..90f3e77a18
--- /dev/null
+++ b/libs/open-flash-chart/README.txt
@@ -0,0 +1,8 @@
+Hello.
+
+This is the Open Flash Chart source code.
+
+Take a look around :-)
+
+The test data is in the 'data-files' directory.
+
diff --git a/libs/open-flash-chart/actionscript/AreaHollow.as b/libs/open-flash-chart/actionscript/AreaHollow.as
new file mode 100644
index 0000000000..e6d84fda69
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/AreaHollow.as
@@ -0,0 +1,82 @@
+class AreaHollow extends LineHollow
+{
+ public var bottom:Number=-1;
+ public var alpha:Number=50;
+ private var mc_area:MovieClip
+ private var fill_colour:Number;
+
+ public function AreaHollow( val:String, bgColour:Number, name:String )
+ {
+ //this.values = values;
+ this.bgColour = bgColour;
+ this.name = name;
+
+ var vals:Array = val.split(",");
+ this.line_width = Number( vals[0] );
+ this.circle_size = Number( vals[1] );
+ this.alpha = Number( vals[2] );
+ this.colour = _root.get_colour( vals[3] );
+
+ if( vals.length > 4 )
+ this.key = vals[4];
+
+ if( vals.length > 5 )
+ this.font_size = Number( vals[5] );
+
+ // patch from Will Henry
+ if( vals.length > 6 )
+ this.fill_colour = _root.get_colour( vals[6] );
+ else
+ this.fill_colour = this.colour;
+
+ // draw the area behine the line:
+ this.mc_area = _root.createEmptyMovieClip( name+'_area', _root.getNextHighestDepth());
+ this.mc = _root.createEmptyMovieClip( name, _root.getNextHighestDepth());
+ }
+
+ public function valPos( b:Box, right_axis:Boolean, min:Number )
+ {
+ // we need this to draw the area:
+ this.bottom = b.getY( 0, right_axis );
+ super.valPos( b, right_axis, min );
+ }
+
+ public function draw()
+ {
+ var colour:Number = 0x000000;
+ if(this.fill_colour == '') {
+ this.fill_colour = this.colour;
+ }
+
+ this.mc_area.clear();
+
+// this.mc_area.beginFill( this.colour, this.alpha );
+
+ this.mc_area.beginFill(this.fill_colour, this.alpha );
+
+ var pos:Number = 0;
+ while( this.ExPoints[pos] == null )
+ pos++;
+
+ this.mc_area.moveTo( this.ExPoints[pos].center, this.bottom );
+ this.mc_area.lineTo( this.ExPoints[pos].center, this.ExPoints[pos].y );
+
+ var last:ExPoint = null;
+ for( var i:Number=pos+1; i < this.ExPoints.length; i++ )
+ {
+ if( this.ExPoints[i] != null )
+ {
+ this.mc_area.lineTo( this.ExPoints[i].center, this.ExPoints[i].y );
+ last = this.ExPoints[i];
+ }
+ }
+
+ if( last != null )
+ this.mc_area.lineTo( last.center, this.bottom );
+
+ this.mc_area.endFill();
+
+ // now draw the line + hollow dots
+ super.draw();
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/Background.as b/libs/open-flash-chart/actionscript/Background.as
new file mode 100644
index 0000000000..515dc57e6d
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/Background.as
@@ -0,0 +1,121 @@
+class Background
+{
+ private var colour:Number=0;
+ private var mc:MovieClip;
+ private var img_mc:MovieClip;
+ private var img_x;
+ private var img_y;
+
+ // added by NetVicious, 05 July, 2007
+ function positionize( mc:MovieClip, myX, myY, s:Square )
+ {
+ var newX:Number = 0;
+ var newY:Number = 0;
+
+ if ( isNaN(myX) ) {
+ myX.toLowerCase()
+ switch ( myX ) {
+ case 'center':
+ newX = (s.width / 2) - (mc._width / 2);
+ break;
+ case 'left':
+ newX = s.left;
+ break;
+ case 'right':
+ newX = s.right - mc._width;
+ break;
+ default:
+ newX = 0;
+ }
+ } else if ( myX < 0 ) {
+ newX = s.right - mc._width - myX;
+ } else { newX = s.left + myX; }
+
+ if ( isNaN(myY) ) {
+ myY.toLowerCase();
+ switch ( myY ) {
+ case 'middle':
+ newY = (s.height / 2) - (mc._height / 2);
+ break;
+ case 'top':
+ newY = s.top;
+ break;
+ case 'bottom':
+ newY = s.bottom - mc._height;
+ break;
+ default:
+ newY = 0;
+ }
+ } else if ( myY < 0 ) {
+ newY = s.bottom - mc._height - myY;
+ } else { newY = s.top + myY; }
+
+ mc._x = newX;
+ mc._y = newY;
+ }
+
+
+ function Background( lv:LoadVars )
+ {
+ if( lv.bg_colour != undefined )
+ this.colour = _root.get_colour( lv.bg_colour );
+ else
+ this.colour = 0xf8f8d8; // <-- default to Ivory
+
+ this.mc = _root.createEmptyMovieClip( "background", _root.getNextHighestDepth(), 0, 0, Stage.width, Stage.height );
+
+ if( lv.bg_image != undefined )
+ {
+ this.img_mc = _root.createEmptyMovieClip( "background_img", _root.getNextHighestDepth(), 0, 0, Stage.width, Stage.height );
+ //this.img_mc.cacheAsBitmap = true;
+ //this.img_mc.opaqueBackground = 0xFFFFFF;
+ // this.img_mc is replaced with the loaded image:
+
+ // added by NetVicious, 05 July, 2007 ++++
+
+ if( lv.bg_image_x != undefined )
+ this.img_x = lv.bg_image_x;
+
+ if( lv.bg_image_y != undefined )
+ this.img_y = lv.bg_image_y;
+
+ var ref = this; // This variable it's used for avoid the scope loss
+
+ var loader:MovieClipLoader = new MovieClipLoader();
+ loader.addListener({
+ onLoadInit: function(mymc:MovieClip) {
+ ref.positionize( mymc, ref.img_x, ref.img_y, new Square(0, 0, Stage.width, Stage.height) );
+ delete loader;
+ }
+ });
+
+ loader.loadClip(lv.bg_image, this.img_mc);
+ // ++++++++++++++++++++++++++++++++++++++++
+
+// loader = new MovieClipLoader()
+// //Give us status updates by firing events
+// loader.addListener(this)
+
+ //loadMovie(lv.bg_image, this.img_mc );
+ }
+ }
+
+ // the background doesn't 'move' but
+ // it does re-size:
+ function move()
+ {
+ this.mc.clear();
+ this.mc.beginFill( this.colour, 100 );
+ this.mc.moveTo( 0, 0 );
+ this.mc.lineTo( Stage.width, 0 );
+ this.mc.lineTo( Stage.width, Stage.height );
+ this.mc.lineTo( 0, Stage.height );
+ this.mc.endFill();
+
+ // do we have an image, and did it load:
+ if(( this.img_mc != undefined ) and (this.img_mc._width != undefined))
+ {
+ positionize( this.img_mc, this.img_x, this.img_y, new Square(0, 0, Stage.width, Stage.height) );
+ }
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/Bar3D.as b/libs/open-flash-chart/actionscript/Bar3D.as
new file mode 100644
index 0000000000..4a4642bb50
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/Bar3D.as
@@ -0,0 +1,118 @@
+class Bar3D extends BarStyle
+{
+ public var is_bar:Boolean = true;
+ public var outline_colour:Number = 0x000000;
+
+ public function Bar3D( val:String, name:String )
+ {
+ super( val, name );
+ }
+
+ private function top( mc:MovieClip, val:ExPoint )
+ {
+ //
+ var w:Number = val.bar_width;
+ //var rad:Number = 7;
+
+// mc.lineStyle(0, this.outline_colour, 100);
+ mc.lineStyle(0, this.outline_colour, 0);
+ //set gradient fill
+
+ var lighter:Number = ChartUtil.Lighten( this.colour );
+
+ var colors:Array = [this.colour,lighter];
+ var alphas:Array = [100,100];
+ var ratios:Array = [0,255];
+ var matrix:Object = { matrixType:"box", x:0, y:0, w:w+12, h:12, r:(270/180)*Math.PI };
+ mc.beginGradientFill("linear", colors, alphas, ratios, matrix);
+
+
+ //mc.beginFill(this.colour, 100);
+ mc.moveTo(0, 0);
+ mc.lineTo(w, 0);
+ mc.lineTo(w-12, 12);
+ mc.lineTo(-12, 12);
+ mc.endFill();
+ mc._x = val.left;
+ mc._y = val.y;
+ }
+
+ private function front( mc:MovieClip, val:ExPoint )
+ {
+ //
+ var w:Number = val.bar_width;
+ var h:Number = val.bar_bottom-val.y;
+ var x:Number = val.left;
+ var y:Number = val.y;
+ var rad:Number = 7;
+
+ var lighter:Number = ChartUtil.Lighten( this.colour );
+
+ // Darken a light color
+ //var darker:Number = this.colour;
+ //darker &= 0x7F7F7F;
+
+ var colors:Array = [lighter,this.colour];
+ var alphas:Array = [100,100];
+ var ratios:Array = [0,127];
+ var matrix:Object = { matrixType:"box", x:-12, y:12, w:w-12, h:h+12, r:(90/180)*Math.PI };
+ mc.beginGradientFill("linear", colors, alphas, ratios, matrix);
+
+ mc.moveTo(-12, 12);
+ mc.lineTo(-12, h+12);
+ mc.lineTo(w-12, h+12);
+ mc.lineTo(w-12, 12);
+ mc.endFill();
+ }
+
+ private function side( mc:MovieClip, val:ExPoint )
+ {
+ //
+ var w:Number = val.bar_width;
+ var h:Number = val.bar_bottom-val.y;
+ var x:Number = val.left;
+ var y:Number = val.y;
+ var rad:Number = 7;
+
+ var lighter:Number = ChartUtil.Lighten( this.colour );
+
+ var colors:Array = [this.colour,lighter];
+ var alphas:Array = [100,100];
+ var ratios:Array = [0,255];
+ var matrix:Object = { matrixType:"box", x:w-12, y:0, w:w, h:h+12, r:(270/180)*Math.PI };
+ mc.beginGradientFill("linear", colors, alphas, ratios, matrix);
+
+ mc.lineStyle(0, this.outline_colour, 0);
+ //mc.beginFill(this.colour, 100);
+ mc.moveTo(w, 0);
+ mc.lineTo(w, h);
+ mc.lineTo(w-12, h+12);
+ mc.lineTo(w-12, 12);
+ mc.endFill();
+ };
+
+ public function draw_bar( val:ExPoint, i:Number )
+ {
+ var mc:MovieClip = this.bar_mcs[i];
+
+ mc.clear();
+ this.top( mc, val );
+ this.front( mc, val );
+ this.side( mc, val );
+
+ var dropShadow = new flash.filters.DropShadowFilter();
+ dropShadow.blurX = 5;
+ dropShadow.blurY = 5;
+ dropShadow.distance = 3;
+ dropShadow.angle = 45;
+ dropShadow.quality = 2;
+ dropShadow.alpha = 0.4;
+ //mc.filters = [dropShadow];
+
+ mc._alpha = this.alpha;
+ mc._alpha_original = this.alpha; // <-- remember our original alpha while tweening
+
+ // this is used in _root.FadeIn and _root.FadeOut
+ mc.val = val;
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/BarArrow.as b/libs/open-flash-chart/actionscript/BarArrow.as
new file mode 100644
index 0000000000..d99396dd70
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/BarArrow.as
@@ -0,0 +1,107 @@
+class BarArrow extends BarStyle
+{
+ public function BarArrow( val:String, name:String )
+ {
+ super( val, name );
+ }
+
+ public function draw_bar( val:ExPoint, i:Number )
+ {
+ var mc:MovieClip = super.draw_bar( val, i );
+
+ //var mc:MovieClip = this.bar_mcs[i];
+
+ mc.lineStyle( 2, 0x000000, 100);
+
+ mc.moveTo( val.left+(val.bar_width/2), val.bar_bottom );
+
+ var steps:Number = Math.floor( 4+Math.random()*4);
+ var height:Number = (val.bar_bottom-val.y)/steps;
+ var x:Number;
+ var y:Number;
+
+ for( var i:Number=1; i<steps; i++ )
+ {
+ x = Math.random()*(val.bar_width/2);
+ y = val.bar_bottom-(height*i)
+
+ // zig-zag the line:
+ if( i%2==0 )
+ x += val.left;
+ else
+ x = val.left+val.bar_width-x;
+
+ mc.lineTo( x, y );
+ }
+ mc.lineTo( val.left+(val.bar_width/2), val.y );
+
+ //
+ //
+ //
+
+ mc.moveTo( val.left+(val.bar_width/2), val.bar_bottom );
+
+ var steps:Number = 8;
+ var height:Number = (val.bar_bottom-val.y)/steps;
+ var x:Number;
+ var y:Number;
+
+ var prev_x:Number = val.left+(val.bar_width/2);
+ var prev_y:Number = val.bar_bottom;
+
+ for( var i:Number=1; i<steps; i++ )
+ {
+// x = Math.random()*(val.bar_width/2);
+ y = val.bar_bottom-(height*i)
+
+ // zig-zag the line:
+ if( i%2==0 )
+ x = val.left;
+ else
+ x = val.left+val.bar_width;
+
+ mc.curveTo( x, y, val.left+(val.bar_width/2), val.bar_bottom-(height*(i+1)) );
+ }
+ mc.lineTo( val.left+(val.bar_width/2), val.y );
+
+ x = val.left+(val.bar_width/2)-x;
+ y = val.y-y;
+
+ var angle:Number = Math.atan(y/x)/(Math.PI/180);
+ if( x<0 )
+ {
+ angle += 180;
+ }
+ if( x>=0 && y<0 )
+ {
+ angle += 360;
+ }
+ angle += 180;
+
+ var r:Number=20;
+
+ var radian = (angle+20) * Math.PI/180;
+ var cos:Number = Math.cos(radian);
+ var sin:Number = Math.sin(radian);
+
+ var x_1 = Math.cos(radian)*r;
+ var y_1 = Math.sin(radian)*r;
+
+ var radian = (angle-20) * Math.PI/180;
+ var cos:Number = Math.cos(radian);
+ var sin:Number = Math.sin(radian);
+
+ var x_2 = Math.cos(radian)*r;
+ var y_2 = Math.sin(radian)*r;
+
+ mc.lineStyle( 0, 0x0000E0, 100);
+ //mc.beginFill( 0x0000E0, 100 );
+ mc.moveTo( val.left+(val.bar_width/2), val.y );
+ mc.lineTo( val.left+(val.bar_width/2)+x_1, val.y+y_1 );
+ mc.lineTo( val.left+(val.bar_width/2)+x_2, val.y+y_2 );
+ mc.lineTo( val.left+(val.bar_width/2), val.y );
+ //mc.endFill();
+
+ return mc;
+ }
+}
diff --git a/libs/open-flash-chart/actionscript/BarFade.as b/libs/open-flash-chart/actionscript/BarFade.as
new file mode 100644
index 0000000000..6312957600
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/BarFade.as
@@ -0,0 +1,55 @@
+class BarFade extends BarStyle
+{
+ public function BarFade( val:String, name:String )
+ {
+ super( val, name );
+ }
+
+ public function draw_bar( val:ExPoint, i:Number )
+ {
+ var mc:MovieClip = this.bar_mcs[i];
+ mc.clear();
+
+ var top:Number;
+ var height:Number;
+
+ if(val.bar_bottom<val.y)
+ {
+ top = val.bar_bottom;
+ height = val.y-val.bar_bottom;
+ }
+ else
+ {
+ top = val.y
+ height = val.bar_bottom-val.y;
+ }
+
+ //set gradient fill
+ var colors:Array = [this.colour,0xFFFFFF];
+ var alphas:Array = [100,0];
+ var ratios:Array = [0,255];
+ var matrix:Object = { matrixType:"box", x:0, y:0, w:val.bar_width, h:height, r:(90/180)*Math.PI };
+ mc.beginGradientFill("linear", colors, alphas, ratios, matrix);
+
+
+ //mc.beginFill( this.colour, 100 );
+ mc.moveTo( 0, 0 );
+ mc.lineTo( val.bar_width, 0 );
+ mc.lineTo( val.bar_width, height );
+ mc.lineTo( 0, height );
+ mc.lineTo( 0, 0 );
+ mc.endFill();
+
+ mc._x = val.left;
+ mc._y = top;
+
+ mc._alpha = this.alpha;
+ mc._alpha_original = this.alpha; // <-- remember our original alpha while tweening
+
+ // this is used in _root.FadeIn and _root.FadeOut
+ //mc.val = val;
+
+ // we return this MovieClip to FilledBarStyle
+ return mc;
+ }
+}
diff --git a/libs/open-flash-chart/actionscript/BarGlassStyle.as b/libs/open-flash-chart/actionscript/BarGlassStyle.as
new file mode 100644
index 0000000000..bd2273f5cc
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/BarGlassStyle.as
@@ -0,0 +1,106 @@
+class BarGlassStyle extends BarStyle
+{
+ public var is_bar:Boolean = true;
+ public var outline_colour:Number = 0x000000;
+
+ public function BarGlassStyle( val:String, name:String )
+ {
+ this.name = name;
+ this.parse( val );
+ }
+
+ public function parse( val:String )
+ {
+ var vals:Array = val.split(",");
+
+ this.alpha = Number( vals[0] );
+ this.colour = _root.get_colour( vals[1] );
+ this.outline_colour = _root.get_colour( vals[2] );
+
+ if( vals.length > 3 )
+ this.key = vals[3];
+
+ if( vals.length > 4 )
+ this.font_size = Number( vals[4] );
+
+ }
+
+ private function glass( mc:MovieClip, val:ExPoint )
+ {
+ var x:Number = 3;
+ var y:Number = x;
+ var width:Number = (val.bar_width/2)-x;
+ var height:Number = val.bar_bottom-val.y-y-1;
+
+ //set gradient fill
+ var colors:Array = [0xFFFFFF,0xFFFFFF];
+ var alphas:Array = [30, 70];
+ var ratios:Array = [0,255];
+ var matrix:Object = { matrixType:"box", x:x, y:y, w:width, h:height, r:(180/180)*Math.PI };
+ mc.beginGradientFill("linear", colors, alphas, ratios, matrix);
+
+
+ mc.lineStyle(0, 0, 0);
+
+ var rad:Number = 3;
+ var w:Number = width;
+ var h:Number = height;
+
+ //this.beginFill(this.shine_colour, 100);
+ mc.moveTo(x+rad, y);
+ mc.lineTo(x+w, y);
+ mc.lineTo(x+w, y+h);
+ mc.lineTo(x+rad, y+h);
+ mc.curveTo(x, y+h, x, y+h-rad);
+ mc.lineTo(x, y+rad);
+ mc.endFill();
+
+ }
+
+ private function bg( mc:MovieClip, val:ExPoint )
+ {
+ //
+ var w:Number = val.bar_width;
+ var h:Number = val.bar_bottom-val.y;
+ var x:Number = val.left;
+ var y:Number = val.y;
+ var rad:Number = 7;
+
+ mc.lineStyle(0, this.outline_colour, 100);
+ mc.beginFill(this.colour, 100);
+ mc.moveTo(0+rad, 0);
+ mc.lineTo(w-rad, 0);
+ mc.curveTo(w, 0, w, rad);
+ mc.lineTo(w, h);
+ mc.lineTo(0, h);
+ mc.lineTo(0, 0+rad);
+ mc.curveTo(0, 0, 0+rad, 0);
+ mc.endFill();
+ mc._x = x;
+ mc._y = y;
+ };
+
+ public function draw_bar( val:ExPoint, i:Number )
+ {
+ var mc:MovieClip = this.bar_mcs[i];
+
+ mc.clear();
+ this.bg( mc, val );
+ this.glass( mc, val );
+
+ var dropShadow = new flash.filters.DropShadowFilter();
+ dropShadow.blurX = 5;
+ dropShadow.blurY = 5;
+ dropShadow.distance = 3;
+ dropShadow.angle = 45;
+ dropShadow.quality = 2;
+ dropShadow.alpha = 0.4;
+ mc.filters = [dropShadow];
+
+ mc._alpha = this.alpha;
+ mc._alpha_original = this.alpha; // <-- remember our original alpha while tweening
+
+ // this is used in _root.FadeIn and _root.FadeOut
+ //mc.val = val;
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/BarStyle.as b/libs/open-flash-chart/actionscript/BarStyle.as
new file mode 100644
index 0000000000..bb975ea409
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/BarStyle.as
@@ -0,0 +1,137 @@
+class BarStyle extends Style
+{
+ public var is_bar:Boolean = true;
+
+ // MovieClip that holds each bar:
+ private var bar_mcs:Array;
+ public var name:String;
+
+ public function BarStyle( val:String, name:String )
+ {
+ this.name = name;
+ // this calls parent obj Style.Style first
+ this.parse_bar( val );
+ }
+
+ public function parse_bar( val:String )
+ {
+ var vals:Array = val.split(",");
+
+ this.alpha = Number( vals[0] );
+ this.colour = _root.get_colour(vals[1]);
+
+ if( vals.length > 2 )
+ this.key = vals[2];
+
+ if( vals.length > 3 )
+ this.font_size = Number( vals[3] );
+
+ }
+
+ // override Style:set_values
+ function set_values( v:Array, labels:Array )
+ {
+ super.set_values( v );
+
+ // make an empty array to hold each bar MovieClip:
+ this.bar_mcs = new Array(this.values.length);
+
+ for( var i:Number=0; i < this.values.length; i++ )
+ {
+ var mc:MovieClip = _root.createEmptyMovieClip( this.name+'_'+i, _root.getNextHighestDepth() );
+
+ mc.onRollOver = _root.FadeIn;
+ mc.onRollOut = _root.FadeOut;
+
+ //mc.onRollOver = ChartUtil.glowIn;
+
+ // this is used in FadeIn and FadeOut
+ //mc.tool_tip_title = labels[i];
+ var tooltip:Object = {x_label:labels[i], value:this.values[i], key:this.key};
+ mc.tooltip = tooltip;
+
+ // add the MovieClip to our array:
+ this.bar_mcs[i] = mc;
+ }
+
+ }
+
+
+ public function valPos( b:Box, right_axis:Boolean, min:Number, bar_count:Number, bar:Number )
+ {
+ this.ExPoints=Array();
+
+ var item_width:Number = b.width_() / values.length;
+
+ // the bar(s) have gaps between them:
+ var bar_set_width:Number = item_width*0.8;
+ // get the margin between sets of bars:
+ var bar_left:Number = b.left_()+((item_width-bar_set_width)/2);
+ // 1 bar == 100% wide, 2 bars = 50% wide each
+ var bar_width:Number = bar_set_width/bar_count;
+
+ for( var i:Number=0; i < this.values.length; i++)
+ {
+
+ var left2:Number = bar_left+(i*item_width);
+ left2 += bar_width*bar;
+
+ this.ExPoints.push(
+ new ExPoint(
+ left2, // x position of value
+ 0, // center (not applicable for a bar)
+ b.getY( Number(this.values[i]), right_axis ),
+ bar_width,
+ b.getYbottom( right_axis ),
+ Number(values[i])
+ )
+ );
+ }
+ }
+
+ public function draw()
+ {
+ for( var i:Number=0; i < this.ExPoints.length; i++ )
+ this.draw_bar( this.ExPoints[i], i );
+ }
+
+ public function draw_bar( val:ExPoint, i:Number )
+ {
+ var top:Number;
+ var height:Number;
+
+ if(val.bar_bottom<val.y)
+ {
+ top = val.bar_bottom;
+ height = val.y-val.bar_bottom;
+ }
+ else
+ {
+ top = val.y
+ height = val.bar_bottom-val.y;
+ }
+
+ var mc:MovieClip = this.bar_mcs[i];
+
+ mc.clear();
+ mc.beginFill( this.colour, 100 );
+ mc.moveTo( 0, 0 );
+ mc.lineTo( val.bar_width, 0 );
+ mc.lineTo( val.bar_width, height );
+ mc.lineTo( 0, height );
+ mc.lineTo( 0, 0 );
+ mc.endFill();
+
+ mc._x = val.left;
+ mc._y = top;
+
+ mc._alpha = this.alpha;
+ mc._alpha_original = this.alpha; // <-- remember our original alpha while tweening
+
+ // this is used in _root.FadeIn and _root.FadeOut
+ //mc.val = val;
+
+ // we return this MovieClip to FilledBarStyle
+ return mc;
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/Box.as b/libs/open-flash-chart/actionscript/Box.as
new file mode 100644
index 0000000000..b94e223fb0
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/Box.as
@@ -0,0 +1,164 @@
+class Box
+{
+ public var top:Number=0;
+ public var left:Number=0;
+ public var right:Number=0;
+ public var bottom:Number=0;
+ public var width:Number=0;
+ public var height:Number=0;
+
+ // position of the zero line
+ //public var zero:Number=0;
+ //public var steps:Number=0;
+
+ // set by 3D axis
+ public var tick_offset:Number=0;
+
+ public var count:Number = 0;
+
+ private var minmax:MinMax;
+
+ public function Box( top:Number, left:Number, right:Number, bottom:Number,
+ minmax:MinMax,
+ x_left_label_width:Number, x_right_label_width:Number,
+ count:Number, jiggle:Boolean, three_d:Boolean )
+ {
+
+ var tmp_left:Number = left;
+
+ if( jiggle )
+ {
+ right = this.jiggle( left, right, x_right_label_width, count );
+ tmp_left = this.shrink_left( left, right, x_left_label_width, count );
+ }
+
+ this.top = top;
+ this.left = Math.max(left,tmp_left);
+
+ // round this down to the nearest int:
+ this.right = Math.floor( right );
+ this.bottom = bottom;
+ this.width = this.right-this.left;
+ this.height = bottom-top;
+
+ //this.steps = this.height/(minmax.y_max-minmax.y_min);
+ //this.zero = bottom-(steps*(minmax.y_min*-1));
+
+ this.count = count;
+ this.minmax = minmax;
+
+ if( three_d )
+ {
+ // tell the box object that the
+ // X axis labels need to be offset
+ this.tick_offset = 12;
+ }
+ }
+
+ //
+ // if the last X label is wider than the chart area, the last few letters will
+ // be outside the drawing area. So we make the chart width smaller so the label
+ // will fit into the screen.
+ //
+ function jiggle( left:Number, right:Number, x_label_width:Number, count:Number )
+ {
+ var r:Number = 0;
+
+ if( x_label_width != 0 )
+ {
+ var item_width:Number = (right-left) / count;
+ var r:Number = right-(item_width/2);
+ var new_right:Number = right;
+
+ // while the right most X label is off the edge of the
+ // Stage, move the box.right - 1
+ while( r+(x_label_width/2) > right )
+ {
+ new_right -= 1;
+ // changing the right also changes the item_width:
+ item_width = (new_right-left) / count;
+ r = new_right-(item_width/2);
+ }
+ right = new_right;
+ }
+
+ return right;
+
+ }
+
+ // if the left label is truncated, shrink the box until
+ // it fits onto the screen
+ function shrink_left( left:Number, right:Number, x_label_width:Number, count:Number )
+ {
+ var pos:Number = 0;
+
+ if( x_label_width != 0 )
+ {
+ var item_width:Number = (right-left) / count;
+ var pos:Number = left+(item_width/2);
+ var new_left:Number = left;
+
+ // while the left most label is hanging off the Stage
+ // move the box.left in one pixel:
+ while( pos-(x_label_width/2) < 0 )
+ {
+ new_left += 1;
+ // changing the left also changes the item_width:
+ item_width = (right-new_left) / count;
+ pos = new_left+(item_width/2);
+ }
+ left = new_left;
+ }
+
+ return left;
+
+ }
+
+ //
+ // the bottom point of a bar:
+ // min=-100 and max=100, use b.zero
+ // min = 10 and max = 20, use b.bottom
+ //
+ function getYbottom( right_axis:Boolean )
+ {
+ var min:Number = this.minmax.min( right_axis );
+ return this.getY( Math.max(0,min), right_axis );
+ }
+
+ // takes a value and returns the screen Y location
+ function getY( i:Number, right_axis:Boolean )
+ {
+ var steps:Number = this.height/(this.minmax.range( right_axis ));
+
+ // find Y pos for value=zero
+ var y:Number = this.bottom-(steps*(this.minmax.min( right_axis )*-1));
+
+ // move up (-Y) to our point (don't forget that y_min will shift it down)
+ y -= i*steps;
+ return y;
+ }
+
+ function width_():Number
+ {
+ return this.right-this.left_();
+ }
+
+ function left_():Number
+ {
+ var padding_left:Number = this.tick_offset;
+ return this.left+padding_left;
+ }
+
+ function get_x_pos( i:Number )
+ {
+ var item_width:Number = this.width_() / this.count;
+ return this.left_()+(item_width/2)+(i*item_width);
+ }
+
+ function get_x_tick_pos( i:Number )
+ {
+ //var item_width:Number = (this.right-this.left_()) / this.count;
+
+ return this.get_x_pos(i) - this.tick_offset;
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/ChartUtil.as b/libs/open-flash-chart/actionscript/ChartUtil.as
new file mode 100644
index 0000000000..bd877da072
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/ChartUtil.as
@@ -0,0 +1,271 @@
+/**
+ * @author Hugo
+ */
+class ChartUtil {
+
+ static function get_colour( col:String ) :Number
+ {
+ if( col.substr(0,2) == '0x' )
+ return Number(col);
+
+ if( col.substr(0,1) == '#' )
+ return Number( '0x'+col.substr(1,col.length) );
+
+ if( col.length=6 )
+ return Number( '0x'+col );
+
+ // not recognised as a valid colour, so?
+ return Number( col );
+
+ }
+
+
+ static function FadeIn(mc :MovieClip, tooltip_follow:Boolean) : Void
+ {
+ mc.onEnterFrame = function () {
+ _root.show_tip(
+ mc,
+ mc.val.left,
+ ((mc.val.bar_bottom<mc.val.y)?mc.val.bar_bottom:mc.val.y)-20,
+ mc.tooltip
+ );
+
+ if(tooltip_follow) {
+ _root.tooltip._x = _root._xmouse+5;
+ _root.tooltip._y = _root._ymouse-_root.tooltip._height-20;
+ }
+ if( mc._alpha < 100 )
+ {
+ mc._alpha += 10;
+ }
+ else
+ {
+ mc._alpha = 100;
+ //
+ // we delete mc.onEnterFrame later,
+ // so the tool tip keeps following the mouse
+ //
+ }
+ };
+ }
+
+ static function FadeOut(mc:MovieClip) : Void {
+ mc.onEnterFrame = function ()
+ {
+
+ if( (mc._alpha-5) > mc._alpha_original )
+ {
+ mc._alpha -= 5;
+ }
+ else
+ {
+ mc._alpha = mc._alpha_original;
+ _root.hide_tip( mc );
+ delete mc.onEnterFrame;
+ }
+ };
+
+ }
+
+ //
+ // JG: lighten a colour by splitting it
+ // into RGB, then adding a bit to each
+ // value...
+ //
+ static function Lighten( col:Number ) : Number
+ {
+ var rgb = col; //decimal value for a purple color
+ var red = (rgb & 16711680) >> 16; //extacts the red channel
+ var green = (rgb & 65280) >> 8; //extacts the green channel
+ var blue = rgb & 255; //extacts the blue channel
+ var p=2;
+ red += red/p;
+ if( red > 255 )
+ red = 255;
+
+ green += green/p;
+ if( green > 255 )
+ green = 255;
+
+ blue += blue/p;
+ if( blue > 255 )
+ blue = 255;
+
+ return red << 16 | green << 8 | blue;
+ }
+
+ // JG - I copied this from :
+ // http://www.actionscript.org/showMovie.php?id=1183
+ //
+ // Rounded rectangle made only with actionscript.
+ // Code taken and modified from http://www.actionscript-toolbox.com
+ // w = rectangle width
+ // h = rectangle height
+ // rad = rounded corner radius
+ // x = x start point for rectangle
+ // y = y start point for rectangle
+ //
+ //
+ // If you have any questions about this script mail me: janiss@cc.lv
+ //
+ static function rrectangle( mc:MovieClip, w:Number, h:Number, rad:Number, x:Number, y:Number, stroke:Object, fill:Object) : Void {
+ // added by JG on 30th May 07
+ x = Math.round(x);
+ y = Math.round(y);
+ w = Math.round(w);
+ h = Math.round(h);
+ //
+ mc.lineStyle(stroke.width, stroke.color, stroke.alpha);
+ mc.beginFill(fill.color, fill.alpha);
+ mc.moveTo(0+rad, 0);
+ mc.lineTo(w-rad, 0);
+ mc.curveTo(w, 0, w, rad);
+ mc.lineTo(w, h-rad);
+ mc.curveTo(w, h, w-rad, h);
+ mc.lineTo(0+rad, h);
+ mc.curveTo(0, h, 0, h-rad);
+ mc.lineTo(0, 0+rad);
+ mc.curveTo(0, 0, 0+rad, 0);
+ mc.endFill();
+ mc._x = x;
+ mc._y = y;
+ }
+
+
+/*
+ //import flash.filters.GlowFilter;
+ static function GlowIn(mc :MovieClip, tooltip_follow:Boolean) : Void
+ {
+ var gf:GlowFilter = new flash.filters.GlowFilter(0x356D83, 100, 3, 3, 5, 3, false, false);
+ mc.filters = [gf];
+ mc.onRollOver = function()
+ {
+ this.onEnterFrame = function()
+ {
+ if( mc.blurX < 20)
+ {
+ gf.blurX++;
+ gf.blurY++;
+ }
+ else
+ {
+ delete this.onEnterFrame;
+ }
+ this.filters = [gf];
+ };
+ };
+*/
+/*
+ kText.onRollOut = function() {
+
+ this.onEnterFrame = function() {
+
+ this.filters = [gf];
+ if (gf.blurX > 3) {
+
+ gf.blurX--;
+ gf.blurY--;
+
+ } else {
+
+ delete this.onEnterFrame;
+
+ }
+
+ };
+
+ };
+*/
+
+
+/*
+
+static function hide_tip( owner:Object ) : Void {
+ if( _root.tooltip._owner == owner )
+ removeMovieClip("tooltip");
+}
+
+static function show_tip( owner:Object, x:Number, y:Number, tip_text:String ) : Void
+{
+ if( ( _root.tooltip != undefined ) )
+ {
+ if(_root.tooltip._owner==owner)
+ return; // <-- it's our tooltip and it is showing
+ else
+ removeMovieClip("tooltip"); // <-- it is someone elses tootlip - remove it
+ }
+
+ var tooltip:MovieClip = _root.createEmptyMovieClip( "tooltip", _root.getNextHighestDepth() );
+
+ // let the tooltip know who owns it, else we get weird race conditions where one
+ // bar has onRollOver fired, then another has onRollOut and deletes the tooltip
+ tooltip._owner = owner;
+
+ var cstroke:Object = {width:2, color:0x808080, alpha:100};
+ var ccolor:Object = {color:0xf0f0f0, alpha:100};
+
+ tooltip.createTextField( "txt", _root.getNextHighestDepth(), 5, 5, 100, 100);
+ tooltip.txt.text = tip_text;
+
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = 0x000000;
+ fmt.font = "Verdana";
+ fmt.size = 12;
+ fmt.align = "right";
+ tooltip.txt.setTextFormat(fmt);
+ tooltip.txt.autoSize="left";
+
+ rrectangle(tooltip,
+ tooltip.txt._width+10,
+ tooltip.txt._height+10,
+ 6,
+ ((x+tooltip._width+10) > Stage.width ) ? (Stage.width-tooltip._width-10) : x,
+ y - tooltip.txt._height,
+ cstroke,
+ ccolor);
+
+ // NetVicious, June, 2007
+ // create shadow filter
+ var dropShadow:Object = new flash.filters.DropShadowFilter();
+ dropShadow.blurX = 4;
+ dropShadow.blurY = 4;
+ dropShadow.distance = 4;
+ dropShadow.angle = 45;
+ dropShadow.quality = 2;
+ dropShadow.alpha = 0.5;
+ // apply shadow filter
+ tooltip.filters = [dropShadow];
+
+}
+
+
+static function format( i:Number ) : String {
+ var s:String = '';
+ if( i<0 )
+ var num:Array = String(-i).split('.');
+ else
+ var num:Array = String(i).split('.');
+
+ var x:String = num[0];
+ var pos:Number=0;
+ for(var c:Number = x.length-1;c>-1;c--)
+ {
+ if( pos%3==0 && s.length>0 )
+ {
+ s=','+s;
+ pos=0;
+ }
+ pos++;
+
+ s=x.substr(c,1)+s;
+ }
+ if( num[1] != undefined )
+ s += '.'+ num[1].substr(0,2);
+
+ if( i<0 )
+ s = '-'+s;
+
+ return s;
+}
+*/
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/Css.as b/libs/open-flash-chart/actionscript/Css.as
new file mode 100644
index 0000000000..9199229393
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/Css.as
@@ -0,0 +1,248 @@
+class Css {
+ private var text_align:String;
+ private var font_size:String;
+ private var text_decoration:String;
+ private var margin:String;
+ public var margin_top:Number;
+ public var margin_bottom:Number;
+ public var margin_left:Number;
+ public var margin_right:Number;
+
+ private var padding:String;
+ public var padding_top:Number=0;
+ public var padding_bottom:Number=0;
+ public var padding_left:Number=0;
+ public var padding_right:Number=0;
+
+ private var font_weight:String;
+ private var font_style:String;
+ private var font_family:String;
+ private var color:String;
+ private var stop_process:Number; // Flag for disable checking
+ private var bg_colour:String;
+
+ private function trim( txt:String )
+ {
+ var l = 0; var r = txt.length - 1;
+ while(txt.charAt(l) == ' ' or txt.charAt(l) == "\t" ) l++;
+ while(txt.charAt(r) == ' ' or txt.charAt(r) == "\t" ) r--;
+ return txt.substring( l, r+1 );
+ }
+
+ private function removeDoubleSpaces( txt:String ) {
+ var aux:String;
+ var auxPrev:String;
+ aux = txt;
+ do {
+ auxPrev = aux;
+ aux.replace(' ',' ');
+ } while ( auxPrev.length != aux.length );
+ return aux;
+ }
+
+ private function ToNumber(cad:String) {
+
+ cad = cad.replace( 'px', '' );
+
+ if ( isNaN( Number(cad) ) ) {
+ return 0;
+ } else {
+ return Number(cad);
+ }
+ }
+
+ private function getAttribute( txt:String ) {
+ var arr:Array = txt.split(":");
+ if( arr.length==2 )
+ {
+ this.stop_process = 1;
+ this.set( arr[0], trim(arr[1]) );
+ }
+ }
+
+ public function get( cad:String ) {
+ switch (cad) {
+ case "text-align" : return this.text_align;
+ case "font-size" : return ToNumber(this.font_size);
+ case "text-decoration" : return this.text_decoration;
+ case "margin-top" : return this.margin_top;
+ case "margin-bottom" : return this.margin_bottom;
+ case "margin-left" : return this.margin_left;
+ case "margin-right" : return this.margin_right;
+ case "padding-top" : return this.padding_top;
+ case "padding-bottom" : return this.padding_bottom;
+ case "padding-left" : return this.padding_left;
+ case "padding-right" : return this.padding_right;
+ case "font-weight" : return ToNumber(this.font_weight);
+ case "font-style" : return this.font_style;
+ case "font-family" : return this.font_family;
+ case "color" : return this.color;
+ case "background-color" : return this.bg_colour;
+ default : return 0;
+ }
+ }
+
+ // FUCKING!! Flash without By reference String parameters on functions
+ public function set( cad:String, val:String )
+ {
+ cad = trim( cad );
+
+ switch( cad )
+ {
+ case "text-align" : this.text_align = val; break;
+ case "font-size" : this.font_size = val; break;
+ case "text-decoration" : this.text_decoration = val; break;
+ case "margin":
+ this.margin = setMargin(val);
+ break;
+ case "margin-top" : this.margin_top = ToNumber(val); break;
+ case "margin-bottom" : this.margin_bottom = ToNumber(val); break;
+ case "margin-left" : this.margin_left = ToNumber(val); break;
+ case "margin-right" : this.margin_right = ToNumber(val); break;
+
+ case 'padding':
+ this.padding = setPadding(val);
+ break;
+
+ case "padding-top" : this.padding_top = ToNumber(val); break;
+ case "padding-bottom" : this.padding_bottom = ToNumber(val); break;
+ case "padding-left" : this.padding_left = ToNumber(val); break;
+ case "padding-right" : this.padding_right = ToNumber(val); break;
+
+ case "font-weight" : this.font_weight = val; break;
+ case "font-style" : this.font_style = val; break;
+ case "font-family" : this.font_family = val; break;
+ case "color" : this.color = _root.get_colour( val ); break;
+ case "background-color":
+ this.bg_colour = _root.get_colour( val);
+ break;
+ }
+ }
+
+
+ private function setPadding( val:String )
+ {
+
+ val = trim( val );
+ var arr:Array = val.split(' ');
+
+ switch( arr.length )
+ {
+
+ // margin: 30px;
+ case 1:
+ this.padding_top = ToNumber(arr[0]);
+ this.padding_right = ToNumber(arr[0]);
+ this.padding_bottom = ToNumber(arr[0]);
+ this.padding_left = ToNumber(arr[0]);
+ break;
+
+ // margin: 15px 5px;
+ case 2:
+ this.padding_top = ToNumber(arr[0]);
+ this.padding_right = ToNumber(arr[1]);
+ this.padding_bottom= ToNumber(arr[0]);
+ this.padding_left = ToNumber(arr[1]);
+ break;
+
+ // margin: 15px 5px 10px;
+ case 3:
+ this.padding_top = ToNumber(arr[0]);
+ this.padding_right = ToNumber(arr[1]);
+ this.padding_bottom= ToNumber(arr[2]);
+ this.padding_left = ToNumber(arr[1]);
+ break;
+
+ // margin: 1px 2px 3px 4px;
+ default:
+ this.padding_top = ToNumber(arr[0]);
+ this.padding_right = ToNumber(arr[1]);
+ this.padding_bottom= ToNumber(arr[2]);
+ this.padding_left = ToNumber(arr[3]);
+ }
+ }
+
+ private function setMargin( val:String )
+ {
+
+ val = trim( val );
+ var arr:Array = val.split(' ');
+
+ switch( arr.length )
+ {
+
+ // margin: 30px;
+ case 1:
+ this.margin_top = ToNumber(arr[0]);
+ this.margin_right = ToNumber(arr[0]);
+ this.margin_bottom= ToNumber(arr[0]);
+ this.margin_left = ToNumber(arr[0]);
+ break;
+
+ // margin: 15px 5px;
+ case 2:
+ this.margin_top = ToNumber(arr[0]);
+ this.margin_right = ToNumber(arr[1]);
+ this.margin_bottom= ToNumber(arr[0]);
+ this.margin_left = ToNumber(arr[1]);
+ break;
+
+ // margin: 15px 5px 10px;
+ case 3:
+ this.margin_top = ToNumber(arr[0]);
+ this.margin_right = ToNumber(arr[1]);
+ this.margin_bottom= ToNumber(arr[2]);
+ this.margin_left = ToNumber(arr[1]);
+ break;
+
+ // margin: 1px 2px 3px 4px;
+ default:
+ this.margin_top = ToNumber(arr[0]);
+ this.margin_right = ToNumber(arr[1]);
+ this.margin_bottom= ToNumber(arr[2]);
+ this.margin_left = ToNumber(arr[3]);
+ }
+ }
+
+ public function clear() {
+ this.text_align = undefined;
+ this.font_size = undefined;
+ this.text_decoration = undefined;
+ this.margin_top = undefined;
+ this.margin_bottom = undefined;
+ this.margin_left = undefined;
+ this.margin_right = undefined;
+ this.font_weight = undefined;
+ this.font_style = undefined;
+ this.font_family = undefined;
+ this.color = undefined;
+ }
+
+ public function Css( txt:String )
+ {
+ // To lower case
+ txt.toLowerCase();
+
+ // monk.e.boy: remove the { and }
+ txt = txt.replace( '{', '' );
+ txt = txt.replace( '}', '' );
+
+ // monk.e.boy: setup some default values.
+ // does this confilct with 'clear()'?
+ this.margin_top = 0;
+ this.margin_bottom = 0;
+ this.margin_left = 0;
+ this.margin_right = 0;
+
+ this.color = '#000000';
+
+ // Splitting by the ;
+ var arr:Array = txt.split(";");
+
+ // Checking all the types of css params we accept and writing to internal variables of the object class
+ for( var i = 0; i < arr.length; i++)
+ {
+ getAttribute(arr[i]);
+ }
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/ExPoint.as b/libs/open-flash-chart/actionscript/ExPoint.as
new file mode 100644
index 0000000000..f4a5fe40dc
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/ExPoint.as
@@ -0,0 +1,25 @@
+class ExPoint
+{
+ public var left:Number=0; // <-- for bars
+ public var center:Number=0; // <-- for dots
+ public var y:Number=0;
+ public var tooltip:String = "";
+
+ public var bar_width:Number=0;
+ public var bar_bottom:Number=0;
+
+ public function ExPoint( left:Number, center:Number, y:Number, width:Number, bar_bottom:Number, tooltip:Number )
+ {
+ this.left = left;
+ this.center = center;
+ this.y = y;
+ this.bar_width = width;
+ this.bar_bottom = bar_bottom;
+ this.tooltip = _root.format(tooltip);
+ }
+
+ public function toString()
+ {
+ return "left :"+ this.left;
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/FilledBarStyle.as b/libs/open-flash-chart/actionscript/FilledBarStyle.as
new file mode 100644
index 0000000000..c7889ed970
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/FilledBarStyle.as
@@ -0,0 +1,56 @@
+class FilledBarStyle extends BarStyle
+{
+ public var is_bar:Boolean = true;
+ public var outline_colour:Number = 0x000000;
+
+ public function FilledBarStyle( val:String, name:String )
+ {
+ this.name = name;
+ this.parse( val );
+ }
+
+ public function parse( val:String )
+ {
+ var vals:Array = val.split(",");
+
+ this.alpha = Number( vals[0] );
+ this.colour = _root.get_colour( vals[1] );
+ this.outline_colour = _root.get_colour( vals[2] );
+
+ if( vals.length > 3 )
+ this.key = vals[3];
+
+ if( vals.length > 4 )
+ this.font_size = Number( vals[4] );
+
+ }
+
+ public function draw_bar( val:ExPoint, i:Number )
+ {
+ var mc:MovieClip = super.draw_bar( val, i );
+
+ var top:Number;
+ var height:Number;
+
+ if(val.bar_bottom<val.y)
+ {
+ top = val.bar_bottom;
+ height = val.y-val.bar_bottom;
+ }
+ else
+ {
+ top = val.y
+ height = val.bar_bottom-val.y;
+ }
+
+ mc.lineStyle(2,this.outline_colour,100);
+ mc.moveTo( 0, 0 );
+ mc.lineTo( val.bar_width, 0 );
+ mc.lineTo( val.bar_width, height );
+ mc.lineTo( 0, height );
+ mc.lineTo( 0, 0 );
+
+ mc._alpha = this.alpha;
+ mc._alpha_original = this.alpha; // <-- remember our original alpha while tweening
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/InnerBackground.as b/libs/open-flash-chart/actionscript/InnerBackground.as
new file mode 100644
index 0000000000..3262d777b7
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/InnerBackground.as
@@ -0,0 +1,75 @@
+class InnerBackground
+{
+ private var colour:Number=0;
+ private var colour_2:Number=-1;
+ private var angle:Number = 90;
+ private var mc:MovieClip;
+
+ function InnerBackground( lv:LoadVars )
+ {
+ if( lv.inner_background == undefined )
+ return;
+
+ var vals:Array = lv.inner_background.split(",");
+
+ this.colour = _root.get_colour( vals[0] );
+
+ trace( this.colour)
+
+ if( vals.length > 1 )
+ this.colour_2 = _root.get_colour( vals[1] );
+
+ if( vals.length > 2 )
+ this.angle = Number( vals[2] );
+
+ this.mc = _root.createEmptyMovieClip( "inner_background", _root.getNextHighestDepth() );
+
+ // create shadow filter
+ var dropShadow = new flash.filters.DropShadowFilter();
+ dropShadow.blurX = 5;
+ dropShadow.blurY = 5;
+ dropShadow.distance = 5;
+ dropShadow.angle = 45;
+ dropShadow.quality = 2;
+ dropShadow.alpha = 0.5;
+ // apply shadow filter
+
+ // disabled for now...
+ //this.mc.filters = [dropShadow];
+
+ }
+
+ function move( box:Box )
+ {
+ if( this.mc == undefined )
+ return;
+
+ this.mc.clear();
+ this.mc.lineStyle(1, 0xFFFFFF, 0);
+
+ if( this.colour_2 > -1 )
+ {
+ // Gradients: http://www.lukamaras.com/tutorials/actionscript/gradient-colored-movie-background-actionscript.html
+ var fillType:String = "linear";
+ var colors:Array = [this.colour, this.colour_2];
+ var alphas:Array = [100, 100];
+ var ratios:Array = [0, 255];
+ var matrix = {matrixType:"box", x:0, y:0, w:box.width, h:box.height, r:this.angle/180*Math.PI};
+ this.mc.beginGradientFill(fillType, colors, alphas, ratios, matrix);
+ }
+ else
+ this.mc.beginFill( this.colour, 100);
+
+
+ this.mc.moveTo(0, 0);
+ this.mc.lineTo(box.width, 0);
+ this.mc.lineTo(box.width, box.height);
+ this.mc.lineTo(0, box.height);
+ this.mc.lineTo(0, 0);
+ this.mc.endFill();
+
+ this.mc._x = box.left;
+ this.mc._y = box.top;
+ }
+
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/Keys.as b/libs/open-flash-chart/actionscript/Keys.as
new file mode 100644
index 0000000000..fe78a53e2c
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/Keys.as
@@ -0,0 +1,117 @@
+class Keys
+{
+ private var _height:Number = 0;
+ public var left:Number = 0;
+ public var top:Number = 0;
+
+ private var count:Number = 0;
+ private var key_mcs:Array;
+
+ function Keys( left:Number, top:Number, styles:Array )
+ {
+ this.left = left;
+ this.top = top;
+
+ this.key_mcs = Array();
+ var key:Number = 0;
+ for( var i=0; i<styles.length; i++ )
+ {
+ // some lines may not have a key
+ if( (styles[i].font_size > 0) and (styles[i].key != '' ) )
+ {
+ this.key_mcs.push( this.make_key( styles[i], key ) );
+ key++;
+ }
+ }
+
+ this.count = key;
+
+ this.move();
+ }
+
+ //
+ // this should be in the destructor, but
+ // actionscript does not support them :-(
+ //
+ function del()
+ {
+ for( var i=0; i<this.key_mcs.length; i++ )
+ removeMovieClip(this.key_mcs[i]);
+ }
+
+ // each key is a MovieClip with text on it
+ function make_key( st:Style, c:Number )
+ {
+ var name2:String = "_key_block"+c;
+ var mc:MovieClip = _root.createEmptyMovieClip( name2, _root.getNextHighestDepth() );
+
+ var tf:TextField = mc.createTextField( 'txt', _root.getNextHighestDepth(), 10, 0, 100, 100 );
+
+ tf.text = st.key;
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = st.colour;
+ fmt.font = "Verdana";
+ fmt.size = st.font_size;
+ fmt.align = "left";
+
+ tf.setTextFormat(fmt);
+ tf.autoSize="left";
+
+ var y:Number = (mc.txt._height/2) - (st.line_width/2);
+
+ mc.beginFill( st.colour, 100 );
+ mc.moveTo( 0, y );
+ mc.lineTo( 10, y );
+ mc.lineTo( 10, y+st.line_width );
+ mc.lineTo( 0, y+st.line_width );
+ mc.endFill();
+
+ mc._height = mc.txt._height;
+
+ return mc;
+ }
+
+
+ // shuffle the keys into place, keeping note of the total
+ // height the key block has taken up
+ function move()
+ {
+
+ if( this.count == 0 )
+ return;
+
+ var height:Number = 0;
+ var x:Number = left;
+ var top:Number = this.top;
+
+ for( var i=0; i<this.key_mcs.length; i++ )
+ {
+ var width:Number = this.key_mcs[i]._width;
+
+ if( ( x + width ) > Stage.width )
+ {
+ // it is past the edge of the stage, so move it down a line
+ x = left;
+ top += this.key_mcs[i]._height;
+ height += this.key_mcs[i]._height;
+ }
+
+ this.key_mcs[i]._x = x;
+ this.key_mcs[i]._y = top;
+
+ // move next key to the left + some padding between keys
+ x += width + 10;
+ }
+
+ // Ugly code:
+ height += this.key_mcs[0]._height;
+ this._height = height;
+ }
+
+ function height()
+ {
+ return this._height;
+ }
+
+
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/LineDot.as b/libs/open-flash-chart/actionscript/LineDot.as
new file mode 100644
index 0000000000..8ed09f93c1
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/LineDot.as
@@ -0,0 +1,78 @@
+class LineDot extends LineStyle
+{
+ public var bgColour:Number=0;
+ public var name:String;
+ public var mcs:Array;
+
+ public function LineDot( val:String, bgColour:Number, name:String )
+ {
+ this.mcs=[];
+ this.values = [];
+
+ this.bgColour = bgColour;
+ this.name = name;
+
+ var vals:Array = val.split(",");
+
+ this.line_width = Number( vals[0] );
+ this.colour = _root.get_colour( vals[1] );
+
+ if( vals.length > 2 )
+ this.key = vals[2];
+
+ if( vals.length > 3 )
+ this.font_size = Number( vals[3] );
+
+ if( length( vals ) > 4 )
+ this.circle_size = Number( vals[4] );
+
+ }
+
+ // override Style:set_values
+ function set_values( v:Array, labels:Array )
+ {
+ for( var i:Number=0; i < v.length; i++ )
+ this.add( v[i], labels[i] );
+ }
+
+ public function add( val:String, tool_tip:String )
+ {
+ super.add( val );
+
+ if( this.circle_size > 0 )
+ {
+ //
+ // if this is not a null value, create a tooltip for it:
+ //
+ if( val != 'null' )
+ {
+ var mc:MovieClip = _root.createEmptyMovieClip(this.name+'_dot_'+this.mcs.length, _root.getNextHighestDepth());
+ var tooltip = {x_label:tool_tip, value:_root.format(val), key:this.key};
+ this.make_dot( mc, this.colour, this.bgColour, tooltip );
+ this.mcs.push(mc);
+ }
+ else
+ this.mcs.push( null );
+ }
+ }
+
+ // delete the left most value
+ function del()
+ {
+ removeMovieClip(this.mcs[0]._name);
+ this.mcs.shift();
+ this.values.shift();
+ }
+
+
+ public function draw()
+ {
+ super.draw();
+
+ if( this.circle_size == 0 )
+ return;
+
+ for( var i:Number=0; i < this.ExPoints.length; i++ )
+ super.move_dot( this.ExPoints[i], this.mcs[i] )
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/LineHollow.as b/libs/open-flash-chart/actionscript/LineHollow.as
new file mode 100644
index 0000000000..54d0c3e8d2
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/LineHollow.as
@@ -0,0 +1,65 @@
+class LineHollow extends LineStyle
+{
+ public var bgColour:Number=0;
+ public var name:String;
+ public var mcs:Array;
+
+ public function LineHollow( val:String, bgColour:Number, name:String )
+ {
+ this.mcs=[];
+ this.values = [];
+
+ this.bgColour = bgColour;
+ this.name = name;
+
+ var vals:Array = val.split(",");
+ this.line_width = Number( vals[0] );
+ this.colour = _root.get_colour( vals[1] );
+
+ if( vals.length > 2 )
+ this.key = vals[2];
+
+ if( vals.length > 3 )
+ this.font_size = Number( vals[3] );
+
+ if( length( vals ) > 4 )
+ this.circle_size = Number( vals[4] );
+
+ }
+
+ function set_values( v:Array, labels:Array )
+ {
+ for( var i:Number=0; i < v.length; i++ )
+ this.add( String( v[i] ), labels[i] );
+ }
+
+ public function add( val:String, tool_tip:String )
+ {
+ super.add( val );
+
+ if( this.circle_size > 0 )
+ {
+ if( val != 'null' )
+ {
+ var mc:MovieClip = _root.createEmptyMovieClip(this.name+'_dot_'+this.mcs.length, _root.getNextHighestDepth());
+ var tooltip = {x_label:tool_tip, value:_root.format(val), key:this.key};
+ this.make_dot( mc, this.bgColour, this.colour, tooltip );
+ this.mcs.push(mc);
+ }
+ else
+ this.mcs.push(null);
+ }
+ }
+
+
+ public function draw()
+ {
+ super.draw();
+
+ if( this.circle_size == 0 )
+ return;
+
+ for( var i:Number=0; i < this.ExPoints.length; i++ )
+ super.move_dot( this.ExPoints[i], this.mcs[i] )
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/LineStyle.as b/libs/open-flash-chart/actionscript/LineStyle.as
new file mode 100644
index 0000000000..3985eb4f38
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/LineStyle.as
@@ -0,0 +1,129 @@
+class LineStyle extends Style
+{
+ private var mc:MovieClip;
+
+ public function LineStyle( val:String, name:String )
+ {
+
+ var vals:Array = val.split(",");
+ this.line_width = Number( vals[0] );
+ this.colour = _root.get_colour( vals[1] );
+
+ if( vals.length > 2 )
+ this.key = vals[2];
+
+ if( vals.length > 3 )
+ this.font_size = Number( vals[3] );
+
+ if( length( vals ) > 4 )
+ this.circle_size = Number( vals[4] );
+
+ this.mc = _root.createEmptyMovieClip(name, _root.getNextHighestDepth());
+
+ }
+
+ public function valPos( b:Box, right_axis:Boolean, min:Number )
+ {
+ this.ExPoints=Array();
+
+ for( var i:Number=0; i < this.values.length; i++)
+ {
+
+ if( this.values[i] == 'null' )
+ {
+ this.ExPoints.push( null );
+ }
+ else
+ {
+ this.ExPoints.push(
+ new ExPoint(
+ 0, // x position of value
+ b.get_x_pos( i ),
+ b.getY( Number(this.values[i]), right_axis ),
+ 0,//bar_width,
+ 0,//b.bottom,
+ Number( this.values[i] )
+ )
+ );
+ }
+ }
+ }
+
+ // Draw lines...
+ public function draw()
+ {
+ this.mc.clear();
+ mc.lineStyle( this.line_width, this.colour, 100); // <-- alpha 0 to 100
+
+ var first:Boolean = true;
+
+ for( var i:Number=0; i < this.ExPoints.length; i++ )
+ {
+ // skip null values
+ if( this.ExPoints[i] != null )
+ {
+ if( first )
+ {
+ mc.moveTo(this.ExPoints[i].center,this.ExPoints[i].y);
+ first = false;
+ }
+ else
+ mc.lineTo(this.ExPoints[i].center,this.ExPoints[i].y);
+ }
+ }
+ }
+
+ private function rollOver()
+ {
+
+ }
+
+ // called by AreaHollow, LineHollow
+ public function make_dot( mc:MovieClip, col:Number, bg:Number, tool_tip_title:String, tool_tip_value:String )
+ {
+
+ if( tool_tip_title != undefined )
+ mc.tool_tip_title = tool_tip_title;
+ else
+ mc.tool_tip_title = '';
+
+ mc.tool_tip_value = tool_tip_value;
+
+ //mc.onRollOver = _root.circleBig;
+
+ //
+ // extremely curious syntax, but it works.
+ // add a roll over function to the MovieClip
+ //
+ var ref = mc;
+ mc.onRollOver = function(){
+ ref._width += 4;
+ ref._height += 4;
+ _root.show_tip( this, this._x, this._y-20, this.tool_tip_title, this.tool_tip_value );
+ };
+
+ // make the circle shrink and remove tooltip:
+ mc.onRollOut = function(){
+ _root.hide_tip( this );
+ ref._width -= 4;
+ ref._height -= 4;
+ };
+
+ mc.lineStyle( 0, bg, 100);
+ mc.fillCircle( 0, 0, this.circle_size, 15, bg );
+ mc.fillCircle( 0, 0, this.circle_size-1, 15, col);
+ }
+
+ public function move_dot( val:ExPoint, mc:MovieClip )
+ {
+ //trace(val.center);
+ // Move and fix the dots...
+ mc._x = val.center;
+ mc._y = val.y;
+ }
+
+ public function add( val:String )
+ {
+ this.values.push( val );
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/Loading.as b/libs/open-flash-chart/actionscript/Loading.as
new file mode 100644
index 0000000000..156d98e32b
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/Loading.as
@@ -0,0 +1,82 @@
+class Loading
+{
+ function Loading( text:String )
+ {
+ if( _root.loading != undefined )
+ {
+ _root.removeMovieClip("loading");
+ }
+
+ var mc:MovieClip = _root.createEmptyMovieClip( "loading", _root.getNextHighestDepth() );
+ mc.createTextField("txt", mc.getNextHighestDepth(), 5, 5, 100, 100 );
+ mc.txt.text = text;
+
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = 0x000000;
+ fmt.font = "Verdana";
+ fmt.size = 12;
+ fmt.align = "center";
+ mc.txt.setTextFormat(fmt);
+ mc.txt.autoSize="left";
+
+ mc.txt.setTextFormat(fmt);
+
+ var cstroke = {width:2, color:0x808080, alpha:100};
+ var ccolor = {color:0xf0f0f0, alpha:100};
+
+ ChartUtil.rrectangle(
+ mc,
+ mc.txt._width+10,
+ mc.txt._height+10,
+ 6,
+ (Stage.width/2)-((mc.txt._width+10)/2),
+ (Stage.height/2)-((mc.txt._height+10)/2),
+ cstroke,
+ ccolor);
+
+ var spin:MovieClip = mc.createEmptyMovieClip( "spinner", mc.getNextHighestDepth() );
+
+ spin._x = mc.txt._width+40;
+ spin._y = (mc.txt._height+10)/2;
+
+ var radius:Number = 15;
+ var dots:Number = 6;
+ var colours:Array = [0xF0F0F0,0xD0D0D0,0xB0B0B0,0x909090,0x707070,0x505050,0x303030];
+
+ for( var i=0; i<dots; i++ )
+ {
+ var deg = (360/dots)*i;
+ var radians:Number = deg * (Math.PI/180);
+ var x:Number = radius * Math.cos(radians);
+ var y:Number = radius * Math.sin(radians);
+
+ spin.fillCircle(
+ x,
+ y,
+ 4,
+ 3,
+ colours[i]
+ );
+ }
+
+ spin.onEnterFrame = function ()
+ {
+ this._rotation += 2.4;
+ }
+
+ var dropShadow = new flash.filters.DropShadowFilter();
+ dropShadow.blurX = 4;
+ dropShadow.blurY = 4;
+ dropShadow.distance = 4;
+ dropShadow.angle = 45;
+ dropShadow.quality = 2;
+ dropShadow.alpha = 0.5;
+ // apply shadow filter
+ mc.filters = [dropShadow];
+ }
+
+ function done()
+ {
+ removeMovieClip("loading");
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/MinMax.as b/libs/open-flash-chart/actionscript/MinMax.as
new file mode 100644
index 0000000000..7744d74104
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/MinMax.as
@@ -0,0 +1,47 @@
+class MinMax
+{
+ public var y_min:Number=0;
+ public var y_max:Number=0;
+ public var y2_min:Number=0;
+ public var y2_max:Number=0;
+
+ function MinMax( lv:LoadVars )
+ {
+ if( lv.y_max == undefined )
+ this.y_max = 10;
+ else
+ this.y_max = Number(lv.y_max)
+
+ if( lv.y_min == undefined )
+ this.y_min = 0;
+ else
+ this.y_min = Number(lv.y_min)
+
+ // y 2
+ if( lv.y2_max == undefined )
+ this.y2_max = 10;
+ else
+ this.y2_max = Number(lv.y2_max)
+
+ if( lv.y2_min == undefined )
+ this.y2_min = 0;
+ else
+ this.y2_min = Number(lv.y2_min)
+ }
+
+ function range( right:Boolean )
+ {
+ if( right )
+ return this.y2_max-this.y2_min;
+ else
+ return this.y_max-this.y_min;
+ }
+
+ function min( right:Boolean )
+ {
+ if( right )
+ return this.y2_min;
+ else
+ return this.y_min;
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/PieStyle.as b/libs/open-flash-chart/actionscript/PieStyle.as
new file mode 100644
index 0000000000..5e31f1355c
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/PieStyle.as
@@ -0,0 +1,275 @@
+import flash.external.ExternalInterface;
+
+
+class PieStyle extends Style
+{
+ var TO_RADIANS:Number = Math.PI/180;
+ var labels:Array;
+ var links:Array;
+ var colours:Array;
+
+ var text_colour:Number;
+
+ public var values:Array;
+
+ private var pie_mcs:Array;
+ public var name:String;
+
+ private var gradientFill:String = 'true'; //toggle gradients
+ private var border_width:Number = 1;
+
+ public function PieStyle( lv:LoadVars, name:String )//, links:String )
+ {
+ this.labels = new Array();
+ this.links = new Array();
+ this.colours = new Array();
+
+ this.name = name;
+
+ this.parse( lv.pie );
+ this.labels = lv.pie_labels.split(',');
+ this.links = lv.links.split(',');
+
+ var tmp:Array;
+ if( lv.colours != undefined )
+ tmp = lv.colours.split(',');
+
+ // allow for both spellings fo colour.
+ if( lv.colors != undefined )
+ tmp = lv.colours.split(',');
+
+
+ for( var i:Number=0; i<tmp.length; i++ )
+ this.colours.push( _root.get_colour( tmp[i] ) );
+
+
+ var tmp:Array = this.parseVals( lv.values );
+ this.set_values( tmp );
+ }
+
+ public function parse( val:String ) : Void
+ {
+ var vals:Array = val.split(",");
+
+ this.alpha = Number( vals[0] );
+ this.colour = _root.get_colour( vals[1] );
+ this.text_colour = _root.get_colour( vals[2] );
+
+ if( vals.length > 3 )
+ this.gradientFill = vals[3];
+
+ if( vals.length > 4 )
+ this.border_width = vals[4];
+ }
+
+ private function parseVals( val:String ):Array
+ {
+ var tmp:Array = Array();
+
+ var vals:Array = val.split(",");
+ for( var i:Number=0; i < vals.length; i++ )
+ {
+ tmp.push( vals[i] );
+ }
+ return tmp;
+ }
+
+ // override Style:set_values
+ function set_values( v:Array )
+ {
+ super.set_values( v );
+
+ // make an empty array to hold each bar MovieClip:
+ this.pie_mcs = new Array( this.values.length );
+
+ for( var i:Number=0; i < this.values.length; i++ )
+ {
+ var mc:MovieClip = _root.createEmptyMovieClip( this.name+'_'+i, _root.getNextHighestDepth() );
+
+ mc.onRollOver = function() {ChartUtil.FadeIn(this, true); };
+ mc.onRollOut = function() {ChartUtil.FadeOut(this); };
+
+ if(this.links.length>i)
+ {
+ mc._ofc_link = this.links[i];
+ mc.onRelease = function ():Void { trace(this._ofc_link); getURL(this._ofc_link); };
+ }
+
+ // this is used in FadeIn and FadeOut
+ var tooltip:Object = {x_label:this.labels[i], value:this.values[i], key:'??'};
+ mc.tooltip = tooltip;
+
+ // add the MovieClip to our array:
+ this.pie_mcs[i] = mc;
+ }
+
+ this.valPos();
+ }
+
+ private function valPos() : Void
+ {
+ this.ExPoints = new Array();
+
+ var total:Number = 0;
+ var slice_start:Number=0;
+ for( var i:Number=0; i < this.values.length; i++)
+ {
+ total += Number(values[i]);
+ }
+
+ for( var i:Number=0; i < this.values.length; i++)
+ {
+ var slice_percent :Number = Number(this.values[i])*100/total;
+
+ this.ExPoints.push(
+ new ExPoint(
+ slice_start, // x position of value
+ 0, // center (not applicable for a bar)
+ Number(this.values[i]), //y
+ slice_percent,//width
+ // min=-100 and max=100, use b.zero
+ // min = 10 and max = 20, use b.bottom
+ slice_start, //bar bottom
+ //ChartUtil.format(slice_percent)+"%"+"\n"+ChartUtil.format(values[i]), //tooltip
+ //_root.format(slice_percent)+"%"+"\n"+_root.format(values[i])
+ slice_percent
+ //,"#" //link
+ )
+ );
+
+ slice_start += slice_percent;
+ }
+ }
+
+ public function draw() : Void
+ {
+
+ //var colors_array:Array = [0xd01f3c,0x356aa0,0xC79810,0x73880A,0xD15600,0x6BBA70];
+
+ for( var i:Number=0; i < this.ExPoints.length; i++ ) {
+ //ignore non-positive values
+ if( this.ExPoints[i].bar_width > 0)
+ {
+ this.draw_slice( this.ExPoints[i], i, this.colours[i%this.colours.length], this.labels[i], this.links[i] );
+ }
+ }
+ }
+
+ function draw_slice( value:ExPoint, num:Number, color:Number, label:String, link:String ) : Void
+ {
+ //radius for the pie
+ var r1:Number = (Stage.width<Stage.height) ? Stage.width/2-60 : Stage.height/2-60;
+
+ //the slice to be drawn
+ //var pieSlice: MovieClip = _root.createEmptyMovieClip(name, _root.getNextHighestDepth());
+ var pieSlice:MovieClip = this.pie_mcs[num];
+ pieSlice.clear();
+
+
+
+ //line from center to edge
+ pieSlice.lineStyle(this.border_width, this.colour, 100);
+
+ //if the user selected the charts to be gradient filled do gradients
+ if( this.gradientFill == 'true' )
+ {
+ //set gradient fill
+ var colors:Array = [color, color];
+ var alphas:Array = [100, 50];
+ var ratios:Array = [100,255];
+ var matrix:Object = {a:r1*2, b:0, c:50, d:0, e:r1*2, f:0, g:-3, h:3, i:1};
+ pieSlice.beginGradientFill("radial", colors, alphas, ratios, matrix);
+ }
+ else
+ pieSlice.beginFill(color, 100);
+
+ pieSlice.moveTo(0, 0);
+ pieSlice.lineTo(r1, 0);
+
+
+ var angle:Number = 4;
+ var a:Number = Math.tan((angle/2)*TO_RADIANS);
+
+ var i:Number = 0;
+ //draw curve segments spaced by angle
+ for( i=0; i+angle < value.bar_width*3.6; i+=angle) {
+ var endx:Number = r1*Math.cos((i+angle)*TO_RADIANS);
+ var endy:Number = r1*Math.sin((i+angle)*TO_RADIANS);
+ var ax:Number = endx+r1*a*Math.cos(((i+angle)-90)*TO_RADIANS);
+ var ay:Number = endy+r1*a*Math.sin(((i+angle)-90)*TO_RADIANS);
+ pieSlice.curveTo(ax, ay, endx, endy);
+ }
+
+ //when aproaching end of slice, refine angle interval
+ var angle:Number = 0.08;
+ var a:Number = Math.tan((angle/2)*TO_RADIANS);
+
+ for ( ; i+angle < value.bar_width*3.6; i+=angle) {
+ var endx:Number = r1*Math.cos((i+angle)*TO_RADIANS);
+ var endy:Number = r1*Math.sin((i+angle)*TO_RADIANS);
+ var ax:Number = endx+r1*a*Math.cos(((i+angle)-90)*TO_RADIANS);
+ var ay:Number = endy+r1*a*Math.sin(((i+angle)-90)*TO_RADIANS);
+ pieSlice.curveTo(ax, ay, endx, endy);
+ }
+
+ //close slice
+ pieSlice.endFill();
+ pieSlice.lineTo(0,0);
+
+ //move slice to center
+ pieSlice._x = Stage.width/2;//x;
+ pieSlice._y = Stage.height/2;//y;
+
+ //rotate slice to appropriate place in pie
+ pieSlice._rotation = 3.6*value.bar_bottom;
+
+ if( this.labels.length>0 )
+ {
+ var labelLineSize:Number = 1.1*r1;
+
+ //draw line
+ pieSlice.lineStyle(1, this.colour, 100);
+ //move to center of arc
+ pieSlice.moveTo(r1*Math.cos(value.bar_width/2*3.6*TO_RADIANS), r1*Math.sin(value.bar_width/2*3.6*TO_RADIANS));
+
+ //final line positions
+ var lineEnd_x : Number = labelLineSize*Math.cos(value.bar_width/2*3.6*TO_RADIANS);
+ var lineEnd_y : Number = labelLineSize*Math.sin(value.bar_width/2*3.6*TO_RADIANS);
+ pieSlice.lineTo(lineEnd_x, lineEnd_y);
+
+ //text field position
+ var legend_x : Number = pieSlice._x+labelLineSize*Math.cos((value.bar_bottom+value.bar_width/2)*3.6*TO_RADIANS);
+ var legend_y : Number = pieSlice._y+labelLineSize*Math.sin((value.bar_bottom+value.bar_width/2)*3.6*TO_RADIANS);
+
+ //create legend text field
+ if( _root["pie_text_"+num] != undefined )
+ _root["pie_text_"+num].removeTextField();
+
+ var legend_tf:TextField = _root.createTextField("pie_text_"+num, _root.getNextHighestDepth(), legend_x, legend_y, 10, 10);
+ legend_tf.text = label;
+ legend_tf.autoSize = true;
+ legend_tf.rotation = 3.6*value.bar_bottom;
+
+ //if legend stands to the right side of the pie
+ if(legend_x<pieSlice._x)
+ legend_tf._x -= legend_tf._width;
+
+ //if legend stands on upper half of the pie
+ if(legend_y<pieSlice._y)
+ legend_tf._y -= legend_tf._height;
+
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = this.text_colour;
+ fmt.font = "Verdana";
+ //fmt.size = this.size;
+ fmt.align = "center";
+ legend_tf.setTextFormat(fmt);
+
+ //pieSlice.tool_tip_title = label;
+ //pieSlice.tool_tip_value = value.tooltip;
+
+ pieSlice._alpha = this.alpha;
+ pieSlice._alpha_original = this.alpha; // <-- remember our original alpha while tweening
+ }
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/README.txt b/libs/open-flash-chart/actionscript/README.txt
new file mode 100644
index 0000000000..1971c22283
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/README.txt
@@ -0,0 +1,16 @@
+Open Flash Chart, displays data as a chart in flash.
+Copyright (C) 2007 John Glazebrook
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/Size.as b/libs/open-flash-chart/actionscript/Size.as
new file mode 100644
index 0000000000..d25437c458
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/Size.as
@@ -0,0 +1,11 @@
+class Size
+{
+ public var width:Number=0;
+ public var height:Number=0;
+
+ public function Size( width:Number, height:Number )
+ {
+ this.width = width;
+ this.height = height;
+ }
+}
diff --git a/libs/open-flash-chart/actionscript/Square.as b/libs/open-flash-chart/actionscript/Square.as
new file mode 100644
index 0000000000..171e5045d0
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/Square.as
@@ -0,0 +1,19 @@
+class Square
+{
+ public var top:Number=0;
+ public var left:Number=0;
+ public var right:Number=0;
+ public var bottom:Number=0;
+ public var width:Number=0;
+ public var height:Number=0;
+
+ public function Square( left:Number, top:Number, right:Number, bottom:Number )
+ {
+ this.top = top;
+ this.left = left;
+ this.right = right;
+ this.bottom = bottom;
+ this.width = right-left;
+ this.height = bottom-top;
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/String.prototype.replace.as b/libs/open-flash-chart/actionscript/String.prototype.replace.as
new file mode 100644
index 0000000000..af372f7931
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/String.prototype.replace.as
@@ -0,0 +1,42 @@
+// -----------------------
+// Replace string in a string with a string; ;)
+// 2006.08
+// Raimundas Banevicius (Deril)
+// mail: raima156@yahoo.com
+// -----------------------
+
+// originalString = "This is the original fucking text. What the hell are you typing?"
+// replacedText = originalString.replace('fuck','***');
+// trace("-----------------------------");
+// trace("original was: " + originalString);
+// trace("replaced is: " + replacedText);
+
+
+String.prototype.replace = function() {
+ var arg_search:String = arguments[0], arg_replace:String = arguments[1];
+ var preText:String = this, newText:String = "";
+ var tempArr:Array = preText.split(arg_search);
+ newText = tempArr[0];
+ for (var i = 1; i<tempArr.length; i++) {
+ newText += arg_replace+tempArr[i];
+ }
+ return newText;
+};
+
+var TAB = 9;
+var LINEFEED = 10;
+var CARRIAGE = 13;
+var SPACE = 32;
+
+String.prototype.LTrim = function()
+{
+ var s = this.toString();
+ var i = 0;
+ while(s.charCodeAt(i) == SPACE
+ || s.charCodeAt(i) == CARRIAGE
+ || s.charCodeAt(i) == LINEFEED
+ || s.charCodeAt(i) == TAB) {
+ i++;
+ }
+ return s.substring(i,s.length);
+}; \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/Style.as b/libs/open-flash-chart/actionscript/Style.as
new file mode 100644
index 0000000000..f1334f7f3a
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/Style.as
@@ -0,0 +1,28 @@
+class Style
+{
+ public var key:String = '';
+ public var font_size:Number = -1;
+ public var colour:Number = 0x000000;
+ public var line_width:Number = 1;
+ public var circle_size:Number = 0;
+
+ //
+ public var is_bar:Boolean = false;
+ public var alpha:Number = 50; // <- transparancy
+
+ public var values:Array = [];
+ public var ExPoints:Array;
+
+
+ public function Style( val:String, bar:Boolean )
+ {
+ }
+
+ function set_values( v:Array )
+ {
+ this.values = v;
+ }
+
+ public function draw( val, mc )
+ {}
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/Title.as b/libs/open-flash-chart/actionscript/Title.as
new file mode 100644
index 0000000000..6086ff14f9
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/Title.as
@@ -0,0 +1,101 @@
+class Title
+{
+ public var mc:MovieClip;
+ public var title:String = '';
+ public var colour:Number;
+ public var size:Number;
+ private var top_padding:Number = 0;
+
+ private var style:Css;
+
+ function Title( lv:LoadVars )
+ {
+ if( lv.title == undefined )
+ return;
+
+ var tmp:Array = lv.title.split(',');
+
+ this.style = new Css( tmp[1] );
+ this.build( tmp[0] );
+ }
+
+ function build( text:String )
+ {
+ this.title = text;
+
+ if( this.mc == undefined )
+ {
+ this.mc = _root.createEmptyMovieClip( "title", _root.getNextHighestDepth() );
+ this.mc.txt = this.mc.createTextField( 'title', _root.getNextHighestDepth(), 0, 0, 200, 200 );
+ }
+
+ this.mc.txt.text = this.title;
+
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = this.style.get( 'color' );
+ fmt.font = "Verdana";
+ fmt.size = this.style.get( 'font-size' );
+
+ fmt.align = "center";
+
+ this.mc.txt.setTextFormat(fmt);
+ this.mc.txt.autoSize = "left";
+
+ this.mc.txt._y = this.style.padding_top;
+ this.mc.txt._x = this.style.padding_left;
+
+ var height:Number = this.style.padding_top+this.mc.txt._height+this.style.padding_bottom;
+ var width:Number = this.style.padding_left+this.mc.txt._width+this.style.padding_right;
+
+ this.mc.beginFill( this.style.get( 'background-color' ), 100);
+ this.mc.moveTo(0, 0);
+ this.mc.lineTo(width, 0);
+ this.mc.lineTo(width, height);
+ this.mc.lineTo(0, height);
+ this.mc.lineTo(0, 0);
+ this.mc.endFill();
+ }
+
+ function move()
+ {
+ if( this.mc != undefined )
+ {
+ //
+ // is the title aligned (text-align: xxx)?
+ //
+ var tmp:String = this.style.get( 'text-align' );
+ switch( tmp )
+ {
+ case 'left':
+ this.mc._x = this.style.get( 'margin-left' );
+ break;
+
+ case 'right':
+ this.mc._x = Stage.width - ( this.mc._width + this.style.get( 'margin-right' ) );
+ break;
+
+ case 'center':
+ default:
+ this.mc._x = (Stage.width/2) - (this.mc._width/2);
+ break;
+ }
+
+ this.mc._y = this.style.get( 'margin-top' );
+ }
+ }
+
+ function height()
+ {
+ // the title may be turned off:
+ if( this.mc == undefined )
+ return 0;
+ else
+ {
+ return this.style.padding_top+
+ this.style.margin_top+
+ this.mc.txt._height+
+ this.style.padding_bottom+
+ this.style.margin_bottom;
+ }
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/Values.as b/libs/open-flash-chart/actionscript/Values.as
new file mode 100644
index 0000000000..6824e41d1a
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/Values.as
@@ -0,0 +1,181 @@
+class Values
+{
+ public var styles:Array;
+
+ public function Values( lv:LoadVars, bgColour:Number, labels:Array )
+ {
+ this.styles = [];
+ var name:String = '';
+ var c:Number=1;
+
+ do
+ {
+ if( c>1 ) name = '_'+c;
+
+ if( lv['values'+name ] != undefined )
+ {
+ this.styles[c-1] = this.make_style( lv, name, c, bgColour );
+ this.styles[c-1].set_values( this.parseVal( lv['values'+name] ), labels );
+ }
+ else
+ break; // <-- stop loading data
+
+ c++;
+ }
+ while( true );
+
+ }
+
+ private function make_style( lv:LoadVars, name:String, c:Number, bgColour:Number )
+ {
+ if( lv['line'+name] != undefined )
+ return new LineStyle(lv['line'+name],'bar_'+c);
+ if( lv['line_dot'+name] != undefined )
+ return new LineDot(lv['line_dot'+name],bgColour,'bar_'+c);
+ if( lv['line_hollow'+name] != undefined )
+ return new LineHollow(lv['line_hollow'+name],bgColour,'bar_'+c);
+ else if( lv['area_hollow'+name] != undefined )
+ return new AreaHollow(lv['area_hollow'+name],bgColour,'bar_'+c);
+ else if( lv['bar'+name] != undefined )
+ return new BarStyle(lv['bar'+name],'bar_'+c);
+ else if( lv['filled_bar'+name] != undefined )
+ return new FilledBarStyle(lv['filled_bar'+name],'bar_'+c);
+ else if( lv['bar_glass'+name] != undefined )
+ return new BarGlassStyle(lv['bar_glass'+name],'bar_'+c);
+ else if( lv['bar_fade'+name] != undefined )
+ return new BarFade(lv['bar_fade'+name],'bar_'+c);
+ else if( lv['bar_arrow'+name] != undefined )
+ return new BarArrow(lv['bar_arrow'+name],'bar_'+c);
+ else if( lv['bar_3d'+name] != undefined )
+ return new Bar3D(lv['bar_3d'+name],'bar_'+c);
+ else if( lv['pie'+name] != undefined )
+ return new PieStyle(lv['pie'+name], lv.x_labels!=undefined ? lv['values'] : "", lv['links']);
+ }
+
+ private function parseVal( val:String ):Array
+ {
+ var tmp:Array = Array();
+
+ var vals:Array = val.split(",");
+ for( var i:Number=0; i < vals.length; i++ )
+ {
+ tmp.push( vals[i] );
+ }
+ return tmp;
+ }
+
+ public function length()
+ {
+ var max:Number = -1;
+
+ for(var i:Number=0; i<this.styles.length; i++ )
+ max = Math.max( max, this.styles[i].values.length );
+
+ return max;
+ }
+
+ function _count_bars()
+ {
+ // count how many sets of bars we have
+ var bar_count:Number = 0;
+ for( var i=0; i<this.styles.length; i++ )
+ if( this.styles[i].is_bar )
+ bar_count++;
+
+ return bar_count;
+ }
+
+ // If the current line is to be drawn on y2 (defined in data values, y2_lines)
+ private function is_right( y2lines:Array, line:Number )
+ {
+ //var y2lines:Array = _root.lv.y2_lines.split(",");
+ var right:Boolean = false;
+ for( var i:Number=0; i<y2lines.length; i++ )
+ {
+ if(y2lines[i] == line)
+ right = true;
+ }
+
+ return right;
+ }
+
+ function _do_it()
+ {
+
+ }
+
+ // get x, y co-ords of vals
+ function move( b:Box, min:Number, max:Number, min2:Number, max2:Number )
+ {
+ // If we have a second y-axel
+ if( 1==0 )//_root.lv.show_y2 && _root.lv.y2_lines)
+ {
+ var y2lines:Array = _root.lv.y2_lines.split(",");
+
+ var bar_count:Number = this._count_bars();
+ var bar:Number = 0;
+
+ for( var c:Number=0; c<this.styles.length; c++ )
+ {
+ // If the current axel is to be drawn on y2 (defined in data values, y2_lines)
+ if( is_right(c+1) )
+ {
+ // move values..
+ var tickY:Number = b.height / (max2-min2);
+ }
+ else
+ {
+ var tickY:Number = b.height / (max-min);
+ }
+
+
+ this.styles[c].valPos( b, tickY, min2, bar_count, bar );
+ if( this.styles[c].is_bar )
+ bar++;
+
+ // draw the bars and dots ontop of the line
+ for( var c:Number=0; c < this.styles.length; c++ )
+ {
+ this.styles[c].draw();
+ }
+ }
+
+ }
+ else
+ {
+
+ var bar_count:Number = this._count_bars();
+ var bar:Number = 0;
+ var y2:Boolean = false;
+ var y2lines:Array;
+
+ if( _root.lv.show_y2 != undefined )
+ if( _root.lv.show_y2 != 'false' )
+ if( _root.lv.y2_lines != undefined )
+ {
+ y2 = true;
+ y2lines = _root.lv.y2_lines.split(",");
+ }
+
+ for( var c:Number=0; c<this.styles.length; c++ )
+ {
+ var right_axis:Boolean = false;
+
+ // move values...
+ if( y2 && is_right(y2lines,c+1) )
+ right_axis = true;
+
+ this.styles[c].valPos( b, right_axis, min, bar_count, bar );
+ if( this.styles[c].is_bar )
+ bar++;
+ }
+
+ // draw the bars and dots ontop of the line
+ for( var c:Number=0; c < this.styles.length; c++ )
+ {
+ this.styles[c].draw();
+ }
+ }
+
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/XAxis.as b/libs/open-flash-chart/actionscript/XAxis.as
new file mode 100644
index 0000000000..7aa27595be
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/XAxis.as
@@ -0,0 +1,206 @@
+class XAxis
+{
+ private var tick:Number;
+ private var grid_colour:Number;
+ private var axis_colour:Number;
+ //private var label_count:Number;
+ private var grid_count:Number;
+ private var mc:MovieClip;
+ private var x_steps:Number;
+ private var alt_axis_colour:Number;
+ private var alt_axis_step:Number;
+ private var three_d:Boolean;
+ private var three_d_height:Number;
+
+ function XAxis( tick:Number, lv:LoadVars, label_count:Number, steps:Number )
+ {
+ this.tick = tick;
+
+ if( lv.x_grid_colour != undefined )
+ this.grid_colour = _root.get_colour( lv.x_grid_colour );
+ else
+ this.grid_colour = 0xF5E1AA;
+
+ if( lv.x_axis_colour != undefined )
+ this.axis_colour = _root.get_colour( lv.x_axis_colour );
+ else
+ this.axis_colour = 0x784016;
+
+ if( lv.x_axis_3d != undefined )
+ {
+ this.three_d = true;
+ this.three_d_height = int( lv.x_axis_3d );
+ }
+ else
+ this.three_d = false;
+
+ // Path from Will Henry
+ var style:Array = lv.x_label_style.split(',');
+ if( style.length > 4 )
+ {
+ this.alt_axis_step = style[3];
+ this.alt_axis_colour = _root.get_colour(style[4]);
+ }
+
+ //this.label_count = label_count;
+ this.grid_count = label_count;
+ if( steps == undefined )
+ this.x_steps = 1;
+ else
+ this.x_steps = steps;
+
+ this.mc = _root.createEmptyMovieClip( "x_axis", _root.getNextHighestDepth() );
+
+ }
+
+ function set_grid_count( val:Number )
+ {
+ this.grid_count = val;
+ }
+
+ function move( box:Box )
+ {
+ this.mc.clear();
+
+ //
+ // Grid lines
+ //
+ for( var i:Number=0; i < this.grid_count; i+=this.x_steps )
+ {
+ if( ( this.alt_axis_step > 1 ) && ( i % this.alt_axis_step == 0 ) )
+ {
+ this.mc.lineStyle(1,this.alt_axis_colour,100);
+ }
+ else
+ {
+ this.mc.lineStyle(1,this.grid_colour,100);
+ }
+
+ var x:Number = box.get_x_pos(i);
+ this.mc.moveTo( x, box.bottom);
+ this.mc.lineTo( x, box.top);
+
+ this.mc.moveTo( x, box.bottom);
+ this.mc.lineTo( x, box.top);
+ }
+
+ if( this.three_d )
+ this.three_d_axis( mc, box );
+ else
+ this.two_d_axis( mc, box );
+ }
+
+ function three_d_axis( mc:MovieClip, box:Box )
+ {
+
+ // for 3D
+ var h:Number = this.three_d_height;
+ var offset:Number = 12;
+ var x_axis_height:Number = h+offset;
+
+ //
+ // ticks
+ var item_width:Number = box.width / this.grid_count;
+
+ this.mc.lineStyle(1, this.axis_colour, 100);
+ var w:Number = 1;
+ for( var i:Number=0; i < this.grid_count; i+=this.x_steps )
+ {
+ //
+ // uncommenting beginFill and endFill causes big bugs??!
+ //
+ //this.mc.beginFill(this.axis_colour,100);
+ var pos:Number = box.get_x_tick_pos(i);
+
+ this.mc.moveTo( pos, box.bottom+x_axis_height);
+ this.mc.lineTo( pos+w, box.bottom+x_axis_height);
+ this.mc.lineTo( pos+w, box.bottom+x_axis_height+this.tick);
+ this.mc.lineTo( pos, box.bottom+x_axis_height+this.tick);
+ this.mc.lineTo( pos, box.bottom+x_axis_height);
+ //this.mc.endFill();
+ }
+
+
+ // turn off out lines:
+ mc.lineStyle(0, 0, 0);
+
+ var lighter:Number = ChartUtil.Lighten( this.axis_colour );
+
+ // TOP
+ var colors:Array = [this.axis_colour,lighter];
+ var alphas:Array = [100,100];
+ var ratios:Array = [0,255];
+ var matrix:Object = { matrixType:"box", x:box.left-offset, y:box.bottom, w:box.width_(), h:offset, r:(270/180)*Math.PI };
+ mc.beginGradientFill("linear", colors, alphas, ratios, matrix);
+ this.mc.moveTo(box.left,box.bottom);
+ this.mc.lineTo(box.right,box.bottom);
+ this.mc.lineTo(box.right-offset,box.bottom+offset);
+ this.mc.lineTo(box.left-offset,box.bottom+offset);
+ this.mc.endFill();
+
+ // front
+ var colors:Array = [this.axis_colour,lighter];
+ var alphas:Array = [100,100];
+ var ratios:Array = [0,255];
+ var matrix:Object = { matrixType:"box", x:box.left-offset, y:box.bottom+offset, w:box.width_(), h:h, r:(270/180)*Math.PI };
+ mc.beginGradientFill("linear", colors, alphas, ratios, matrix);
+ this.mc.moveTo(box.left-offset,box.bottom+offset);
+ this.mc.lineTo(box.right-offset,box.bottom+offset);
+ this.mc.lineTo(box.right-offset,box.bottom+offset+h);
+ this.mc.lineTo(box.left-offset,box.bottom+offset+h);
+ this.mc.endFill();
+
+ // right side
+ var colors:Array = [this.axis_colour,lighter];
+ var alphas:Array = [100,100];
+ var ratios:Array = [0,255];
+ var matrix:Object = { matrixType:"box", x:box.left-offset, y:box.bottom+offset, w:box.width_(), h:h, r:(225/180)*Math.PI };
+ mc.beginGradientFill("linear", colors, alphas, ratios, matrix);
+ this.mc.moveTo(box.right,box.bottom);
+ this.mc.lineTo(box.right,box.bottom+h);
+ this.mc.lineTo(box.right-offset,box.bottom+offset+h);
+ this.mc.lineTo(box.right-offset,box.bottom+offset);
+ this.mc.endFill();
+
+ }
+
+ // 2D:
+ function two_d_axis( mc:MovieClip, box:Box )
+ {
+ //
+ // ticks
+ var item_width:Number = box.width / this.grid_count;
+ var left:Number = box.left+(item_width/2);
+ //
+ this.mc.lineStyle(2,this.axis_colour,100);
+ for( var i:Number=0; i < this.grid_count; i+=this.x_steps )
+ {
+ this.mc.moveTo(left + (i*item_width),box.bottom);
+ this.mc.lineTo(left + (i*item_width),box.bottom+this.tick);
+ }
+
+ // Axis line:
+ this.mc.lineStyle(2,this.axis_colour,100);
+ this.mc.moveTo(box.left,box.bottom);
+ this.mc.lineTo(box.right,box.bottom);
+
+ }
+
+ function height_()
+ {
+ return 2 + this.tick;
+ }
+
+ function height()
+ {
+ if( this.three_d )
+ {
+ // 12 is the size of the slanty
+ // 3D part of the X axis
+ return this.three_d_height+12+this.tick;
+ }
+ else
+ return this.tick;
+ }
+
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/XAxisLabels.as b/libs/open-flash-chart/actionscript/XAxisLabels.as
new file mode 100644
index 0000000000..f170c4197a
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/XAxisLabels.as
@@ -0,0 +1,156 @@
+class XAxisLabels
+{
+ private var mcs:Array;
+ private var style:XLabelStyle;
+ public var labels:Array;
+
+ function XAxisLabels( lv:LoadVars, style:XLabelStyle )
+ {
+
+ if( lv.x_labels == undefined )
+ return;
+
+ var labels:Array = lv.x_labels.split(',');
+
+ this.style = style;
+
+ // what if there are more values than labels?
+
+ //this.count = this.labels.length;
+ this.labels = [];
+
+ this.mcs = Array();
+ for( var i:Number=0; i < labels.length; i++ )
+ {
+ this.add( labels[i] );
+
+ }
+ }
+
+ function add( label:String )
+ {
+ this.labels.push( label );
+
+ if( ( (this.labels.length-1) % style.step ) ==0 )
+ this.show_label( label, 'x_label_'+String(this.labels.length) );
+ }
+
+ function del()
+ {
+ this.labels.shift();
+
+ // delete all the MovieClips, and recreate them
+ // we have to do this because of the 'step' value
+ //
+ // I expect there is a better way of doing this...
+ //
+ for( var i:Number=0; i<this.mcs.length; i++ )
+ removeMovieClip(this.mcs[i]._name);
+
+ this.mcs = [];
+
+ // now we have deleted all the labels, re-create them
+ // note we use the step value so only create *some*
+ for( var i:Number=0; i<this.labels.length; i++ )
+ if( ( i % style.step ) == 0 )
+ this.show_label( this.labels[i], 'x_label_'+i );
+
+ }
+
+ function show_label( label:String, name:String )
+ {
+ // we create the text in its own movie clip, so when
+ // we rotate it, we can move the regestration point
+ var mc:MovieClip = _root.createEmptyMovieClip(name, _root.getNextHighestDepth() );
+ mc.createTextField('txt', _root.getNextHighestDepth(), 0, 0, 100, 80);
+ mc.txt.text = label;
+
+ if( style.vertical || style.diag )
+ {
+ // so we can rotate the text
+ mc.txt.embedFonts = true;
+ }
+
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = style.colour;
+
+ if( style.vertical )
+ fmt.font = "Verdana_embed";
+ else
+ fmt.font = "Verdana";
+
+ fmt.size = style.size;
+ fmt.align = "left";
+ mc.txt.setTextFormat(fmt);
+ mc.txt.autoSize = "left";
+
+ if( style.vertical )
+ {
+ mc.txt._rotation = 270;
+ // LOOK: move registration point:
+ mc.txt._y = mc._height;
+ mc.txt._x = -(mc.txt._width/2)
+ }
+ else if( style.diag )
+ {
+ // shift the text so when we rotate the movie clip it rotates
+ // arround the last letter
+ mc.txt._x = -mc.txt._width;
+ mc.txt._y = -(mc.txt._height/2);
+ mc._rotation = -45;
+ }
+ else
+ {
+ mc.txt._x = -(mc.txt._width/2);
+ }
+
+ this.mcs.push( mc );
+ // we don't know the x & y locations yet...
+ }
+
+ function count()
+ {
+ return this.labels.length;
+ }
+
+ function height()
+ {
+ var height:Number = 0;
+ for( var i:Number=0; i<this.mcs.length; i++ )
+ height = Math.max( height, this.mcs[i]._height );
+
+ return height;
+ }
+
+ function move( yPos:Number, count:Number, b:Box )
+ {
+ var i:Number = 0;
+ for( var pos:Number=0; pos < this.mcs.length; pos++ )
+ {
+ this.mcs[pos]._x = b.get_x_tick_pos(i);
+ this.mcs[pos]._y = yPos;
+ i+=this.style.step;
+ }
+ }
+
+ //
+ // to help Box calculate the correct width:
+ //
+ function last_label_width()
+ {
+ // is the last label shown?
+ if( ( (this.labels.length-1) % style.step ) != 0 )
+ return 0;
+
+ // get the width of the right most label
+ // because it may stick out past the end of the graph
+ // and we don't want to truncate it.
+ return this.mcs[(this.mcs.length-1)]._width;
+ }
+
+ // see above comments
+ function first_label_width()
+ {
+ return this.mcs[0]._width;
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/XLabelStyle.as b/libs/open-flash-chart/actionscript/XLabelStyle.as
new file mode 100644
index 0000000000..b2338ddc10
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/XLabelStyle.as
@@ -0,0 +1,31 @@
+class XLabelStyle
+{
+ public var size:Number = 10;
+ public var colour:Number = 0x000000;
+ public var vertical:Boolean = false;
+ public var diag:Boolean = false;
+ public var step:Number = 1;
+
+ public function XLabelStyle( lv:LoadVars )
+ {
+ if( lv.x_label_style == undefined )
+ return;
+
+ var tmp:Array = lv.x_label_style.split(',');
+ if( tmp.length > 0 )
+ this.size = tmp[0];
+
+ if( tmp.length > 1 )
+ this.colour = _root.get_colour(tmp[1]);
+
+ if( tmp.length > 2 )
+ {
+ this.vertical = (Number(tmp[2])==1);
+ this.diag = (Number(tmp[2])==2);
+ }
+
+ if( tmp.length > 3 )
+ if( Number(tmp[3]) > 0 )
+ this.step = Number(tmp[3]);
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/XLegend.as b/libs/open-flash-chart/actionscript/XLegend.as
new file mode 100644
index 0000000000..a55af62b52
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/XLegend.as
@@ -0,0 +1,72 @@
+class XLegend extends Title
+{
+
+ // override the MovieClip name:
+ private var name:String = 'x_legend';
+ public var mc:TextField;
+
+ function XLegend( lv:LoadVars )
+ {
+ if( lv.x_legend == undefined )
+ return;
+
+ var tmp:Array = lv.x_legend.split(',');
+
+ var text:String = tmp[0];
+ this.size = Number( tmp[1] );
+ this.colour = _root.get_colour( tmp[2] );
+
+ // call our parent (Title) constructor:
+ // super.build( text );
+
+ // while no CSS :
+ this.build( text );
+ }
+
+ // remove when this gets CSS
+ function build( text:String )
+ {
+ this.title = text;
+
+ if( this.mc == undefined )
+ this.mc = _root.createTextField( 'title', _root.getNextHighestDepth(), 0, 0, 200, 200 );
+
+ this.mc.text = this.title;
+
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = this.colour;
+ fmt.font = "Verdana";
+ fmt.size = this.size;
+
+ fmt.align = "center";
+
+ this.mc.setTextFormat(fmt);
+ this.mc.autoSize = "left";
+ }
+
+ function get_legend()
+ {
+ return this.title;
+ }
+
+ function move()
+ {
+ // this will center it in the X
+ super.move();
+ // this will align bottom:
+ this.mc._y = Stage.height - this.mc._height;
+ }
+
+ //
+ // this is only here while title has CSS and x legend does not.
+ // remove this when we put css in this object
+ //
+ function height()
+ {
+ // the title may be turned off:
+ if( this.mc == undefined )
+ return 0;
+ else
+ return this.mc._height;
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/YAxis.as b/libs/open-flash-chart/actionscript/YAxis.as
new file mode 100644
index 0000000000..1af1d208d0
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/YAxis.as
@@ -0,0 +1,142 @@
+class YAxis
+{
+ private var _width:Number=0;
+ private var ticks:YTicks;
+ private var grid_colour:Number;
+ private var axis_colour:Number;
+ //private var count:Number;
+ private var mc:MovieClip;
+ private var line_width:Number = 2;
+
+ private var min:Number;
+ private var max:Number;
+ private var steps:Number;
+
+ function YAxis( y_ticks:YTicks, lv:LoadVars, min:Number, max:Number, steps:Number, nr:Number )
+ {
+ // ticks: thin and wide ticks
+ this.ticks = y_ticks;
+
+ if( lv.y_grid_colour != undefined )
+ this.grid_colour = _root.get_colour( lv.y_grid_colour );
+ else
+ this.grid_colour = 0xF5E1AA;
+
+ if(nr != 2) {
+ if( lv.y_axis_colour != undefined )
+ this.axis_colour = _root.get_colour( lv.y_axis_colour );
+ else
+ this.axis_colour = 0x784016;
+ }else{
+ if( lv.y2_axis_colour != undefined )
+ this.axis_colour = _root.get_colour( lv.y2_axis_colour );
+ else
+ this.axis_colour = 0x784016;
+ }
+
+ //this.count = count;
+ this.min = min;
+ this.max = max;
+ this.steps = steps;
+
+ if(nr == 1)
+ this.mc = _root.createEmptyMovieClip( "y_axis", _root.getNextHighestDepth() );
+ else if(nr==2)
+ this.mc = _root.createEmptyMovieClip( "y_axis2", _root.getNextHighestDepth() );
+
+ this._width = this.line_width + Math.max( this.ticks.small, this.ticks.big );
+ }
+
+ function move( box:Box, nr:Number )
+ {
+ if( nr == 2 )
+ {
+ if( !_root.lv.show_y2 )
+ return;
+
+ // Create the new axel
+ this.mc.clear();
+ this.mc.lineStyle(this.line_width,this.axis_colour,100);
+
+ this.mc.moveTo( box.right, box.top );
+ this.mc.lineTo( box.right, box.bottom );
+
+ // create new ticks..
+ var every:Number = (this.max-this.min)/this.steps;
+ for( var i:Number=this.min; i<=this.max; i+=every )
+ {
+
+ // start at the bottom and work up:
+ var y:Number = box.getY(i);
+ this.mc.moveTo( box.right, y );
+ if( i % this.ticks.steps == 0 )
+ this.mc.lineTo( box.right+this.ticks.big, y );
+ else
+ this.mc.lineTo( box.right+this.ticks.small, y );
+
+ }
+ return;
+ }
+
+ // this should be an option:
+ this.mc.clear();
+ // Ticks
+ //var tick:Number = box.height/(this.count-1);
+
+ // Grid lines
+ this.mc.lineStyle(1,this.grid_colour,100);
+// for( var i:Number=0; i < this.count; i++)
+// {
+// var y:Number = box.top+(i*tick);
+// this.mc.moveTo( box.left, y );
+// this.mc.lineTo( box.right, y );
+// }
+
+ // y axel grid lines
+ var every:Number = (this.max-this.min)/this.steps;
+ // Set opacity for the first line to 0 (otherwise it overlaps the x-axel line)
+ //
+ // Bug? Does this work on graphs with minus values?
+ //
+ var i2:Number=0;
+ for( var i:Number=this.min; i<=this.max; i+=every )
+ {
+ var y:Number = box.getY(i);
+ if(i2 == 0)
+ this.mc.lineStyle(1,this.grid_colour,0);
+
+ this.mc.moveTo( box.left, y );
+ this.mc.lineTo( box.right, y );
+
+ if(i2 == 0)
+ this.mc.lineStyle(1,this.grid_colour,100);
+ i2 +=1;
+ }
+
+
+ this.mc.lineStyle(this.line_width,this.axis_colour,100);
+
+ this.mc.moveTo( box.left, box.top );
+ this.mc.lineTo( box.left, box.bottom );
+
+ // ticks..
+ var every:Number = (this.max-this.min)/this.steps;
+ for( var i:Number=this.min; i<=this.max; i+=every )
+ {
+ // start at the bottom and work up:
+ var y:Number = box.getY(i);
+ this.mc.moveTo( box.left, y );
+ if( i % this.ticks.steps == 0 )
+ this.mc.lineTo( box.left-this.ticks.big, y );
+ else
+ this.mc.lineTo( box.left-this.ticks.small, y );
+
+ }
+ }
+
+ function width()
+ {
+ return this._width;
+ }
+
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/YAxisLabels.as b/libs/open-flash-chart/actionscript/YAxisLabels.as
new file mode 100644
index 0000000000..39ee3bd103
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/YAxisLabels.as
@@ -0,0 +1,96 @@
+class YAxisLabels
+{
+ public var labelNames:Array;
+ private var steps:Number;
+
+ function YAxisLabels( y_label_style:YLabelStyle, min:Number, max:Number, steps:Number, nr:Number, lv:LoadVars )
+ {
+ this.steps = steps;
+ this.labelNames = [];
+ var name:String = '';
+
+ if(nr == 1)
+ {
+ // are the Y Labels visible?
+ if( !y_label_style.show_labels )
+ return;
+
+ name = 'y_label_';
+ }
+ else if (nr = 2)
+ {
+
+ // are the Y Labels visible?
+ if( !lv.show_y2 )
+ return;
+
+ name = 'y_label_2_';
+ }
+
+ // labels
+ var every:Number = (max-min)/this.steps;
+
+ for( var i:Number=min; i<=max; i+=every )
+ {
+ this.yAxisLabel( i, name+String(i), y_label_style, nr );
+ this.labelNames.push( name+String(i) );
+ }
+ }
+
+
+
+ function yAxisLabel( title:Number, name:String, y_label_style:YLabelStyle )
+ {
+ // does _root already have this textFiled defined?
+ // this happens when we do an AJAX reload()
+ // these have to be deleted by hand or else flash goes wonky.
+ // In an ideal world we would put this code in the object
+ // distructor method, but I don't think actionscript has these :-(
+ if( _root[name] != undefined )
+ _root[name].removeTextField();
+
+ var tf:TextField = _root.createTextField(name, _root.getNextHighestDepth(), 0, 0, 100, 100);
+ //tf.border = true;
+ tf.text = _root.format(title);
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = y_label_style.colour;
+ fmt.font = "Verdana";
+ fmt.size = y_label_style.size;
+ fmt.align = "right";
+ tf.setTextFormat(fmt);
+ tf.autoSize="right";
+ }
+
+ // move y axis labels to the correct x pos
+ function move( left:Number, box:Box )
+ {
+ var maxWidth:Number = this.width();
+
+ for( var i in this.labelNames )
+ {
+ // right align
+ _root[this.labelNames[i]]._x = left - _root[this.labelNames[i]]._width + maxWidth;
+ }
+
+ // now move it to the correct Y, vertical center align
+ var tick:Number = box.height/this.steps;
+
+ var count:Number = 0;
+ for( var i in this.labelNames )
+ {
+ _root[this.labelNames[i]]._y = box.top + (tick*count) - (_root[this.labelNames[i]]._height/2);
+ count+=1;
+ }
+ }
+
+
+ function width()
+ {
+ var max:Number = 0;
+ for( var x in this.labelNames )
+ {
+ max = Math.max( max, _root[this.labelNames[x]]._width );
+ }
+ return max;
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/YLabelStyle.as b/libs/open-flash-chart/actionscript/YLabelStyle.as
new file mode 100644
index 0000000000..2dffe20f22
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/YLabelStyle.as
@@ -0,0 +1,68 @@
+class YLabelStyle
+{
+ public var size:Number;
+ public var colour:Number = 0x000000;
+
+ public var show_labels:Boolean;
+ public var show_y2:Boolean;
+
+ public function YLabelStyle( lv:LoadVars, nr:Number )
+ {
+ this.size = 10;
+ this.colour = 0x000000;
+ this.show_labels = true;
+
+ if(nr != 2) {
+
+ if( lv.y_label_style == undefined )
+ return;
+
+ // is it CSV?
+ var comma:Number = lv.y_label_style.lastIndexOf(',');
+
+ if( comma<0 )
+ {
+ var none:Number = lv.y_label_style.lastIndexOf('none',0);
+ if( none>-1 )
+ {
+ this.show_labels = false;
+ }
+ }
+ else
+ {
+ var tmp:Array = lv.y_label_style.split(',');
+ if( tmp.length > 0 )
+ this.size = tmp[0];
+
+ if( tmp.length > 1 )
+ this.colour = _root.get_colour(tmp[1]);
+ }
+ }else{ // if (nr..
+
+ if( lv.y2_label_style == undefined )
+ return;
+
+ // is it CSV?
+ var comma:Number = lv.y2_label_style.lastIndexOf(',');
+
+ if( comma<0 )
+ {
+ var none:Number = lv.y2_label_style.lastIndexOf('none',0);
+ if( none>-1 )
+ {
+ this.show_labels = false;
+ }
+ }
+ else
+ {
+ var tmp:Array = lv.y2_label_style.split(',');
+ if( tmp.length > 0 )
+ this.size = tmp[0];
+
+ if( tmp.length > 1 )
+ this.colour = _root.get_colour(tmp[1]);
+ }
+
+ }
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/YLegend.as b/libs/open-flash-chart/actionscript/YLegend.as
new file mode 100644
index 0000000000..09bef0d201
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/YLegend.as
@@ -0,0 +1,69 @@
+class YLegend
+{
+ public var mc:TextField = undefined;
+
+ function YLegend( lv:LoadVars, nr:Number )
+ {
+
+ if( lv.y_legend == undefined && lv.y2_legend == undefined)
+ return;
+
+ // parse the data file string:
+ if(nr == 2)
+ var tmp:Array = lv.y2_legend.split(',');
+ else
+ var tmp:Array = lv.y_legend.split(',');
+
+ var text:String = tmp[0];
+ var size:Number = Number( tmp[1] );
+ var colour:Number = _root.get_colour( tmp[2] );
+
+ if(text == undefined) return;
+
+ if(nr == 1)
+ this.mc = _root.createTextField("y_legend", _root.getNextHighestDepth(), 0, 0, 200, 200);
+ else
+ this.mc = _root.createTextField("y2_legend", _root.getNextHighestDepth(), 0, 0, 200, 200);
+
+
+
+ this.mc.text = text;
+ // so we can rotate the text
+ this.mc.embedFonts = true;
+
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = colour;
+ // our embedded font - so we can rotate it
+ // library->new font, linkage
+ fmt.font = "Verdana_embed";
+
+ fmt.size = size;
+ fmt.align = "center";
+
+ this.mc.setTextFormat(fmt);
+ this.mc.autoSize = "left";
+ this.mc._rotation = 270;
+ this.mc.autoSize = "left";
+ }
+
+ function move(nr:Number)
+ {
+
+ if( this.mc == undefined )
+ return;
+
+ this.mc._y = (Stage.height/2)+(this.mc._height/2);
+ if(nr == 2)
+ this.mc._x = Stage.width-this.mc._width;
+ else
+ this.mc._x = 0;
+ }
+
+ function width()
+ {
+ if( this.mc == undefined )
+ return 0;
+ else
+ return this.mc._width;
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/YTicks.as b/libs/open-flash-chart/actionscript/YTicks.as
new file mode 100644
index 0000000000..fb1f7a2c9f
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/YTicks.as
@@ -0,0 +1,21 @@
+class YTicks
+{
+ // default tick sizes (small,big,big every step):
+ public var big:Number = 5;
+ public var small:Number = 2;
+ public var steps:Number = 2;
+
+ function YTicks( lv:LoadVars )
+ {
+ if( lv.y_ticks != undefined )
+ {
+ var ticks:Array = lv.y_ticks.split(',');
+ if( ticks.length == 3 )
+ {
+ this.small = Number(ticks[0]);
+ this.big = Number(ticks[1]);
+ this.steps = Number(ticks[2]);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/open-flash-chart.as b/libs/open-flash-chart/actionscript/open-flash-chart.as
new file mode 100644
index 0000000000..189f2b1326
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/open-flash-chart.as
@@ -0,0 +1,693 @@
+
+// rectangle with rounded corners
+//#include "rrectangle.as"
+#include "prototype.drawCircle.as"
+#include "prototype.fillCircle.as"
+#include "String.prototype.replace.as"
+
+MovieClip.prototype.rect = function( x:Number, y:Number, width:Number, height:Number, colour:Number, alpha:Number )
+{
+
+ this.beginFill( colour, 100 );
+ this.moveTo( x, y );
+ this.lineTo( x+width, y );
+ this.lineTo( x+width, y+height );
+ this.lineTo( x, y+height );
+ this.lineTo( x, y );
+ this.endFill();
+
+ this._alpha = alpha;
+ this._alpha_original = alpha; // <-- remember our original alpha while tweening
+
+}
+
+function get_colour( col:String )
+{
+ if( col.substr(0,2) == '0x' )
+ return Number(col);
+
+ if( col.substr(0,1) == '#' )
+ return Number( '0x'+col.substr(1,col.length) );
+
+ if( col.length=6 )
+ return Number( '0x'+col );
+
+ // not recognised as a valid colour, so?
+ return Number( col );
+
+}
+
+// why isn't this built into flash?
+// make a number 1000 = 1,000
+function format( i:Number )
+{
+ var s:String = '';
+ if( i<0 )
+ var num:Array = String(-i).split('.');
+ else
+ var num:Array = String(i).split('.');
+
+ var x:String = num[0];
+ var pos:Number=0;
+ for(c=x.length-1;c>-1;c--)
+ {
+ if( pos%3==0 && s.length>0 )
+ {
+ s=','+s;
+ pos=0;
+ }
+ pos++;
+
+ s=x.substr(c,1)+s;
+ }
+ if( num[1] != undefined )
+ s += '.'+ num[1].substr(0,2);
+
+ if( i<0 )
+ s = '-'+s;
+
+ return s;
+}
+
+// added by NetVicious June 2007
+function setContextualMenu()
+{
+ var contextual_menu:ContextMenu = new ContextMenu();
+ var About:ContextMenuItem = new ContextMenuItem("About Open Flash Chart...");
+ About.onSelect = function(obj, item) {
+ // Go to project url
+ getURL("javascript:popup=window.open('http://teethgrinder.co.uk/open-flash-chart/','ofc', 'toolbar=Yes,location=Yes,scrollbars=Yes,menubar=Yes,status=Yes,resizable=Yes,fullscreen=No'); popup.focus()");
+ };
+ /*
+ If you want to remove default items of Flash (except conf and about) uncomment this line
+ contextual_menu.hideBuiltInItems();
+ */
+ contextual_menu.customItems.push(About);
+ createClassObject
+ _root.menu = contextual_menu;
+}
+
+function TxtFormat(size:Number,colour:Number)
+{
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = colour;
+ fmt.font = "Verdana";
+ fmt.size = size;
+ fmt.align = "center";
+ return fmt;
+}
+
+
+
+function FadeIn()
+{
+ this.onEnterFrame = function ()
+ {
+
+ _root.show_tip(
+ this,
+ this._x,
+ this._y-20,
+ this.tooltip
+ );
+
+ if( this._alpha < 100 )
+ {
+ this._alpha += 10;
+ }
+ else
+ {
+ this._alpha = 100;
+ delete this.onEnterFrame;
+ }
+ }
+}
+
+function FadeOut()
+{
+ this.onEnterFrame = function ()
+ {
+
+ if( (this._alpha-5) > this._alpha_original )
+ {
+ this._alpha -= 5;
+ }
+ else
+ {
+ this._alpha = this._alpha_original;
+ _root.hide_tip( this );
+ delete this.onEnterFrame;
+ }
+ }
+}
+
+
+function hide_tip( owner:Object )
+{
+ if( _root.tooltip._owner == owner )
+ removeMovieClip("tooltip");
+}
+
+function show_tip( owner:Object, x:Number, y:Number, tip_obj:Object )
+{
+ if( ( _root.tooltip != undefined ) )
+ {
+ if(_root.tooltip._owner==owner)
+ return; // <-- it's our tooltip and it is showing
+ else
+ removeMovieClip("tooltip"); // <-- it is someone elses tootlip - remove it
+ }
+
+ var tmp:String;
+ var lines:Array = [];
+ //
+ // Dirty hack. Takes a tool_tip_wrapper, and replaces the #val# with the
+ // tool_tip text, so noew you can do: "My Val = $#val#%", which turns into:
+ // "My Val = $12.00%"
+ //
+ if( _root.tool_tip_wrapper != undefined )
+ {
+ tmp = _root.tool_tip_wrapper.replace('#val#',tip_obj.value);
+ tmp = tmp.replace('#key#',tip_obj.key);
+ tmp = tmp.replace('#x_label#',tip_obj.x_label);
+
+ if( _root._x_legend != undefined )
+ tmp = tmp.replace('#x_legend#',_root._x_legend.get_legend());
+ }
+ else
+ {
+ if( tip_obj.x_label == undefined )
+ tmp = tip_obj.value;
+ else
+ tmp = tip_obj.x_label+'<br>'+tip_obj.value;
+ }
+
+ lines = tmp.split( '<br>' );
+
+ var tooltip = _root.createEmptyMovieClip( "tooltip", this.getNextHighestDepth() );
+
+ // let the tooltip know who owns it, else we get weird race conditions where one
+ // bar has onRollOver fired, then another has onRollOut and deletes the tooltip
+ tooltip._owner = owner;
+
+ tooltip.createTextField( "txt_title", tooltip.getNextHighestDepth(), 5, 5, 100, 100);
+ if( lines.length > 1 )
+ tooltip.txt_title.text = lines.shift();
+
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = 0x0000F0;
+ fmt.font = "Verdana";
+
+ // this needs to be an option:
+ fmt.bold = true;
+ fmt.size = 12;
+ fmt.align = "right";
+ tooltip.txt_title.setTextFormat(fmt);
+ tooltip.txt_title.autoSize="left";
+
+ tooltip.createTextField( "txt", tooltip.getNextHighestDepth(), 5, tooltip.txt_title._height, 100, 100);
+
+ tooltip.txt.text = lines.join( '\n' );
+
+ var fmt2:TextFormat = new TextFormat();
+ fmt2.color = 0x000000;
+ fmt2.font = "Verdana";
+ fmt2.size = 12;
+ fmt2.align = "left";
+ tooltip.txt.setTextFormat(fmt2);
+ tooltip.txt.autoSize="left";
+
+ var max_width:Number = Math.max( tooltip.txt_title._width, tooltip.txt._width );
+ var y_pos:Number = y - tooltip.txt_title._height - tooltip.txt._height;
+
+ if( y_pos < 0 )
+ {
+ // the tooltip has drifted off the top of the screen, move it down:
+ y_pos = y + tooltip.txt_title._height + tooltip.txt._height;
+ }
+
+ var cstroke = {width:2, color:0x808080, alpha:100};
+ var ccolor = {color:0xf0f0f0, alpha:100};
+
+ ChartUtil.rrectangle(
+ tooltip,
+ max_width+10,
+ tooltip.txt_title._height + tooltip.txt._height + 5,
+ 6,
+ ((x+max_width+16) > Stage.width ) ? (Stage.width-max_width-16) : x,
+ y_pos,
+ cstroke,
+ ccolor);
+
+ // NetVicious, June, 2007
+ // create shadow filter
+ var dropShadow = new flash.filters.DropShadowFilter();
+ dropShadow.blurX = 4;
+ dropShadow.blurY = 4;
+ dropShadow.distance = 4;
+ dropShadow.angle = 45;
+ dropShadow.quality = 2;
+ dropShadow.alpha = 0.5;
+ // apply shadow filter
+ tooltip.filters = [dropShadow];
+
+}
+
+
+function hide_oops()
+{
+ removeMovieClip("oops");
+}
+
+function oops( text:String )
+{
+ if( _root.oops != undefined )
+ {
+ hide_oops();
+ }
+
+ var mc:MovieClip = _root.createEmptyMovieClip( "oops", this.getNextHighestDepth() );
+ mc.createTextField("txt", this.getNextHighestDepth(), 5, 5, 100, 100 );
+ mc.txt.text = text;
+
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = 0x000000;
+ fmt.font = "Verdana";
+ fmt.size = 12;
+ fmt.align = "center";
+ mc.txt.setTextFormat(fmt);
+ mc.txt.autoSize="left";
+
+ mc.txt.setTextFormat(fmt);
+
+ var cstroke = {width:2, color:0x808080, alpha:100};
+ var ccolor = {color:0xf0f0f0, alpha:100};
+
+ ChartUtil.rrectangle(
+ mc,
+ mc.txt._width+10,
+ mc.txt._height+10,
+ 6,
+ (Stage.width/2)-((mc.txt._width+10)/2),
+ (Stage.height/2)-((mc.txt._height+10)/2),
+ cstroke,
+ ccolor);
+
+ var dropShadow = new flash.filters.DropShadowFilter();
+ dropShadow.blurX = 4;
+ dropShadow.blurY = 4;
+ dropShadow.distance = 4;
+ dropShadow.angle = 45;
+ dropShadow.quality = 2;
+ dropShadow.alpha = 0.5;
+ // apply shadow filter
+ //mc.filters = [dropShadow];
+}
+
+function make_pie()
+{
+ _root._pie = new PieStyle( this, 'pie' );//!=undefined ? lv['values'] : "", lv['links']);
+ _root._title = new Title( this );
+}
+
+
+function make_chart()
+{
+ //
+ // the order that these are built determines their Z order:
+ //
+ _root._inner_background = new InnerBackground( this );
+
+ _root._min_max = new MinMax( this );
+
+ // we build the graph from top to bottom
+ _root._title = new Title( this );
+ _root._x_legend = new XLegend( this );
+ _root._y_legend = new YLegend( this , 1);
+
+ if(_root.lv.show_y2)
+ _root._y2_legend = new YLegend( this , 2);
+
+ var xTicks = 5;
+ if( this.x_ticks != undefined )
+ xTicks = Number( this.x_ticks );
+
+ // size, colour
+ var x_label_style:XLabelStyle = new XLabelStyle( this );
+ var y_label_style:YLabelStyle = new YLabelStyle( this, 1 );
+
+ if(_root.lv.show_y2)
+ var y_label_style2:YLabelStyle = new YLabelStyle( this, 2 );
+
+
+ // create X labels and measure the height:
+ _root._x_axis_labels = new XAxisLabels( this, x_label_style );
+
+ var xSteps = 1;
+ if( this.x_axis_steps != undefined )
+ xStep = Number( this.x_axis_steps );
+
+ _root._x_axis = new XAxis(
+ xTicks, // <-- tick size
+ this,
+ _root._x_axis_labels.count(),
+ xStep
+ );
+
+ _root._y_ticks = new YTicks( this );
+
+ _root._y_axis_labels = new YAxisLabels(
+ y_label_style,
+ _root._min_max.y_min,
+ _root._min_max.y_max,
+ _root._y_ticks.steps,
+ 1,
+ this
+ );
+
+ if(_root.lv.show_y2)
+ {
+ _root._y_axis_labels2 = new YAxisLabels(
+ y_label_style2,
+ _root._min_max.y2_min,
+ _root._min_max.y2_max,
+ _root._y_ticks.steps,
+ 2,
+ this
+ );
+ }
+
+ _root._y_axis = new YAxis(
+ _root._y_ticks,
+ this,
+ _root._min_max.y_min,
+ _root._min_max.y_max,
+ _root._y_ticks.steps,
+ 1
+ );
+
+ if(_root.lv.show_y2)
+ {
+ _root._y_axis2 = new YAxis(
+ _root._y_ticks,
+ this,
+ _root._min_max.y_min,
+ _root._min_max.y_max,
+ _root._y_ticks.steps,
+ 2
+ );
+ }
+
+ // The chart values are defined last and are on TOP of every thing else
+ _root.chartValues = new Values( this, _root._background.colour, _root._x_axis_labels.labels );
+
+ // tell the x axis where the grid lines are:
+ _root._x_axis.set_grid_count( _root.chartValues.length() );
+
+ if( _root._keys != undefined )
+ {
+ //_root._keys.del();
+ //_root.oops('deleted');
+ }
+
+ _root._keys = new Keys(
+ (_root._y_legend.width()+_root._y_axis_labels.width()+_root._y_axis.width()), // <-- from left
+ _root._title.height(), // <-- from top
+ _root.chartValues.styles );
+
+}
+
+var lv:LoadVars = new LoadVars();
+
+//lv.onLoad = function( success )
+lv.onLoad = LoadVarsOnLoad;
+lv.make_chart = make_chart;
+lv.make_pie = make_pie;
+
+function LoadVarsOnLoad( success )
+{
+ if( !success )
+ {
+ _root.loading.done();
+ //_root.oops('Open Flash Chart: Error opening data file URL\n'+_root.data);
+ _root.oops(_root.data);
+ return;
+ }
+
+ // remove loading data... message
+ if( _root.oops != undefined )
+ removeMovieClip("oops");
+
+ _root.css = new Css('margin-top: 30;margin-right: 40;');
+
+ //
+ // Now we build the objects, the order in which we
+ // build them determins their Z position.
+ //
+ _root._background = new Background( this );
+
+
+ //
+ // if we have a pie chart, we don't build the
+ // axis, grid and stuff..
+ //
+ if( this.pie != undefined )
+ this.make_pie();
+ else
+ this.make_chart();
+
+
+ if( this.tool_tip != undefined )
+ {
+ _root.tool_tip_wrapper = this.tool_tip;
+ }
+
+ _root.loading.done();
+ _root.move();
+}
+
+function move()
+{
+ if( _root._pie != undefined )
+ {
+ _root._background.move();
+ _root._title.move();
+ _root._pie.draw();
+ return;
+ }
+
+ //
+ // move items that may resize themselves:
+ //
+ _root._keys.move();
+
+ //
+ // measure the box:
+ //
+ var top:Number = _root._title.height()+_root._keys.height();
+ var left:Number = _root._y_legend.width()+_root._y_axis_labels.width()+_root._y_axis.width();
+ var right:Number = Stage.width;
+ // do we jiggle the box smaller because the last X Axis label
+ // is hanging off the end of the screen?
+ var jiggle:Boolean = true;
+
+ if(_root.lv.show_y2)
+ {
+ right -= _root._y2_legend.width()+_root._y_axis_labels2.width()+_root._y_axis2.width();
+ // no need to shrink the box:
+ jiggle = false;
+ }
+
+ var bottom:Number = Stage.height-(_root._x_axis_labels.height()+_root._x_legend.height()+_root._x_axis.height())
+
+ var b:Box = new Box(
+ top, left, right, bottom,
+ _root._min_max, // <-- scale everything between min/max
+ _root._x_axis_labels.first_label_width(),
+ _root._x_axis_labels.last_label_width(),
+ _root.chartValues.length(),
+ jiggle,
+ _root._x_axis.three_d
+ );
+
+
+ //
+ // tell everything else to move, the order in
+ // which we .move() things doesn't matter because
+ // they allready have their z-order assigned.
+ //
+ _root._background.move();
+ _root._inner_background.move( b );
+ _root._title.move();
+ _root._x_legend.move();
+ _root._y_legend.move(1);
+
+
+ if(_root.lv.show_y2)
+ _root._y2_legend.move(2);
+
+ _root._y_axis_labels.move( _root._y_legend.width(), b );
+
+ // position of second y axel labels..
+ if(_root.lv.show_y2)
+ _root._y_axis_labels2.move( Stage.width-(_root._y2_legend.width()+_root._y_axis_labels2.width()), b );
+
+ _root._x_axis.move( b );
+
+ // move x labels
+ _root._x_axis_labels.move(
+ Stage.height-(_root._x_legend.height()+_root._x_axis_labels.height()), // <-- up from the bottom
+ _root.chartValues.styles[0].values.length,
+ b );
+
+ _root._y_axis.move( b , 1);
+
+ if(_root.lv.show_y2)
+ _root._y_axis2.move( b , 2 );
+
+ _root.chartValues.move(
+ b,
+ _root._min_max.y_min,
+ _root._min_max.y_max, // <-- scale everything between min/max
+ _root._min_max.y2_min,
+ _root._min_max.y2_max
+ );
+}
+
+//
+// test JS to flash coms
+//
+import flash.external.*;
+ExternalInterface.addCallback("set_title", null, setTitle);
+function setTitle(str:String):Void
+{
+ if( _root._title != undefined )
+ {
+ _root._title.build( str );
+ _root.move();
+ }
+ // for debuggig:
+ //_root.oops(str);
+}
+
+ExternalInterface.addCallback("push_value", null, pushValue);
+function pushValue( val:String, label:String ):Void
+{
+ _root.chartValues.styles[0].add( Number( val ), label );
+ _root._x_axis_labels.add(label);
+ // tell the x axis where the grid lines are:
+ _root._x_axis.set_grid_count( _root.chartValues.length() );
+ _root.move();
+}
+
+ExternalInterface.addCallback("delete_value", null, deleteValue);
+function deleteValue():Void
+{
+ _root.chartValues.styles[0].del();
+ _root._x_axis_labels.del();
+ // tell the x axis where the grid lines are:
+ _root._x_axis.set_grid_count( _root.chartValues.length() );
+ _root.move();
+}
+
+ExternalInterface.addCallback("show_message", null, show_message);
+function show_message( msg:String ):Void
+{
+ _root.oops(msg);
+}
+
+ExternalInterface.addCallback("hide_message", null, hide_message);
+function hide_message():Void
+{
+ hide_oops();
+}
+
+ExternalInterface.addCallback("reload", null, reload);
+function reload( u:String ):Void
+{
+ // inform the user we are reloading data:
+ _root.loading = new Loading('Loading data...');
+
+ var lv:LoadVars = new LoadVars();
+
+ // ugh!:
+ lv.onLoad = LoadVarsOnLoad;
+ lv.make_chart = make_chart;
+ lv.make_pie = make_pie;
+ //
+
+ var url:String = '';
+
+ if( _root.data != undefined )
+ url = _root.data;
+
+ if( u != undefined )
+ {
+ if( u.length > 0 )
+ {
+ url = u;
+ }
+ }
+ //setTitle( u );
+ lv.load(url);
+}
+
+
+//
+//
+//
+// ********************************************************************************
+
+//_root.loading = new Loading('Loading data...');
+//
+// variables from the url:
+if( _root.width == undefined )
+ _root.width = 400; // <-- default width
+
+if( _root.height == undefined )
+ _root.height = 300; // <-- default width
+
+_root.loading = new Loading('Loading data...');
+
+// so we can rotate text:
+this.embedFonts = true;
+
+_root.chartValues = new Array();
+
+// -------------------------------------------------------------+
+//
+// tell flash to align top left, and not to scale
+// anything (we do that in the code)
+//
+Stage.align = "LT";
+//
+// ----- RESIZE ----
+//
+// noScale: now we can pick up resize events
+Stage.scaleMode = "noScale";
+//
+var stageListener:Object = new Object();
+stageListener.onResize = function()
+{
+ //trace("w:"+Stage.width+", h:"+Stage.height);
+ _root.move();
+};
+Stage.addListener(stageListener);
+//
+// ------ END RESIZE ----
+//
+//
+
+
+// NetVicious, June 2007
+// Right click menu:
+setContextualMenu();
+
+// from URL
+if( _root.data == undefined )
+ _root.data="C:\\Users\\John\\Documents\\flash\\svn\\data-files\\data-23.txt";
+ //_root.data="http://www.stelteronline.de/index.php?option=com_joomleague&func=showStats_GetChartData&p=1";
+
+lv.load(_root.data);
+
+stop(); \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/open-flash-chart.fla b/libs/open-flash-chart/actionscript/open-flash-chart.fla
new file mode 100644
index 0000000000..2315891e18
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/open-flash-chart.fla
Binary files differ
diff --git a/libs/open-flash-chart/actionscript/prototype.drawCircle.as b/libs/open-flash-chart/actionscript/prototype.drawCircle.as
new file mode 100644
index 0000000000..654d641802
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/prototype.drawCircle.as
@@ -0,0 +1,19 @@
+MovieClip.prototype.drawCircle = function(x, y, radius, accuracy )
+{
+ if (a < 3) a = 3;
+ var span = Math.PI/accuracy;
+ var controlRadius = radius/Math.cos(span);
+ var anchorAngle=0, controlAngle=0;
+ this.moveTo(x+Math.cos(anchorAngle)*radius, y+Math.sin(anchorAngle)*radius);
+ for (var i=0; i<accuracy; ++i)
+ {
+ controlAngle = anchorAngle+span;
+ anchorAngle = controlAngle+span;
+ this.curveTo(
+ x + Math.cos(controlAngle)*controlRadius,
+ y + Math.sin(controlAngle)*controlRadius,
+ x + Math.cos(anchorAngle)*radius,
+ y + Math.sin(anchorAngle)*radius
+ );
+ }
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/prototype.fillCircle.as b/libs/open-flash-chart/actionscript/prototype.fillCircle.as
new file mode 100644
index 0000000000..14db8e38d0
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/prototype.fillCircle.as
@@ -0,0 +1,22 @@
+MovieClip.prototype.fillCircle = function(x, y, radius, accuracy, colour:Number )
+{
+ if (a < 3) a = 3;
+ var span = Math.PI/accuracy;
+ var controlRadius = radius/Math.cos(span);
+ var anchorAngle=0, controlAngle=0;
+ this.moveTo(x+Math.cos(anchorAngle)*radius, y+Math.sin(anchorAngle)*radius);
+
+ this.beginFill( colour, 100 );
+ for (var i=0; i<accuracy; ++i)
+ {
+ controlAngle = anchorAngle+span;
+ anchorAngle = controlAngle+span;
+ this.curveTo(
+ x + Math.cos(controlAngle)*controlRadius,
+ y + Math.sin(controlAngle)*controlRadius,
+ x + Math.cos(anchorAngle)*radius,
+ y + Math.sin(anchorAngle)*radius
+ );
+ }
+ this.endFill();
+} \ No newline at end of file
diff --git a/libs/open-flash-chart/actionscript/rrectangle.as b/libs/open-flash-chart/actionscript/rrectangle.as
new file mode 100644
index 0000000000..23c76aecce
--- /dev/null
+++ b/libs/open-flash-chart/actionscript/rrectangle.as
@@ -0,0 +1,36 @@
+// JG - I copied this from :
+// http://www.actionscript.org/showMovie.php?id=1183
+//
+// Rounded rectangle made only with actionscript.
+// Code taken and modified from http://www.actionscript-toolbox.com
+// w = rectangle width
+// h = rectangle height
+// rad = rounded corner radius
+// x = x start point for rectangle
+// y = y start point for rectangle
+//
+//
+// If you have any questions about this script mail me: janiss@cc.lv
+//
+MovieClip.prototype.rrectangle = function(w, h, rad, x, y, stroke, fill) {
+ // added by JG on 30th May 07
+ x = Math.round(x);
+ y = Math.round(y);
+ w = Math.round(w);
+ h = Math.round(h);
+ //
+ this.lineStyle(stroke.width, stroke.color, stroke.alpha);
+ this.beginFill(fill.color, fill.alpha);
+ this.moveTo(0+rad, 0);
+ this.lineTo(w-rad, 0);
+ this.curveTo(w, 0, w, rad);
+ this.lineTo(w, h-rad);
+ this.curveTo(w, h, w-rad, h);
+ this.lineTo(0+rad, h);
+ this.curveTo(0, h, 0, h-rad);
+ this.lineTo(0, 0+rad);
+ this.curveTo(0, 0, 0+rad, 0);
+ this.endFill();
+ this._x = x;
+ this._y = y;
+}; \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-1.txt b/libs/open-flash-chart/data-files/data-1.txt
new file mode 100644
index 0000000000..1c7673dc41
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-1.txt
@@ -0,0 +1,11 @@
+&y_legend=Time of day,#736AFF,12&
+&y_ticks=5,10,6&
+&line_dot=3,0x736AFF,Avg. wave height (cm),10,3&
+&values=1.5,1.6986693307951,1.8894183423087,2.064642473395,2.2173560908995,2.3414709848079,2.4320390859672,2.4854497299885,2.4995736030415,2.4738476308782,2.4092974268257,2.3084964038196,2.1754631805512,2.0155013718215,1.8349881501559,1.6411200080599,1.4416258565724,1.2444588979732,1.0574795567051,0.88814210905728,0.74319750469207,0.62842422758641,0.54839792611048,0.50630899636654,0.50383539116416,0.54107572533686,0.61654534427985,0.72723551244401,0.86873336212768,1.0353978205862,1.2205845018011,1.4169105971825,1.6165492048505,1.8115413635134,1.9941133511386,2.1569865987188,2.2936678638492,2.3987080958116,2.4679196720315,2.4985433453746,2.4893582466234,2.4407305566798,2.3545989080883,2.2343970978741,2.0849171928918&
+&x_labels=2:00am,2:10,2:20,2:30,2:40,2:50,3:00am,3:10,3:20,3:30,3:40,3:50,4:00am,4:10,4:20,4:30,4:40,4:50,5:00am,,,,,,,6:00am,,,,,,,7:00am,,,,,,,8:00am,,,,,,&
+&y_min=0&
+&y_max=3&
+&bg_colour=0xDFFFDF&
+&x_label_style=13,0x9933CC,0,6&
+
+&y_label_style=none&
diff --git a/libs/open-flash-chart/data-files/data-10.txt b/libs/open-flash-chart/data-files/data-10.txt
new file mode 100644
index 0000000000..c44cfe4583
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-10.txt
@@ -0,0 +1,7 @@
+&x_label_style=10,#9933CC,0,6&
+&y_ticks=5,10,8&
+&area_hollow=2,3,25,#CC3399,12,12&
+&y_min=0&
+&y_max=40000&
+&x_labels=2007-06-22,2007-06-23,2007-06-24,2007-06-25,2007-06-26,2007-06-27,2007-06-28,2007-06-29,2007-06-30,2007-06-31,2007-07-01,2007-07-02,2007-07-03,2007-07-04&
+&values=null,null,33188,34019,34692,null,null,null,36319,null,null,37089,null,null& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-11.txt b/libs/open-flash-chart/data-files/data-11.txt
new file mode 100644
index 0000000000..96bb63d25c
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-11.txt
@@ -0,0 +1,14 @@
+&title=Many data lines,{font-size:30px; color:#000000}&
+
+
+&pie=60,#9933CC,#000000&
+&values=2,2,6&
+
+&X colours=#d01f3c,#356aa0,#C79810,#73880A,#D15600,#6BBA70&
+&colours=#d01f3c,#356aa0,#C79810&
+
+&links=javascript:alert('9'),javascript:alert('6'),javascript:alert('7'),javascript:alert('9'),javascript:alert('5'),javascript:alert('7'),javascript:alert('6'),javascript:alert('9'),javascript:alert('9')&
+
+&pie_labels=January,Feb,March,April,May,June,July,August,Sept&
+
+&tool_tip=#x_label#<br>Value: #val#%25& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-12.txt b/libs/open-flash-chart/data-files/data-12.txt
new file mode 100644
index 0000000000..e44a5f684f
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-12.txt
@@ -0,0 +1,21 @@
+&title=Gothic Department,{font-size:25px;color:#FFB900}&
+&x_legend=Sacrifice breakdown (2007),12,#FFFFFF&
+&x_label_style=14,#FFFFFF,2,1&
+&x_axis_steps=1&
+&y_legend=Totals,12,#FFFFFF&
+&y_label_style=14,#FFFFFF&
+&y_ticks=5,10,2&
+&bar=75,#FFB900,Kittens,10&
+&bar_2=75,#28A0DC,Puppies,10&
+
+&values=24,25,22,23,22,25,25,21,22&
+&values_2=21,22,22,23,25,22,22,21,25&
+&x_labels=January,February,March,April,May,June,July,August,September&
+&y_min=20&
+&y_max=30&
+&bg_colour=#303030&
+&x_axis_colour=#D0D0D0&
+&x_grid_colour=#808080&
+&y_axis_colour=#D0D0D0&
+
+&y_grid_colour=#808080&
diff --git a/libs/open-flash-chart/data-files/data-13.txt b/libs/open-flash-chart/data-files/data-13.txt
new file mode 100644
index 0000000000..b31fc579af
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-13.txt
@@ -0,0 +1,14 @@
+&title=Many data lines,{font-size:30px; color:#000000}&
+
+
+&pie=60,#9933CC,#000000,false,3&
+&values=2,2,6&
+
+&X colours=#d01f3c,#356aa0,#C79810,#73880A,#D15600,#6BBA70&
+&colours=#d01f3c,#356aa0,#C79810&
+
+&links=javascript:alert('9'),javascript:alert('6'),javascript:alert('7'),javascript:alert('9'),javascript:alert('5'),javascript:alert('7'),javascript:alert('6'),javascript:alert('9'),javascript:alert('9')&
+
+&pie_labels=January,Feb,March,April,May,June,July,August,Sept&
+
+&tool_tip=Value: #val#%25& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-14.txt b/libs/open-flash-chart/data-files/data-14.txt
new file mode 100644
index 0000000000..05247dcec6
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-14.txt
@@ -0,0 +1,21 @@
+&title=Many data lines,{font-size:30px; color:#7E97A6}&
+
+&y_legend=Open Flash Chart,12,#7E97A6&
+&y_label_size=15&
+&y_ticks=5,10,4&
+&bar=70,#7E97A6,Page views,10&
+&values=9,6,7,9,5,7,6,9,9&
+&x_labels=January,February,March,April,May,June,July,August,September&
+&y_max=20&
+
+&bg_image=../data-files/logo.png&
+&bg_image_x=right&
+&bg_image_y=top&
+
+&bg_colour=#E2E6E0&
+&x_axis_colour=#818D9D&
+&x_grid_colour=#ADB5C7&
+&y_axis_colour=#818D9D&
+&y_grid_colour=#ADB5C7&
+
+&x_label_style=14,#000000,2,3,#00FF00& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-15.txt b/libs/open-flash-chart/data-files/data-15.txt
new file mode 100644
index 0000000000..579857e222
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-15.txt
@@ -0,0 +1,7 @@
+&x_label_style=10,#9933CC,0,6&
+&y_ticks=5,10,8&
+&area_hollow=2,3,25,#CC3399,key,12,#9933CC&
+&y_min=0&
+&y_max=40000&
+&x_labels=2007-06-22,2007-06-23,2007-06-24,2007-06-25,2007-06-26,2007-06-27,2007-06-28,2007-06-29,2007-06-30,2007-06-31,2007-07-01,2007-07-02,2007-07-03,2007-07-04&
+&values=null,null,33188,34019,34692,null,null,null,36319,null,null,37089,null,null& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-16.txt b/libs/open-flash-chart/data-files/data-16.txt
new file mode 100644
index 0000000000..635a9db98a
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-16.txt
@@ -0,0 +1,35 @@
+&title=Users vs. ram - 24h statistics,{color: #7E97A6; font-size: 20; margin: 30px 5px; text-align: center}&
+&x_label_style=10,0x164166,2,3&
+ &x_axis_steps=1&
+ &y_legend=Max Users,12,0x164166&
+ &y_label_style=10,0x164166&
+ &y_ticks=5,10,10&
+
+ &line_hollow=2,0x164166,Ram free on irc server,10,3&
+
+
+ &line_dot_2=2,0x164166,Max users,10,4&
+
+ &values=698,1101,1324,1396,1568,1571,1496,1349,1140,1045,966,926,906,754,766,757,672,510,431,436,227,533,566,744,1004& &values_2=289,198,143,126,98,96,124,164,213,238,256,263,265,294,291,289,306,341,353,353,402,419,404,366,309&
+&x_labels=02:05,03:00,04:00,05:05,06:30,07:55,08:55,09:50,10:55,11:25,12:25,13:10,14:50,15:45,16:10,17:45,18:55,19:55,20:55,21:05,22:35,23:40,00:05,01:35,02:00&
+
+ &y_min=0&
+ &y_max=600&
+ &bg_colour=#FFFFFF&
+ &x_axis_colour=#164166&
+ &x_grid_colour=#cedcea&
+ &y_axis_colour=#164166&
+&y_grid_colour=#cedcea&
+&_inner_background=#FF0000&
+
+&show_y2=true&
+&y2_axis_colour=#164166&
+ &y2_label_style=10,0x164166&
+&y2_lines=1&
+
+ &y2_min=0&
+&y2_max=1700&
+
+&y2_legend=Free Ram (mb) xxxxxxxxx,12,0x164166&
+
+&y_legend=Max Users,12,0x164166&
diff --git a/libs/open-flash-chart/data-files/data-17.txt b/libs/open-flash-chart/data-files/data-17.txt
new file mode 100644
index 0000000000..cfb13d7033
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-17.txt
@@ -0,0 +1,17 @@
+&title=Many data lines,{font-size:30px; color: #7E97A6}&
+&y_legend=Open Flash Chart,12,#7E97A6&
+&y_label_size=15&
+&y_ticks=5,10,4&
+
+&bar_glass=60,#849FC2,#335778,Page views,10&
+&values=9,6,7,9,5,7,6,9,9&
+
+&x_labels=January,,March,,May,,June,,August&
+&y_max=20&
+&bg_colour=#E2E6E0&
+&x_axis_colour=#818D9D&
+&x_grid_colour=#ADB5C7&
+&y_axis_colour=#818D9D&
+&y_grid_colour=#ADB5C7&
+
+&y_max=12& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-18.txt b/libs/open-flash-chart/data-files/data-18.txt
new file mode 100644
index 0000000000..108fba1294
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-18.txt
@@ -0,0 +1,17 @@
+&title=Many data lines,{text-align:right; font-size:12px; color: #00FF00; margin: 12px; background-color: #000090; padding:10px}&
+&y_legend=Open Flash Chart,12,#7E97A6&
+&y_label_size=15&
+&y_ticks=5,10,4&
+
+&bar_glass=60,#D54C78,#C31812,Page views,10&
+&values=9,6,7,9,5,7,6,9,9&
+
+&x_labels=Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep&
+
+&bg_colour=#E2E6E0&
+&x_axis_colour=#818D9D&
+&x_grid_colour=#ADB5C7&
+&y_axis_colour=#818D9D&
+&y_grid_colour=#ADB5C7&
+
+&y_max=12& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-19.txt b/libs/open-flash-chart/data-files/data-19.txt
new file mode 100644
index 0000000000..d9b20ad77f
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-19.txt
@@ -0,0 +1,18 @@
+&title=Many data lines,{font-size:20px; color: #FFFFFF; margin: 5px; background-color: #505050; padding:5px; padding-left: 20px; padding-right: 20px;}&
+&y_legend=Open Flash Chart,12,#7E97A6&
+&y_label_size=15&
+&y_ticks=5,10,4&
+
+&bar_fade=60,#D54C78,Page views,10&
+&values=9,6,7,-9,5,7,6,9,9&
+
+&x_labels=Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep&
+
+&bg_colour=#E2E6E0&
+&x_axis_colour=#818D9D&
+&x_grid_colour=#ADB5C7&
+&y_axis_colour=#818D9D&
+&y_grid_colour=#ADB5C7&
+
+&y_min=-12&
+&y_max=12& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-2.txt b/libs/open-flash-chart/data-files/data-2.txt
new file mode 100644
index 0000000000..a27aaa3054
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-2.txt
@@ -0,0 +1,8 @@
+&title=Portreath beach,{color: #736AFF; font-size: 25;}&
+&x_legend=Waves in Feburary,20,0x736AFF&
+&y_legend=Wave height (cm),15,0x736AFF&
+&y_ticks=5,10,6&
+&line=3,#87421F&
+&values=1.5,1.6986693307951,1.8894183423087,2.064642473395,2.2173560908995,2.3414709848079,2.4320390859672,2.4854497299885,2.4995736030415,2.4738476308782,2.4092974268257,2.3084964038196,2.1754631805512,2.0155013718215,1.8349881501559,1.6411200080599,1.4416258565724,1.2444588979732,1.0574795567051,0.88814210905728,0.74319750469207,0.62842422758641,0.54839792611048,0.50630899636654,0.50383539116416,0.54107572533686,0.61654534427985,0.72723551244401,0.86873336212768,1.0353978205862,1.2205845018011,1.4169105971825,1.6165492048505,1.8115413635134,1.9941133511386,2.1569865987188,2.2936678638492,2.3987080958116,2.4679196720315,2.4985433453746&
+&y_min=0&
+&y_max=3&
diff --git a/libs/open-flash-chart/data-files/data-20.txt b/libs/open-flash-chart/data-files/data-20.txt
new file mode 100644
index 0000000000..98ea03f59f
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-20.txt
@@ -0,0 +1,17 @@
+&title=Many data lines,{text-align:right; font-size:12px; color: #00FF00; margin: 12px; background-color: #000090; padding:10px}&
+&y_legend=Open Flash Chart,12,#7E97A6&
+&y_label_size=15&
+&y_ticks=5,10,4&
+
+&bar_arrow=50,#D54C78,Page views,10&
+&values=9,6,7,9,5,7,6,9,9&
+
+&x_labels=Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep&
+
+&bg_colour=#E2E6E0&
+&x_axis_colour=#818D9D&
+&x_grid_colour=#ADB5C7&
+&y_axis_colour=#818D9D&
+&y_grid_colour=#ADB5C7&
+
+&y_max=12& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-21.txt b/libs/open-flash-chart/data-files/data-21.txt
new file mode 100644
index 0000000000..66eed909a7
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-21.txt
@@ -0,0 +1,32 @@
+&title=Many data lines,{font-size:20px; color: #FFFFFF; margin: 5px; background-color: #505050; padding:5px; padding-left: 20px; padding-right: 20px;}&
+&y_legend=Open Flash Chart,12,#7E97A6&
+&y_label_size=15&
+&y_ticks=5,10,4&
+
+&bar_3d=40,#D54C78,Page views,10&
+&values=6,6,7,2,5,7,6,5,6&
+
+&line_dot_2=3,#CC3399,Line,10,5&
+&values_2=9,9,9,9,9,9,9,9,9&
+
+&x_labels=Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep&
+
+&bg_colour=#E2E6E0&
+&x_axis_colour=#818D9D&
+&x_grid_colour=#ADB5C7&
+&y_axis_colour=#818D9D&
+&y_grid_colour=#ADB5C7&
+
+&x_ticks=20&
+&_x_axis_3d=5&
+&y_max=12&
+
+&show_y2=true&
+&y2_axis_colour=#164166&
+ &y2_label_style=10,0x164166&
+&y2_lines=99&
+
+ &y2_min=0&
+&y2_max=1700&
+
+&y2_legend=Free Ram (mb),12,0x164166& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-22.txt b/libs/open-flash-chart/data-files/data-22.txt
new file mode 100644
index 0000000000..ea5f1ccb72
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-22.txt
@@ -0,0 +1,43 @@
+&title=Many data lines,{font-size:20px; color: #FFFFFF; margin: 5px; background-color: #505050; padding:5px 20px 5px 20px;}&
+&y_legend=Open Flash Chart,12,#7E97A6&
+&y_label_size=15&
+&y_ticks=5,10,4&
+
+&bar_3d=60,#D54C78,Page views,10&
+&bar_3d_2=60,#3334AD,Stuff,10&
+&bar_3=50,#339966,Green Bar,10&
+&line_dot_4=3,#CC3399,Line,10,5&
+
+&values=10,6,7,-9,5,7,6,9,9&
+&values_2=80,60,70,55,70,90,75,80,75&
+&values_3=7,9,5,7,6,-9,9,-4,1&
+&values_4=60,70,55,70,90,90,80,75,80&
+
+&x_labels=Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep&
+
+&bg_colour=#E2E6E0&
+&x_axis_colour=#909090&
+
+&x_axis_3d=5&
+
+&x_grid_colour=#ADB5C7&
+&y_axis_colour=#818D9D&
+&y_grid_colour=#ADB5C7&
+
+&x_ticks=20&
+
+&y_max=20&
+&y_min=-20&
+
+&show_y2=true&
+&y2_axis_colour=#164166&
+ &y2_label_style=10,0x164166&
+&y2_lines=2,4&
+
+ &y2_min=50&
+&y2_max=100&
+
+&y2_legend=Free Ram (mb),12,0x164166&
+
+&_tool_tip=#x_legend#, #x_label#<br>#key#: £#val#.00&
+&x_legend=2007,12,0x164166& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-23.txt b/libs/open-flash-chart/data-files/data-23.txt
new file mode 100644
index 0000000000..8a2ac994e6
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-23.txt
@@ -0,0 +1,45 @@
+&title=Many data lines,{font-size:20px; color: #FFFFFF; margin: 5px; background-color: #505050; padding:5px 20px 5px 20px;}&
+&y_legend=Open Flash Chart,12,#7E97A6&
+&y_label_size=15&
+&y_ticks=5,10,4&
+
+&bar_3d=60,#D54C78,Page views,10&
+&bar_fade_2=60,#3334AD,Stuff,10&
+&bar_3=50,#339966,Green Bar,10&
+&bar_glass_4=50,#339966,Green Bar,10&
+&filled_bar_5=50,#9933CC,#8010A0,Page views,10&
+
+&values=10,-6&
+&values_2=10,-10&
+&values_3=7,-7&
+&values_4=10,-10&
+&values_5=8,-8&
+
+&x_labels=Jan,Feb&
+
+&bg_colour=#E2E6E0&
+&x_axis_colour=#909090&
+
+&x_axis_3d=5&
+
+&x_grid_colour=#ADB5C7&
+&y_axis_colour=#818D9D&
+&y_grid_colour=#ADB5C7&
+
+&x_ticks=20&
+
+&y_max=20&
+&y_min=-20&
+
+&show_y2=true&
+&y2_axis_colour=#164166&
+ &y2_label_style=10,0x164166&
+&y2_lines=2,4&
+
+ &y2_min=-10&
+&y2_max=10&
+
+&y2_legend=Free Ram (mb),12,0x164166&
+
+&tool_tip=#x_legend#, € %25 #x_label#<br>#key#: £#val#.00&
+&x_legend=2007,12,0x164166& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-25.txt b/libs/open-flash-chart/data-files/data-25.txt
new file mode 100644
index 0000000000..d403605062
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-25.txt
@@ -0,0 +1 @@
+&title=Profit,{font-size: 25px; color: #FF8040}& &x_label_style=10,0x9933CC,0,6& &x_axis_steps=1& &y_ticks=5,10,5& &line_dot=3,0x9933CC,Beer money,18,6& &values=12,16,14,18,16,19,11,11,12,17,17,14,16,16,18,13,12,19,15,12,16,17,15,12& &x_labels=January 07,February 07,March 07,April 07,May 07,June 07,July 07,August 07,September 07,October 07,November 07,December 07,January 08,February 08,March 08,April 08,May 08,June 08,July 08,August 08,September 08,October 08,November 08,December 08& &y_min=0& &y_max=20& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-26.txt b/libs/open-flash-chart/data-files/data-26.txt
new file mode 100644
index 0000000000..e19a052bcb
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-26.txt
@@ -0,0 +1 @@
+&title=Profit (2007-2008),{font-size: 18px; color: #FF8040}& &x_axis_steps=4& &y_ticks=5,10,5& &line=1,0xB0E050,Jan,12& &values=15,17,18,18,13,17,17,14,16,13,13,16,14,15,11,17,11,19,16,14,11,17,18,19& &y_min=0& &y_max=20& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-27.txt b/libs/open-flash-chart/data-files/data-27.txt
new file mode 100644
index 0000000000..a1e0f6a632
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-27.txt
@@ -0,0 +1 @@
+&title=Pie Chart,{font-size:18px; color: #d01f3c}& &x_axis_steps=1& &y_ticks=5,10,5& &line=3,#87421F& &y_min=0& &y_max=20& &pie=60,#505050,#000000,true,1& &values=5,5,5,6,15& &pie_labels=IE,Firefox,Opera,Wii,Other& &colours=#d01f3c,#356aa0,#C79810& &tool_tip=#val#%25& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-28.txt b/libs/open-flash-chart/data-files/data-28.txt
new file mode 100644
index 0000000000..a798dea5c8
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-28.txt
@@ -0,0 +1,5 @@
+&title=Tool Tip Example,{font-size: 35px; color: #738995}& &x_legend=2007,12,#000000& &x_axis_steps=1& &y_legend=Money,12,#000000& &y_ticks=5,10,2& &bar=50,#7D8E99,Earnings,10& &line_hollow_2=3,#799191,Savings,10,5& &values=5,3,3,2,5,3,4,3,3& &values_2=4,7,7,6,5,4,4,7,7& &x_labels=Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep& &y_min=0& &y_max=10& &bg_colour=#F0F0F0& &x_axis_colour=#FFFFFF& &x_grid_colour=#FFFFFF& &y_axis_colour=#FFFFFF& &y_grid_colour=#FFFFFF& &inner_background=#DDEFFA,#CBD7E6,90& &tool_tip=#key#: £#val#.00 (#x_label#, #x_legend#)
+Key: #key#
+X Label: #x_label#
+Val: £#val#.00
+X Legend: #x_legend#& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-29.txt b/libs/open-flash-chart/data-files/data-29.txt
new file mode 100644
index 0000000000..6abfaae561
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-29.txt
@@ -0,0 +1,13 @@
+<html><head></head><body>&amp;x_axis_steps=1&amp;
+&amp;y_label_style=none&amp;y_ticks=5,10,5&amp;
+&amp;line_hollow=2,#799191,Data,10,3&amp;
+&amp;values=8,3,9,2,5,6,3,3,5,7,3,2,9,1,3&amp;
+&amp;y_min=0&amp;
+&amp;y_max=10&amp;
+&amp;bg_colour=#E0E0E0&amp;
+&amp;x_axis_colour=#799191&amp;
+&amp;x_grid_colour=#FFFFFF&amp;
+&amp;y_axis_colour=#799191&amp;
+&amp;y_grid_colour=#FFFFFF&amp;
+&amp;inner_background=#DDEFFA,#CBD7E6,90&amp;
+</body></html> \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-3.txt b/libs/open-flash-chart/data-files/data-3.txt
new file mode 100644
index 0000000000..6747d6eead
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-3.txt
@@ -0,0 +1,13 @@
+&title=Many data lines,{font-size: 30px;}&
+&y_legend=Open Flash Chart,12,0x736AFF&
+&y_ticks=5,10,4&
+&line=2,0x9933CC,Page views,10&
+&line_dot_2=3,0xCC3399,Downloads,10,5&
+&line_hollow_3=2,0x80a033,Bounces,10,4&
+&values=15,18,19,14,17,18,15,18,17&
+&values_2=12,8,11,13,10,12,9,10,8&
+&values_3=5,5,5,4,1,6,1,5,1&
+
+&x_labels=January,,March,,May,,June,,August&
+&y_min=0&
+&y_max=20&
diff --git a/libs/open-flash-chart/data-files/data-30.txt b/libs/open-flash-chart/data-files/data-30.txt
new file mode 100644
index 0000000000..f47f830bdd
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-30.txt
@@ -0,0 +1 @@
+&title=Avg. Property Value (showing null values),{font-size: 14px; color: #CC3399}& &x_label_style=10,#CC3399,2& &x_axis_steps=1& &y_label_style=10,#CC3399&y_ticks=5,10,8& &area_hollow=2,3,25,#CC3399,Price,12& &values=null,null,33188,34019,34692,null,null,null,36319,null,null,37089,null,null& &x_labels=2007-06-22,2007-06-23,2007-06-24,2007-06-25,2007-06-26,2007-06-27,2007-06-28,2007-06-29,2007-06-30,2007-06-31,2007-07-01,2007-07-02,2007-07-03,2007-07-04& &y_min=0& &y_max=40000& &bg_colour=#E0E0E0& &x_axis_colour=#799191& &x_grid_colour=#FFFFFF& &y_axis_colour=#799191& &y_grid_colour=#FFFFFF& &inner_background=#DDEFFA,#CBD7E6,90& &tool_tip=USD $#val#& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-31.txt b/libs/open-flash-chart/data-files/data-31.txt
new file mode 100644
index 0000000000..f736838070
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-31.txt
@@ -0,0 +1 @@
+&title=3D Bar Chart,{font-size:20px; color: #FFFFFF; margin: 5px; background-color: #505050; padding:5px; padding-left: 20px; padding-right: 20px;}& &x_axis_steps=1& &x_axis_3d=12& &y_legend=Open Flash Chart,12,#736AFF& &y_ticks=5,10,5& &bar_3d=75,#D54C78,2006,10& &bar_3d_2=75,#3334AD,2007,10& &values=5,3,2,3,4,2,2,5,2,4& &values_2=5,9,7,6,5,8,7,9,6,8& &x_labels=January,February,March,April,May,June,July,August,September,October& &y_min=0& &y_max=10& &x_axis_colour=#909090& &x_grid_colour=#ADB5C7& &y_axis_colour=#909090& &y_grid_colour=#ADB5C7& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-32.txt b/libs/open-flash-chart/data-files/data-32.txt
new file mode 100644
index 0000000000..1132d8b609
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-32.txt
@@ -0,0 +1 @@
+&title=Profit,{font-size: 25px; color: #FF8040}& &x_label_style=10,0x9933CC,0,6& &x_axis_steps=1& &y_ticks=5,10,5& &line_dot=3,#189570,Earnings,18,6& &line_hollow_2=3,#9933CC,Beer money,18,6& &values=11,18,12,11,13,19,12,13,19,19,15,16,16,12,11,11,16,17,17,13,14,14,16,14& &values_2=6,6,8,6,7,4,4,8,4,3,3,5,5,6,2,3,9,7,7,2,4,6,7,6& &x_labels=January 07,February 07,March 07,April 07,May 07,June 07,July 07,August 07,September 07,October 07,November 07,December 07,January 08,February 08,March 08,April 08,May 08,June 08,July 08,August 08,September 08,October 08,November 08,December 08& &y_min=0& &y_max=20& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-34.txt b/libs/open-flash-chart/data-files/data-34.txt
new file mode 100644
index 0000000000..f3c878e81e
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-34.txt
@@ -0,0 +1 @@
+&title=Glass Bars,{font-size:20px; color: #bcd6ff; margin:10px; background-color: #5E83BF; padding: 5px 15px 5px 15px;}& &x_axis_steps=1& &y_legend=Open Flash Chart,12,#736AFF& &y_ticks=5,10,5& &bar_glass=55,#D54C78,#C31812,2006,10& &bar_glass_2=55,#5E83BF,#424581,2007,10& &values=2,5,2,2,5,5,3,3,5,4& &values_2=9,5,7,9,9,7,8,9,5,9& &x_labels=January,February,March,April,May,June,July,August,September,October& &y_min=0& &y_max=10& &x_axis_colour=#909090& &x_grid_colour=#D2D2FB& &y_axis_colour=#909090& &y_grid_colour=#D2D2FB& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-35.txt b/libs/open-flash-chart/data-files/data-35.txt
new file mode 100644
index 0000000000..872ad561e4
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-35.txt
@@ -0,0 +1 @@
+&title=Fade Bars,{font-size:20px; color: #bcd6ff; margin:10px; background-color: #5E83BF; padding: 5px 15px 5px 15px;}& &x_label_style=11,#000000,2& &x_axis_steps=1& &y_legend=Open Flash Chart,12,#736AFF& &y_ticks=5,10,5& &bar_fade=55,#C31812,2006,10& &bar_fade_2=55,#424581,2007,10& &values=3,3,4,4,2,2,2,5,5,5& &values_2=9,5,5,8,9,6,6,8,5,9& &x_labels=January,February,March,April,May,June,July,August,September,October& &y_min=0& &y_max=10& &bg_colour=#FDFDFD& &x_axis_colour=#909090& &x_grid_colour=#D2D2FB& &y_axis_colour=#909090& &y_grid_colour=#D2D2FB& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-36.txt b/libs/open-flash-chart/data-files/data-36.txt
new file mode 100644
index 0000000000..2fb47e1510
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-36.txt
@@ -0,0 +1,2 @@
+&title=Users vs. Ram - 24h statistics,{color: #7E97A6; font-size: 20; text-align: center}& &x_legend=My IRC Server,12,#164166& &x_label_style=10,#164166,0,3,#818D9D& &x_axis_steps=1& &y_legend=Max Users,12,#164166& &y2_legend=Free Ram (MB),12,#164166& &y_ticks=5,10,5& &line_dot=2,#818D9D,Max Users,10,4& &line_hollow_2=2,#164166,Free Ram,10,4& &values=289,198,143,126,98,96,124,164,213,238,256,263,265,294,291,289,306,341,353,353,402,419,404,366,309& &values_2=698,1101,1324,1396,1568,1571,1496,1349,1140,1045,966,926,906,754,766,757,672,510,431,436,227,533,566,744,1004& &y2_lines=2& &show_y2=true& &x_labels=00:00,01:00,02:00,03:00,04:00,05:00,06:00,07:00,08:00,09:00,10:00,11:00,12:00,13:00,14:00,15:00,16:00,17:00,18:00,19:00,20:00,21:00,22:00,23:00,24:00& &y_min=0& &y_max=600& &y2_max=1700& &bg_colour=#FFFFFF& &x_axis_colour=#818D9D& &x_grid_colour=#F0F0F0& &y_axis_colour=#818D9D& &y_grid_colour=#ADB5C7& &y2_axis_colour=#164166& &tool_tip=#key#
+#val# (#x_label#)& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-37.txt b/libs/open-flash-chart/data-files/data-37.txt
new file mode 100644
index 0000000000..855f6e735b
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-37.txt
@@ -0,0 +1 @@
+&title=Loch Ness,{color: #7E97A6; font-size: 20; text-align: center}& &x_legend=My IRC Server,12,#164166& &x_label_style=10,#164166,0,3,#818D9D& &x_axis_steps=1& &y2_legend=Free Ram (MB),12,#164166& &y_label_style=none&y_ticks=5,10,5& &line_dot=2,#818D9D,Line Dot,10,3& &values=1.4112000805987,-7.5680249530793,-9.5892427466314,-2.7941549819893,6.5698659871879,9.8935824662338,4.1211848524176,-5.4402111088937,-9.999902065507,-5.3657291800043,4.2016703682664,9.9060735569487,6.5028784015712,-2.8790331666507,-9.6139749187956,-7.5098724677168,1.4987720966295,9.1294525072763,8.3665563853606,-0.088513092904039,-8.4622040417517,-9.0557836200662,-1.3235175009777,7.625584504796,9.563759284045& &y2_lines=1& &show_y2=true& &x_labels=00:00,01:00,02:00,03:00,04:00,05:00,06:00,07:00,08:00,09:00,10:00,11:00,12:00,13:00,14:00,15:00,16:00,17:00,18:00,19:00,20:00,21:00,22:00,23:00,24:00& &y_min=0& &y_max=20& &y2_max=20& &y2_min=-10& &bg_colour=#FFFFFF& &x_axis_colour=#818D9D& &x_grid_colour=#F0F0F0& &y2_axis_colour=#164166& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-38.txt b/libs/open-flash-chart/data-files/data-38.txt
new file mode 100644
index 0000000000..4211c3f41f
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-38.txt
@@ -0,0 +1 @@
+&title=Area Chart 2,{font-size: 26px;}& &x_legend=X squared,12,#C11B01& &x_label_style=10,#000000,0,2& &x_axis_steps=2& &y_legend=Value,12,#C11B01& &y_ticks=5,10,15& &area_hollow=2,3,25,#C11B01,Squared,12,#8E560F& &values=0,1,4,9,16,25,36,49,64,81,100,121,144,169,196,225& &x_labels=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15& &y_min=0& &y_max=225& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-39.txt b/libs/open-flash-chart/data-files/data-39.txt
new file mode 100644
index 0000000000..3457a2283e
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-39.txt
@@ -0,0 +1 @@
+&title=Pie Chart,{font-size:18px; color: #d01f3c}& &x_axis_steps=1& &y_ticks=5,10,5& &line=3,#87421F& &y_min=0& &y_max=20& &pie=60,#E4F0DB,#000000,false,1& &values=12,7,8,12,9& &pie_labels=IE,Firefox,Opera,Wii,Other,Slashdot& &links=javascript:alert('12'),javascript:alert('7'),javascript:alert('8'),javascript:alert('12'),javascript:alert('9')& &colours=#d01f3c,#356aa0,#C79810& &tool_tip=#val#%25& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-4.txt b/libs/open-flash-chart/data-files/data-4.txt
new file mode 100644
index 0000000000..90ecb1231b
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-4.txt
@@ -0,0 +1,13 @@
+&title=Mixed Line and Bar Charts,{font-size:35px; color: #800000}&
+&y_legend=Your legend here!,12,#736AFF&
+&y_ticks=5,10,2&
+&bar=50,#9933CC,Purple Bar,10&
+&bar_2=50,#339966,Green Bar,10&
+&line_dot_3=3,#CC3399,Line,10,5&
+&values=3,2,5,5,4,5,2,2,2&
+&values_2=4,6,6,6,6,6,6,7,4&
+&values_3=5,5,7,7,9,5,6,8,6&
+
+&x_labels=Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep&
+&y_min=0&
+&y_max=10&
diff --git a/libs/open-flash-chart/data-files/data-5.txt b/libs/open-flash-chart/data-files/data-5.txt
new file mode 100644
index 0000000000..d6916e08a1
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-5.txt
@@ -0,0 +1,10 @@
+&title=Area Chart,{font-size:30px}&
+&x_label_style=10,#9933CC,2&
+&y_legend=Open Flash Chart,12,#736AFF&
+&y_ticks=5,10,4&
+&area_hollow=2,3,25,#CC3399&
+&values=0,0.37747172851062,0.73989485038644,1.0728206994506,1.3629765727091,1.598794871135,1.7708742633377,1.8723544869781,1.8991898457789,1.8503104986686,1.7276651109688,1.5361431672572,1.2833800430472,0.97945260646078,0.63647748529622,0.26812801531375,-0.1109108725124,-0.48552809385098,-0.84078884226022,-1.1625299927912,-1.4379247410851,-1.6559939675858,-1.8080439403901,-1.8880129069036,-1.8927127567881,-1.82195612186,-1.6785638458683,-1.4682525263564,-1.1994066119574,-0.88274414088613&
+&x_labels=0.00,0.38,0.74,1.07,1.36,1.60,1.77,1.87,1.90,1.85,1.73,1.54,1.28,0.98,0.64,0.27,-0.11,-0.49,-0.84,-1.16,-1.44,-1.66,-1.81,-1.89,-1.89,-1.82,-1.68,-1.47,-1.20,-0.88&
+&y_min=-2&
+&y_max=2&
+
diff --git a/libs/open-flash-chart/data-files/data-6.txt b/libs/open-flash-chart/data-files/data-6.txt
new file mode 100644
index 0000000000..6c9a1029fc
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-6.txt
@@ -0,0 +1,18 @@
+&title=Many data lines,{font-size:30px; color: #7E97A6}&
+&y_legend=Open Flash Chart,12,#7E97A6&
+&y_label_size=15&
+&y_ticks=5,10,4&
+&bar=70,#7E97A6,Page views,10&
+&values=9,6,7,9,5,7,6,9,9&
+&x_labels=January,,March,,May,,June,,August&
+&y_max=20&
+
+&bg_image=../data-files/logo.png&
+&bg_image_x=right&
+&bg_image_y=top&
+
+&bg_colour=#E2E6E0&
+&x_axis_colour=#818D9D&
+&x_grid_colour=#ADB5C7&
+&y_axis_colour=#818D9D&
+&y_grid_colour=#ADB5C7& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-7.txt b/libs/open-flash-chart/data-files/data-7.txt
new file mode 100644
index 0000000000..01128162a0
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-7.txt
@@ -0,0 +1,10 @@
+&title=Background Image,{font-size:30px}&
+&y_legend=Attacks,12,0x736AFF&
+&y_ticks=5,10,8&
+&line_hollow=2,0x80a033,Fatal kitten attacks in 2007,10,4&
+&values=5,5,5,7,5,10,5,10,10,11,15,10,17,8,11,5,11,13,12,8,24,19,6,10,22,18,24,12,32,9&
+&y_min=0&
+&y_max=40&
+&bg_colour=#FFFFFF&
+&bg_image=http://teethgrinder.co.uk/open-flash-chart/email.png&
+
diff --git a/libs/open-flash-chart/data-files/data-8.txt b/libs/open-flash-chart/data-files/data-8.txt
new file mode 100644
index 0000000000..a17dead1fe
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-8.txt
@@ -0,0 +1,10 @@
+&title=Profit,{font-size:25; color: #FF8040}&
+&x_label_style=10,0x9933CC,0,6&
+&y_ticks=5,10,5&
+&line_dot=3,0x9933CC,Beer money,18,6&
+&values=null,16,19,16,14,18,null,17,null,null,16,14,11,11,14,16,14,18,14,13,11,13,14,null,null&
+&x_labels=xxx January 07,February 07,March 07,April 07,May 07,June 07,July 07,August 07,September 07,October 07,November 07,December 07,January 08,February 08,March 08,April 08,May 08,June 08,July 08,August 08,September 08,October 08,November 08,December 08,tracy was here&
+&y_min=0&
+&y_max=20&
+&tool_tip=Value: £#val#&
+&y_label_stylex=none& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data-9.txt b/libs/open-flash-chart/data-files/data-9.txt
new file mode 100644
index 0000000000..fa79ebc8bf
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data-9.txt
@@ -0,0 +1,5 @@
+&tool_tip=#val#%25&
+&y_ticks=5,10,5&
+&area_hollow=2,3,45,#363c48,CA asddddd,12&
+&values=0,3,4,2,6,6,3,0,0,0,0,3.409922927618,0,0,0,0,0,0,0,61.470058977604,0,0,0,0,0,0,0,0,0&
+&y_max=100& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/data.txt b/libs/open-flash-chart/data-files/data.txt
new file mode 100644
index 0000000000..0add912feb
--- /dev/null
+++ b/libs/open-flash-chart/data-files/data.txt
@@ -0,0 +1,9 @@
+&title=Many data lines,{font-size: 20;}&
+&y_legendx=Open Flash Chart,12,0x736AFF&
+&y_label_size=15&
+&y_ticks=5,10,4&
+&bar=50,0x9933CC,Page views,10&
+&values=9,6,7,9,5,7,6,9,9&
+&x_labels=January,,March,,May,,June,,August&
+&x_axis_steps=2&
+&y_max=20& \ No newline at end of file
diff --git a/libs/open-flash-chart/data-files/logo.png b/libs/open-flash-chart/data-files/logo.png
new file mode 100644
index 0000000000..3a203cfe69
--- /dev/null
+++ b/libs/open-flash-chart/data-files/logo.png
Binary files differ
diff --git a/libs/open-flash-chart/data-files/nodata.txt b/libs/open-flash-chart/data-files/nodata.txt
new file mode 100644
index 0000000000..c7236b0460
--- /dev/null
+++ b/libs/open-flash-chart/data-files/nodata.txt
@@ -0,0 +1,9 @@
+&title=No data - Piwik,{font-size: 20;}&
+&y_legendx=Legend test,12,0x736AFF&
+&y_label_size=15&
+&y_ticks=5,10,4&
+&bar=50,0x9933CC,Page views,10&
+&values=9,6,7,9,5,7,6,9,9&
+&x_labels=January,,March,,May,,June,,August&
+&x_axis_steps=2&
+&y_max=20& \ No newline at end of file
diff --git a/libs/open-flash-chart/open-flash-chart.swf b/libs/open-flash-chart/open-flash-chart.swf
new file mode 100644
index 0000000000..5a884344b6
--- /dev/null
+++ b/libs/open-flash-chart/open-flash-chart.swf
Binary files differ
diff --git a/libs/open-flash-chart/php-ofc-library/README.txt b/libs/open-flash-chart/php-ofc-library/README.txt
new file mode 100644
index 0000000000..7bbaece56a
--- /dev/null
+++ b/libs/open-flash-chart/php-ofc-library/README.txt
@@ -0,0 +1,16 @@
+Open Flash Chart - PHP libraries. These help create data files for Open Flash Chart.
+Copyright (C) 2007 John Glazebrook
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA \ No newline at end of file
diff --git a/libs/open-flash-chart/php-ofc-library/open_flash_chart_object.php b/libs/open-flash-chart/php-ofc-library/open_flash_chart_object.php
new file mode 100644
index 0000000000..a45d440345
--- /dev/null
+++ b/libs/open-flash-chart/php-ofc-library/open_flash_chart_object.php
@@ -0,0 +1,2 @@
+<?php
+?> \ No newline at end of file
diff --git a/libs/swfobject/README.txt b/libs/swfobject/README.txt
new file mode 100644
index 0000000000..db54d3ae23
--- /dev/null
+++ b/libs/swfobject/README.txt
@@ -0,0 +1,12 @@
+***************
+** JS Folder **
+***************
+
+Here are some Javascript libraries used on the code or samples.
+
+- swfobject.js
+
+ SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
+ *
+ * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
diff --git a/libs/swfobject/swfobject.js b/libs/swfobject/swfobject.js
new file mode 100644
index 0000000000..02ca073dcf
--- /dev/null
+++ b/libs/swfobject/swfobject.js
@@ -0,0 +1,233 @@
+/**
+ * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
+ *
+ * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ */
+if(typeof deconcept == "undefined") var deconcept = new Object();
+if(typeof deconcept.util == "undefined") deconcept.util = new Object();
+if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
+deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
+ if (!document.getElementById) { return; }
+ this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
+ this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
+ this.params = new Object();
+ this.variables = new Object();
+ this.attributes = new Array();
+ if(swf) { this.setAttribute('swf', swf); }
+ if(id) { this.setAttribute('id', id); }
+ if(w) { this.setAttribute('width', w); }
+ if(h) { this.setAttribute('height', h); }
+ if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
+ this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
+ if (!window.opera && document.all && this.installedVer.major > 7) {
+ // only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
+ deconcept.SWFObject.doPrepUnload = true;
+ }
+ if(c) { this.addParam('bgcolor', c); }
+ var q = quality ? quality : 'high';
+ this.addParam('quality', q);
+ this.setAttribute('useExpressInstall', false);
+ this.setAttribute('doExpressInstall', false);
+ var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
+ this.setAttribute('xiRedirectUrl', xir);
+ this.setAttribute('redirectUrl', '');
+ if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
+}
+deconcept.SWFObject.prototype = {
+ useExpressInstall: function(path) {
+ this.xiSWFPath = !path ? "expressinstall.swf" : path;
+ this.setAttribute('useExpressInstall', true);
+ },
+ setAttribute: function(name, value){
+ this.attributes[name] = value;
+ },
+ getAttribute: function(name){
+ return this.attributes[name];
+ },
+ addParam: function(name, value){
+ this.params[name] = value;
+ },
+ getParams: function(){
+ return this.params;
+ },
+ addVariable: function(name, value){
+ this.variables[name] = value;
+ },
+ getVariable: function(name){
+ return this.variables[name];
+ },
+ getVariables: function(){
+ return this.variables;
+ },
+ getVariablePairs: function(){
+ var variablePairs = new Array();
+ var key;
+ var variables = this.getVariables();
+ for(key in variables){
+ variablePairs[variablePairs.length] = key +"="+ variables[key];
+ }
+ return variablePairs;
+ },
+ getSWFHTML: function() {
+ var swfNode = "";
+ if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
+ if (this.getAttribute("doExpressInstall")) {
+ this.addVariable("MMplayerType", "PlugIn");
+ this.setAttribute('swf', this.xiSWFPath);
+ }
+ swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'"';
+ swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
+ var params = this.getParams();
+ for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
+ var pairs = this.getVariablePairs().join("&");
+ if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
+ swfNode += '/>';
+ } else { // PC IE
+ if (this.getAttribute("doExpressInstall")) {
+ this.addVariable("MMplayerType", "ActiveX");
+ this.setAttribute('swf', this.xiSWFPath);
+ }
+ swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'">';
+ swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
+ var params = this.getParams();
+ for(var key in params) {
+ swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
+ }
+ var pairs = this.getVariablePairs().join("&");
+ if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
+ swfNode += "</object>";
+ }
+ return swfNode;
+ },
+ write: function(elementId){
+ if(this.getAttribute('useExpressInstall')) {
+ // check to see if we need to do an express install
+ var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
+ if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
+ this.setAttribute('doExpressInstall', true);
+ this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
+ document.title = document.title.slice(0, 47) + " - Flash Player Installation";
+ this.addVariable("MMdoctitle", document.title);
+ }
+ }
+ if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
+ var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
+ n.innerHTML = this.getSWFHTML();
+ return true;
+ }else{
+ if(this.getAttribute('redirectUrl') != "") {
+ document.location.replace(this.getAttribute('redirectUrl'));
+ }
+ }
+ return false;
+ }
+}
+
+/* ---- detection functions ---- */
+deconcept.SWFObjectUtil.getPlayerVersion = function(){
+ var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
+ if(navigator.plugins && navigator.mimeTypes.length){
+ var x = navigator.plugins["Shockwave Flash"];
+ if(x && x.description) {
+ PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
+ }
+ }else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
+ var axo = 1;
+ var counter = 3;
+ while(axo) {
+ try {
+ counter++;
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
+// document.write("player v: "+ counter);
+ PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
+ } catch (e) {
+ axo = null;
+ }
+ }
+ } else { // Win IE (non mobile)
+ // do minor version lookup in IE, but avoid fp6 crashing issues
+ // see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
+ try{
+ var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
+ }catch(e){
+ try {
+ var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
+ PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
+ axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
+ } catch(e) {
+ if (PlayerVersion.major == 6) {
+ return PlayerVersion;
+ }
+ }
+ try {
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
+ } catch(e) {}
+ }
+ if (axo != null) {
+ PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
+ }
+ }
+ return PlayerVersion;
+}
+deconcept.PlayerVersion = function(arrVersion){
+ this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
+ this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
+ this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
+}
+deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
+ if(this.major < fv.major) return false;
+ if(this.major > fv.major) return true;
+ if(this.minor < fv.minor) return false;
+ if(this.minor > fv.minor) return true;
+ if(this.rev < fv.rev) return false;
+ return true;
+}
+/* ---- get value of query string param ---- */
+deconcept.util = {
+ getRequestParameter: function(param) {
+ var q = document.location.search || document.location.hash;
+ if (param == null) { return q; }
+ if(q) {
+ var pairs = q.substring(1).split("&");
+ for (var i=0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return pairs[i].substring((pairs[i].indexOf("=")+1));
+ }
+ }
+ }
+ return "";
+ }
+}
+/* fix for video streaming bug */
+deconcept.SWFObjectUtil.cleanupSWFs = function() {
+ var objects = document.getElementsByTagName("OBJECT");
+ for (var i = objects.length - 1; i >= 0; i--) {
+ objects[i].style.display = 'none';
+ for (var x in objects[i]) {
+ if (typeof objects[i][x] == 'function') {
+ objects[i][x] = function(){};
+ }
+ }
+ }
+}
+// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
+if (deconcept.SWFObject.doPrepUnload) {
+ if (!deconcept.unloadSet) {
+ deconcept.SWFObjectUtil.prepUnload = function() {
+ __flash_unloadHandler = function(){};
+ __flash_savedUnloadHandler = function(){};
+ window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
+ }
+ window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
+ deconcept.unloadSet = true;
+ }
+}
+/* add document.getElementById if needed (mobile IE < 5) */
+if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}
+
+/* add some aliases for ease of use/backwards compatibility */
+var getQueryParamValue = deconcept.util.getRequestParameter;
+var FlashObject = deconcept.SWFObject; // for legacy support
+var SWFObject = deconcept.SWFObject;
diff --git a/modules/SmartyPlugins/function.url.php b/modules/SmartyPlugins/function.url.php
index 0fbb5726ab..810687efe8 100644
--- a/modules/SmartyPlugins/function.url.php
+++ b/modules/SmartyPlugins/function.url.php
@@ -4,7 +4,7 @@
* @package Smarty
* @subpackage plugins
*/
-
+require_once "Url.php";
/**
* Smarty {mailto} function plugin
@@ -29,16 +29,7 @@
*/
function smarty_function_url($params, &$smarty)
{
- $queryString = Piwik_Url::getCurrentQueryString();
- $queryString = htmlspecialchars($queryString);
- $urlValues = Piwik_Common::getArrayFromQueryString($queryString);
-// var_dump($urlValues);
- foreach($params as $key => $value)
- {
- $urlValues[$key] = $value;
- }
-
- return '?' . http_build_query($urlValues);
+ return Piwik_Url::getCurrentQueryStringWithParametersModified( $params );
}
/* vim: set expandtab: */
diff --git a/modules/Url.php b/modules/Url.php
index de672847d9..72df3763c3 100644
--- a/modules/Url.php
+++ b/modules/Url.php
@@ -1,6 +1,21 @@
<?php
class Piwik_Url
{
+
+ static function getCurrentQueryStringWithParametersModified( $params )
+ {
+ $queryString = Piwik_Url::getCurrentQueryString();
+ $queryString = htmlspecialchars($queryString);
+ $urlValues = Piwik_Common::getArrayFromQueryString($queryString);
+ // var_dump($urlValues);
+ foreach($params as $key => $value)
+ {
+ $urlValues[$key] = $value;
+ }
+
+ return '?' . http_build_query($urlValues);
+ }
+
static public function redirectToUrl( $url )
{
header("Location: $url");
@@ -30,6 +45,21 @@ class Piwik_Url
. self::getCurrentScriptName() ;
}
+ /**
+ * Ending with /
+ */
+ static public function getCurrentUrlWithoutFileName()
+ {
+
+ $host = self::getCurrentHost();
+ $queryString = self::getCurrentScriptName() ;
+
+ //add a fake letter case /test/test2/ returns /test which is not expected
+ $urlDir = dirname ($queryString . 'x');
+ return $host.$urlDir.'/';
+
+ }
+
static public function getCurrentScriptName()
{
$url = '';
diff --git a/modules/View.php b/modules/View.php
index 2641c95a70..4bd15724de 100644
--- a/modules/View.php
+++ b/modules/View.php
@@ -1,7 +1,8 @@
<?php
require_once 'Smarty/Smarty.class.php';
-class Piwik_View
+require_once "iView.php";
+class Piwik_View implements iView
{
private $template = '';
private $smarty = false;
diff --git a/modules/View/DataTableCloud.php b/modules/View/DataTableCloud.php
deleted file mode 100644
index e51e2c8706..0000000000
--- a/modules/View/DataTableCloud.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-require_once "View/Cloud.php";
-class Piwik_View_DataTableCloud extends Piwik_View_DataTable
-{
-
- protected $displayLogoInsteadOfLabel = false;
- function init($currentControllerAction,
- $moduleNameAndMethod )
- {
- parent::init($currentControllerAction,
- $moduleNameAndMethod );
- $this->dataTableTemplate = 'UserSettings/templates/cloud.tpl';
-
- $this->disableOffsetInformation();
- $this->disableExcludeLowPopulation();
- $this->disableSearchBox();
- }
-
- public function main()
- {
- $this->setDefaultLimit( 30 );
- if($this->mainAlreadyExecuted)
- {
- return;
- }
- $this->mainAlreadyExecuted = true;
-
- $this->loadDataTableFromAPI();
-
- // We apply a filter to the DataTable, decoding the label column (useful for keywords for example)
- $filter = new Piwik_DataTable_Filter_ColumnCallbackReplace(
- $this->dataTable,
- 'label',
- 'urldecode'
- );
-
-
- $view = new Piwik_View($this->dataTableTemplate);
- $view->method = $this->method;
-
- $view->id = $this->getUniqIdTable();
-
-
- $view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet();
-// echo $this->dataTable; exit;
- $words = $labelDetails = array();
- foreach($this->dataTable->getRows() as $row)
- {
- $label = $row->getColumn('label');
- $value = $row->getColumn('nb_unique_visitors');
- // case no unique visitors
- if($value === false)
- {
- $value = $row->getColumn('nb_visits');
- }
- $words[$label] = $value;
-
- $logo = false;
- if($this->displayLogoInsteadOfLabel)
- {
- $logo = $row->getDetail('logo');
- }
-
- $labelDetails[$label] = array(
- 'logo' => $logo,
- 'url' => $row->getDetail('url'),
- 'hits' => $value
- );
- }
- $cloud = new Piwik_Cloud($words);
- $cloudValues = $cloud->render('array');
-
- foreach($cloudValues as &$value)
- {
- $value['logoWidth'] = round(max(16, $value['percent']));
- }
-// var_dump($cloudValues);exit;
-// var_dump($labelDetails);exit;
- $view->labelDetails = $labelDetails;
- $view->cloudValues = $cloudValues;
-
- $this->view = $view;
- }
-}
-?>
diff --git a/modules/View/DataTable.php b/modules/ViewDataTable.php
index 6d9ef60246..1dca1d8954 100644
--- a/modules/View/DataTable.php
+++ b/modules/ViewDataTable.php
@@ -1,8 +1,13 @@
<?php
// TODO clean this unit should'nt read the requests parameters (via getRequestVar)
-class Piwik_View_DataTable
+// This unit should be some sort of configuration manager that would
+// redirect the config info on the renderer
+// currently this is ugly, YES!!!
+require_once "iView.php";
+class Piwik_ViewDataTable
{
+ protected $typeViewRequested = null;
protected $dataTableTemplate = null;
protected $currentControllerAction;
@@ -32,21 +37,37 @@ class Piwik_View_DataTable
{
$type = Piwik_Common::getRequestVar('viewDataTable', 'table', 'string');
}
+
+ // TODO: instead of giving the parameter to the constructor we should really
+ // have only one class per type view renderer
switch($type)
{
case 'cloud':
- require_once "View/DataTableCloud.php";
- return new Piwik_View_DataTableCloud;
+ require_once "ViewDataTable/Cloud.php";
+ return new Piwik_ViewDataTable_Cloud($type);
break;
+ case 'graphVerticalBar':
+ case 'graphPie':
+ require_once "ViewDataTable/Graph.php";
+ return new Piwik_ViewDataTable_Graph($type);
+ break;
+
+ case 'generateDataChartVerticalBar':
+ case 'generateDataChartPie':
+ require_once "ViewDataTable/GenerateGraphData.php";
+ return new Piwik_ViewDataTable_GenerateGraphData($type);
+ break;
+
case 'table':
default:
- return new Piwik_View_DataTable;
+ return new Piwik_ViewDataTable($type);
break;
}
}
- function __construct()
+ function __construct($typeView)
{
+ $this->typeViewRequested = $typeView;
}
function init( $currentControllerAction,
@@ -67,6 +88,7 @@ class Piwik_View_DataTable
function getView()
{
+ //TODO check at some point that the class implements the interface iView
return $this->view;
}
@@ -339,8 +361,10 @@ class Piwik_View_DataTable
// var_dump($this->variablesDefault);
// var_dump($javascriptVariablesToSet); exit;
- $javascriptVariablesToSet['totalRows'] = $this->dataTable->getRowsCountBeforeLimitFilter();
-
+ if($this->dataTable)
+ {
+ $javascriptVariablesToSet['totalRows'] = $this->dataTable->getRowsCountBeforeLimitFilter();
+ }
$javascriptVariablesToSet['show_search'] = $this->getSearchBox();
$javascriptVariablesToSet['show_offset_information'] = $this->getOffsetInformation();
$javascriptVariablesToSet['show_exclude_low_population'] = $this->getExcludeLowPopulation();
diff --git a/modules/ViewDataTable/Cloud.php b/modules/ViewDataTable/Cloud.php
index 30cabb0a8a..7bc5760c40 100644
--- a/modules/ViewDataTable/Cloud.php
+++ b/modules/ViewDataTable/Cloud.php
@@ -1,156 +1,88 @@
<?php
-// inspired from Derek Harvey (www.derekharvey.co.uk)
-class Piwik_Cloud
+require_once "Visualization/Cloud.php";
+class Piwik_ViewDataTable_Cloud extends Piwik_ViewDataTable
{
- protected $wordsArray = array();
- public $truncatingLimit = 30;
- /**
- * @param array array( word => 10, word2 => 50, word3 => 1)
- */
- function __construct($words = false)
- {
- if ($words !== false && is_array($words))
- {
- foreach ($words as $word => $value)
- {
- $this->addWord($word, $value);
- }
- }
- }
-
- /*
- * Assign word to array
- *
- * @param string $word
- * @return string
- */
-
- function addWord($word, $value = 1)
- {
-// $word = strtolower($word);
- if (isset($this->wordsArray[$word]))
- {
- $this->wordsArray[$word] += $value;
- }
- else
- {
- $this->wordsArray[$word] = $value;
- }
- }
-
- /*
- * Shuffle associated names in array
- */
-
- function shuffleCloud()
- {
- $keys = array_keys($this->wordsArray);
-
- shuffle($keys);
-
- if (count($keys) && is_array($keys))
- {
- $tmpArray = $this->wordsArray;
- $this->wordsArray = array();
- foreach ($keys as $key => $value)
- $this->wordsArray[$value] = $tmpArray[$value];
- }
- }
-
- /*
- * Calculate size of words array
- */
-
- function getCloudSize()
- {
- return array_sum($this->wordsArray);
- }
-
- /*
- * Get the class range using a percentage
- *
- * @returns int $class
- */
-
- function getClassFromPercent($percent)
- {
- $mapping = array(
- 95,
- 70,
- 50,
- 30,
- 15,
- 5,
- 0
- );
- foreach($mapping as $key => $value)
- {
- if($percent >= $value)
- {
- return $key;
- }
- }
- }
-
- /*
- * Create the HTML code for each word and apply font size.
- *
- * @returns string $spans
- */
-
- function render($returnType = "html")
- {
- $this->shuffleCloud();
-
-
-
- if($returnType == "html")
- {
- $return = '';
- }
- else
- {
- $return = array();
- }
+ function __construct($typeViewRequested)
+ {
+ parent::__construct($typeViewRequested);
+ }
+ protected $displayLogoInsteadOfLabel = false;
+ function init($currentControllerAction,
+ $moduleNameAndMethod )
+ {
+ parent::init($currentControllerAction,
+ $moduleNameAndMethod );
+ $this->dataTableTemplate = 'UserSettings/templates/cloud.tpl';
+ $this->disableOffsetInformation();
+ $this->disableExcludeLowPopulation();
+ $this->disableSearchBox();
+ }
+
+ public function main()
+ {
+ $this->setDefaultLimit( 30 );
+ if($this->mainAlreadyExecuted)
+ {
+ return;
+ }
+ $this->mainAlreadyExecuted = true;
+
+ $this->loadDataTableFromAPI();
+
+ // We apply a filter to the DataTable, decoding the label column (useful for keywords for example)
+ $filter = new Piwik_DataTable_Filter_ColumnCallbackReplace(
+ $this->dataTable,
+ 'label',
+ 'urldecode'
+ );
- if (count($this->wordsArray) > 0)
- {
-
- $this->max = max($this->wordsArray);
-
- $return = ($returnType == "html" ? "" : ($returnType == "array" ? array() : ""));
- foreach ($this->wordsArray as $word => $popularity)
- {
-
- // truncating the word
- $wordTruncated = $word;
- if(strlen($word) > $this->truncatingLimit)
- {
- $wordTruncated = substr($word, 0, $this->truncatingLimit - 3).'...';
- }
-
- // computing the percentage
- $percent = ($popularity / $this->max) * 100;
-
- // and the CSS style value
- $sizeRange = $this->getClassFromPercent($percent);
-
- if ($returnType == "array")
- {
- $return[$word]['word'] = $word;
- $return[$word]['wordTruncated'] = $wordTruncated;
- $return[$word]['size'] = $sizeRange;
- $return[$word]['percent'] = $percent;
- }
- else if ($returnType == "html")
- {
- $return .= "\n<span title='".$word."' class='word size{$sizeRange}'> &nbsp; {$wordTruncated} &nbsp; </span>";
- }
-// print( $word ."=".$percent."<br>");
- }
- }
- return $return;
- }
+
+ $view = new Piwik_View($this->dataTableTemplate);
+ $view->method = $this->method;
+
+ $view->id = $this->getUniqIdTable();
+
+
+ $view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet();
+// echo $this->dataTable; exit;
+ $words = $labelDetails = array();
+ foreach($this->dataTable->getRows() as $row)
+ {
+ $label = $row->getColumn('label');
+ $value = $row->getColumn('nb_unique_visitors');
+ // case no unique visitors
+ if($value === false)
+ {
+ $value = $row->getColumn('nb_visits');
+ }
+ $words[$label] = $value;
+
+ $logo = false;
+ if($this->displayLogoInsteadOfLabel)
+ {
+ $logo = $row->getDetail('logo');
+ }
+
+ $labelDetails[$label] = array(
+ 'logo' => $logo,
+ 'url' => $row->getDetail('url'),
+ 'hits' => $value
+ );
+ }
+ $cloud = new Piwik_Visualization_Cloud($words);
+ $cloudValues = $cloud->render('array');
+
+ foreach($cloudValues as &$value)
+ {
+ $value['logoWidth'] = round(max(16, $value['percent']));
+ }
+// var_dump($cloudValues);exit;
+// var_dump($labelDetails);exit;
+ $view->labelDetails = $labelDetails;
+ $view->cloudValues = $cloudValues;
+
+ $this->view = $view;
+ }
}
-
+?>
diff --git a/modules/ViewDataTable/DataTableCloud.php b/modules/ViewDataTable/DataTableCloud.php
deleted file mode 100644
index 8ea8322d66..0000000000
--- a/modules/ViewDataTable/DataTableCloud.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-require_once "View/Cloud.php";
-class Piwik_ViewDataTable_Cloud extends Piwik_View_DataTable
-{
-
- protected $displayLogoInsteadOfLabel = false;
- function init($currentControllerAction,
- $moduleNameAndMethod )
- {
- parent::init($currentControllerAction,
- $moduleNameAndMethod );
- $this->dataTableTemplate = 'UserSettings/templates/cloud.tpl';
-
- $this->disableOffsetInformation();
- $this->disableExcludeLowPopulation();
- $this->disableSearchBox();
- }
-
- public function main()
- {
- $this->setDefaultLimit( 30 );
- if($this->mainAlreadyExecuted)
- {
- return;
- }
- $this->mainAlreadyExecuted = true;
-
- $this->loadDataTableFromAPI();
-
- // We apply a filter to the DataTable, decoding the label column (useful for keywords for example)
- $filter = new Piwik_DataTable_Filter_ColumnCallbackReplace(
- $this->dataTable,
- 'label',
- 'urldecode'
- );
-
-
- $view = new Piwik_View($this->dataTableTemplate);
- $view->method = $this->method;
-
- $view->id = $this->getUniqIdTable();
-
-
- $view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet();
-// echo $this->dataTable; exit;
- $words = $labelDetails = array();
- foreach($this->dataTable->getRows() as $row)
- {
- $label = $row->getColumn('label');
- $value = $row->getColumn('nb_unique_visitors');
- // case no unique visitors
- if($value === false)
- {
- $value = $row->getColumn('nb_visits');
- }
- $words[$label] = $value;
-
- $logo = false;
- if($this->displayLogoInsteadOfLabel)
- {
- $logo = $row->getDetail('logo');
- }
-
- $labelDetails[$label] = array(
- 'logo' => $logo,
- 'url' => $row->getDetail('url'),
- 'hits' => $value
- );
- }
- $cloud = new Piwik_Cloud($words);
- $cloudValues = $cloud->render('array');
-
- foreach($cloudValues as &$value)
- {
- $value['logoWidth'] = round(max(16, $value['percent']));
- }
-// var_dump($cloudValues);exit;
-// var_dump($labelDetails);exit;
- $view->labelDetails = $labelDetails;
- $view->cloudValues = $cloudValues;
-
- $this->view = $view;
- }
-}
-?>
diff --git a/modules/ViewDataTable/GenerateGraphData.php b/modules/ViewDataTable/GenerateGraphData.php
new file mode 100644
index 0000000000..efafc16d11
--- /dev/null
+++ b/modules/ViewDataTable/GenerateGraphData.php
@@ -0,0 +1,77 @@
+<?php
+
+class Piwik_ViewDataTable_GenerateGraphData extends Piwik_ViewDataTable
+{
+ function __construct($typeViewRequested)
+ {
+ parent::__construct($typeViewRequested);
+ }
+
+ function init($currentControllerAction,
+ $moduleNameAndMethod )
+ {
+ parent::init($currentControllerAction,
+ $moduleNameAndMethod );
+
+ $this->disableOffsetInformation();
+ $this->disableExcludeLowPopulation();
+ $this->disableSearchBox();
+ }
+
+ public function main()
+ {
+ if($this->mainAlreadyExecuted)
+ {
+ return;
+ }
+ $this->mainAlreadyExecuted = true;
+
+ switch($this->typeViewRequested)
+ {
+ case 'generateDataChartPie':
+ require_once "Visualization/ChartPie.php";
+ $view = new Piwik_Visualization_ChartPie;
+ break;
+
+ default:
+ case 'generateDataChartVerticalBar':
+ require_once "Visualization/ChartVerticalBar.php";
+ $view = new Piwik_Visualization_ChartVerticalBar;
+ break;
+
+ }
+
+ $this->setDefaultLimit( $view->getDefaultLimit() );
+
+
+ $this->loadDataTableFromAPI();
+ // We apply a filter to the DataTable, decoding the label column (useful for keywords for example)
+ $filter = new Piwik_DataTable_Filter_ColumnCallbackReplace(
+ $this->dataTable,
+ 'label',
+ 'urldecode'
+ );
+
+ foreach($this->dataTable->getRows() as $row)
+ {
+ $label = $row->getColumn('label');
+ $value = $row->getColumn('nb_unique_visitors');
+ // case no unique visitors
+ if($value === false)
+ {
+ $value = $row->getColumn('nb_visits');
+ }
+ $data[] = array(
+ 'label' => $label,
+ 'value' => $value,
+ 'url' => $row->getDetail('url'),
+ );
+ }
+ $view->setData($data);
+ $view->customizeGraph();
+
+ $this->view = $view;
+
+ }
+}
+?>
diff --git a/modules/ViewDataTable/Graph.php b/modules/ViewDataTable/Graph.php
new file mode 100644
index 0000000000..ef0b37af65
--- /dev/null
+++ b/modules/ViewDataTable/Graph.php
@@ -0,0 +1,117 @@
+<?php
+class Piwik_ViewDataTable_Graph extends Piwik_ViewDataTable
+{
+ function __construct($typeViewRequested)
+ {
+ parent::__construct($typeViewRequested);
+ }
+
+ function init($currentControllerAction,
+ $moduleNameAndMethod )
+ {
+ parent::init($currentControllerAction,
+ $moduleNameAndMethod );
+ $this->dataTableTemplate = 'UserSettings/templates/graph.tpl';
+
+ $this->disableOffsetInformation();
+ $this->disableExcludeLowPopulation();
+ $this->disableSearchBox();
+ }
+
+ public function main()
+ {
+ if($this->mainAlreadyExecuted)
+ {
+ return;
+ }
+ $this->mainAlreadyExecuted = true;
+
+ $view = new Piwik_View($this->dataTableTemplate);
+ $this->id = $this->getUniqIdTable();
+ $view->id = $this->id;
+ $view->method = $this->method;
+
+ $mappingTypeToGenerator = array (
+ 'graphVerticalBar' => 'generateDataChartVerticalBar',
+ 'graphPie' => 'generateDataChartPie',
+ );
+
+ $parametersToModify = array( 'viewDataTable' => $mappingTypeToGenerator[$this->typeViewRequested]);
+ $url = Piwik_Url::getCurrentQueryStringWithParametersModified($parametersToModify);
+ $view->jsInvocationTag = $this->getFlashInvocationCode($url);
+// print($url);exit;
+ $view->urlData = $url;
+ $view->codeEmbed = $this->codeEmbed;
+
+ $view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet();
+ $this->view = $view;
+ }
+
+ protected function getCodeEmbed( $url )
+ {
+
+ }
+ protected function getFlashInvocationCode(
+ $url = 'libs/open-flash-chart/data-files/nodata.txt',
+ $width = 500,
+ $height = 250,
+ $use_swfobject = true )
+ {
+ $libPathInPiwik = 'libs/open-flash-chart/';
+
+ $currentPath = Piwik_Url::getCurrentUrlWithoutFileName();
+
+ $pathToLibraryOpenChart = $currentPath . $libPathInPiwik;
+
+ $url = $currentPath . $url;
+
+ $div_name = $this->id;
+
+ $obj_id = 'chart';
+ $div_name = 'flashcontent';
+ // I think we may use swfobject for all browsers,
+ // not JUST for IE...
+ //
+ //$ie = strstr(getenv('HTTP_USER_AGENT'), 'MSIE');
+
+ //
+ // escape the & and stuff:
+ //
+ $url = urlencode($url);
+
+ $return = '';
+ if( $use_swfobject )
+ {
+ // Using library for auto-enabling Flash object on IE, disabled-Javascript proof
+ $return .= '
+ <div id="'. $div_name .'"></div>
+ <script type="text/javascript">
+ var so = new SWFObject("'.$pathToLibraryOpenChart.'open-flash-chart.swf", "ofc", "'. $width . '", "' . $height . '", "9", "#FFFFFF");
+ so.addVariable("width", "' . $width . '");
+ so.addVariable("height", "' . $height . '");
+ so.addVariable("data", "'. $url . '");
+ so.addParam("allowScriptAccess", "sameDomain");
+ so.write("'. $div_name .'");
+ </script>
+ <noscript>
+ ';
+ }
+ $this->codeEmbed = '<embed src="'.$pathToLibraryOpenChart.'open-flash-chart.swf?data=' . $url .'" quality="high" bgcolor="#FFFFFF" width="'. $width .'" height="'. $height .'" name="open-flash-chart" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="'. $obj_id .'"/>';
+
+ $return .= '
+ <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
+ width="' . $width . '" height="' . $height . '" id="ie_'. $obj_id .'" align="middle">
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="movie" value="'.$pathToLibraryOpenChart.'open-flash-chart.swf?width='. $width .'&height='. $height . '&data='. $url .'" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="#FFFFFF" />
+ '.$this->codeEmbed.'
+ </object>';
+
+ if ( $use_swfobject ) {
+ $return .= '</noscript>';
+ }
+
+ return $return;
+ }
+}
diff --git a/modules/ViewDataTable/HtmlAjax.php b/modules/ViewDataTable/HtmlAjax.php
new file mode 100644
index 0000000000..f7e8d5cb11
--- /dev/null
+++ b/modules/ViewDataTable/HtmlAjax.php
@@ -0,0 +1,2 @@
+<?php
+//TODO should contain the code from the viewDataTable
diff --git a/modules/Visualization/Chart.php b/modules/Visualization/Chart.php
new file mode 100644
index 0000000000..b1cdad994f
--- /dev/null
+++ b/modules/Visualization/Chart.php
@@ -0,0 +1,48 @@
+<?php
+require_once "Visualization/OpenFlashChart.php";
+abstract class Piwik_Visualization_Chart extends Piwik_Visualization_OpenFlashChart
+{
+ abstract function getDefaultLimit();
+
+ function setData($data)
+ {
+ $this->dataGraph = $data;
+ }
+
+ function prepareData()
+ {
+ $label = $data = array();
+ foreach($this->dataGraph as $row)
+ {
+ $label[] = $row['label'];
+ $data[] = $row['value'];
+ }
+ $max = max($data);
+
+ $this->arrayData = $data;
+ $this->arrayLabel = $label;
+ $this->maxData = $max;
+// var_dump($label);var_dump($data);
+ }
+
+ function render()
+ {
+ //some tests data
+ /*return '&y_legend=Time of day,#736AFF,12&
+ &y_ticks=5,10,6&
+ &line_dot=3,0x736AFF,Avg. wave height (cm),10,3&
+ &values=1.5,1.6986693307951,1.8894183423087,2.064642473395,2.2173560908995,2.3414709848079,2.4320390859672,2.4854497299885,2.4995736030415,2.4738476308782,2.4092974268257,2.3084964038196,2.1754631805512,2.0155013718215,1.8349881501559,1.6411200080599,1.4416258565724,1.2444588979732,1.0574795567051,0.88814210905728,0.74319750469207,0.62842422758641,0.54839792611048,0.50630899636654,0.50383539116416,0.54107572533686,0.61654534427985,0.72723551244401,0.86873336212768,1.0353978205862,1.2205845018011,1.4169105971825,1.6165492048505,1.8115413635134,1.9941133511386,2.1569865987188,2.2936678638492,2.3987080958116,2.4679196720315,2.4985433453746,2.4893582466234,2.4407305566798,2.3545989080883,2.2343970978741,2.0849171928918&
+ &x_labels=2:00am,2:10,2:20,2:30,2:40,2:50,3:00am,3:10,3:20,3:30,3:40,3:50,4:00am,4:10,4:20,4:30,4:40,4:50,5:00am,,,,,,,6:00am,,,,,,,7:00am,,,,,,,8:00am,,,,,,&
+ &y_min=0&
+ &y_max=3&
+ &bg_colour=0xDFFFDF&
+ &x_label_style=13,0x9933CC,0,6&
+
+ &y_label_style=none&
+ ';
+ */
+ return parent::render();
+ }
+
+}
+?>
diff --git a/modules/Visualization/ChartPie.php b/modules/Visualization/ChartPie.php
new file mode 100644
index 0000000000..b4a6e5cdfc
--- /dev/null
+++ b/modules/Visualization/ChartPie.php
@@ -0,0 +1,32 @@
+<?php
+require_once "Visualization/Chart.php";
+class Piwik_Visualization_ChartPie extends Piwik_Visualization_Chart
+{
+ function getDefaultLimit()
+ {
+ return 5;
+ }
+ function customizeGraph()
+ {
+ $this->prepareData();
+// $this->title( 'PIE Chart', '{font-size: 20px;}' );
+
+ //
+ $this->pie(60,'#505050','#000000');
+ //
+ // pass in two arrays, one of data, the other data labels
+ //
+ $this->pie_values( $this->arrayData, $this->arrayLabel );
+ //
+ // Colours for each slice, in this case some of the colours
+ // will be re-used (3 colurs for 5 slices means the last two
+ // slices will have colours colour[0] and colour[1]):
+ //
+ $this->pie_slice_colours( array('#d01f3c','#356aa0','#C79810') );
+
+
+ $this->set_tool_tip( '#x_label# <br>#val# visits ' );
+
+ }
+
+} \ No newline at end of file
diff --git a/modules/Visualization/ChartVerticalBar.php b/modules/Visualization/ChartVerticalBar.php
new file mode 100644
index 0000000000..0a71b1cb66
--- /dev/null
+++ b/modules/Visualization/ChartVerticalBar.php
@@ -0,0 +1,26 @@
+<?php
+require_once "Visualization/Chart.php";
+class Piwik_Visualization_ChartVerticalBar extends Piwik_Visualization_Chart
+{
+ function getDefaultLimit()
+ {
+ return 10;
+ }
+ function customizeGraph()
+ {
+ $this->prepareData();
+// $this->title( 'Bar Chart', '{font-size: 20px;}' );
+ $this->set_data( $this->arrayData );
+ $this->set_x_labels( $this->arrayLabel );
+ $this->set_x_label_style( 10, '#9933CC', 0, 2 );
+ // and tick every second value:
+ $this->set_x_axis_steps( 2 );
+ $this->set_y_max( $this->maxData );
+ $this->y_label_steps( 3 );
+
+ $this->bar_filled( 50, '#9933CC', '#8010A0', 'visits', 10 );
+ $this->set_tool_tip( '#x_label# <br>#val# #key# ' );
+// $this->set_y_legend( 'Open Flash Chart', 12, '#736AFF' );
+ }
+
+} \ No newline at end of file
diff --git a/modules/View/Cloud.php b/modules/Visualization/Cloud.php
index 30cabb0a8a..efbed67cb0 100644
--- a/modules/View/Cloud.php
+++ b/modules/Visualization/Cloud.php
@@ -1,6 +1,6 @@
<?php
// inspired from Derek Harvey (www.derekharvey.co.uk)
-class Piwik_Cloud
+class Piwik_Visualization_Cloud
{
protected $wordsArray = array();
public $truncatingLimit = 30;
@@ -23,8 +23,7 @@ class Piwik_Cloud
*
* @param string $word
* @return string
- */
-
+ */
function addWord($word, $value = 1)
{
// $word = strtolower($word);
@@ -40,8 +39,7 @@ class Piwik_Cloud
/*
* Shuffle associated names in array
- */
-
+ */
function shuffleCloud()
{
$keys = array_keys($this->wordsArray);
@@ -102,8 +100,6 @@ class Piwik_Cloud
{
$this->shuffleCloud();
-
-
if($returnType == "html")
{
$return = '';
@@ -113,10 +109,8 @@ class Piwik_Cloud
$return = array();
}
-
if (count($this->wordsArray) > 0)
- {
-
+ {
$this->max = max($this->wordsArray);
$return = ($returnType == "html" ? "" : ($returnType == "array" ? array() : ""));
diff --git a/modules/Visualization/OpenFlashChart.php b/modules/Visualization/OpenFlashChart.php
new file mode 100644
index 0000000000..fe85d348b7
--- /dev/null
+++ b/modules/Visualization/OpenFlashChart.php
@@ -0,0 +1,565 @@
+<?php
+require_once "iView.php";
+abstract class Piwik_Visualization_OpenFlashChart implements iView
+{
+ // Original class provided by Open Flash Chart
+ function __construct()
+ {
+ $this->data = array();
+ $this->x_labels = array();
+ $this->y_min = 0;
+ $this->y_max = 20;
+ $this->y_steps = 5;
+ $this->title = '';
+ $this->title_style = '';
+
+ $this->x_tick_size = -1;
+
+ $this->y2_max = '';
+ $this->y2_min = '';
+
+ // GRID styles:
+ $this->x_axis_colour = '';
+ $this->x_axis_3d = '';
+ $this->x_grid_colour = '';
+ $this->x_axis_steps = 1;
+ $this->y_axis_colour = '';
+ $this->y_grid_colour = '';
+ $this->y2_axis_colour = '';
+
+ // AXIS LABEL styles:
+ $this->x_label_style = '';
+ $this->y_label_style = '';
+ $this->y_label_style_right = '';
+
+
+ // AXIS LEGEND styles:
+ $this->x_legend = '';
+ $this->x_legend_size = 20;
+ $this->x_legend_colour = '#000000';
+
+ $this->y_legend = '';
+ $this->y_legend_right = '';
+ //$this->y_legend_size = 20;
+ //$this->y_legend_colour = '#000000';
+
+ $this->lines = array();
+ $this->line_default = '&line=3,#87421F&'. "\r\n";
+
+ $this->bg_colour = '';
+ $this->bg_image = '';
+
+ $this->inner_bg_colour = '';
+ $this->inner_bg_colour_2 = '';
+ $this->inner_bg_angle = '';
+
+ // PIE chart ------------
+ $this->pie = '';
+ $this->pie_values = '';
+ $this->pie_colours = '';
+ $this->pie_labels = '';
+
+ $this->tool_tip = '';
+
+ // which data lines are attached to the
+ // right Y axis?
+ $this->y2_lines = array();
+ }
+
+ function set_data( $a )
+ {
+ if( count( $this->data ) == 0 )
+ $this->data[] = '&values='.implode(',',$a).'&'."\r\n";
+ else
+ $this->data[] = '&values_'. (count( $this->data )+1) .'='.implode(',',$a).'&'."\r\n";
+ }
+
+ function set_tool_tip( $tip )
+ {
+ $this->tool_tip = $tip;
+ }
+
+ function set_x_labels( $a )
+ {
+ $this->x_labels = $a;
+ }
+
+ function set_x_label_style( $size, $colour='', $orientation=0, $step=-1, $grid_colour='' )
+ {
+
+ $this->x_label_style = '&x_label_style='. $size;
+
+ if( strlen( $colour ) > 0 )
+ $this->x_label_style .= ','. $colour;
+
+ if( $orientation > -1 )
+ $this->x_label_style .= ','. $orientation;
+
+ if( $step > 0 )
+ $this->x_label_style .= ','. $step;
+
+ if( strlen( $grid_colour ) > 0 )
+ $this->x_label_style .= ','. $grid_colour;
+
+ $this->x_label_style .= "&\r\n";
+ }
+
+ function set_bg_colour( $colour )
+ {
+ $this->bg_colour = $colour;
+ }
+
+ function set_bg_image( $url, $x='center', $y='center' )
+ {
+ $this->bg_image = $url;
+ $this->bg_image_x = $x;
+ $this->bg_image_y = $y;
+ }
+
+ function attach_to_y_right_axis( $data_number )
+ {
+ $this->y2_lines[] = $data_number;
+ }
+
+ function set_inner_background( $col, $col2='', $angle=-1 )
+ {
+
+ $this->inner_bg_colour = $col;
+
+
+ if( strlen($col2) > 0 )
+ $this->inner_bg_colour_2 = $col2;
+
+ if( $angle != -1 )
+ $this->inner_bg_angle = $angle;
+
+ }
+
+ function _set_y_label_style( $name, $size, $colour )
+ {
+ $tmp = '&'. $name .'='. $size;
+
+ if( strlen( $colour ) > 0 )
+ $tmp .= ','. $colour;
+
+ return $tmp;
+ }
+
+ function set_y_label_style( $size, $colour='' )
+ {
+ $this->y_label_style = $this->_set_y_label_style( 'y_label_style', $size, $colour );
+ }
+
+ function set_y_right_label_style( $size, $colour='' )
+ {
+ $this->y_label_style_right = $this->_set_y_label_style( 'y2_label_style', $size, $colour );
+ }
+
+ function set_y_max( $max )
+ {
+
+ $this->y_max = intval( $max );
+ }
+
+ function set_y_min( $min )
+ {
+
+ $this->y_min = intval( $min );
+ }
+
+ function set_y_right_max( $max )
+ {
+ $this->y2_max = '&y2_max='. $max .'&'."\r\n";
+ }
+
+ function set_y_right_min( $min )
+ {
+ $this->y2_min = '&y2_min='. $min .'&'."\r\n";
+ }
+
+ function y_label_steps( $val )
+ {
+ $this->y_steps = intval( $val );
+ }
+
+ function title( $title, $style='' )
+ {
+ $this->title = $title;
+ if( strlen( $style ) > 0 )
+ $this->title_style = $style;
+ }
+
+ function set_x_legend( $text, $size=-1, $colour='' )
+ {
+ $this->x_legend = $text;
+ if( $size > -1 )
+ $this->x_legend_size = $size;
+
+ if( strlen( $colour )>0 )
+ $this->x_legend_colour = $colour;
+ }
+
+ function set_x_tick_size( $size )
+ {
+ if( $size > 0 )
+ $this->x_tick_size = $size;
+ }
+
+ function set_x_axis_steps( $steps )
+ {
+ if ( $steps > 0 )
+ $this->x_axis_steps = $steps;
+ }
+
+ function set_x_axis_3d( $size )
+ {
+ if( $size > 0 )
+ $this->x_axis_3d = '&x_axis_3d='. $size ."&\r\n";
+ }
+
+ // PRIVATE METHOD
+ function _set_y_legend( $label, $text, $size, $colour )
+ {
+ $tmp = '&'. $label .'=';
+ $tmp .= $text;
+
+ if( $size > -1 )
+ $tmp .= ','. $size;
+
+ if( strlen( $colour )>0 )
+ $tmp .= ','. $colour;
+
+ $tmp .= "&\r\n";
+
+ return $tmp;
+ }
+
+ function set_y_legend( $text, $size=-1, $colour='' )
+ {
+ $this->y_legend = $this->_set_y_legend( 'y_legend', $text, $size, $colour );
+ }
+
+ function set_y_right_legend( $text, $size=-1, $colour='' )
+ {
+ $this->y_legend_right = $this->_set_y_legend( 'y2_legend', $text, $size, $colour );
+ }
+
+ function line( $width, $colour='', $text='', $size=-1, $circles=-1 )
+ {
+ $tmp = '&line';
+
+ if( count( $this->lines ) > 0 )
+ $tmp .= '_'. (count( $this->lines )+1);
+
+ $tmp .= '=';
+
+ if( $width > 0 )
+ {
+ $tmp .= $width;
+ $tmp .= ','. $colour;
+ }
+
+ if( strlen( $text ) > 0 )
+ {
+ $tmp .= ','. $text;
+ $tmp .= ','. $size;
+ }
+
+ if( $circles > 0 )
+ $tmp .= ','. $circles;
+
+ $tmp .= "&\r\n";;
+
+ $this->lines[] = $tmp;
+ }
+
+ function line_dot( $width, $dot_size, $colour, $text='', $font_size='' )
+ {
+ $tmp = '&line_dot';
+
+ if( count( $this->lines ) > 0 )
+ $tmp .= '_'. (count( $this->lines )+1);
+
+ $tmp .= "=$width,$colour,$text";
+
+ if( strlen( $font_size ) > 0 )
+ $tmp .= ",$font_size,$dot_size";
+
+ $tmp .= "&\r\n";
+
+ $this->lines[] = $tmp;
+ }
+
+ function line_hollow( $width, $dot_size, $colour, $text='', $font_size='' )
+ {
+ $tmp = '&line_hollow';
+
+ if( count( $this->lines ) > 0 )
+ $tmp .= '_'. (count( $this->lines )+1);
+
+ $tmp .= "=$width,$colour,$text";
+
+ if( strlen( $font_size ) > 0 )
+ $tmp .= ",$font_size,$dot_size";
+
+ $tmp .= "&\r\n";
+ $this->lines[] = $tmp;
+ }
+
+ function area_hollow( $width, $dot_size, $colour, $alpha, $text='', $font_size='', $fill_colour='' )
+ {
+ $tmp = '&area_hollow';
+
+ if( count( $this->lines ) > 0 )
+ $tmp .= '_'. (count( $this->lines )+1);
+
+ $tmp .= "=$width,$dot_size,$colour,$alpha";
+
+ if( strlen( $text ) > 0 )
+ $tmp .= ",$text,$font_size";
+
+ if( strlen( $fill_colour ) > 0 )
+ $tmp .= ','. $fill_colour;
+
+ $tmp .= "&\r\n";
+
+ $this->lines[] = $tmp;
+ }
+
+
+ function bar( $alpha, $colour='', $text='', $size=-1 )
+ {
+ $tmp = '&bar';
+
+ if( count( $this->lines ) > 0 )
+ $tmp .= '_'. (count( $this->lines )+1);
+
+ $tmp .= '=';
+ $tmp .= $alpha .','. $colour .','. $text .','. $size;
+ $tmp .= "&\r\n";;
+
+ $this->lines[] = $tmp;
+ }
+
+ function bar_filled( $alpha, $colour, $colour_outline, $text='', $size=-1 )
+ {
+ $tmp = '&filled_bar';
+
+ if( count( $this->lines ) > 0 )
+ $tmp .= '_'. (count( $this->lines )+1);
+
+ $tmp .= "=$alpha,$colour,$colour_outline,$text,$size&\r\n";
+
+ $this->lines[] = $tmp;
+ }
+
+ function bar_3D( $alpha, $colour='', $text='', $size=-1 )
+ {
+ $tmp = '&bar_3d';
+
+ if( count( $this->lines ) > 0 )
+ $tmp .= '_'. (count( $this->lines )+1);
+
+ $tmp .= '=';
+ $tmp .= $alpha .','. $colour .','. $text .','. $size;
+ $tmp .= "&\r\n";;
+
+ $this->lines[] = $tmp;
+ }
+
+ function bar_glass( $alpha, $colour, $outline_colour, $text='', $size=-1 )
+ {
+ $tmp = '&bar_glass';
+
+ if( count( $this->lines ) > 0 )
+ $tmp .= '_'. (count( $this->lines )+1);
+
+ $tmp .= '=';
+ $tmp .= $alpha .','. $colour .','. $outline_colour .','. $text .','. $size;
+ $tmp .= "&\r\n";;
+
+ $this->lines[] = $tmp;
+ }
+
+ function bar_fade( $alpha, $colour='', $text='', $size=-1 )
+ {
+ $tmp = '&bar_fade';
+
+ if( count( $this->lines ) > 0 )
+ $tmp .= '_'. (count( $this->lines )+1);
+
+ $tmp .= '=';
+ $tmp .= $alpha .','. $colour .','. $text .','. $size;
+ $tmp .= "&\r\n";;
+
+ $this->lines[] = $tmp;
+ }
+
+ function x_axis_colour( $axis, $grid='' )
+ {
+ $this->x_axis_colour = $axis;
+ $this->x_grid_colour = $grid;
+ }
+
+ function y_axis_colour( $axis, $grid='' )
+ {
+ $this->y_axis_colour = '&y_axis_colour='. $axis .'&'."\r\n";
+
+ if( strlen( $grid ) > 0 )
+ $this->y_grid_colour = '&y_grid_colour='. $grid .'&'."\r\n";
+ }
+
+ function y_right_axis_colour( $colour )
+ {
+ $this->y2_axis_colour = '&y2_axis_colour='. $colour .'&'."\r\n";
+ }
+
+
+ function pie( $alpha, $line_colour, $label_colour )
+ {
+ $this->pie = $alpha.','.$line_colour.','.$label_colour;
+
+ }
+
+ function pie_values( $values, $labels )
+ {
+ $this->pie_values = implode(',',$values);
+ $this->pie_labels = implode(',',$labels);
+ }
+
+
+ function pie_slice_colours( $colours )
+ {
+ $this->pie_colours = implode(',',$colours);
+ }
+
+
+
+ function render()
+ {
+ //$tmp = "&padding=70,5,50,40&\r\n";
+ $tmp = '';
+
+ if( strlen( $this->title ) > 0 )
+ {
+ $tmp .= '&title='. $this->title .',';
+ $tmp .= $this->title_style .'&';
+ $tmp .= "\r\n";
+ }
+
+ if( strlen( $this->x_legend ) > 0 )
+ {
+ $tmp .= '&x_legend='. $this->x_legend .',';
+ $tmp .= $this->x_legend_size .',';
+ $tmp .= $this->x_legend_colour ."&\r\n";
+ }
+
+ if( strlen( $this->x_label_style ) > 0 )
+ $tmp .= $this->x_label_style;
+
+ if( $this->x_tick_size > 0 )
+ $tmp .= "&x_ticks=". $this->x_tick_size ."&\r\n";
+
+ if( $this->x_axis_steps > 0 )
+ $tmp .= "&x_axis_steps=". $this->x_axis_steps ."&\r\n";
+
+ if( strlen( $this->x_axis_3d ) > 0 )
+ $tmp .= $this->x_axis_3d;
+
+ $tmp .= $this->y_legend;
+ $tmp .= $this->y_legend_right;
+
+ if( strlen( $this->y_label_style ) > 0 )
+ $tmp .= $this->y_label_style;
+
+ $tmp .= '&y_ticks=5,10,'. $this->y_steps .'&'."\r\n";
+
+ if( count( $this->lines ) == 0 )
+ {
+ $tmp .= $this->line_default;
+ }
+ else
+ {
+ foreach( $this->lines as $line )
+ $tmp .= $line;
+ }
+
+ foreach( $this->data as $data )
+ $tmp .= $data;
+
+ if( count( $this->y2_lines ) > 0 )
+ {
+ $tmp .= '&y2_lines=';
+ $tmp .= implode( ',', $this->y2_lines );
+ $tmp .= '&'."\r\n";
+ //
+ // Should this be an option? I think so...
+ //
+ $tmp .= '&show_y2=true&'."\r\n";
+ }
+
+ if( count( $this->x_labels ) > 0 )
+ $tmp .= '&x_labels='.implode(',',$this->x_labels).'&'."\r\n";
+
+ $tmp .= '&y_min='. $this->y_min .'&'."\r\n";
+ $tmp .= '&y_max='. $this->y_max .'&'."\r\n";
+
+ $tmp .= $this->y2_max;
+ $tmp .= $this->y2_min;
+
+ if( strlen( $this->bg_colour ) > 0 )
+ $tmp .= '&bg_colour='. $this->bg_colour .'&'."\r\n";
+
+ if( strlen( $this->bg_image ) > 0 )
+ {
+ $tmp .= '&bg_image='. $this->bg_image .'&'."\r\n";
+ $tmp .= '&bg_image_x='. $this->bg_image_x .'&'."\r\n";
+ $tmp .= '&bg_image_y='. $this->bg_image_y .'&'."\r\n";
+ }
+
+
+ if( strlen( $this->x_axis_colour ) > 0 )
+ {
+ $tmp .= '&x_axis_colour='. $this->x_axis_colour .'&'."\r\n";
+ $tmp .= '&x_grid_colour='. $this->x_grid_colour .'&'."\r\n";
+ }
+
+ if( strlen( $this->y_axis_colour ) > 0 )
+ $tmp .= $this->y_axis_colour;
+
+ if( strlen( $this->y_grid_colour ) > 0 )
+ $tmp .= $this->y_grid_colour;
+
+ if( strlen( $this->y2_axis_colour ) > 0 )
+ $tmp .= $this->y2_axis_colour;
+
+ if( strlen( $this->inner_bg_colour ) > 0 )
+ {
+ $tmp .= '&inner_background='.$this->inner_bg_colour;
+ if( strlen( $this->inner_bg_colour_2 ) > 0 )
+ {
+
+ $tmp .= ','. $this->inner_bg_colour_2;
+ $tmp .= ','. $this->inner_bg_angle;
+ }
+ $tmp .= '&'."\r\n";
+ }
+
+ if( strlen( $this->pie ) > 0 )
+ {
+
+ $tmp .= '&pie='. $this->pie .'&'."\r\n";
+ $tmp .= '&values='. $this->pie_values .'&'."\r\n";
+ $tmp .= '&pie_labels='. $this->pie_labels .'&'."\r\n";
+ $tmp .= '&colours='. $this->pie_colours .'&'."\r\n";
+ }
+
+ if( strlen( $this->tool_tip ) > 0 )
+ {
+ $tmp .= '&tool_tip='. $this->tool_tip .'&'."\r\n";
+ }
+
+ return $tmp;
+ }
+}
+?>
diff --git a/modules/iView.php b/modules/iView.php
new file mode 100644
index 0000000000..9ecfa2e152
--- /dev/null
+++ b/modules/iView.php
@@ -0,0 +1,6 @@
+<?php
+interface iView
+{
+ function render();
+}
+?>
diff --git a/plugins/Actions/Controller.php b/plugins/Actions/Controller.php
index 121f385276..d6d58c5ed4 100644
--- a/plugins/Actions/Controller.php
+++ b/plugins/Actions/Controller.php
@@ -11,7 +11,7 @@ class Piwik_Actions_Controller extends Piwik_Controller
}
function getActions($fetch = false)
{
- $view = new Piwik_View_DataTable( __FUNCTION__, 'Actions.getActions' );
+ $view = new Piwik_ViewDataTable( __FUNCTION__, 'Actions.getActions' );
$view->disableSearchBox();
$view->disableSort();
$view->disableOffsetInformation();
diff --git a/plugins/Home/Controller.php b/plugins/Home/Controller.php
index 7e171b2e9c..ab9309036a 100644
--- a/plugins/Home/Controller.php
+++ b/plugins/Home/Controller.php
@@ -13,6 +13,13 @@ class Piwik_Home_Controller extends Piwik_Controller
}
}
+function dump($var)
+{
+ print("<pre>");
+ var_export($var);
+ print("</pre>");
+}
+
function main()
{
diff --git a/plugins/UserSettings/Controller.php b/plugins/UserSettings/Controller.php
index 5b5235e86f..663fc59e53 100644
--- a/plugins/UserSettings/Controller.php
+++ b/plugins/UserSettings/Controller.php
@@ -1,6 +1,6 @@
<?php
require_once "API/Request.php";
-require_once "View/DataTable.php";
+require_once "ViewDataTable.php";
class Piwik_UserSettings_Controller extends Piwik_Controller
{
@@ -122,7 +122,7 @@ List of the public methods for the class Piwik_Actions_API
$methodToCall = 'Actions.getActions',
$subMethod = 'getActionsSubDataTable')
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( $currentMethod,
$methodToCall,
$subMethod );
@@ -266,7 +266,7 @@ List of the public methods for the class Piwik_Actions_API
*/
function getVisitInformationPerServerTime( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( __FUNCTION__,
"VisitTime.getVisitInformationPerServerTime" );
@@ -282,7 +282,7 @@ List of the public methods for the class Piwik_Actions_API
function getVisitInformationPerLocalTime( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( __FUNCTION__,
"VisitTime.getVisitInformationPerLocalTime" );
@@ -300,7 +300,7 @@ List of the public methods for the class Piwik_Actions_API
*/
function getNumberOfVisitsPerVisitDuration( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( __FUNCTION__,
"VisitorInterest.getNumberOfVisitsPerVisitDuration" );
@@ -317,7 +317,7 @@ List of the public methods for the class Piwik_Actions_API
function getNumberOfVisitsPerPage( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( __FUNCTION__,
"VisitorInterest.getNumberOfVisitsPerPage" );
@@ -337,7 +337,7 @@ List of the public methods for the class Piwik_Actions_API
*/
function getProvider( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( __FUNCTION__, "Provider.getProvider" );
$view->setColumnsToDisplay( array(0,1) );
@@ -352,7 +352,7 @@ List of the public methods for the class Piwik_Actions_API
*/
function getCountry( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( __FUNCTION__, "UserCountry.getCountry" );
$view->disableExcludeLowPopulation();
@@ -370,7 +370,7 @@ List of the public methods for the class Piwik_Actions_API
function getContinent( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( __FUNCTION__, "UserCountry.getContinent" );
$view->disableExcludeLowPopulation();
$view->disableSearchBox();
@@ -389,7 +389,7 @@ List of the public methods for the class Piwik_Actions_API
function getStandardDataTableUserSettings( $currentControllerAction,
$APItoCall )
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( $currentControllerAction, $APItoCall );
$view->disableSearchBox();
$view->disableExcludeLowPopulation();
@@ -460,7 +460,7 @@ List of the public methods for the class Piwik_Actions_API
function getPlugin( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( __FUNCTION__, 'UserSettings.getPlugin' );
$view->disableSearchBox();
$view->disableExcludeLowPopulation();
@@ -481,7 +481,7 @@ List of the public methods for the class Piwik_Actions_API
*/
function getRefererType( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( 'getRefererType',
'Referers.getRefererType'
);
@@ -496,7 +496,7 @@ List of the public methods for the class Piwik_Actions_API
function getKeywords( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( 'getKeywords',
'Referers.getKeywords',
'getSearchEnginesFromKeywordId'
@@ -509,7 +509,7 @@ List of the public methods for the class Piwik_Actions_API
function getSearchEnginesFromKeywordId( $fetch = false )
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( 'getSearchEnginesFromKeywordId',
'Referers.getSearchEnginesFromKeywordId'
);
@@ -523,7 +523,7 @@ List of the public methods for the class Piwik_Actions_API
function getSearchEngines( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( 'getSearchEngines',
'Referers.getSearchEngines',
'getKeywordsFromSearchEngineId'
@@ -539,7 +539,7 @@ List of the public methods for the class Piwik_Actions_API
function getKeywordsFromSearchEngineId( $fetch = false )
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( 'getKeywordsFromSearchEngineId',
'Referers.getKeywordsFromSearchEngineId'
);
@@ -552,7 +552,7 @@ List of the public methods for the class Piwik_Actions_API
function getWebsites( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( 'getWebsites',
'Referers.getWebsites',
'getUrlsFromWebsiteId'
@@ -566,7 +566,7 @@ List of the public methods for the class Piwik_Actions_API
function getCampaigns( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( 'getCampaigns',
'Referers.getCampaigns',
'getKeywordsFromCampaignId'
@@ -583,7 +583,7 @@ List of the public methods for the class Piwik_Actions_API
function getKeywordsFromCampaignId( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( 'getKeywordsFromCampaignId',
'Referers.getKeywordsFromCampaignId'
);
@@ -597,7 +597,7 @@ List of the public methods for the class Piwik_Actions_API
function getUrlsFromWebsiteId( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( 'getUrlsFromWebsiteId',
'Referers.getUrlsFromWebsiteId'
);
@@ -610,7 +610,7 @@ List of the public methods for the class Piwik_Actions_API
function getPartners( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( 'getPartners',
'Referers.getPartners',
'getUrlsFromPartnerId'
@@ -626,7 +626,7 @@ List of the public methods for the class Piwik_Actions_API
function getUrlsFromPartnerId( $fetch = false)
{
- $view = Piwik_View_DataTable::factory();
+ $view = Piwik_ViewDataTable::factory();
$view->init( 'getUrlsFromPartnerId',
'Referers.getUrlsFromPartnerId'
);
diff --git a/plugins/UserSettings/templates/datatable.js b/plugins/UserSettings/templates/datatable.js
index bac2e02b70..57af701990 100644
--- a/plugins/UserSettings/templates/datatable.js
+++ b/plugins/UserSettings/templates/datatable.js
@@ -29,8 +29,7 @@ function bindDataTableEvent( indexDiv )
var DataTableAlreadyLoaded = new Array;
// ID of the DIV containing the DataTable we are currently working on
- workingDivId = $(this).attr('id');
-
+ workingDivId = $(this).attr('id');
// reset All filters set to false all the datatable filters JS variables
// returns the values before reseting the filters
diff --git a/plugins/UserSettings/templates/datatable_footer.tpl b/plugins/UserSettings/templates/datatable_footer.tpl
index 81c327a527..bc6be7941e 100644
--- a/plugins/UserSettings/templates/datatable_footer.tpl
+++ b/plugins/UserSettings/templates/datatable_footer.tpl
@@ -28,6 +28,8 @@
<a class="viewDataTable" format="table"><img width="16" height="16" src="themes/default/images/table.png" title="Table"></a>
<a class="viewDataTable" format="cloud"><img width="16" height="16" src="themes/default/images/tagcloud.png" title="Tag Cloud"></a>
+ <a class="viewDataTable" format="graphVerticalBar"><img width="16" height="16" src="themes/default/images/chart_bar.png" title="Vertical bar graph"></a>
+ <a class="viewDataTable" format="graphPie"><img width="16" height="16" src="themes/default/images/chart_pie.png" title="Pie chart"></a>
</span>
diff --git a/plugins/UserSettings/templates/graph.tpl b/plugins/UserSettings/templates/graph.tpl
new file mode 100644
index 0000000000..4d6e52cddb
--- /dev/null
+++ b/plugins/UserSettings/templates/graph.tpl
@@ -0,0 +1,18 @@
+<div id="{$id}" class="parentDiv">
+{$jsInvocationTag}
+<br/><br/>
+<small>
+<form name="urlForm" id="urlForm">
+Embed <input
+name="embed_code"
+value="{$codeEmbed|escape}"
+onclick="javascript:document.urlForm.embed_code.focus();document.urlForm.embed_code.select();"
+readonly="true"
+type="text">
+
+| <a target="_blank" href="{$urlData}">Graph data</a>
+</form>
+
+</small>
+{include file="UserSettings/templates/datatable_footer.tpl"}
+</div> \ No newline at end of file
diff --git a/plugins/UserSettings/templates/index.tpl b/plugins/UserSettings/templates/index.tpl
index 8d1f907cf0..d1aa370072 100644
--- a/plugins/UserSettings/templates/index.tpl
+++ b/plugins/UserSettings/templates/index.tpl
@@ -21,6 +21,7 @@ var minDateDay = {$minDateDay};
<script type="text/javascript" src="plugins/UserSettings/templates/datatable.js"></script>
<script type="text/javascript" src="libs/jquery/jquery-calendar.js"></script>
<script type="text/javascript" src="plugins/UserSettings/templates/calendar.js"></script>
+<script type="text/javascript" src="libs/swfobject/swfobject.js"></script>
<link rel="stylesheet" href="libs/jquery/tooltip/jquery.tooltip.css">
<link rel="stylesheet" href="plugins/UserSettings/templates/datatable.css">
diff --git a/tests/modules/ArchiveProcessing/Day.test.php b/tests/modules/ArchiveProcessing/Day.test.php
index 6bcaf59d8f..5151c55056 100644
--- a/tests/modules/ArchiveProcessing/Day.test.php
+++ b/tests/modules/ArchiveProcessing/Day.test.php
@@ -39,8 +39,7 @@ class Test_Piwik_ArchiveProcessing_Day extends UnitTestCase
$table->addRow($row1);
$tableGenerated = Piwik_ArchiveProcessing_Day::generateDataTable($input);
-// dump($tableGenerated);
-// dump($table);
+
$this->assertTrue(Piwik_DataTable::isEqual($table,$tableGenerated));
}
diff --git a/themes/default/images/chart_bar.png b/themes/default/images/chart_bar.png
new file mode 100644
index 0000000000..9051fbc609
--- /dev/null
+++ b/themes/default/images/chart_bar.png
Binary files differ
diff --git a/themes/default/images/chart_pie.png b/themes/default/images/chart_pie.png
new file mode 100644
index 0000000000..fe00fa050a
--- /dev/null
+++ b/themes/default/images/chart_pie.png
Binary files differ