From e46d87f774c79837986dd173b93bcd98553f46d0 Mon Sep 17 00:00:00 2001 From: matthieu_ Date: Fri, 14 Sep 2007 17:09:22 +0000 Subject: Added GRAPH export!! yipii to be tested on IE / opera (konqueror crashes dont know why) still lots of work to do but thats beautiful... :) --- LICENSE | 2 + TODO | 7 + index.php | 39 -- libs/open-flash-chart/README.txt | 8 + libs/open-flash-chart/actionscript/AreaHollow.as | 82 +++ libs/open-flash-chart/actionscript/Background.as | 121 ++++ libs/open-flash-chart/actionscript/Bar3D.as | 118 ++++ libs/open-flash-chart/actionscript/BarArrow.as | 107 ++++ libs/open-flash-chart/actionscript/BarFade.as | 55 ++ .../open-flash-chart/actionscript/BarGlassStyle.as | 106 ++++ libs/open-flash-chart/actionscript/BarStyle.as | 137 ++++ libs/open-flash-chart/actionscript/Box.as | 164 +++++ libs/open-flash-chart/actionscript/ChartUtil.as | 271 ++++++++ libs/open-flash-chart/actionscript/Css.as | 248 ++++++++ libs/open-flash-chart/actionscript/ExPoint.as | 25 + .../actionscript/FilledBarStyle.as | 56 ++ .../actionscript/InnerBackground.as | 75 +++ libs/open-flash-chart/actionscript/Keys.as | 117 ++++ libs/open-flash-chart/actionscript/LineDot.as | 78 +++ libs/open-flash-chart/actionscript/LineHollow.as | 65 ++ libs/open-flash-chart/actionscript/LineStyle.as | 129 ++++ libs/open-flash-chart/actionscript/Loading.as | 82 +++ libs/open-flash-chart/actionscript/MinMax.as | 47 ++ libs/open-flash-chart/actionscript/PieStyle.as | 275 ++++++++ libs/open-flash-chart/actionscript/README.txt | 16 + libs/open-flash-chart/actionscript/Size.as | 11 + libs/open-flash-chart/actionscript/Square.as | 19 + .../actionscript/String.prototype.replace.as | 42 ++ libs/open-flash-chart/actionscript/Style.as | 28 + libs/open-flash-chart/actionscript/Title.as | 101 +++ libs/open-flash-chart/actionscript/Values.as | 181 ++++++ libs/open-flash-chart/actionscript/XAxis.as | 206 ++++++ libs/open-flash-chart/actionscript/XAxisLabels.as | 156 +++++ libs/open-flash-chart/actionscript/XLabelStyle.as | 31 + libs/open-flash-chart/actionscript/XLegend.as | 72 +++ libs/open-flash-chart/actionscript/YAxis.as | 142 +++++ libs/open-flash-chart/actionscript/YAxisLabels.as | 96 +++ libs/open-flash-chart/actionscript/YLabelStyle.as | 68 ++ libs/open-flash-chart/actionscript/YLegend.as | 69 ++ libs/open-flash-chart/actionscript/YTicks.as | 21 + .../actionscript/open-flash-chart.as | 693 +++++++++++++++++++++ .../actionscript/open-flash-chart.fla | Bin 0 -> 66048 bytes .../actionscript/prototype.drawCircle.as | 19 + .../actionscript/prototype.fillCircle.as | 22 + libs/open-flash-chart/actionscript/rrectangle.as | 36 ++ libs/open-flash-chart/data-files/data-1.txt | 11 + libs/open-flash-chart/data-files/data-10.txt | 7 + libs/open-flash-chart/data-files/data-11.txt | 14 + libs/open-flash-chart/data-files/data-12.txt | 21 + libs/open-flash-chart/data-files/data-13.txt | 14 + libs/open-flash-chart/data-files/data-14.txt | 21 + libs/open-flash-chart/data-files/data-15.txt | 7 + libs/open-flash-chart/data-files/data-16.txt | 35 ++ libs/open-flash-chart/data-files/data-17.txt | 17 + libs/open-flash-chart/data-files/data-18.txt | 17 + libs/open-flash-chart/data-files/data-19.txt | 18 + libs/open-flash-chart/data-files/data-2.txt | 8 + libs/open-flash-chart/data-files/data-20.txt | 17 + libs/open-flash-chart/data-files/data-21.txt | 32 + libs/open-flash-chart/data-files/data-22.txt | 43 ++ libs/open-flash-chart/data-files/data-23.txt | 45 ++ libs/open-flash-chart/data-files/data-25.txt | 1 + libs/open-flash-chart/data-files/data-26.txt | 1 + libs/open-flash-chart/data-files/data-27.txt | 1 + libs/open-flash-chart/data-files/data-28.txt | 5 + libs/open-flash-chart/data-files/data-29.txt | 13 + libs/open-flash-chart/data-files/data-3.txt | 13 + libs/open-flash-chart/data-files/data-30.txt | 1 + libs/open-flash-chart/data-files/data-31.txt | 1 + libs/open-flash-chart/data-files/data-32.txt | 1 + libs/open-flash-chart/data-files/data-34.txt | 1 + libs/open-flash-chart/data-files/data-35.txt | 1 + libs/open-flash-chart/data-files/data-36.txt | 2 + libs/open-flash-chart/data-files/data-37.txt | 1 + libs/open-flash-chart/data-files/data-38.txt | 1 + libs/open-flash-chart/data-files/data-39.txt | 1 + libs/open-flash-chart/data-files/data-4.txt | 13 + libs/open-flash-chart/data-files/data-5.txt | 10 + libs/open-flash-chart/data-files/data-6.txt | 18 + libs/open-flash-chart/data-files/data-7.txt | 10 + libs/open-flash-chart/data-files/data-8.txt | 10 + libs/open-flash-chart/data-files/data-9.txt | 5 + libs/open-flash-chart/data-files/data.txt | 9 + libs/open-flash-chart/data-files/logo.png | Bin 0 -> 1588 bytes libs/open-flash-chart/data-files/nodata.txt | 9 + libs/open-flash-chart/open-flash-chart.swf | Bin 0 -> 40635 bytes libs/open-flash-chart/php-ofc-library/README.txt | 16 + .../php-ofc-library/open_flash_chart_object.php | 2 + libs/swfobject/README.txt | 12 + libs/swfobject/swfobject.js | 233 +++++++ modules/SmartyPlugins/function.url.php | 13 +- modules/Url.php | 30 + modules/View.php | 3 +- modules/View/Cloud.php | 156 ----- modules/View/DataTable.php | 410 ------------ modules/View/DataTableCloud.php | 85 --- modules/ViewDataTable.php | 434 +++++++++++++ modules/ViewDataTable/Cloud.php | 234 +++---- modules/ViewDataTable/DataTableCloud.php | 85 --- modules/ViewDataTable/GenerateGraphData.php | 77 +++ modules/ViewDataTable/Graph.php | 117 ++++ modules/ViewDataTable/HtmlAjax.php | 2 + modules/Visualization/Chart.php | 48 ++ modules/Visualization/ChartPie.php | 32 + modules/Visualization/ChartVerticalBar.php | 26 + modules/Visualization/Cloud.php | 150 +++++ modules/Visualization/OpenFlashChart.php | 565 +++++++++++++++++ modules/iView.php | 6 + plugins/Actions/Controller.php | 2 +- plugins/Home/Controller.php | 7 + plugins/UserSettings/Controller.php | 44 +- plugins/UserSettings/templates/datatable.js | 3 +- .../UserSettings/templates/datatable_footer.tpl | 2 + plugins/UserSettings/templates/graph.tpl | 18 + plugins/UserSettings/templates/index.tpl | 1 + tests/modules/ArchiveProcessing/Day.test.php | 3 +- themes/default/images/chart_bar.png | Bin 0 -> 541 bytes themes/default/images/chart_pie.png | Bin 0 -> 918 bytes 118 files changed, 6749 insertions(+), 965 deletions(-) create mode 100644 LICENSE create mode 100644 libs/open-flash-chart/README.txt create mode 100644 libs/open-flash-chart/actionscript/AreaHollow.as create mode 100644 libs/open-flash-chart/actionscript/Background.as create mode 100644 libs/open-flash-chart/actionscript/Bar3D.as create mode 100644 libs/open-flash-chart/actionscript/BarArrow.as create mode 100644 libs/open-flash-chart/actionscript/BarFade.as create mode 100644 libs/open-flash-chart/actionscript/BarGlassStyle.as create mode 100644 libs/open-flash-chart/actionscript/BarStyle.as create mode 100644 libs/open-flash-chart/actionscript/Box.as create mode 100644 libs/open-flash-chart/actionscript/ChartUtil.as create mode 100644 libs/open-flash-chart/actionscript/Css.as create mode 100644 libs/open-flash-chart/actionscript/ExPoint.as create mode 100644 libs/open-flash-chart/actionscript/FilledBarStyle.as create mode 100644 libs/open-flash-chart/actionscript/InnerBackground.as create mode 100644 libs/open-flash-chart/actionscript/Keys.as create mode 100644 libs/open-flash-chart/actionscript/LineDot.as create mode 100644 libs/open-flash-chart/actionscript/LineHollow.as create mode 100644 libs/open-flash-chart/actionscript/LineStyle.as create mode 100644 libs/open-flash-chart/actionscript/Loading.as create mode 100644 libs/open-flash-chart/actionscript/MinMax.as create mode 100644 libs/open-flash-chart/actionscript/PieStyle.as create mode 100644 libs/open-flash-chart/actionscript/README.txt create mode 100644 libs/open-flash-chart/actionscript/Size.as create mode 100644 libs/open-flash-chart/actionscript/Square.as create mode 100644 libs/open-flash-chart/actionscript/String.prototype.replace.as create mode 100644 libs/open-flash-chart/actionscript/Style.as create mode 100644 libs/open-flash-chart/actionscript/Title.as create mode 100644 libs/open-flash-chart/actionscript/Values.as create mode 100644 libs/open-flash-chart/actionscript/XAxis.as create mode 100644 libs/open-flash-chart/actionscript/XAxisLabels.as create mode 100644 libs/open-flash-chart/actionscript/XLabelStyle.as create mode 100644 libs/open-flash-chart/actionscript/XLegend.as create mode 100644 libs/open-flash-chart/actionscript/YAxis.as create mode 100644 libs/open-flash-chart/actionscript/YAxisLabels.as create mode 100644 libs/open-flash-chart/actionscript/YLabelStyle.as create mode 100644 libs/open-flash-chart/actionscript/YLegend.as create mode 100644 libs/open-flash-chart/actionscript/YTicks.as create mode 100644 libs/open-flash-chart/actionscript/open-flash-chart.as create mode 100644 libs/open-flash-chart/actionscript/open-flash-chart.fla create mode 100644 libs/open-flash-chart/actionscript/prototype.drawCircle.as create mode 100644 libs/open-flash-chart/actionscript/prototype.fillCircle.as create mode 100644 libs/open-flash-chart/actionscript/rrectangle.as create mode 100644 libs/open-flash-chart/data-files/data-1.txt create mode 100644 libs/open-flash-chart/data-files/data-10.txt create mode 100644 libs/open-flash-chart/data-files/data-11.txt create mode 100644 libs/open-flash-chart/data-files/data-12.txt create mode 100644 libs/open-flash-chart/data-files/data-13.txt create mode 100644 libs/open-flash-chart/data-files/data-14.txt create mode 100644 libs/open-flash-chart/data-files/data-15.txt create mode 100644 libs/open-flash-chart/data-files/data-16.txt create mode 100644 libs/open-flash-chart/data-files/data-17.txt create mode 100644 libs/open-flash-chart/data-files/data-18.txt create mode 100644 libs/open-flash-chart/data-files/data-19.txt create mode 100644 libs/open-flash-chart/data-files/data-2.txt create mode 100644 libs/open-flash-chart/data-files/data-20.txt create mode 100644 libs/open-flash-chart/data-files/data-21.txt create mode 100644 libs/open-flash-chart/data-files/data-22.txt create mode 100644 libs/open-flash-chart/data-files/data-23.txt create mode 100644 libs/open-flash-chart/data-files/data-25.txt create mode 100644 libs/open-flash-chart/data-files/data-26.txt create mode 100644 libs/open-flash-chart/data-files/data-27.txt create mode 100644 libs/open-flash-chart/data-files/data-28.txt create mode 100644 libs/open-flash-chart/data-files/data-29.txt create mode 100644 libs/open-flash-chart/data-files/data-3.txt create mode 100644 libs/open-flash-chart/data-files/data-30.txt create mode 100644 libs/open-flash-chart/data-files/data-31.txt create mode 100644 libs/open-flash-chart/data-files/data-32.txt create mode 100644 libs/open-flash-chart/data-files/data-34.txt create mode 100644 libs/open-flash-chart/data-files/data-35.txt create mode 100644 libs/open-flash-chart/data-files/data-36.txt create mode 100644 libs/open-flash-chart/data-files/data-37.txt create mode 100644 libs/open-flash-chart/data-files/data-38.txt create mode 100644 libs/open-flash-chart/data-files/data-39.txt create mode 100644 libs/open-flash-chart/data-files/data-4.txt create mode 100644 libs/open-flash-chart/data-files/data-5.txt create mode 100644 libs/open-flash-chart/data-files/data-6.txt create mode 100644 libs/open-flash-chart/data-files/data-7.txt create mode 100644 libs/open-flash-chart/data-files/data-8.txt create mode 100644 libs/open-flash-chart/data-files/data-9.txt create mode 100644 libs/open-flash-chart/data-files/data.txt create mode 100644 libs/open-flash-chart/data-files/logo.png create mode 100644 libs/open-flash-chart/data-files/nodata.txt create mode 100644 libs/open-flash-chart/open-flash-chart.swf create mode 100644 libs/open-flash-chart/php-ofc-library/README.txt create mode 100644 libs/open-flash-chart/php-ofc-library/open_flash_chart_object.php create mode 100644 libs/swfobject/README.txt create mode 100644 libs/swfobject/swfobject.js delete mode 100644 modules/View/Cloud.php delete mode 100644 modules/View/DataTable.php delete mode 100644 modules/View/DataTableCloud.php create mode 100644 modules/ViewDataTable.php delete mode 100644 modules/ViewDataTable/DataTableCloud.php create mode 100644 modules/ViewDataTable/GenerateGraphData.php create mode 100644 modules/ViewDataTable/Graph.php create mode 100644 modules/ViewDataTable/HtmlAjax.php create mode 100644 modules/Visualization/Chart.php create mode 100644 modules/Visualization/ChartPie.php create mode 100644 modules/Visualization/ChartVerticalBar.php create mode 100644 modules/Visualization/Cloud.php create mode 100644 modules/Visualization/OpenFlashChart.php create mode 100644 modules/iView.php create mode 100644 plugins/UserSettings/templates/graph.tpl create mode 100644 themes/default/images/chart_bar.png create mode 100644 themes/default/images/chart_pie.png 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("
");
-	var_export($var);
-	print("
"); -} - -?> - -
-
-test download -
-test download - without name var -
-test link php -
-test link php - without name var -
- - - - - - \ 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=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 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 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._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 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 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 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 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.width0 ) + { + 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_x1 ) 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 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 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+'
'+tip_obj.value; + } + + lines = tmp.split( '
' ); + + 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 Binary files /dev/null and b/libs/open-flash-chart/actionscript/open-flash-chart.fla 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; iValue: #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#
#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#
#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 @@ +&x_axis_steps=1& +&y_label_style=none&y_ticks=5,10,5& +&line_hollow=2,#799191,Data,10,3& +&values=8,3,9,2,5,6,3,3,5,7,3,2,9,1,3& +&y_min=0& +&y_max=10& +&bg_colour=#E0E0E0& +&x_axis_colour=#799191& +&x_grid_colour=#FFFFFF& +&y_axis_colour=#799191& +&y_grid_colour=#FFFFFF& +&inner_background=#DDEFFA,#CBD7E6,90& + \ 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 Binary files /dev/null and b/libs/open-flash-chart/data-files/logo.png 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 Binary files /dev/null and b/libs/open-flash-chart/open-flash-chart.swf 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 @@ + \ 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 = ' 0){ swfNode += 'flashvars="'+ pairs +'"'; } + swfNode += '/>'; + } else { // PC IE + if (this.getAttribute("doExpressInstall")) { + this.addVariable("MMplayerType", "ActiveX"); + this.setAttribute('swf', this.xiSWFPath); + } + swfNode = ''; + swfNode += ''; + var params = this.getParams(); + for(var key in params) { + swfNode += ''; + } + var pairs = this.getVariablePairs().join("&"); + if(pairs.length > 0) {swfNode += '';} + swfNode += ""; + } + 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 @@ $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 @@ 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(); - } - - - 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   {$wordTruncated}   "; - } -// print( $word ."=".$percent."
"); - } - } - return $return; - } -} - diff --git a/modules/View/DataTable.php b/modules/View/DataTable.php deleted file mode 100644 index 6d9ef60246..0000000000 --- a/modules/View/DataTable.php +++ /dev/null @@ -1,410 +0,0 @@ -currentControllerAction = $currentControllerAction; - $this->moduleNameAndMethod = $moduleNameAndMethod; - $this->actionToLoadTheSubTable = $actionToLoadTheSubTable; - $this->dataTableTemplate = 'UserSettings/templates/datatable.tpl'; - - $this->idSubtable = Piwik_Common::getRequestVar('idSubtable', false,'int'); - - $this->method = $moduleNameAndMethod; - $this->variablesDefault['filter_excludelowpop_default'] = 'false'; - $this->variablesDefault['filter_excludelowpop_value_default'] = 'false'; - } - - function getView() - { - return $this->view; - } - - public function setTemplate( $tpl ) - { - $this->dataTableTemplate = $tpl; - } - - public function main() - { - if($this->mainAlreadyExecuted) - { - return; - } - $this->mainAlreadyExecuted = true; - -// $i=0;while($i<1500000){ $j=$i*$i;$i++;} - - $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->id = $this->getUniqIdTable(); - - // We get the PHP array converted from the DataTable - $phpArray = $this->getPHPArrayFromDataTable(); - - - $view->arrayDataTable = $phpArray; - $view->method = $this->method; - - $columns = $this->getColumnsToDisplay($phpArray); - $view->dataTableColumns = $columns; - - $nbColumns = count($columns); - // case no data in the array we use the number of columns set to be displayed - if($nbColumns == 0) - { - $nbColumns = count($this->columnsToDisplay); - } - - $view->nbColumns = $nbColumns; - - $view->javascriptVariablesToSet - = $this->getJavascriptVariablesToSet(); - - - $this->view = $view; - } - - protected function getUniqIdTable() - { - // the $uniqIdTable variable is used as the DIV ID in the rendered HTML - // we use the current Controller action name as it is supposed to be unique in the rendered page - $uniqIdTable = $this->currentControllerAction; - - // if we request a subDataTable the $this->currentControllerAction DIV ID is already there in the page - // we make the DIV ID really unique by appending the ID of the subtable requested - if( $this->idSubtable != false) - { - $uniqIdTable = 'subDataTable_' . $this->idSubtable; - } - return $uniqIdTable; - } - - public function setColumnsToDisplay( $arrayIds) - { - $this->columnsToDisplay = $arrayIds; - } - - protected function isColumnToDisplay( $idColumn ) - { - // we return true - // - we didn't set any column to display (means we display all the columns) - // - the column has been set as to display - if( count($this->columnsToDisplay) == 0 - || in_array($idColumn, $this->columnsToDisplay)) - { - return true; - } - return false; - } - - protected function getColumnsToDisplay($phpArray) - { - - $dataTableColumns = array(); - if(count($phpArray) > 0) - { - // build column information - $id = 0; - foreach($phpArray[0]['columns'] as $columnName => $row) - { - if( $this->isColumnToDisplay( $id, $columnName) ) - { - $dataTableColumns[] = array('id' => $id, 'name' => $columnName); - } - $id++; - } - } - return $dataTableColumns; - } - - protected function getDefaultOrCurrent( $nameVar ) - { - if(isset($_REQUEST[$nameVar])) - { - return $_REQUEST[$nameVar]; - } - $default = $this->getDefault($nameVar); - return $default; - } - - protected function getDefault($nameVar) - { - if(!isset($this->variablesDefault[$nameVar])) - { - return false; - } - return $this->variablesDefault[$nameVar]; - } - - public function setSearchRecursive() - { - $this->variablesDefault['search_recursive'] = true; - } - public function setRecursiveLoadDataTableIfSearchingForPattern() - { - try{ - $requestValue = Piwik_Common::getRequestVar('filter_column_recursive'); - $requestValue = Piwik_Common::getRequestVar('filter_pattern_recursive'); - // if the 2 variables are set we are searching for something. - // we have to load all the children subtables in this case - - $this->recursiveDataTableLoad = true; - return true; - } - catch(Exception $e) { - $this->recursiveDataTableLoad = false; - return false; - } - - } - - public function setExcludeLowPopulation( $value = 30 ) - { - $this->variablesDefault['filter_excludelowpop_default'] = 2; - $this->variablesDefault['filter_excludelowpop_value_default'] = $value; - $this->variablesDefault['filter_excludelowpop'] = 2; - $this->variablesDefault['filter_excludelowpop_value'] = $value; - } - - public function setDefaultLimit( $limit ) - { - $this->variablesDefault['filter_limit'] = $limit; - } - - public function setSortedColumn( $columnId, $order = 'desc') - { - $this->variablesDefault['filter_sort_column']= $columnId; - $this->variablesDefault['filter_sort_order']= $order; - } - public function disableSort() - { - $this->JSsortEnabled = 'false'; - } - public function getSort() - { - return $this->JSsortEnabled; - } - - public function disableOffsetInformation() - { - $this->JSoffsetInformation = 'false'; - } - public function getOffsetInformation() - { - return $this->JSoffsetInformation; - } - - public function disableSearchBox() - { - $this->JSsearchBox = 'false'; - } - - public function getSearchBox() - { - return $this->JSsearchBox; - } - - public function disableExcludeLowPopulation() - { - $this->JSexcludeLowPopulation = 'false'; - } - - public function getExcludeLowPopulation() - { - return $this->JSexcludeLowPopulation; - } - - protected function getJavascriptVariablesToSet( ) - { - // build javascript variables to set - $javascriptVariablesToSet = array(); - - $genericFilters = Piwik_API_Request::getGenericFiltersInformation(); - foreach($genericFilters as $filter) - { - foreach($filter as $filterVariableName => $filterInfo) - { - // if there is a default value for this filter variable we set it - // so that it is propagated to the javascript - if(isset($filterInfo[1])) - { - $javascriptVariablesToSet[$filterVariableName] = $filterInfo[1]; - - // we set the default specified column and Order to sort by - // when this javascript variable is not set already - // for example during an AJAX call this variable will be set in the URL - // so this will not be executed ( and the default sorted not be used as the sorted column might have changed in the meanwhile) - if( false !== ($defaultValue = $this->getDefault($filterVariableName))) - { - $javascriptVariablesToSet[$filterVariableName] = $defaultValue; - } - } - } - } - -// var_dump($javascriptVariablesToSet);exit; - //TODO check security of printing javascript variables; inject some JS code here?? - foreach($_GET as $name => $value) - { - try{ - $requestValue = Piwik_Common::getRequestVar($name); - } - catch(Exception $e) { - $requestValue = ''; - } - $javascriptVariablesToSet[$name] = $requestValue; - } - - // at this point there are some filters values we may have not set, - // case of the filter without default values and parameters set directly in this class - // for example setExcludeLowPopulation - // we go through all the $this->variablesDefault array and set the variables not set yet - foreach($this->variablesDefault as $name => $value) - { - if(!isset($javascriptVariablesToSet[$name] )) - { - $javascriptVariablesToSet[$name] = $value; - } - } - - - $javascriptVariablesToSet['action'] = $this->currentControllerAction; - - if(!is_null($this->actionToLoadTheSubTable)) - { - $javascriptVariablesToSet['actionToLoadTheSubTable'] = $this->actionToLoadTheSubTable; - } - -// var_dump($this->variablesDefault); -// var_dump($javascriptVariablesToSet); exit; - - $javascriptVariablesToSet['totalRows'] = $this->dataTable->getRowsCountBeforeLimitFilter(); - - $javascriptVariablesToSet['show_search'] = $this->getSearchBox(); - $javascriptVariablesToSet['show_offset_information'] = $this->getOffsetInformation(); - $javascriptVariablesToSet['show_exclude_low_population'] = $this->getExcludeLowPopulation(); - $javascriptVariablesToSet['enable_sort'] = $this->getSort(); - - return $javascriptVariablesToSet; - } - - protected function loadDataTableFromAPI( $idSubtable = false) - { - if($idSubtable === false) - { - $idSubtable = $this->idSubtable; - } - // we prepare the string to give to the API Request - // we setup the method and format variable - // - we request the method to call to get this specific DataTable - // - the format = original specifies that we want to get the original DataTable structure itself, not rendered - $requestString = 'method='.$this->moduleNameAndMethod - .'&format=original' - ; - if( $this->recursiveDataTableLoad ) - { - $requestString .= '&expanded=1'; - } - - // if a subDataTable is requested we add the variable to the API request string - if( $idSubtable != false) - { - $requestString .= '&this->idSubtable='.$idSubtable; - } - - $toSetEventually = array( - 'filter_limit', - 'filter_sort_column', - 'filter_sort_order', - 'filter_excludelowpop', - 'filter_excludelowpop_value', - ); - foreach($toSetEventually as $varToSet) - { - $value = $this->getDefaultOrCurrent($varToSet); - if( false !== $value ) - { - $requestString .= '&'.$varToSet.'='.$value; - } - } - // We finally make the request to the API - $request = new Piwik_API_Request($requestString); - - // and get the DataTable structure - $dataTable = $request->process(); - -// echo $dataTable;exit; - - $this->dataTable = $dataTable; - } - - protected function getPHPArrayFromDataTable( ) - { - $renderer = Piwik_DataTable_Renderer::factory('php'); - $renderer->setTable($this->dataTable); - $renderer->setSerialize( false ); - $phpArray = $renderer->render(); - return $phpArray; - } -} \ No newline at end of file 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 @@ -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.php b/modules/ViewDataTable.php new file mode 100644 index 0000000000..1dca1d8954 --- /dev/null +++ b/modules/ViewDataTable.php @@ -0,0 +1,434 @@ +typeViewRequested = $typeView; + } + + function init( $currentControllerAction, + $moduleNameAndMethod, + $actionToLoadTheSubTable = null) + { + $this->currentControllerAction = $currentControllerAction; + $this->moduleNameAndMethod = $moduleNameAndMethod; + $this->actionToLoadTheSubTable = $actionToLoadTheSubTable; + $this->dataTableTemplate = 'UserSettings/templates/datatable.tpl'; + + $this->idSubtable = Piwik_Common::getRequestVar('idSubtable', false,'int'); + + $this->method = $moduleNameAndMethod; + $this->variablesDefault['filter_excludelowpop_default'] = 'false'; + $this->variablesDefault['filter_excludelowpop_value_default'] = 'false'; + } + + function getView() + { + //TODO check at some point that the class implements the interface iView + return $this->view; + } + + public function setTemplate( $tpl ) + { + $this->dataTableTemplate = $tpl; + } + + public function main() + { + if($this->mainAlreadyExecuted) + { + return; + } + $this->mainAlreadyExecuted = true; + +// $i=0;while($i<1500000){ $j=$i*$i;$i++;} + + $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->id = $this->getUniqIdTable(); + + // We get the PHP array converted from the DataTable + $phpArray = $this->getPHPArrayFromDataTable(); + + + $view->arrayDataTable = $phpArray; + $view->method = $this->method; + + $columns = $this->getColumnsToDisplay($phpArray); + $view->dataTableColumns = $columns; + + $nbColumns = count($columns); + // case no data in the array we use the number of columns set to be displayed + if($nbColumns == 0) + { + $nbColumns = count($this->columnsToDisplay); + } + + $view->nbColumns = $nbColumns; + + $view->javascriptVariablesToSet + = $this->getJavascriptVariablesToSet(); + + + $this->view = $view; + } + + protected function getUniqIdTable() + { + // the $uniqIdTable variable is used as the DIV ID in the rendered HTML + // we use the current Controller action name as it is supposed to be unique in the rendered page + $uniqIdTable = $this->currentControllerAction; + + // if we request a subDataTable the $this->currentControllerAction DIV ID is already there in the page + // we make the DIV ID really unique by appending the ID of the subtable requested + if( $this->idSubtable != false) + { + $uniqIdTable = 'subDataTable_' . $this->idSubtable; + } + return $uniqIdTable; + } + + public function setColumnsToDisplay( $arrayIds) + { + $this->columnsToDisplay = $arrayIds; + } + + protected function isColumnToDisplay( $idColumn ) + { + // we return true + // - we didn't set any column to display (means we display all the columns) + // - the column has been set as to display + if( count($this->columnsToDisplay) == 0 + || in_array($idColumn, $this->columnsToDisplay)) + { + return true; + } + return false; + } + + protected function getColumnsToDisplay($phpArray) + { + + $dataTableColumns = array(); + if(count($phpArray) > 0) + { + // build column information + $id = 0; + foreach($phpArray[0]['columns'] as $columnName => $row) + { + if( $this->isColumnToDisplay( $id, $columnName) ) + { + $dataTableColumns[] = array('id' => $id, 'name' => $columnName); + } + $id++; + } + } + return $dataTableColumns; + } + + protected function getDefaultOrCurrent( $nameVar ) + { + if(isset($_REQUEST[$nameVar])) + { + return $_REQUEST[$nameVar]; + } + $default = $this->getDefault($nameVar); + return $default; + } + + protected function getDefault($nameVar) + { + if(!isset($this->variablesDefault[$nameVar])) + { + return false; + } + return $this->variablesDefault[$nameVar]; + } + + public function setSearchRecursive() + { + $this->variablesDefault['search_recursive'] = true; + } + public function setRecursiveLoadDataTableIfSearchingForPattern() + { + try{ + $requestValue = Piwik_Common::getRequestVar('filter_column_recursive'); + $requestValue = Piwik_Common::getRequestVar('filter_pattern_recursive'); + // if the 2 variables are set we are searching for something. + // we have to load all the children subtables in this case + + $this->recursiveDataTableLoad = true; + return true; + } + catch(Exception $e) { + $this->recursiveDataTableLoad = false; + return false; + } + + } + + public function setExcludeLowPopulation( $value = 30 ) + { + $this->variablesDefault['filter_excludelowpop_default'] = 2; + $this->variablesDefault['filter_excludelowpop_value_default'] = $value; + $this->variablesDefault['filter_excludelowpop'] = 2; + $this->variablesDefault['filter_excludelowpop_value'] = $value; + } + + public function setDefaultLimit( $limit ) + { + $this->variablesDefault['filter_limit'] = $limit; + } + + public function setSortedColumn( $columnId, $order = 'desc') + { + $this->variablesDefault['filter_sort_column']= $columnId; + $this->variablesDefault['filter_sort_order']= $order; + } + public function disableSort() + { + $this->JSsortEnabled = 'false'; + } + public function getSort() + { + return $this->JSsortEnabled; + } + + public function disableOffsetInformation() + { + $this->JSoffsetInformation = 'false'; + } + public function getOffsetInformation() + { + return $this->JSoffsetInformation; + } + + public function disableSearchBox() + { + $this->JSsearchBox = 'false'; + } + + public function getSearchBox() + { + return $this->JSsearchBox; + } + + public function disableExcludeLowPopulation() + { + $this->JSexcludeLowPopulation = 'false'; + } + + public function getExcludeLowPopulation() + { + return $this->JSexcludeLowPopulation; + } + + protected function getJavascriptVariablesToSet( ) + { + // build javascript variables to set + $javascriptVariablesToSet = array(); + + $genericFilters = Piwik_API_Request::getGenericFiltersInformation(); + foreach($genericFilters as $filter) + { + foreach($filter as $filterVariableName => $filterInfo) + { + // if there is a default value for this filter variable we set it + // so that it is propagated to the javascript + if(isset($filterInfo[1])) + { + $javascriptVariablesToSet[$filterVariableName] = $filterInfo[1]; + + // we set the default specified column and Order to sort by + // when this javascript variable is not set already + // for example during an AJAX call this variable will be set in the URL + // so this will not be executed ( and the default sorted not be used as the sorted column might have changed in the meanwhile) + if( false !== ($defaultValue = $this->getDefault($filterVariableName))) + { + $javascriptVariablesToSet[$filterVariableName] = $defaultValue; + } + } + } + } + +// var_dump($javascriptVariablesToSet);exit; + //TODO check security of printing javascript variables; inject some JS code here?? + foreach($_GET as $name => $value) + { + try{ + $requestValue = Piwik_Common::getRequestVar($name); + } + catch(Exception $e) { + $requestValue = ''; + } + $javascriptVariablesToSet[$name] = $requestValue; + } + + // at this point there are some filters values we may have not set, + // case of the filter without default values and parameters set directly in this class + // for example setExcludeLowPopulation + // we go through all the $this->variablesDefault array and set the variables not set yet + foreach($this->variablesDefault as $name => $value) + { + if(!isset($javascriptVariablesToSet[$name] )) + { + $javascriptVariablesToSet[$name] = $value; + } + } + + + $javascriptVariablesToSet['action'] = $this->currentControllerAction; + + if(!is_null($this->actionToLoadTheSubTable)) + { + $javascriptVariablesToSet['actionToLoadTheSubTable'] = $this->actionToLoadTheSubTable; + } + +// var_dump($this->variablesDefault); +// var_dump($javascriptVariablesToSet); exit; + + 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(); + $javascriptVariablesToSet['enable_sort'] = $this->getSort(); + + return $javascriptVariablesToSet; + } + + protected function loadDataTableFromAPI( $idSubtable = false) + { + if($idSubtable === false) + { + $idSubtable = $this->idSubtable; + } + // we prepare the string to give to the API Request + // we setup the method and format variable + // - we request the method to call to get this specific DataTable + // - the format = original specifies that we want to get the original DataTable structure itself, not rendered + $requestString = 'method='.$this->moduleNameAndMethod + .'&format=original' + ; + if( $this->recursiveDataTableLoad ) + { + $requestString .= '&expanded=1'; + } + + // if a subDataTable is requested we add the variable to the API request string + if( $idSubtable != false) + { + $requestString .= '&this->idSubtable='.$idSubtable; + } + + $toSetEventually = array( + 'filter_limit', + 'filter_sort_column', + 'filter_sort_order', + 'filter_excludelowpop', + 'filter_excludelowpop_value', + ); + foreach($toSetEventually as $varToSet) + { + $value = $this->getDefaultOrCurrent($varToSet); + if( false !== $value ) + { + $requestString .= '&'.$varToSet.'='.$value; + } + } + // We finally make the request to the API + $request = new Piwik_API_Request($requestString); + + // and get the DataTable structure + $dataTable = $request->process(); + +// echo $dataTable;exit; + + $this->dataTable = $dataTable; + } + + protected function getPHPArrayFromDataTable( ) + { + $renderer = Piwik_DataTable_Renderer::factory('php'); + $renderer->setTable($this->dataTable); + $renderer->setSerialize( false ); + $phpArray = $renderer->render(); + return $phpArray; + } +} \ No newline at end of file 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 @@ 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   {$wordTruncated}   "; - } -// print( $word ."=".$percent."
"); - } - } - 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 @@ -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 @@ +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 @@ +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 .= ' +
+ + '; + } + + 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 @@ +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 @@ +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#
#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 @@ +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#
#val# #key# ' ); +// $this->set_y_legend( 'Open Flash Chart', 12, '#736AFF' ); + } + +} \ No newline at end of file diff --git a/modules/Visualization/Cloud.php b/modules/Visualization/Cloud.php new file mode 100644 index 0000000000..efbed67cb0 --- /dev/null +++ b/modules/Visualization/Cloud.php @@ -0,0 +1,150 @@ + 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(); + } + + 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   {$wordTruncated}   "; + } +// print( $word ."=".$percent."
"); + } + } + return $return; + } +} + 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 @@ +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 @@ + 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("
");
+	var_export($var);
+	print("
"); +} + 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 @@ 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 @@ + + 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 @@ +
+{$jsInvocationTag} +

+ +
+Embed + +| Graph data +
+ +
+{include file="UserSettings/templates/datatable_footer.tpl"} +
\ 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}; + 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 Binary files /dev/null and b/themes/default/images/chart_bar.png differ diff --git a/themes/default/images/chart_pie.png b/themes/default/images/chart_pie.png new file mode 100644 index 0000000000..fe00fa050a Binary files /dev/null and b/themes/default/images/chart_pie.png differ -- cgit v1.2.3