├── web ├── Tests ├── css │ ├── HeatMap.css │ ├── RGraph.css │ ├── Hypertree.css │ ├── col1.png │ ├── col2.png │ ├── gradient.png │ ├── Other.css │ ├── ForceDirected3D.css │ ├── ForceDirected.css │ ├── Sunburst.css │ ├── Spacetree.css │ ├── Icicle.css │ ├── base.css │ ├── Treemap.css │ ├── Voronoi.css │ ├── BarChart.css │ ├── PieChart.css │ ├── TimeGraph.css │ └── AreaChart.css ├── Voronoi │ └── left.js ├── js │ └── common.js ├── Hypertree │ ├── test8.js │ ├── test9.js │ └── test2.js ├── Spacetree │ ├── test3.js │ ├── test2.js │ ├── test4.js │ ├── test1.js │ └── test5.js ├── PieChart │ ├── test2.js │ ├── test1.js │ └── test3.js ├── Treemap │ ├── test1.js │ └── test6.js ├── BarChart │ ├── test2.js │ ├── test1.js │ └── test3.js └── AreaChart │ ├── test1.js │ ├── test2.js │ └── test3.js ├── webpy ├── web │ ├── contrib │ │ ├── __init__.py │ │ └── template.py │ ├── __init__.py │ ├── test.py │ ├── wsgiserver │ │ └── LICENSE.txt │ └── wsgi.py └── .gitignore ├── Templates ├── Hypertree │ ├── test2.html │ ├── test8.html │ ├── test9.html │ ├── test1.html │ ├── test12.html │ ├── test7.html │ ├── left.html │ ├── test6.html │ ├── test5.html │ ├── test3.html │ ├── test4.html │ ├── test10.html │ └── test11.html ├── Other │ ├── test1.html │ ├── test2.html │ ├── test3.html │ ├── test4.html │ └── left.html ├── AreaChart │ ├── test1.html │ ├── test2.html │ ├── test3.html │ └── left.html ├── BarChart │ ├── test1.html │ ├── test2.html │ ├── test3.html │ └── left.html ├── HeatMap │ ├── test1.html │ └── left.html ├── PieChart │ ├── test1.html │ ├── test2.html │ ├── test3.html │ └── left.html ├── RGraph │ ├── test1.html │ ├── test10.html │ ├── test11.html │ ├── test6.html │ ├── test9.html │ ├── left.html │ ├── test12.html │ ├── test5.html │ ├── test4.html │ ├── test2.html │ ├── test3.html │ ├── test7.html │ └── test8.html ├── Sunburst │ ├── test1.html │ ├── test2.html │ ├── test3.html │ ├── test4.html │ ├── test5.html │ └── left.html ├── TimeGraph │ ├── test1.html │ └── left.html ├── Treemap │ ├── test1.html │ ├── test2.html │ ├── test3.html │ ├── test4.html │ ├── test5.html │ ├── test6.html │ └── left.html ├── ForceDirected │ ├── test1.html │ ├── test2.html │ ├── test4.html │ ├── test5.html │ ├── test6.html │ ├── left.html │ └── test3.html ├── ForceDirected3D │ ├── test1.html │ ├── test2.html │ └── left.html ├── Icicle │ ├── test1.html │ ├── test2.html │ ├── test3.html │ └── left.html ├── Voronoi │ ├── test1.html │ ├── test2.html │ ├── test3.html │ ├── test4.html │ └── left.html ├── Spacetree │ ├── left.html │ ├── test1.html │ ├── test4.html │ ├── test2.html │ ├── test9.html │ ├── test10.html │ ├── test5.html │ ├── test3.html │ ├── test11.html │ ├── test8.html │ ├── test7.html │ ├── test6.html │ └── test12.html ├── basetests.html ├── baseexamples.html └── basecode.html ├── .gitignore ├── Source ├── Options │ ├── Options.js │ ├── Options.Margin.js │ ├── Options.NodeStyles.js │ ├── Options.Tree.js │ ├── Options.Navigation.js │ ├── Options.Tips.js │ ├── Options.Canvas.js │ ├── Options.Edge.js │ ├── Options.PieChart.js │ ├── Options.AreaChart.js │ ├── Options.Label.js │ ├── Options.BarChart.js │ ├── Options.Fx.js │ └── Options.Node.js ├── Geometry │ ├── Camera.js │ └── Vector3.js ├── Layouts │ ├── Layouts.Grid.js │ ├── Layouts.js │ └── Layouts.Icicle.js └── Graph │ └── Graph.Geom.js ├── AUTHORS ├── README.md ├── bower.json ├── Extras ├── code.css └── generators.js ├── TODO ├── LICENSE ├── Jit └── jit-yc.js └── serve.py /web: -------------------------------------------------------------------------------- 1 | webpy/web -------------------------------------------------------------------------------- /Tests/css/HeatMap.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Tests/css/RGraph.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Tests/Voronoi/left.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /webpy/web/contrib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webpy/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .DS_Store -------------------------------------------------------------------------------- /Templates/Hypertree/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | -------------------------------------------------------------------------------- /Templates/Hypertree/test8.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | -------------------------------------------------------------------------------- /Templates/Hypertree/test9.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | -------------------------------------------------------------------------------- /Templates/Other/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Other/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Other/test3.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Other/test4.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Tests/css/Hypertree.css: -------------------------------------------------------------------------------- 1 | #infovis-canvaswidget { 2 | margin:25px 0 0 25px; 3 | } -------------------------------------------------------------------------------- /Tests/css/col1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philogb/jit/HEAD/Tests/css/col1.png -------------------------------------------------------------------------------- /Tests/css/col2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philogb/jit/HEAD/Tests/css/col2.png -------------------------------------------------------------------------------- /Templates/AreaChart/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/AreaChart/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/BarChart/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/BarChart/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/BarChart/test3.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/HeatMap/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Hypertree/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Hypertree/test12.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Hypertree/test7.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/PieChart/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/PieChart/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/PieChart/test3.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/RGraph/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/RGraph/test10.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/RGraph/test11.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/RGraph/test6.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/RGraph/test9.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Sunburst/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Sunburst/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Sunburst/test3.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Sunburst/test4.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Sunburst/test5.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/TimeGraph/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Treemap/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Treemap/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Treemap/test3.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Treemap/test4.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Treemap/test5.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Treemap/test6.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/AreaChart/test3.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
4 | -------------------------------------------------------------------------------- /Templates/ForceDirected/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/ForceDirected/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/ForceDirected/test4.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/ForceDirected/test5.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/ForceDirected/test6.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/ForceDirected3D/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/ForceDirected3D/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
-------------------------------------------------------------------------------- /Templates/Icicle/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
4 | -------------------------------------------------------------------------------- /Templates/Icicle/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
4 | -------------------------------------------------------------------------------- /Templates/Icicle/test3.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
4 | -------------------------------------------------------------------------------- /Templates/Voronoi/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
4 | -------------------------------------------------------------------------------- /Templates/Voronoi/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
4 | -------------------------------------------------------------------------------- /Templates/Voronoi/test3.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
4 | -------------------------------------------------------------------------------- /Templates/Voronoi/test4.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |
4 | -------------------------------------------------------------------------------- /Tests/css/gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philogb/jit/HEAD/Tests/css/gradient.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .pydevproject 3 | Examples 4 | Extras/sh/ 5 | NaturalDocs* 6 | Docs* 7 | *.pyc 8 | *.jar 9 | *.zip 10 | *.*~ 11 | -------------------------------------------------------------------------------- /Tests/css/Other.css: -------------------------------------------------------------------------------- 1 | #right-container { 2 | display:none; 3 | } 4 | 5 | #infovis { 6 | width:800px; 7 | background-color:#1a1a1a; 8 | } 9 | -------------------------------------------------------------------------------- /Tests/css/ForceDirected3D.css: -------------------------------------------------------------------------------- 1 | #right-container { 2 | display: none; 3 | } 4 | 5 | #center-container { 6 | width:800px; 7 | background: #efefef; 8 | } 9 | 10 | #infovis { 11 | width:800px; 12 | } -------------------------------------------------------------------------------- /Source/Options/Options.js: -------------------------------------------------------------------------------- 1 | var Options = function() { 2 | var args = arguments; 3 | for(var i=0, l=args.length, ans={}; i 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 |
17 | -------------------------------------------------------------------------------- /Templates/RGraph/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 |
17 | -------------------------------------------------------------------------------- /Templates/Spacetree/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 |
17 | -------------------------------------------------------------------------------- /Templates/Spacetree/test1.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 16 | 17 |
6 | Orientation: 7 | 9 | 15 |
-------------------------------------------------------------------------------- /Templates/Spacetree/test4.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 16 | 17 |
6 | Orientation: 7 | 9 | 15 |
-------------------------------------------------------------------------------- /Templates/HeatMap/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 |
17 | -------------------------------------------------------------------------------- /Templates/Hypertree/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 |
17 | -------------------------------------------------------------------------------- /Templates/Sunburst/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 |
17 | -------------------------------------------------------------------------------- /Templates/TimeGraph/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 |
17 | -------------------------------------------------------------------------------- /Templates/Voronoi/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 | Go to Parent 17 | -------------------------------------------------------------------------------- /Templates/ForceDirected/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 |
17 | -------------------------------------------------------------------------------- /Templates/ForceDirected3D/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 |
17 | -------------------------------------------------------------------------------- /Tests/css/ForceDirected.css: -------------------------------------------------------------------------------- 1 | #inner-details { 2 | font-size:12px; 3 | } 4 | 5 | span.close { 6 | color:#FF5555; 7 | cursor:pointer; 8 | font-weight:bold; 9 | margin-left:3px; 10 | } 11 | 12 | span.name { 13 | cursor: pointer; 14 | } 15 | 16 | /*TOOLTIPS*/ 17 | .tip { 18 | text-align: left; 19 | width:auto; 20 | max-width:500px; 21 | } 22 | 23 | .tip-title { 24 | font-size: 11px; 25 | text-align:center; 26 | margin-bottom:2px; 27 | } 28 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | ## 2 | ## This should be a somewhat complete list of people that have 3 | ## contributed to the JavaScript InfoVis Toolkit project. The fields are: name 4 | ## (N), email (E), web-address (W), description (D). 5 | ## 6 | 7 | N: Nicolas Garcia Belmonte 8 | E: philogb@gmail.com 9 | W: http://blog.thejit.org/ 10 | D: Creator and main author. 11 | 12 | N: Pablo Flouret 13 | E: quuxbaz@gmail.com 14 | W: http://quuxbaz.com.ar/ 15 | D: Mostly Icicle code. 16 | 17 | -------------------------------------------------------------------------------- /Templates/BarChart/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 | Update Data 17 | -------------------------------------------------------------------------------- /Templates/PieChart/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 | Update Data 17 | -------------------------------------------------------------------------------- /Templates/Spacetree/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 11 | 12 | 13 | 16 | 19 | 20 |
6 | Animate: 7 | 9 | 10 |
14 | 15 | 17 | 18 |
-------------------------------------------------------------------------------- /Templates/Spacetree/test9.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |

Add Subtrees

4 | 5 | 6 | 9 | 12 | 13 | 14 | 17 | 20 | 21 |
7 | Animate: 8 | 10 | 11 |
15 | 16 | 18 | 19 |
-------------------------------------------------------------------------------- /Templates/Spacetree/test10.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |

Selection Mode

4 | 5 | 6 | 9 | 12 | 13 | 14 | 17 | 20 | 21 |
7 | 8 | 10 | 11 |
15 | 16 | 18 | 19 |
-------------------------------------------------------------------------------- /Templates/AreaChart/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 | Update Data 17 | Remove Filter 18 | 19 | -------------------------------------------------------------------------------- /Tests/css/Sunburst.css: -------------------------------------------------------------------------------- 1 | /*TOOLTIPS*/ 2 | #inner-details { 3 | font-size:12px; 4 | } 5 | 6 | .tip { 7 | text-align: left; 8 | width:auto; 9 | max-width:500px; 10 | } 11 | 12 | .tip-title { 13 | font-size: 11px; 14 | text-align:center; 15 | margin-bottom:2px; 16 | } 17 | 18 | pre { 19 | background-color:#EEEEEE; 20 | border:1px solid #CCCCCC; 21 | font-size:10px; 22 | margin:5px auto; 23 | padding:5px; 24 | width:170px; 25 | 26 | white-space: pre-wrap; 27 | white-space: -moz-pre-wrap; 28 | white-space: -webkit-pre-wrap; 29 | white-space: -pre-wrap; 30 | white-space: -o-pre-wrap; 31 | word-wrap: break-word; 32 | } -------------------------------------------------------------------------------- /Source/Geometry/Camera.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Camera class based on three.js http://github.com/mrdoob/three.js, Copyright (c) Mr.doob http://mrdoob.com/, MIT License http://github.com/mrdoob/three.js/blob/master/LICENSE 3 | */ 4 | 5 | var Camera = function (fov, aspect, near, far) { 6 | this.projectionMatrix = Matrix4.makePerspective(fov, aspect, near, far); 7 | }; 8 | 9 | Camera.prototype = { 10 | position: new Vector3, 11 | target: { 12 | position: new Vector3 13 | }, 14 | up: new Vector3(0, 1, 0), 15 | matrix: new Matrix4, 16 | 17 | updateMatrix: function() { 18 | this.matrix.lookAt(this.position, this.target.position, this.up); 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | JavaScript InfoVis Toolkit 2 | ========================== 3 | 4 | The JavaScript InfoVis Toolkit provides tools for creating Interactive Data 5 | Visualizations for the Web. 6 | 7 | This is the Dev project, users should download the project from http://thejit.org. 8 | 9 | Useful links 10 | ------ 11 | - [jit homepage](http://thejit.org) 12 | - [jit's blog](http://blog.thejit.org) 13 | - [Getting Started with the Source](https://github.com/philogb/jit/wiki/Getting-Started) 14 | 15 | 16 | How to 17 | ------ 18 | 19 | To build: 20 | 21 | python make.py build 22 | 23 | 24 | To build the documentation: 25 | 26 | python make.py docs 27 | 28 | 29 | To build examples: 30 | 31 | python make.py examples 32 | -------------------------------------------------------------------------------- /Templates/Spacetree/test5.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 16 | 17 | 18 | 21 | 28 | 29 |
6 | Orientation: 7 | 9 | 15 |
19 | Align: 20 | 22 | 27 |
-------------------------------------------------------------------------------- /Templates/Spacetree/test3.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 11 | 12 | 13 | 16 | 19 | 20 | 21 | 24 | 27 | 28 |
6 | Animate: 7 | 9 | 10 |
14 | Remove Root: 15 | 17 | 18 |
22 | 23 | 25 | 26 |
-------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "JIT", 3 | "version": "2.0.2", 4 | "description": "The JavaScript InfoVis Toolkit provides tools for creating Interactive Data Visualizations for the Web.", 5 | "keywords": [ 6 | "dom", 7 | "w3c", 8 | "visualization", 9 | "canvas", 10 | "animation" 11 | ], 12 | "main": "Jit/jit-yc.js", 13 | "homepage": "http://thejit.org", 14 | "author": { 15 | "name": "Nicolas Garcia Belmonte", 16 | "url": "http://philogb.github.io/" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/philogb/jit.git" 21 | }, 22 | "licenses": [ 23 | { 24 | "type": "BSD", 25 | "url": "https://github.com/philogb/jit/blob/master/LICENSE" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /Extras/code.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | margin:0; 3 | padding:0; 4 | font-family: "Lucida Grande", Verdana; 5 | font-size: 0.9em; 6 | text-align: center; 7 | background-color:#F2F2F2; 8 | } 9 | 10 | h4 { 11 | font-size:1.1em; 12 | text-decoration:none; 13 | font-weight:normal; 14 | color:#23A4FF; 15 | } 16 | 17 | #container { 18 | width: 900px; 19 | margin:0 auto; 20 | background-color:white; 21 | border:1px solid #ccc; 22 | } 23 | 24 | #center-container { 25 | text-align:left; 26 | width:800px; 27 | color:#888; 28 | margin:auto; 29 | } 30 | 31 | .headtext { 32 | text-align:justify; 33 | width:500px; 34 | margin:20px auto; 35 | } 36 | 37 | .code-wrapper { 38 | width:750px; 39 | margin:5px auto; 40 | overflow:auto; 41 | margin-bottom:30px 42 | } 43 | -------------------------------------------------------------------------------- /webpy/web/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """web.py: makes web apps (http://webpy.org)""" 3 | 4 | from __future__ import generators 5 | 6 | __version__ = "0.31" 7 | __author__ = [ 8 | "Aaron Swartz ", 9 | "Anand Chitipothu " 10 | ] 11 | __license__ = "public domain" 12 | __contributors__ = "see http://webpy.org/changes" 13 | 14 | import utils, db, net, wsgi, http, webapi, httpserver, debugerror 15 | import template, form 16 | 17 | import session 18 | 19 | from utils import * 20 | from db import * 21 | from net import * 22 | from wsgi import * 23 | from http import * 24 | from webapi import * 25 | from httpserver import * 26 | from debugerror import * 27 | from application import * 28 | from browser import * 29 | import test 30 | try: 31 | import webopenid as openid 32 | except ImportError: 33 | pass # requires openid module 34 | 35 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | * Bug fix in IE with the Background canvas not drawing in the first plot (works when scaling and panning but not in the first plot) 2 | 3 | Articles 4 | * creating background canvases 5 | * customizing graph Node/Edge styles (in the JSON and with get/setData) 6 | * making custom animations (get/setData) 7 | * the event system 8 | * in Options.Node/Edge/Label we should add some documentation about Styling nodes in the JSON data. and using getters and setters with nodes/edges etc. 9 | * document the code about the JSON data for the Charts. 10 | * implementing NodeTypes/EdgeTypes documentation is pretty important! 11 | 12 | Bugs 13 | * IE.x has a strange behavior when morphing with animations in ForceDirected/3. Labels that were removed are still there captured by the event system, 14 | but not label or value is returned when, once the event fired, I try to retrieve the subject that fired the event. Weird. 15 | -------------------------------------------------------------------------------- /Source/Options/Options.Margin.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.Margin.js 3 | * 4 | */ 5 | 6 | /* 7 | Object: Options.Margin 8 | 9 | Canvas drawing margins. 10 | 11 | Syntax: 12 | 13 | (start code js) 14 | 15 | Options.Margin = { 16 | top: 0, 17 | left: 0, 18 | right: 0, 19 | bottom: 0 20 | }; 21 | 22 | (end code) 23 | 24 | Example: 25 | 26 | (start code js) 27 | 28 | var viz = new $jit.Viz({ 29 | Margin: { 30 | right: 10, 31 | bottom: 20 32 | } 33 | }); 34 | 35 | (end code) 36 | 37 | Parameters: 38 | 39 | top - (number) Default's *0*. Top margin. 40 | left - (number) Default's *0*. Left margin. 41 | right - (number) Default's *0*. Right margin. 42 | bottom - (number) Default's *0*. Bottom margin. 43 | 44 | */ 45 | 46 | Options.Margin = { 47 | $extend: false, 48 | 49 | top: 0, 50 | left: 0, 51 | right: 0, 52 | bottom: 0 53 | }; -------------------------------------------------------------------------------- /Templates/RGraph/test12.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 |

1.- Two nodes - Reverse the edge

5 | 6 | 7 | 8 | 11 | 14 | 15 |
9 | 10 | 12 | 13 |
16 | 17 |

2.- Three Nodes

18 | 19 | 20 | 21 | 24 | 27 | 28 |
22 | 23 | 25 | 26 |
29 | 30 |

3.- Four Nodes

31 | 32 | 33 | 34 | 37 | 40 | 41 |
35 | 36 | 38 | 39 |
42 | -------------------------------------------------------------------------------- /Templates/Spacetree/test11.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |

Change Tree Orientation

4 | 5 | 6 | 9 | 12 | 13 | 14 | 17 | 20 | 21 | 24 | 27 | 28 | 29 | 32 | 35 | 36 |
7 | 8 | 10 | 11 |
15 | 16 | 18 | 19 |
22 | 23 | 25 | 26 |
30 | 31 | 33 | 34 |
-------------------------------------------------------------------------------- /Templates/Spacetree/test8.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |

Change Tree Orientation

4 | 5 | 6 | 9 | 12 | 13 | 14 | 17 | 20 | 21 | 24 | 27 | 28 | 29 | 32 | 35 | 36 |
7 | 8 | 10 | 11 |
15 | 16 | 18 | 19 |
22 | 23 | 25 | 26 |
30 | 31 | 33 | 34 |
-------------------------------------------------------------------------------- /Tests/js/common.js: -------------------------------------------------------------------------------- 1 | var labelType, useGradients, nativeTextSupport, animate; 2 | 3 | (function() { 4 | var ua = navigator.userAgent, 5 | iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i), 6 | typeOfCanvas = typeof HTMLCanvasElement, 7 | nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'), 8 | textSupport = nativeCanvasSupport 9 | && (typeof document.createElement('canvas').getContext('2d').fillText == 'function'); 10 | //I'm setting this based on the fact that ExCanvas provides text support for IE 11 | //and that as of today iPhone/iPad current text support is lame 12 | labelType = (!nativeCanvasSupport || (textSupport && !iStuff))? 'Native' : 'HTML'; 13 | nativeTextSupport = labelType == 'Native'; 14 | useGradients = nativeCanvasSupport; 15 | animate = !(iStuff || !nativeCanvasSupport); 16 | })(); 17 | 18 | var Log = { 19 | elem: false, 20 | write: function(text){ 21 | if (!this.elem) 22 | this.elem = document.getElementById('log'); 23 | this.elem.innerHTML = text; 24 | this.elem.style.left = (500 - this.elem.offsetWidth / 2) + 'px'; 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /Templates/Icicle/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 |
4 | $if number > 1: 5 | previous 6 | $if number < max: 7 | next 8 | 9 |

10 | $model['Title'] 11 |

12 | $:model['Description'] 13 | 14 |
15 | 16 | 20 |
21 |
22 | 23 | 31 |
32 |
33 |
34 | 35 | Go to Parent 36 | 37 |
38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013 Sencha Inc. - Author: Nicolas Garcia Belmonte (http://philogb.github.com/) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | */ 23 | 24 | -------------------------------------------------------------------------------- /Templates/Treemap/left.html: -------------------------------------------------------------------------------- 1 | $def with (model, type, number, max) 2 | 3 | $if number > 1: 4 | previous 5 | $if number < max: 6 | next 7 | 8 | 9 |
10 |

11 | $model['Title'] 12 |

13 | $:model['Description'] 14 |
15 | 16 |
17 | 18 | 19 | 22 | 25 | 26 | 27 | 30 | 33 | 34 | 37 | 40 | 41 |
20 | 21 | 23 | 24 |
28 | 29 | 31 | 32 |
35 | 36 | 38 | 39 |
42 |
43 | 44 | Go to Parent 45 | -------------------------------------------------------------------------------- /Jit/jit-yc.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013 Sencha Inc. - Author: Nicolas Garcia Belmonte (http://philogb.github.com/) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | */ 23 | 24 | -------------------------------------------------------------------------------- /Tests/Hypertree/test8.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | var p = { 3 | idPrefix: "node", 4 | levelStart: 0, 5 | levelEnd: 4, 6 | maxChildrenPerNode: 15, 7 | minChildrenPerNode: 1, 8 | counter: 0 9 | }; 10 | var json = Feeder.makeTree(p); 11 | $jit(); 12 | ht = new Hypertree({ 13 | 'injectInto': 'infovis', 14 | onBeforeCompute: function(node){ 15 | Log.write("centering"); 16 | }, 17 | 18 | onCreateLabel: function(domElement, node){ 19 | domElement.innerHTML = node.name; 20 | domElement.onclick = function () { 21 | ht.onClick(node.id); 22 | }; 23 | }, 24 | 25 | //Take the left style property and substract half of the label actual width. 26 | onPlaceLabel: function(tag, node){ 27 | tag.style.display = "none"; 28 | var width = tag.offsetWidth; 29 | var intX = parseInt(tag.style.left); 30 | intX -= width / 2; 31 | tag.style.left = intX + 'px'; 32 | }, 33 | 34 | onAfterCompute: function(){ 35 | Log.write("done"); 36 | } 37 | 38 | }); 39 | 40 | ht.loadJSON(json); 41 | ht.compute(); 42 | ht.plot(); 43 | ht.controller.onAfterCompute(); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /serve.py: -------------------------------------------------------------------------------- 1 | import web 2 | from web import template 3 | from tests import tests_model 4 | from build import Build 5 | 6 | urls = ( 7 | '/testcase/(RGraph|Treemap|Icicle|Hypertree|Spacetree|ForceDirected|ForceDirected3D|Sunburst|AreaChart|BarChart|PieChart|TimeGraph|HeatMap|Voronoi|Other)/([0-9]+)/?', 'testcase', 8 | ) 9 | 10 | app = web.application(urls, globals()) 11 | 12 | render = { 13 | 'TestCases': template.render('Templates/'), 14 | } 15 | 16 | class testcase: 17 | def GET(self, type, number): 18 | number_int = int(number) 19 | max = len(tests_model[type]) 20 | if number_int > max: 21 | return "Wrong test number" 22 | 23 | name = type 24 | test = 'test' + number + '.js' 25 | 26 | model = tests_model[type][number_int -1] 27 | title = model['Title'] 28 | extras = model['Extras'][:] 29 | 30 | if 'Build' in model: build_config = model['Build'] 31 | else: build_config = [type] 32 | 33 | build = Build().build(build_config) 34 | 35 | includes = { 36 | 'left': getattr(render['TestCases'], type + '/' + 'left')(model, type, number_int, max), 37 | 'right': getattr(render['TestCases'], type + '/' + 'test' + number)(model), 38 | } 39 | 40 | return render['TestCases'].basetests(name, title, extras, test, build, includes) 41 | 42 | if __name__ == "__main__": app.run() 43 | -------------------------------------------------------------------------------- /Templates/RGraph/test5.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 14 | 15 | 16 | 19 | 26 | 27 | 28 | 31 | 38 | 39 | 40 | 43 | 46 | 47 | 48 | 51 | 54 | 55 |
6 | type: 7 | 9 | 13 |
17 | duration: 18 | 20 | 25 |
29 | fps: 30 | 32 | 37 |
41 | hide labels: 42 | 44 | 45 |
49 | 50 | 52 | 53 |
56 |
-------------------------------------------------------------------------------- /Templates/Hypertree/test6.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 14 | 15 | 16 | 19 | 26 | 27 | 28 | 31 | 38 | 39 | 40 | 43 | 46 | 47 | 48 | 51 | 54 | 55 |
6 | type: 7 | 9 | 13 |
17 | duration: 18 | 20 | 25 |
29 | fps: 30 | 32 | 37 |
41 | hide labels: 42 | 44 | 45 |
49 | 50 | 52 | 53 |
56 |
-------------------------------------------------------------------------------- /Tests/Hypertree/test9.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | var p = { 3 | idPrefix: "node", 4 | levelStart: 0, 5 | levelEnd: 4, 6 | maxChildrenPerNode: 15, 7 | minChildrenPerNode: 1, 8 | counter: 0 9 | }; 10 | var json = Feeder.makeTree(p); 11 | Feeder.setWeights(json, true); 12 | $jit(); 13 | ht = new Hypertree({ 14 | 'injectInto': 'infovis', 15 | Node: { 16 | transform: false, 17 | overridable: true 18 | }, 19 | 20 | onBeforeCompute: function(node){ 21 | Log.write("centering"); 22 | }, 23 | 24 | onCreateLabel: function(domElement, node){ 25 | domElement.innerHTML = node.name; 26 | domElement.onclick = function () { 27 | ht.onClick(node.id); 28 | }; 29 | }, 30 | 31 | //Take the left style property and substract half of the label actual width. 32 | onPlaceLabel: function(tag, node){ 33 | tag.style.display = "none"; 34 | var width = tag.offsetWidth; 35 | var intX = parseInt(tag.style.left); 36 | intX -= width / 2; 37 | tag.style.left = intX + 'px'; 38 | }, 39 | 40 | onAfterCompute: function(){ 41 | Log.write("done"); 42 | } 43 | 44 | }); 45 | 46 | ht.loadJSON(json); 47 | ht.compute(); 48 | ht.plot(); 49 | ht.controller.onAfterCompute(); 50 | 51 | } 52 | -------------------------------------------------------------------------------- /Source/Layouts/Layouts.Grid.js: -------------------------------------------------------------------------------- 1 | Layouts.Grid = new Class({ 2 | compute: function(prop) { 3 | this.controller.onBeforeCompute(); 4 | var size = this.canvas.getSize(), 5 | config = this.config, 6 | margin = config.Margin, 7 | width = size.width - margin.left - margin.right, 8 | height = size.height - margin.top - margin.bottom, 9 | legendX = this.getLegendX(), 10 | legendY = this.getLegendY(), 11 | elemWidth = width / legendX.length, 12 | elemHeight = height / legendY.length; 13 | this.graph.eachNode(function(n) { 14 | var x = $.indexOf(legendX, n.getData('legendX') || 0) * elemWidth - size.width/2 + margin.left, 15 | y = $.indexOf(legendY, n.getData('legendY') || 0) * elemHeight - size.height/2 + margin.top; 16 | n.getPos(prop).setc(x, y); 17 | n.setData('width', elemWidth); 18 | n.setData('height', elemHeight); 19 | }); 20 | this.controller.onAfterCompute(); 21 | }, 22 | 23 | _get: function(prop) { 24 | var config = this.config; 25 | if(config[prop] && config[prop].length) { 26 | return config[prop]; 27 | } 28 | var ans = []; 29 | this.graph.eachNode(function(n) { 30 | var leg = n.getData(prop); 31 | if($.indexOf(ans, leg) < 0) { 32 | ans.push(leg); 33 | } 34 | }); 35 | return ans; 36 | }, 37 | 38 | getLegendX: function() { 39 | return this._get('legendX'); 40 | }, 41 | 42 | getLegendY: function() { 43 | return this._get('legendY'); 44 | } 45 | }); -------------------------------------------------------------------------------- /Templates/Hypertree/test5.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 15 | 16 | 17 | 20 | 27 | 28 | 29 | 32 | 39 | 40 | 41 | 44 | 47 | 48 | 49 | 52 | 55 | 56 |
6 | type: 7 | 9 | 14 |
18 | duration: 19 | 21 | 26 |
30 | fps: 31 | 33 | 38 |
42 | hide labels: 43 | 45 | 46 |
50 | 51 | 53 | 54 |
57 |
-------------------------------------------------------------------------------- /Templates/RGraph/test4.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 15 | 16 | 17 | 20 | 27 | 28 | 29 | 32 | 39 | 40 | 41 | 44 | 47 | 48 | 49 | 52 | 55 | 56 |
6 | type: 7 | 9 | 14 |
18 | duration: 19 | 21 | 26 |
30 | fps: 31 | 33 | 38 |
42 | hide labels: 43 | 45 | 46 |
50 | 51 | 53 | 54 |
57 |
-------------------------------------------------------------------------------- /Source/Options/Options.NodeStyles.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.NodeStyles.js 3 | * 4 | */ 5 | 6 | /* 7 | Object: Options.NodeStyles 8 | 9 | Apply different styles when a node is hovered or selected. 10 | 11 | Syntax: 12 | 13 | (start code js) 14 | Options.NodeStyles = { 15 | enable: false, 16 | type: 'auto', 17 | stylesHover: false, 18 | stylesClick: false 19 | }; 20 | (end code) 21 | 22 | Example: 23 | 24 | (start code js) 25 | var viz = new $jit.Viz({ 26 | NodeStyles: { 27 | enable: true, 28 | type: 'Native', 29 | stylesHover: { 30 | dim: 30, 31 | color: '#fcc' 32 | }, 33 | duration: 600 34 | } 35 | }); 36 | (end code) 37 | 38 | Parameters: 39 | 40 | enable - (boolean) Default's *false*. Whether to enable this option. 41 | type - (string) Default's *auto*. Use this to attach the hover/click events in the nodes or the nodes labels (if they have been defined as DOM elements: 'HTML' or 'SVG', see for more details). The default 'auto' value will set NodeStyles to the same type defined for . 42 | stylesHover - (boolean|object) Default's *false*. An object with node styles just like the ones defined for or *false* otherwise. 43 | stylesClick - (boolean|object) Default's *false*. An object with node styles just like the ones defined for or *false* otherwise. 44 | */ 45 | 46 | Options.NodeStyles = { 47 | $extend: false, 48 | 49 | enable: false, 50 | type: 'auto', 51 | stylesHover: false, 52 | stylesClick: false 53 | }; 54 | -------------------------------------------------------------------------------- /Templates/Hypertree/test3.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 16 | 17 | 18 | 21 | 28 | 29 | 30 | 33 | 40 | 41 | 42 | 45 | 48 | 49 | 50 | 53 | 56 | 57 |
6 | type: 7 | 9 | 15 |
19 | duration: 20 | 22 | 27 |
31 | fps: 32 | 34 | 39 |
43 | hide labels: 44 | 46 | 47 |
51 | 52 | 54 | 55 |
58 |
-------------------------------------------------------------------------------- /Templates/Hypertree/test4.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 16 | 17 | 18 | 21 | 28 | 29 | 30 | 33 | 40 | 41 | 42 | 45 | 48 | 49 | 50 | 53 | 56 | 57 |
6 | type: 7 | 9 | 15 |
19 | duration: 20 | 22 | 27 |
31 | fps: 32 | 34 | 39 |
43 | hide labels: 44 | 46 | 47 |
51 | 52 | 54 | 55 |
58 |
-------------------------------------------------------------------------------- /Templates/RGraph/test2.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 16 | 17 | 18 | 21 | 28 | 29 | 30 | 33 | 40 | 41 | 42 | 45 | 48 | 49 | 50 | 53 | 56 | 57 |
6 | type: 7 | 9 | 15 |
19 | duration: 20 | 22 | 27 |
31 | fps: 32 | 34 | 39 |
43 | hide labels: 44 | 46 | 47 |
51 | 52 | 54 | 55 |
58 |
-------------------------------------------------------------------------------- /Templates/RGraph/test3.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 16 | 17 | 18 | 21 | 28 | 29 | 30 | 33 | 40 | 41 | 42 | 45 | 48 | 49 | 50 | 53 | 56 | 57 |
6 | type: 7 | 9 | 15 |
19 | duration: 20 | 22 | 27 |
31 | fps: 32 | 34 | 39 |
43 | hide labels: 44 | 46 | 47 |
51 | 52 | 54 | 55 |
58 |
-------------------------------------------------------------------------------- /webpy/web/test.py: -------------------------------------------------------------------------------- 1 | """test utilities 2 | (part of web.py) 3 | """ 4 | import unittest 5 | import sys, os 6 | import web 7 | 8 | TestCase = unittest.TestCase 9 | TestSuite = unittest.TestSuite 10 | 11 | def load_modules(names): 12 | return [__import__(name, None, None, "x") for name in names] 13 | 14 | def module_suite(module, classnames=None): 15 | """Makes a suite from a module.""" 16 | if classnames: 17 | return unittest.TestLoader().loadTestsFromNames(classnames, module) 18 | elif hasattr(module, 'suite'): 19 | return module.suite() 20 | else: 21 | return unittest.TestLoader().loadTestsFromModule(module) 22 | 23 | def doctest_suite(module_names): 24 | """Makes a test suite from doctests.""" 25 | import doctest 26 | suite = TestSuite() 27 | for mod in load_modules(module_names): 28 | suite.addTest(doctest.DocTestSuite(mod)) 29 | return suite 30 | 31 | def suite(module_names): 32 | """Creates a suite from multiple modules.""" 33 | suite = TestSuite() 34 | for mod in load_modules(module_names): 35 | suite.addTest(module_suite(mod)) 36 | return suite 37 | 38 | def runTests(suite): 39 | runner = unittest.TextTestRunner() 40 | return runner.run(suite) 41 | 42 | def main(suite=None): 43 | if not suite: 44 | main_module = __import__('__main__') 45 | # allow command line switches 46 | args = [a for a in sys.argv[1:] if not a.startswith('-')] 47 | suite = module_suite(main_module, args or None) 48 | 49 | result = runTests(suite) 50 | sys.exit(not result.wasSuccessful()) 51 | 52 | -------------------------------------------------------------------------------- /Templates/Spacetree/test7.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |

Tree Orientation

4 | 5 | 6 | 9 | 12 | 13 | 14 | 17 | 20 | 21 | 22 | 25 | 28 | 29 | 30 | 33 | 36 | 37 |
7 | 8 | 10 | 11 |
15 | 16 | 18 | 19 |
23 | 24 | 26 | 27 |
31 | 32 | 34 | 35 |
38 | 39 |

Selection Mode

40 | 41 | 42 | 45 | 48 | 49 | 50 | 53 | 56 | 57 |
43 | 44 | 46 | 47 |
51 | 52 | 54 | 55 |
-------------------------------------------------------------------------------- /webpy/web/wsgiserver/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2007, CherryPy Team (team@cherrypy.org) 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of the CherryPy Team nor the names of its contributors 13 | may be used to endorse or promote products derived from this software 14 | without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /Templates/basetests.html: -------------------------------------------------------------------------------- 1 | $def with (name, title, extras, test, build, includes) 2 | 3 | 4 | 5 | 6 | $name - $title 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | $if extras: 17 | $for lib in extras: 18 | $if lib == "excanvas.js": 19 | 20 | $else: 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
34 |
35 | $:includes['left'] 36 |
37 |
38 |
39 |
40 |
41 | $:includes['right'] 42 |
43 |
44 |
45 | 46 | 47 | -------------------------------------------------------------------------------- /Templates/baseexamples.html: -------------------------------------------------------------------------------- 1 | $def with (name, title, extras, example, build, includes, fancy) 2 | 3 | 4 | 5 | 6 | $name - $title 7 | 8 | 9 | 10 | 11 | 12 | $if extras: 13 | $for lib in extras: 14 | $if lib == "excanvas.js": 15 | 16 | 17 | 18 | $if fancy: 19 | 20 | $else: 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
31 | $:includes['left'] 32 | 33 | $if fancy: 34 | 35 | $else: 36 | 37 |
38 | 39 |
40 |
41 |
42 | 43 |
44 | $:includes['right'] 45 |
46 | 47 |
48 |
49 | 50 | 51 | -------------------------------------------------------------------------------- /Source/Options/Options.Tree.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.Tree.js 3 | * 4 | */ 5 | 6 | /* 7 | Object: Options.Tree 8 | 9 | Options related to (strict) Tree layout algorithms. These options are used by the visualization. 10 | 11 | Syntax: 12 | 13 | (start code js) 14 | Options.Tree = { 15 | orientation: "left", 16 | subtreeOffset: 8, 17 | siblingOffset: 5, 18 | indent:10, 19 | multitree: false, 20 | align:"center" 21 | }; 22 | (end code) 23 | 24 | Example: 25 | 26 | (start code js) 27 | var st = new $jit.ST({ 28 | orientation: 'left', 29 | subtreeOffset: 1, 30 | siblingOFfset: 5, 31 | multitree: true 32 | }); 33 | (end code) 34 | 35 | Parameters: 36 | 37 | subtreeOffset - (number) Default's 8. Separation offset between subtrees. 38 | siblingOffset - (number) Default's 5. Separation offset between siblings. 39 | orientation - (string) Default's 'left'. Tree orientation layout. Possible values are 'left', 'top', 'right', 'bottom'. 40 | align - (string) Default's *center*. Whether the tree alignment is 'left', 'center' or 'right'. 41 | indent - (number) Default's 10. Used when *align* is left or right and shows an indentation between parent and children. 42 | multitree - (boolean) Default's *false*. Used with the node $orn data property for creating multitrees. 43 | levelSpacing - (string) Whether each level is evenly spaced or level spacing is relative tothe size of the parent node. The former (which is the default) is 'even', the latter is 'parent'. 44 | 45 | */ 46 | Options.Tree = { 47 | $extend: true, 48 | 49 | orientation: "left", 50 | subtreeOffset: 8, 51 | siblingOffset: 5, 52 | indent:10, 53 | multitree: false, 54 | align:"center", 55 | levelSpacing: "even" 56 | }; 57 | -------------------------------------------------------------------------------- /Templates/RGraph/test7.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 19 | 20 | 21 | 24 | 31 | 32 | 33 | 36 | 47 | 48 | 49 | 52 | 59 | 60 | 61 | 64 | 65 |
6 | node types: 7 | 9 | 18 |
22 | edge types: 23 | 25 | 30 |
34 | transitions: 35 | 37 | 46 |
50 | easing: 51 | 53 | 58 |
62 | 63 |
66 |
67 | -------------------------------------------------------------------------------- /Templates/Hypertree/test10.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 19 | 20 | 21 | 24 | 31 | 32 | 33 | 36 | 47 | 48 | 49 | 52 | 59 | 60 | 61 | 64 | 65 |
6 | node types: 7 | 9 | 18 |
22 | edge types: 23 | 25 | 30 |
34 | transitions: 35 | 37 | 46 |
50 | easing: 51 | 53 | 58 |
62 | 63 |
66 |
67 | -------------------------------------------------------------------------------- /Tests/Spacetree/test3.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | var infovis = document.getElementById('infovis'); 3 | var w = infovis.offsetWidth, h = infovis.offsetHeight; 4 | Feeder.p.color = false; 5 | var json = Feeder.makeTree(); 6 | //Create a new ST instance 7 | st = new $jit.ST({ 8 | 'injectInto': 'infovis', 9 | 'width': w, 10 | 'height': h, 11 | 12 | Node: { 13 | overridable:true 14 | }, 15 | Edge: { 16 | overridable:true 17 | }, 18 | onBeforeCompute: function(node){ 19 | Log.write("loading " + node.name); 20 | }, 21 | 22 | onAfterCompute: function(node){ 23 | Log.write("done"); 24 | }, 25 | 26 | onCreateLabel: function(label, node){ 27 | label.id = node.id; 28 | label.style.cursor = 'pointer'; 29 | label.innerHTML = node.name; 30 | label.onclick = function() { 31 | st.onClick(node.id); 32 | }; 33 | } 34 | }); 35 | //load json data 36 | st.loadJSON(json); 37 | //compute node positions and layout 38 | st.compute(); 39 | //optional: make a translation of the tree 40 | st.geom.translate(new $jit.Complex(-200, 0), "current"); 41 | //Emulate a click on the root node. 42 | st.onClick(st.root); 43 | 44 | var animate = document.getElementById('animate'); 45 | var removeRoot = document.getElementById('removeroot'); 46 | var button = document.getElementById('removeSubtree'); 47 | button.onclick = function() { 48 | var type = animate.checked? "animate" : "replot"; 49 | st.removeSubtree('node13', removeRoot.checked, type, { 50 | onComplete: function(){ 51 | //nothing 52 | } 53 | }); 54 | }; 55 | } -------------------------------------------------------------------------------- /Tests/css/Spacetree.css: -------------------------------------------------------------------------------- 1 | .jit-autoadjust-label { 2 | padding: 15px; 3 | } 4 | 5 | #update, #restore { 6 | text-align: center; 7 | width: 100px; 8 | margin:0px 35px 10px 35px; 9 | } 10 | 11 | .button { 12 | display: inline-block; 13 | outline: none; 14 | cursor: pointer; 15 | text-align: center; 16 | text-decoration: none; 17 | font: 14px / 100% Arial, Helvetica, sans-serif; 18 | padding: 0.5em 1em 0.55em; 19 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3); 20 | -webkit-border-radius: 0.5em; 21 | -moz-border-radius: 0.5em; 22 | border-radius: 0.5em; 23 | -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 24 | -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 25 | box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 26 | } 27 | 28 | .button:hover { 29 | text-decoration: none; 30 | } 31 | 32 | .button:active { 33 | position: relative; 34 | top: 1px; 35 | } 36 | 37 | /* white */ 38 | .white { 39 | color: #606060; 40 | border: solid 1px #b7b7b7; 41 | background: #fff; 42 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed)); 43 | background: -moz-linear-gradient(top, #fff, #ededed); 44 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed'); 45 | } 46 | 47 | .white:hover { 48 | background: #ededed; 49 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#dcdcdc)); 50 | background: -moz-linear-gradient(top, #fff, #dcdcdc); 51 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dcdcdc'); 52 | } 53 | 54 | .white:active { 55 | color: #999; 56 | background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#fff)); 57 | background: -moz-linear-gradient(top, #ededed, #fff); 58 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff'); 59 | } 60 | -------------------------------------------------------------------------------- /Source/Options/Options.Navigation.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.Navigation.js 3 | * 4 | */ 5 | 6 | /* 7 | Object: Options.Navigation 8 | 9 | Panning and zooming options for Graph/Tree based visualizations. These options are implemented 10 | by all visualizations except charts (, and ). 11 | 12 | Syntax: 13 | 14 | (start code js) 15 | 16 | Options.Navigation = { 17 | enable: false, 18 | type: 'auto', 19 | panning: false, //true, 'avoid nodes' 20 | zooming: false 21 | }; 22 | 23 | (end code) 24 | 25 | Example: 26 | 27 | (start code js) 28 | var viz = new $jit.Viz({ 29 | Navigation: { 30 | enable: true, 31 | panning: 'avoid nodes', 32 | zooming: 20 33 | } 34 | }); 35 | (end code) 36 | 37 | Parameters: 38 | 39 | enable - (boolean) Default's *false*. Whether to enable Navigation capabilities. 40 | type - (string) Default's 'auto'. Whether to attach the navigation events onto the HTML labels (via event delegation) or to use the custom 'Native' canvas Event System of the library. When 'auto' set when you let the *type* parameter decide this. 41 | panning - (boolean|string) Default's *false*. Set this property to *true* if you want to add Drag and Drop panning support to the visualization. You can also set this parameter to 'avoid nodes' to enable DnD panning but disable it if the DnD is taking place over a node. This is useful when some other events like Drag & Drop for nodes are added to . 42 | zooming - (boolean|number) Default's *false*. Set this property to a numeric value to turn mouse-scroll zooming on. The number will be proportional to the mouse-scroll sensitivity. 43 | 44 | */ 45 | 46 | Options.Navigation = { 47 | $extend: false, 48 | 49 | enable: false, 50 | type: 'auto', 51 | panning: false, //true | 'avoid nodes' 52 | zooming: false 53 | }; -------------------------------------------------------------------------------- /Templates/basecode.html: -------------------------------------------------------------------------------- 1 | $def with (name, title, code, example) 2 | 3 | 4 | 5 | 6 | $name - $title - Code 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 22 | 23 | 24 | 25 | 26 |
27 | 28 |
29 |

Code for $title

30 |
31 | These are ordered fragments for the $title example code. 32 | I trimmed parts that seemed uninteresting and that are not related to the library code. 33 | You can still see the full code here. Or go back to the example. 34 |
35 | 36 | 37 | $for elem in code: 38 |

$elem['name']

39 | $if elem['name'] == 'data': 40 |
41 | $else: 42 |
43 |
44 |     $elem['code']
45 |     
46 |
47 | 48 |
49 |
50 | 51 | 52 | -------------------------------------------------------------------------------- /Tests/Spacetree/test2.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | Feeder.p.color = false; 3 | var json = Feeder.makeTree(); 4 | //Create a new ST instance 5 | st = new $jit.ST({ 6 | 'injectInto': 'infovis', 7 | 8 | Node: { 9 | overridable: true 10 | }, 11 | Edge: { 12 | overridable: true 13 | }, 14 | 15 | onBeforeCompute: function(node){ 16 | Log.write("loading " + node.name); 17 | }, 18 | 19 | onAfterCompute: function(node){ 20 | Log.write("done"); 21 | }, 22 | 23 | onCreateLabel: function(label, node){ 24 | label.id = node.id; 25 | label.style.cursor = 'pointer'; 26 | label.innerHTML = node.name; 27 | label.onclick = function() { 28 | st.onClick(node.id); 29 | }; 30 | } 31 | }); 32 | //load json data 33 | st.loadJSON(json); 34 | 35 | //compute node positions and layout 36 | st.compute(); 37 | //optional: make a translation of the tree 38 | st.geom.translate(new $jit.Complex(-200, 0), "current"); 39 | //Emulate a click on the root node. 40 | // Tree.Plot.plot(st.tree, st.canvas); 41 | st.onClick(st.root); 42 | 43 | var animate = document.getElementById('animate'); 44 | var button = document.getElementById('addSubtree'); 45 | button.onclick = function() { 46 | var type = animate.checked? "animate" : "replot"; 47 | var minitree = Feeder.makeTree({ 48 | idPrefix: "node" + new Date().getTime(), 49 | levelStart: 0, 50 | levelEnd: 3, 51 | maxChildrenPerNode: 6, 52 | minChildrenPerNode: 1, 53 | counter: 0 54 | }); 55 | minitree.id = "node13"; //02 works too 56 | st.addSubtree(minitree, type, { 57 | onComplete: function(){ 58 | //nothing 59 | } 60 | }); 61 | }; 62 | } 63 | -------------------------------------------------------------------------------- /Tests/PieChart/test2.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | //init data 3 | var json = { 4 | //'color': "#416D9C", 5 | 'label': 'label A', 6 | 'values': [ 7 | { 8 | 'label': 'date A', 9 | 'values': 20 10 | }, 11 | { 12 | 'label': 'date B', 13 | 'values': 30 14 | }, 15 | { 16 | 'label': 'date E', 17 | 'values': 38 18 | }, 19 | { 20 | 'label': 'date F', 21 | 'values': 58 22 | }, 23 | { 24 | 'label': 'date D', 25 | 'values': 55 26 | }, 27 | { 28 | 'label': 'date C', 29 | 'values': 26 30 | }] 31 | }; 32 | var json2 = { 33 | 'values': [ 34 | { 35 | 'label': 'date A', 36 | 'values': 70 37 | }, 38 | { 39 | 'label': 'date B', 40 | 'values': 30 41 | }, 42 | { 43 | 'label': 'date D', 44 | 'values': 25 45 | }, 46 | { 47 | 'label': 'date C', 48 | 'values': 46 49 | }] 50 | }; 51 | //end 52 | var infovis = document.getElementById('infovis'); 53 | //init PieChart 54 | pie = new $jit.PieChart({ 55 | injectInto: 'infovis', 56 | animate: true, 57 | offset: 60, 58 | sliceOffset: 5, 59 | labelOffset: 20, 60 | type:'stacked:gradient', 61 | updateHeights:false, 62 | showLabels:true, 63 | Label: { 64 | size: 13, 65 | family: 'Arial', 66 | color: 'white' 67 | }, 68 | Tips: { 69 | 'enable': true, 70 | 'onShow': function(tip, elem) { 71 | tip.innerHTML = "" + elem.label + ": " + elem.value; 72 | } 73 | } 74 | }); 75 | 76 | //load JSON data. 77 | pie.loadJSON(json); 78 | 79 | setTimeout(function() { 80 | pie.updateJSON(json2); 81 | }, 3000); 82 | } -------------------------------------------------------------------------------- /Source/Options/Options.Tips.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.Tips.js 3 | * 4 | */ 5 | 6 | /* 7 | Object: Options.Tips 8 | 9 | Tips options 10 | 11 | Syntax: 12 | 13 | (start code js) 14 | Options.Tips = { 15 | enable: false, 16 | type: 'auto', 17 | offsetX: 20, 18 | offsetY: 20, 19 | onShow: $.empty, 20 | onHide: $.empty 21 | }; 22 | (end code) 23 | 24 | Example: 25 | 26 | (start code js) 27 | var viz = new $jit.Viz({ 28 | Tips: { 29 | enable: true, 30 | type: 'Native', 31 | offsetX: 10, 32 | offsetY: 10, 33 | onShow: function(tip, node) { 34 | tip.innerHTML = node.name; 35 | } 36 | } 37 | }); 38 | (end code) 39 | 40 | Parameters: 41 | 42 | enable - (boolean) Default's *false*. If *true*, a tooltip will be shown when a node is hovered. The tooltip is a div DOM element having "tip" as CSS class. 43 | type - (string) Default's *auto*. Defines where to attach the MouseEnter/Leave tooltip events. Possible values are 'Native' to attach them to the canvas or 'HTML' to attach them to DOM label elements (if defined). 'auto' sets this property to the value of 's *type* property. 44 | offsetX - (number) Default's *20*. An offset added to the current tooltip x-position (which is the same as the current mouse position). Default's 20. 45 | offsetY - (number) Default's *20*. An offset added to the current tooltip y-position (which is the same as the current mouse position). Default's 20. 46 | onShow(tip, node) - This callack is used right before displaying a tooltip. The first formal parameter is the tip itself (which is a DivElement). The second parameter may be a for graph based visualizations or an object with label, value properties for charts. 47 | onHide() - This callack is used when hiding a tooltip. 48 | 49 | */ 50 | Options.Tips = { 51 | $extend: false, 52 | 53 | enable: false, 54 | type: 'auto', 55 | offsetX: 20, 56 | offsetY: 20, 57 | force: false, 58 | onShow: $.empty, 59 | onHide: $.empty 60 | }; 61 | -------------------------------------------------------------------------------- /Source/Options/Options.Canvas.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.Canvas.js 3 | * 4 | */ 5 | 6 | /* 7 | Object: Options.Canvas 8 | 9 | These are Canvas general options, like where to append it in the DOM, its dimensions, background, 10 | and other more advanced options. 11 | 12 | Syntax: 13 | 14 | (start code js) 15 | 16 | Options.Canvas = { 17 | injectInto: 'id', 18 | type: '2D', //'3D' 19 | width: false, 20 | height: false, 21 | useCanvas: false, 22 | withLabels: true, 23 | background: false 24 | }; 25 | (end code) 26 | 27 | Example: 28 | 29 | (start code js) 30 | var viz = new $jit.Viz({ 31 | injectInto: 'someContainerId', 32 | width: 500, 33 | height: 700 34 | }); 35 | (end code) 36 | 37 | Parameters: 38 | 39 | injectInto - *required* (string|element) The id of the DOM container for the visualization. It can also be an Element provided that it has an id. 40 | type - (string) Context type. Default's 2D but can be 3D for webGL enabled browsers. 41 | width - (number) Default's to the *container's offsetWidth*. The width of the canvas. 42 | height - (number) Default's to the *container's offsetHeight*. The height of the canvas. 43 | useCanvas - (boolean|object) Default's *false*. You can pass another instance to be used by the visualization. 44 | withLabels - (boolean) Default's *true*. Whether to use a label container for the visualization. 45 | background - (boolean|object) Default's *false*. An object containing information about the rendering of a background canvas. 46 | */ 47 | 48 | Options.Canvas = { 49 | $extend: true, 50 | 51 | injectInto: 'id', 52 | type: '2D', 53 | width: false, 54 | height: false, 55 | useCanvas: false, 56 | withLabels: true, 57 | background: false, 58 | 59 | Scene: { 60 | Lighting: { 61 | enable: false, 62 | ambient: [1, 1, 1], 63 | directional: { 64 | direction: { x: -100, y: -100, z: -100 }, 65 | color: [0.5, 0.3, 0.1] 66 | } 67 | } 68 | } 69 | }; -------------------------------------------------------------------------------- /Tests/css/Icicle.css: -------------------------------------------------------------------------------- 1 | #update { 2 | margin:10px 40px; 3 | } 4 | 5 | .button { 6 | display: inline-block; 7 | outline: none; 8 | cursor: pointer; 9 | text-align: center; 10 | text-decoration: none; 11 | font: 14px / 100% Arial, Helvetica, sans-serif; 12 | padding: 0.5em 1em 0.55em; 13 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3); 14 | -webkit-border-radius: 0.5em; 15 | -moz-border-radius: 0.5em; 16 | border-radius: 0.5em; 17 | -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 18 | -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 19 | box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 20 | } 21 | 22 | .button:hover { 23 | text-decoration: none; 24 | } 25 | 26 | .button:active { 27 | position: relative; 28 | top: 1px; 29 | } 30 | 31 | /* white */ 32 | .white { 33 | color: #606060; 34 | border: solid 1px #b7b7b7; 35 | background: #fff; 36 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed)); 37 | background: -moz-linear-gradient(top, #fff, #ededed); 38 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed'); 39 | } 40 | 41 | .white:hover { 42 | background: #ededed; 43 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#dcdcdc)); 44 | background: -moz-linear-gradient(top, #fff, #dcdcdc); 45 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dcdcdc'); 46 | } 47 | 48 | .white:active { 49 | color: #999; 50 | background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#fff)); 51 | background: -moz-linear-gradient(top, #ededed, #fff); 52 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff'); 53 | } 54 | 55 | 56 | .tip { 57 | text-align: left; 58 | width:auto; 59 | max-width:500px; 60 | } 61 | 62 | .tip-title { 63 | font-size: 11px; 64 | text-align:center; 65 | margin-bottom:2px; 66 | } 67 | 68 | #right-container { 69 | display: none; 70 | } 71 | 72 | #center-container { 73 | width:800px; 74 | } 75 | 76 | #infovis { 77 | width:800px; 78 | } 79 | 80 | -------------------------------------------------------------------------------- /Templates/Spacetree/test6.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 | 4 | 5 | 8 | 17 | 18 | 19 | 22 | 32 | 33 | 34 | 37 | 48 | 49 | 50 | 53 | 60 | 61 | 62 | 65 | 73 | 74 | 75 | 78 | 79 |
6 | node types: 7 | 9 | 16 |
20 | edge types: 21 | 23 | 31 |
35 | transitions: 36 | 38 | 47 |
51 | easing: 52 | 54 | 59 |
63 | Orientation: 64 | 66 | 72 |
76 | 77 |
80 |
81 | -------------------------------------------------------------------------------- /Source/Graph/Graph.Geom.js: -------------------------------------------------------------------------------- 1 | Graph.Geom = new Class({ 2 | 3 | initialize: function(viz) { 4 | this.viz = viz; 5 | this.config = viz.config; 6 | this.node = viz.config.Node; 7 | this.edge = viz.config.Edge; 8 | }, 9 | /* 10 | Applies a translation to the tree. 11 | 12 | Parameters: 13 | 14 | pos - A number specifying translation vector. 15 | prop - A position property ('pos', 'start' or 'end'). 16 | 17 | Example: 18 | 19 | (start code js) 20 | st.geom.translate(new Complex(300, 100), 'end'); 21 | (end code) 22 | */ 23 | translate: function(pos, prop) { 24 | prop = $.splat(prop); 25 | this.viz.graph.eachNode(function(elem) { 26 | $.each(prop, function(p) { elem.getPos(p).$add(pos); }); 27 | }); 28 | }, 29 | /* 30 | Hides levels of the tree until it properly fits in canvas. 31 | */ 32 | setRightLevelToShow: function(node, canvas, callback) { 33 | var level = this.getRightLevelToShow(node, canvas), 34 | fx = this.viz.labels, 35 | opt = $.merge({ 36 | execShow:true, 37 | execHide:true, 38 | onHide: $.empty, 39 | onShow: $.empty 40 | }, callback || {}); 41 | node.eachLevel(0, this.config.levelsToShow, function(n) { 42 | var d = n._depth - node._depth; 43 | if(d > level) { 44 | opt.onHide(n); 45 | if(opt.execHide) { 46 | n.drawn = false; 47 | n.exist = false; 48 | fx.hideLabel(n, false); 49 | } 50 | } else { 51 | opt.onShow(n); 52 | if(opt.execShow) { 53 | n.exist = true; 54 | } 55 | } 56 | }); 57 | node.drawn= true; 58 | }, 59 | /* 60 | Returns the right level to show for the current tree in order to fit in canvas. 61 | */ 62 | getRightLevelToShow: function(node, canvas) { 63 | var config = this.config; 64 | var level = config.levelsToShow; 65 | var constrained = config.constrained; 66 | if(!constrained) return level; 67 | while(!this.treeFitsInCanvas(node, canvas, level) && level > 1) { level-- ; } 68 | return level; 69 | } 70 | }); -------------------------------------------------------------------------------- /webpy/web/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI Utilities 3 | (from web.py) 4 | """ 5 | 6 | import os, sys 7 | 8 | import http 9 | import webapi as web 10 | from utils import listget 11 | from net import validaddr, validip 12 | import httpserver 13 | 14 | def runfcgi(func, addr=('localhost', 8000)): 15 | """Runs a WSGI function as a FastCGI server.""" 16 | import flup.server.fcgi as flups 17 | return flups.WSGIServer(func, multiplexed=True, bindAddress=addr).run() 18 | 19 | def runscgi(func, addr=('localhost', 4000)): 20 | """Runs a WSGI function as an SCGI server.""" 21 | import flup.server.scgi as flups 22 | return flups.WSGIServer(func, bindAddress=addr).run() 23 | 24 | def runwsgi(func): 25 | """ 26 | Runs a WSGI-compatible `func` using FCGI, SCGI, or a simple web server, 27 | as appropriate based on context and `sys.argv`. 28 | """ 29 | 30 | if os.environ.has_key('SERVER_SOFTWARE'): # cgi 31 | os.environ['FCGI_FORCE_CGI'] = 'Y' 32 | 33 | if (os.environ.has_key('PHP_FCGI_CHILDREN') #lighttpd fastcgi 34 | or os.environ.has_key('SERVER_SOFTWARE')): 35 | return runfcgi(func, None) 36 | 37 | if 'fcgi' in sys.argv or 'fastcgi' in sys.argv: 38 | args = sys.argv[1:] 39 | if 'fastcgi' in args: args.remove('fastcgi') 40 | elif 'fcgi' in args: args.remove('fcgi') 41 | if args: 42 | return runfcgi(func, validaddr(args[0])) 43 | else: 44 | return runfcgi(func, None) 45 | 46 | if 'scgi' in sys.argv: 47 | args = sys.argv[1:] 48 | args.remove('scgi') 49 | if args: 50 | return runscgi(func, validaddr(args[0])) 51 | else: 52 | return runscgi(func) 53 | 54 | return httpserver.runsimple(func, validip(listget(sys.argv, 1, ''))) 55 | 56 | def _is_dev_mode(): 57 | # quick hack to check if the program is running in dev mode. 58 | if os.environ.has_key('SERVER_SOFTWARE') \ 59 | or os.environ.has_key('PHP_FCGI_CHILDREN') \ 60 | or 'fcgi' in sys.argv or 'fastcgi' in sys.argv: 61 | return False 62 | return True 63 | 64 | # When running the builtin-server, enable debug mode if not already set. 65 | web.config.setdefault('debug', _is_dev_mode()) -------------------------------------------------------------------------------- /Tests/Treemap/test1.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | var json = Feeder.makeTree({ 3 | idPrefix: "node", 4 | levelStart: 0, 5 | levelEnd: 3, 6 | maxChildrenPerNode: 10, 7 | minChildrenPerNode: 1, 8 | counter: 0, 9 | color: false, 10 | dim: true 11 | }); 12 | 13 | tm = new $jit.TM.Squarified( { 14 | 'injectInto': 'infovis', 15 | // orientation: "v", 16 | titleHeight: 13, 17 | animate: true, 18 | duration: 1500, 19 | offset: 1, 20 | Label: { 21 | type: 'Native' 22 | }, 23 | Events: { 24 | enable: false, 25 | onMouseEnter: function(node, eventInfo, e) { 26 | node.setData('border', '#9FD4FF'); 27 | tm.plot(); 28 | }, 29 | onMouseLeave: function(node, eventInfo, e) { 30 | node.removeData('border'); 31 | tm.plot(); 32 | }, 33 | onClick: function(node, eventInfo, e) { 34 | if(node) { 35 | tm.enter(node); 36 | } 37 | }, 38 | onRightClick: function(node, eventInfo, e) { 39 | tm.out(); 40 | } 41 | }, 42 | Navigation: { 43 | enable:true, 44 | panning:true, 45 | zooming:10 46 | }, 47 | //Allow tips 48 | Tips: { 49 | enable: true, 50 | //add positioning offsets 51 | offsetX: 20, 52 | offsetY: 20, 53 | //implement the onShow method to 54 | //add content to the tooltip when a node 55 | //is hovered 56 | onShow: function(tip, node, isLeaf, domElement) { 57 | tip.innerHTML = "
" + node.name + "
"; 58 | } 59 | }, 60 | 61 | //Add the name of the node in the correponding label 62 | //and a click handler to move the graph. 63 | //This method is called once, on label creation. 64 | onCreateLabel: function(domElement, node){ 65 | domElement.innerHTML = node.name; 66 | var style = domElement.style; 67 | style.display = ''; 68 | style.cursor = 'pointer'; 69 | style.color = '#ddd'; 70 | style.border = '1px solid transparent'; 71 | domElement.onmouseover = function() { 72 | style.border = '1px solid #9FD4FF'; 73 | }; 74 | domElement.onmouseout = function() { 75 | style.border = '1px solid transparent'; 76 | }; 77 | } 78 | }); 79 | 80 | tm.loadJSON(json); 81 | tm.refresh(); 82 | } 83 | -------------------------------------------------------------------------------- /Source/Options/Options.Edge.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.Edge.js 3 | * 4 | */ 5 | 6 | /* 7 | Object: Options.Edge 8 | 9 | Provides Edge rendering options for Tree and Graph based visualizations. 10 | 11 | Syntax: 12 | 13 | (start code js) 14 | Options.Edge = { 15 | overridable: false, 16 | type: 'line', 17 | color: '#ccb', 18 | lineWidth: 1, 19 | dim:15, 20 | alpha: 1, 21 | CanvasStyles: {} 22 | }; 23 | (end code) 24 | 25 | Example: 26 | 27 | (start code js) 28 | var viz = new $jit.Viz({ 29 | Edge: { 30 | overridable: true, 31 | type: 'line', 32 | color: '#fff', 33 | CanvasStyles: { 34 | shadowColor: '#ccc', 35 | shadowBlur: 10 36 | } 37 | } 38 | }); 39 | (end code) 40 | 41 | Parameters: 42 | 43 | overridable - (boolean) Default's *false*. Determine whether or not general edges properties can be overridden by a particular . 44 | type - (string) Default's 'line'. Edge styles include 'line', 'hyperline', 'arrow'. The default Edge type might vary in each visualization. You can also implement custom Edge types. 45 | color - (string) Default's '#ccb'. Edge color. 46 | lineWidth - (number) Default's *1*. Line/Edge width. 47 | alpha - (number) Default's *1*. The Edge's alpha value. *1* is for full opacity. 48 | dim - (number) Default's *15*. An extra parameter used by other complex shapes such as quadratic, bezier or arrow, to determine the shape's diameter. 49 | epsilon - (number) Default's *7*. Only used when using *enableForEdges* in . This dimension is used to create an area for the line where the contains method for the edge returns *true*. 50 | CanvasStyles - (object) Default's an empty object (i.e. {}). Attach any other canvas specific property that you'd set to the canvas context before plotting an Edge. 51 | 52 | See also: 53 | 54 | If you want to know more about how to customize Node/Edge data per element, in the JSON or programmatically, take a look at this article. 55 | */ 56 | Options.Edge = { 57 | $extend: false, 58 | 59 | overridable: false, 60 | type: 'line', 61 | color: '#ccb', 62 | lineWidth: 1, 63 | dim:15, 64 | alpha: 1, 65 | epsilon: 7, 66 | 67 | //Raw canvas styles to be 68 | //applied to the context instance 69 | //before plotting an edge 70 | CanvasStyles: {} 71 | }; 72 | -------------------------------------------------------------------------------- /Source/Options/Options.PieChart.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.PieChart.js 3 | * 4 | */ 5 | /* 6 | Object: Options.PieChart 7 | 8 | options. 9 | Other options included in the PieChart are , , and . 10 | 11 | Syntax: 12 | 13 | (start code js) 14 | 15 | Options.PieChart = { 16 | animate: true, 17 | offset: 25, 18 | sliceOffset:0, 19 | labelOffset: 3, 20 | type: 'stacked', 21 | hoveredColor: '#9fd4ff', 22 | showLabels: true, 23 | resizeLabels: false, 24 | updateHeights: false 25 | }; 26 | 27 | (end code) 28 | 29 | Example: 30 | 31 | (start code js) 32 | 33 | var pie = new $jit.PieChart({ 34 | animate: true, 35 | sliceOffset: 5, 36 | type: 'stacked:gradient' 37 | }); 38 | 39 | (end code) 40 | 41 | Parameters: 42 | 43 | animate - (boolean) Default's *true*. Whether to add animated transitions when plotting/updating the visualization. 44 | offset - (number) Default's *25*. Adds margin between the visualization and the canvas. 45 | sliceOffset - (number) Default's *0*. Separation between the center of the canvas and each pie slice. 46 | labelOffset - (number) Default's *3*. Adds margin between the label and the default place where it should be drawn. 47 | type - (string) Default's *'stacked'*. Stack style. Posible values are 'stacked', 'stacked:gradient' to add gradients. 48 | hoveredColor - (boolean|string) Default's *'#9fd4ff'*. Sets the selected color for a hovered pie stack. 49 | showLabels - (boolean) Default's *true*. Display the name of the slots. 50 | resizeLabels - (boolean|number) Default's *false*. Resize the pie labels according to their stacked values. Set a number for *resizeLabels* to set a font size minimum. 51 | updateHeights - (boolean) Default's *false*. Only for mono-valued (most common) pie charts. Resize the height of the pie slices according to their current values. 52 | 53 | */ 54 | Options.PieChart = { 55 | $extend: true, 56 | 57 | animate: true, 58 | offset: 25, // page offset 59 | sliceOffset:0, 60 | labelOffset: 3, // label offset 61 | type: 'stacked', // gradient 62 | hoveredColor: '#9fd4ff', 63 | Events: { 64 | enable: false, 65 | onClick: $.empty 66 | }, 67 | Tips: { 68 | enable: false, 69 | onShow: $.empty, 70 | onHide: $.empty 71 | }, 72 | showLabels: true, 73 | resizeLabels: false, 74 | 75 | //only valid for mono-valued datasets 76 | updateHeights: false 77 | }; -------------------------------------------------------------------------------- /Source/Options/Options.AreaChart.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.AreaChart.js 3 | * 4 | */ 5 | 6 | /* 7 | Object: Options.AreaChart 8 | 9 | options. 10 | Other options included in the AreaChart are , , , and . 11 | 12 | Syntax: 13 | 14 | (start code js) 15 | 16 | Options.AreaChart = { 17 | animate: true, 18 | labelOffset: 3, 19 | type: 'stacked', 20 | selectOnHover: true, 21 | showAggregates: true, 22 | showLabels: true, 23 | filterOnClick: false, 24 | restoreOnRightClick: false 25 | }; 26 | 27 | (end code) 28 | 29 | Example: 30 | 31 | (start code js) 32 | 33 | var areaChart = new $jit.AreaChart({ 34 | animate: true, 35 | type: 'stacked:gradient', 36 | selectOnHover: true, 37 | filterOnClick: true, 38 | restoreOnRightClick: true 39 | }); 40 | 41 | (end code) 42 | 43 | Parameters: 44 | 45 | animate - (boolean) Default's *true*. Whether to add animated transitions when filtering/restoring stacks. 46 | labelOffset - (number) Default's *3*. Adds margin between the label and the default place where it should be drawn. 47 | type - (string) Default's *'stacked'*. Stack style. Posible values are 'stacked', 'stacked:gradient' to add gradients. 48 | selectOnHover - (boolean) Default's *true*. If true, it will add a mark to the hovered stack. 49 | showAggregates - (boolean, function) Default's *true*. Display the values of the stacks. Can also be a function that returns *true* or *false* to display or filter some values. That same function can also return a string with the formatted value. 50 | showLabels - (boolean, function) Default's *true*. Display the name of the slots. Can also be a function that returns *true* or *false* to display or not each label. 51 | filterOnClick - (boolean) Default's *true*. Select the clicked stack by hiding all other stacks. 52 | restoreOnRightClick - (boolean) Default's *true*. Show all stacks by right clicking. 53 | 54 | */ 55 | 56 | Options.AreaChart = { 57 | $extend: true, 58 | 59 | animate: true, 60 | labelOffset: 3, // label offset 61 | type: 'stacked', // gradient 62 | Tips: { 63 | enable: false, 64 | onShow: $.empty, 65 | onHide: $.empty 66 | }, 67 | Events: { 68 | enable: false, 69 | onClick: $.empty 70 | }, 71 | selectOnHover: true, 72 | showAggregates: true, 73 | showLabels: true, 74 | filterOnClick: false, 75 | restoreOnRightClick: false 76 | }; -------------------------------------------------------------------------------- /Tests/Hypertree/test2.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | var json = [{ 3 | "id": "a_0", 4 | "name": "someNode", 5 | "data": [], 6 | "adjacencies": [] 7 | }]; 8 | var infovis = document.getElementById('infovis'); 9 | var w = infovis.offsetWidth, h = infovis.offsetHeight; 10 | var nodesCache = {}; 11 | $jit(); 12 | ht = new Hypertree({ 13 | 'injectInto': 'infovis', 14 | 'width': w, 15 | 'height': h, 16 | 'backgroundCanvas': { 17 | 'styles': { 18 | 'fillStyle': '#ccc', 19 | 'strokeStyle': '#ccc' 20 | }, 21 | 'impl': { 22 | 'init': function(){ 23 | }, 24 | 'plot': function(canvas, ctx){ 25 | ctx.beginPath(); 26 | ctx.arc(0, 0, ((w < h) ? w : h) / 2, 0, Math.PI * 2, true); 27 | ctx.stroke(); 28 | ctx.closePath(); 29 | } 30 | } 31 | }, 32 | onBeforeCompute: function(node){ 33 | Log.write("centering"); 34 | }, 35 | 36 | onCreateLabel: function(domElement, node){ 37 | domElement.innerHTML = node.name; 38 | domElement.onclick = function () { 39 | ht.onClick(node.id); 40 | }; 41 | }, 42 | 43 | //Take the left style property and substract half of the label actual width. 44 | onPlaceLabel: function(tag, node){ 45 | var width = tag.offsetWidth; 46 | var intX = parseInt(tag.style.left); 47 | intX -= width / 2; 48 | tag.style.left = intX + 'px'; 49 | }, 50 | 51 | onAfterCompute: function(){ 52 | Log.write("done"); 53 | var node = ht.graph.getClosestNodeToOrigin("current"); 54 | var _self = this; 55 | ht.graph.eachNode(function(n){ 56 | var domNode = (n.id in nodesCache) ? nodesCache[n.id] : nodesCache[n.id] = document.getElementById(n.id); 57 | if (node.adjacentTo(n) || node.id == n.id) { 58 | domNode.style.display = ""; 59 | } 60 | else { 61 | domNode.style.display = "none"; 62 | } 63 | }); 64 | } 65 | }); 66 | 67 | //load tree from tree data. 68 | ht.loadJSON(json); 69 | ht.compute(); 70 | ht.plot(); 71 | ht.controller.onAfterCompute(); 72 | } 73 | -------------------------------------------------------------------------------- /Source/Options/Options.Label.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.Label.js 3 | * 4 | */ 5 | /* 6 | Object: Options.Label 7 | 8 | Provides styling for Labels such as font size, family, etc. Also sets Node labels as HTML, SVG or Native canvas elements. 9 | 10 | Syntax: 11 | 12 | (start code js) 13 | Options.Label = { 14 | overridable: false, 15 | type: 'HTML', //'SVG', 'Native' 16 | style: ' ', 17 | size: 10, 18 | family: 'sans-serif', 19 | textAlign: 'center', 20 | textBaseline: 'alphabetic', 21 | color: '#fff' 22 | }; 23 | (end code) 24 | 25 | Example: 26 | 27 | (start code js) 28 | var viz = new $jit.Viz({ 29 | Label: { 30 | type: 'Native', 31 | size: 11, 32 | color: '#ccc' 33 | } 34 | }); 35 | (end code) 36 | 37 | Parameters: 38 | 39 | overridable - (boolean) Default's *false*. Determine whether or not general label properties can be overridden by a particular . 40 | type - (string) Default's *HTML*. The type for the labels. Can be 'HTML', 'SVG' or 'Native' canvas labels. 41 | style - (string) Default's *empty string*. Can be 'italic' or 'bold'. This parameter is only taken into account when using 'Native' canvas labels. For DOM based labels the className *node* is added to the DOM element for styling via CSS. You can also use methods to style individual labels. 42 | size - (number) Default's *10*. The font's size. This parameter is only taken into account when using 'Native' canvas labels. For DOM based labels the className *node* is added to the DOM element for styling via CSS. You can also use methods to style individual labels. 43 | family - (string) Default's *sans-serif*. The font's family. This parameter is only taken into account when using 'Native' canvas labels. For DOM based labels the className *node* is added to the DOM element for styling via CSS. You can also use methods to style individual labels. 44 | color - (string) Default's *#fff*. The font's color. This parameter is only taken into account when using 'Native' canvas labels. For DOM based labels the className *node* is added to the DOM element for styling via CSS. You can also use methods to style individual labels. 45 | */ 46 | Options.Label = { 47 | $extend: false, 48 | 49 | overridable: false, 50 | type: 'HTML', //'SVG', 'Native' 51 | style: ' ', 52 | size: 10, 53 | family: 'sans-serif', 54 | textAlign: 'center', 55 | textBaseline: 'alphabetic', 56 | color: '#fff' 57 | }; 58 | -------------------------------------------------------------------------------- /Tests/css/base.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | margin:0; 3 | padding:0; 4 | font-family: "Lucida Grande", Verdana; 5 | font-size: 0.9em; 6 | text-align: center; 7 | background-color:#F2F2F2; 8 | } 9 | 10 | input, select { 11 | font-size:0.9em; 12 | } 13 | 14 | table { 15 | margin-top:-10px; 16 | margin-left:7px; 17 | } 18 | 19 | h4 { 20 | font-size:1.1em; 21 | text-decoration:none; 22 | font-weight:normal; 23 | color:#23A4FF; 24 | } 25 | 26 | a { 27 | color:#23A4FF; 28 | } 29 | 30 | #container { 31 | width: 1000px; 32 | height: 600px; 33 | margin:0 auto; 34 | position:relative; 35 | } 36 | 37 | #left-container, 38 | #right-container, 39 | #center-container { 40 | height:600px; 41 | position:absolute; 42 | top:0; 43 | } 44 | 45 | #left-container, #right-container { 46 | width:200px; 47 | color:#686c70; 48 | text-align: left; 49 | overflow: auto; 50 | background-color:#fff; 51 | background-repeat:no-repeat; 52 | border-bottom:1px solid #ddd; 53 | } 54 | 55 | #left-container { 56 | left:0; 57 | background-image:url('col2.png'); 58 | background-position:center right; 59 | border-left:1px solid #ddd; 60 | 61 | } 62 | 63 | #right-container { 64 | right:0; 65 | background-image:url('col1.png'); 66 | background-position:center left; 67 | border-right:1px solid #ddd; 68 | } 69 | 70 | #right-container h4{ 71 | text-indent:8px; 72 | } 73 | 74 | #center-container { 75 | width:600px; 76 | left:200px; 77 | background-color:#1a1a1a; 78 | color:#ccc; 79 | } 80 | 81 | .text { 82 | margin: 7px; 83 | } 84 | 85 | #inner-details { 86 | font-size:0.8em; 87 | list-style:none; 88 | margin:7px; 89 | } 90 | 91 | #log { 92 | position:absolute; 93 | top:10px; 94 | font-size:1.0em; 95 | font-weight:bold; 96 | color:#23A4FF; 97 | } 98 | 99 | 100 | #infovis { 101 | position:relative; 102 | width:600px; 103 | height:600px; 104 | margin:auto; 105 | overflow:hidden; 106 | } 107 | 108 | /*TOOLTIPS*/ 109 | .tip { 110 | color: #111; 111 | width: 139px; 112 | background-color: white; 113 | border:1px solid #ccc; 114 | -moz-box-shadow:#555 2px 2px 8px; 115 | -webkit-box-shadow:#555 2px 2px 8px; 116 | -o-box-shadow:#555 2px 2px 8px; 117 | box-shadow:#555 2px 2px 8px; 118 | opacity:0.9; 119 | filter:alpha(opacity=90); 120 | font-size:10px; 121 | font-family:Verdana, Geneva, Arial, Helvetica, sans-serif; 122 | padding:7px; 123 | } -------------------------------------------------------------------------------- /Source/Options/Options.BarChart.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.BarChart.js 3 | * 4 | */ 5 | 6 | /* 7 | Object: Options.BarChart 8 | 9 | options. 10 | Other options included in the BarChart are , , , and . 11 | 12 | Syntax: 13 | 14 | (start code js) 15 | 16 | Options.BarChart = { 17 | animate: true, 18 | labelOffset: 3, 19 | barsOffset: 0, 20 | type: 'stacked', 21 | hoveredColor: '#9fd4ff', 22 | orientation: 'horizontal', 23 | showAggregates: true, 24 | showLabels: true 25 | }; 26 | 27 | (end code) 28 | 29 | Example: 30 | 31 | (start code js) 32 | 33 | var barChart = new $jit.BarChart({ 34 | animate: true, 35 | barsOffset: 10, 36 | type: 'stacked:gradient' 37 | }); 38 | 39 | (end code) 40 | 41 | Parameters: 42 | 43 | animate - (boolean) Default's *true*. Whether to add animated transitions when filtering/restoring stacks. 44 | offset - (number) Default's *25*. Adds margin between the visualization and the canvas. 45 | labelOffset - (number) Default's *3*. Adds margin between the label and the default place where it should be drawn. 46 | barsOffset - (number) Default's *0*. Separation between bars. 47 | type - (string) Default's *'stacked'*. Stack or grouped styles. Posible values are 'stacked', 'grouped', 'stacked:gradient', 'grouped:gradient' to add gradients. 48 | hoveredColor - (boolean|string) Default's *'#9fd4ff'*. Sets the selected color for a hovered bar stack. 49 | orientation - (string) Default's 'horizontal'. Sets the direction of the bars. Possible options are 'vertical' or 'horizontal'. 50 | showAggregates - (boolean, function) Default's *true*. Display the sum the values of each bar. Can also be a function that returns *true* or *false* to display the value of the bar or not. That same function can also return a string with the formatted data to be added. 51 | showLabels - (boolean, function) Default's *true*. Display the name of the slots. Can also be a function that returns *true* or *false* for each bar to decide whether to show the label or not. 52 | 53 | */ 54 | 55 | Options.BarChart = { 56 | $extend: true, 57 | 58 | animate: true, 59 | type: 'stacked', //stacked, grouped, : gradient 60 | labelOffset: 3, //label offset 61 | barsOffset: 0, //distance between bars 62 | hoveredColor: '#9fd4ff', 63 | orientation: 'horizontal', 64 | showAggregates: true, 65 | showLabels: true, 66 | Tips: { 67 | enable: false, 68 | onShow: $.empty, 69 | onHide: $.empty 70 | }, 71 | Events: { 72 | enable: false, 73 | onClick: $.empty 74 | } 75 | }; -------------------------------------------------------------------------------- /Source/Layouts/Layouts.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Layouts.js 3 | * 4 | * Implements base Tree and Graph layouts. 5 | * 6 | * Description: 7 | * 8 | * Implements base Tree and Graph layouts like Radial, Tree, etc. 9 | * 10 | */ 11 | 12 | /* 13 | * Object: Layouts 14 | * 15 | * Parent object for common layouts. 16 | * 17 | */ 18 | var Layouts = $jit.Layouts = {}; 19 | 20 | 21 | //Some util shared layout functions are defined here. 22 | var NodeDim = { 23 | label: null, 24 | 25 | compute: function(graph, prop, opt) { 26 | this.initializeLabel(opt); 27 | var label = this.label, style = label.style; 28 | graph.eachNode(function(n) { 29 | var autoWidth = n.getData('autoWidth'), 30 | autoHeight = n.getData('autoHeight'); 31 | if(autoWidth || autoHeight) { 32 | //delete dimensions since these are 33 | //going to be overridden now. 34 | delete n.data.$width; 35 | delete n.data.$height; 36 | delete n.data.$dim; 37 | 38 | var width = n.getData('width'), 39 | height = n.getData('height'); 40 | //reset label dimensions 41 | style.width = autoWidth? 'auto' : width + 'px'; 42 | style.height = autoHeight? 'auto' : height + 'px'; 43 | 44 | //font styles 45 | if (n.getData('label-size')) { 46 | style.fontSize = n.getData('label-size') + 'px'; 47 | } else { 48 | style.fontSize = ''; 49 | } 50 | 51 | //TODO(nico) should let the user choose what to insert here. 52 | label.innerHTML = n.name; 53 | 54 | var offsetWidth = label.offsetWidth, 55 | offsetHeight = label.offsetHeight; 56 | var type = n.getData('type'); 57 | if($.indexOf(['circle', 'square', 'triangle', 'star'], type) === -1) { 58 | n.setData('width', offsetWidth); 59 | n.setData('height', offsetHeight); 60 | } else { 61 | var dim = offsetWidth > offsetHeight? offsetWidth : offsetHeight; 62 | n.setData('width', dim); 63 | n.setData('height', dim); 64 | n.setData('dim', dim); 65 | } 66 | } 67 | }); 68 | }, 69 | 70 | initializeLabel: function(opt) { 71 | if(!this.label) { 72 | this.label = document.createElement('div'); 73 | document.body.appendChild(this.label); 74 | } 75 | this.setLabelStyles(opt); 76 | }, 77 | 78 | setLabelStyles: function(opt) { 79 | $.extend(this.label.style, { 80 | 'visibility': 'hidden', 81 | 'position': 'absolute', 82 | 'width': 'auto', 83 | 'height': 'auto' 84 | }); 85 | this.label.className = 'jit-autoadjust-label'; 86 | } 87 | }; 88 | -------------------------------------------------------------------------------- /Source/Layouts/Layouts.Icicle.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Class: Layouts.Icicle 3 | * 4 | * Implements the icicle tree layout. 5 | * 6 | * Implemented By: 7 | * 8 | * 9 | * 10 | */ 11 | 12 | Layouts.Icicle = new Class({ 13 | /* 14 | * Method: compute 15 | * 16 | * Called by loadJSON to calculate all node positions. 17 | * 18 | * Parameters: 19 | * 20 | * posType - The nodes' position to compute. Either "start", "end" or 21 | * "current". Defaults to "current". 22 | */ 23 | compute: function(posType) { 24 | posType = posType || "current"; 25 | 26 | var root = this.graph.getNode(this.root), 27 | config = this.config, 28 | size = this.canvas.getSize(), 29 | width = size.width, 30 | height = size.height, 31 | offset = config.offset, 32 | levelsToShow = config.constrained ? config.levelsToShow : Number.MAX_VALUE; 33 | 34 | this.controller.onBeforeCompute(root); 35 | 36 | Graph.Util.computeLevels(this.graph, root.id, 0, "ignore"); 37 | 38 | var treeDepth = 0; 39 | 40 | Graph.Util.eachLevel(root, 0, false, function (n, d) { if(d > treeDepth) treeDepth = d; }); 41 | 42 | var startNode = this.graph.getNode(this.clickedNode && this.clickedNode.id || root.id); 43 | var maxDepth = Math.min(treeDepth, levelsToShow-1); 44 | var initialDepth = startNode._depth; 45 | if(this.layout.horizontal()) { 46 | this.computeSubtree(startNode, -width/2, -height/2, width/(maxDepth+1), height, initialDepth, maxDepth, posType); 47 | } else { 48 | this.computeSubtree(startNode, -width/2, -height/2, width, height/(maxDepth+1), initialDepth, maxDepth, posType); 49 | } 50 | }, 51 | 52 | computeSubtree: function (root, x, y, width, height, initialDepth, maxDepth, posType) { 53 | root.getPos(posType).setc(x, y); 54 | root.setData('width', width, posType); 55 | root.setData('height', height, posType); 56 | 57 | var nodeLength, prevNodeLength = 0, totalDim = 0; 58 | var children = Graph.Util.getSubnodes(root, [1, 1], 'ignore'); // next level from this node 59 | 60 | if(!children.length) 61 | return; 62 | 63 | $.each(children, function(e) { totalDim += e.getData('dim'); }); 64 | 65 | for(var i=0, l=children.length; i < l; i++) { 66 | if(this.layout.horizontal()) { 67 | nodeLength = height * children[i].getData('dim') / totalDim; 68 | this.computeSubtree(children[i], x+width, y, width, nodeLength, initialDepth, maxDepth, posType); 69 | y += nodeLength; 70 | } else { 71 | nodeLength = width * children[i].getData('dim') / totalDim; 72 | this.computeSubtree(children[i], x, y+height, nodeLength, height, initialDepth, maxDepth, posType); 73 | x += nodeLength; 74 | } 75 | } 76 | } 77 | }); 78 | 79 | -------------------------------------------------------------------------------- /Tests/Spacetree/test4.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | var infovis = document.getElementById('infovis'); 3 | var w = infovis.offsetWidth, h = infovis.offsetHeight; 4 | var json = Feeder.makeTree({ 5 | idPrefix: "node" + new Date().getTime(), 6 | levelStart: 0, 7 | levelEnd: 3, 8 | maxChildrenPerNode: 5, 9 | minChildrenPerNode: 0, 10 | counter: 0 11 | }); 12 | json.children = [{ 13 | 'id': 'lala', 14 | 'name': 'lala', 15 | 'data': {}, 16 | 'children': [] 17 | }].concat(json.children); 18 | //Create a new ST instance 19 | st = new $jit.ST({ 20 | 'injectInto': 'infovis', 21 | 'width': w, 22 | 'height': h, 23 | levelDistance: 50, 24 | Node: { 25 | overridable: false, 26 | height: 20, 27 | align: "right" 28 | }, 29 | 30 | Edge: { 31 | overridable: false, 32 | 'type': 'bezier', 33 | dim: 15 34 | }, 35 | 36 | onBeforeCompute: function(node){ 37 | Log.write("loading " + node.name); 38 | }, 39 | 40 | onAfterCompute: function(node){ 41 | Log.write("done"); 42 | }, 43 | 44 | onCreateLabel: function(label, node){ 45 | label.id = node.id; 46 | label.style.cursor = 'pointer'; 47 | label.innerHTML = node.name; 48 | label.onclick = function() { 49 | st.onClick(node.id); 50 | }; 51 | } 52 | }); 53 | //load json data 54 | st.loadJSON(json); 55 | //compute node positions and layout 56 | st.compute(); 57 | //optional: make a translation of the tree 58 | st.geom.translate(new $jit.Complex(-200, 0), "current"); 59 | //Emulate a click on the root node. 60 | // Tree.Plot.plot(st.tree, st.canvas); 61 | st.onClick(st.root); 62 | 63 | //Add input handler to switch spacetree orientation. 64 | var select = document.getElementById('switch'); 65 | select.onchange = function(){ 66 | var index = select.selectedIndex; 67 | var or = select.options[index].text; 68 | select.disabled = true; 69 | st.switchPosition(or, "animate", { 70 | onComplete: function(){ 71 | select.disabled = false; 72 | } 73 | }); 74 | }; 75 | 76 | //make node list 77 | var elemUl = document.createElement('ul'); 78 | $jit.Graph.Util.eachNode(st.graph, function(elem){ 79 | var elemLi = document.createElement('li'); 80 | elemLi.onclick = function() { 81 | st.select(elem.id); 82 | }; 83 | elemLi.innerHTML = elem.name; 84 | elemUl.appendChild(elemLi); 85 | }); 86 | document.getElementById('id-list').appendChild(elemUl); 87 | } 88 | -------------------------------------------------------------------------------- /Tests/Spacetree/test1.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | var json = Feeder.makeTree(); 3 | 4 | //Create a new ST instance 5 | st = new $jit.ST({ 6 | 'injectInto': 'infovis', 7 | duration: 800, 8 | orientation: 'left', 9 | fps: 35, 10 | transition: $jit.Trans.Quad.easeInOut, 11 | subtreeOffset: 8, 12 | siblingOffset: 5, 13 | levelDistance: 50, 14 | Node: { 15 | overridable: true, 16 | height: 20, 17 | width: 80, 18 | type: 'rectangle', 19 | align: "center" 20 | }, 21 | 22 | Edge: { 23 | overridable: true, 24 | type: 'arrow', 25 | dim: 7 26 | }, 27 | 28 | onBeforeCompute: function(node){ 29 | Log.write("loading " + node.name); 30 | }, 31 | 32 | onAfterCompute: function(){ 33 | Log.write("done"); 34 | }, 35 | 36 | request: function(nodeId, level, onComplete){ 37 | Feeder.request(nodeId, level, onComplete); 38 | }, 39 | 40 | onCreateLabel: function(label, node){ 41 | label.id = node.id; 42 | label.style.cursor = 'pointer'; 43 | label.innerHTML = node.name; 44 | label.onclick = function() { 45 | st.onClick(node.id); 46 | }; 47 | }, 48 | 49 | onBeforePlotNode: function(node){ 50 | if (node.selected) { 51 | node.data.$color = "#ff7"; 52 | } 53 | else { 54 | delete node.data.$color; 55 | } 56 | }, 57 | 58 | onBeforePlotLine: function(adj){ 59 | if (adj.nodeFrom.selected && adj.nodeTo.selected) { 60 | adj.data.$color = "#eed"; 61 | adj.data.$lineWidth = 3; 62 | } 63 | else { 64 | delete adj.data.$color; 65 | delete adj.data.$lineWidth; 66 | } 67 | } 68 | }); 69 | //load json data 70 | st.loadJSON(json); 71 | //compute node positions and layout 72 | st.compute(); 73 | //optional: make a translation of the tree 74 | st.geom.translate(new $jit.Complex(-200, 0), "current"); 75 | //Emulate a click on the root node. 76 | st.onClick(st.root); 77 | 78 | //Add input handler to switch spacetree orientation. 79 | var select = document.getElementById('switch'); 80 | select.onchange = function(){ 81 | var index = select.selectedIndex; 82 | var or = select.options[index].text; 83 | select.disabled = true; 84 | st.switchPosition(or, "animate", { 85 | onComplete: function(){ 86 | select.disabled = false; 87 | } 88 | }); 89 | }; 90 | 91 | } 92 | -------------------------------------------------------------------------------- /Tests/css/Treemap.css: -------------------------------------------------------------------------------- 1 | #right-container { 2 | display: none; 3 | } 4 | 5 | #center-container { 6 | width:800px; 7 | } 8 | 9 | #infovis { 10 | width:800px; 11 | } 12 | 13 | .node { 14 | color:#fff; 15 | font-size:9px; 16 | overflow:hidden; 17 | cursor:pointer; 18 | /* 19 | text-shadow:2px 2px 5px #000; 20 | -o-text-shadow:2px 2px 5px #000; 21 | -webkit-text-shadow:2px 2px 5px #000; 22 | -moz-text-shadow:2px 2px 5px #000; 23 | */ 24 | } 25 | 26 | /*TOOLTIPS*/ 27 | .tip { 28 | color: #fff; 29 | width: 139px; 30 | background-color: black; 31 | opacity:0.9; 32 | filter:alpha(opacity=90); 33 | font-size:10px; 34 | font-family:Verdana, Geneva, Arial, Helvetica, sans-serif; 35 | padding:7px; 36 | } 37 | 38 | .album { 39 | width:100px; 40 | margin:3px; 41 | } 42 | 43 | #id-list { 44 | background-color:#EEEEEE; 45 | border:1px solid #CCCCCC; 46 | margin:10px 20px 0 20px; 47 | padding:5px; 48 | text-align:left; 49 | text-indent:2px; 50 | } 51 | 52 | #id-list table { 53 | margin-top:2px; 54 | } 55 | 56 | #back { 57 | margin:10px 40px; 58 | } 59 | 60 | .button { 61 | display: inline-block; 62 | outline: none; 63 | cursor: pointer; 64 | text-align: center; 65 | text-decoration: none; 66 | font: 14px / 100% Arial, Helvetica, sans-serif; 67 | padding: 0.5em 1em 0.55em; 68 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3); 69 | -webkit-border-radius: 0.5em; 70 | -moz-border-radius: 0.5em; 71 | border-radius: 0.5em; 72 | -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 73 | -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 74 | box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 75 | } 76 | 77 | .button:hover { 78 | text-decoration: none; 79 | } 80 | 81 | .button:active { 82 | position: relative; 83 | top: 1px; 84 | } 85 | 86 | /* white */ 87 | .white { 88 | color: #606060; 89 | border: solid 1px #b7b7b7; 90 | background: #fff; 91 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed)); 92 | background: -moz-linear-gradient(top, #fff, #ededed); 93 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed'); 94 | } 95 | 96 | .white:hover { 97 | background: #ededed; 98 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#dcdcdc)); 99 | background: -moz-linear-gradient(top, #fff, #dcdcdc); 100 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dcdcdc'); 101 | } 102 | 103 | .white:active { 104 | color: #999; 105 | background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#fff)); 106 | background: -moz-linear-gradient(top, #ededed, #fff); 107 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff'); 108 | } 109 | 110 | -------------------------------------------------------------------------------- /Tests/css/Voronoi.css: -------------------------------------------------------------------------------- 1 | #right-container { 2 | display: none; 3 | } 4 | 5 | #center-container { 6 | width:800px; 7 | } 8 | 9 | #infovis { 10 | width:800px; 11 | background : black; 12 | } 13 | 14 | .node { 15 | color:#fff; 16 | font-size:9px; 17 | overflow:hidden; 18 | cursor:pointer; 19 | /* 20 | text-shadow:2px 2px 5px #000; 21 | -o-text-shadow:2px 2px 5px #000; 22 | -webkit-text-shadow:2px 2px 5px #000; 23 | -moz-text-shadow:2px 2px 5px #000; 24 | */ 25 | } 26 | 27 | /*TOOLTIPS*/ 28 | .tip { 29 | color: #fff; 30 | width: 139px; 31 | background-color: black; 32 | opacity:0.9; 33 | filter:alpha(opacity=90); 34 | font-size:10px; 35 | font-family:Verdana, Geneva, Arial, Helvetica, sans-serif; 36 | padding:7px; 37 | } 38 | 39 | .album { 40 | width:100px; 41 | margin:3px; 42 | } 43 | 44 | #id-list { 45 | background-color:#EEEEEE; 46 | border:1px solid #CCCCCC; 47 | margin:10px 20px 0 20px; 48 | padding:5px; 49 | text-align:left; 50 | text-indent:2px; 51 | } 52 | 53 | #id-list table { 54 | margin-top:2px; 55 | } 56 | 57 | #back { 58 | margin:10px 40px; 59 | } 60 | 61 | .button { 62 | display: inline-block; 63 | outline: none; 64 | cursor: pointer; 65 | text-align: center; 66 | text-decoration: none; 67 | font: 14px / 100% Arial, Helvetica, sans-serif; 68 | padding: 0.5em 1em 0.55em; 69 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3); 70 | -webkit-border-radius: 0.5em; 71 | -moz-border-radius: 0.5em; 72 | border-radius: 0.5em; 73 | -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 74 | -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 75 | box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 76 | } 77 | 78 | .button:hover { 79 | text-decoration: none; 80 | } 81 | 82 | .button:active { 83 | position: relative; 84 | top: 1px; 85 | } 86 | 87 | /* white */ 88 | .white { 89 | color: #606060; 90 | border: solid 1px #b7b7b7; 91 | background: #fff; 92 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed)); 93 | background: -moz-linear-gradient(top, #fff, #ededed); 94 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed'); 95 | } 96 | 97 | .white:hover { 98 | background: #ededed; 99 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#dcdcdc)); 100 | background: -moz-linear-gradient(top, #fff, #dcdcdc); 101 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dcdcdc'); 102 | } 103 | 104 | .white:active { 105 | color: #999; 106 | background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#fff)); 107 | background: -moz-linear-gradient(top, #ededed, #fff); 108 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff'); 109 | } 110 | 111 | -------------------------------------------------------------------------------- /Tests/Treemap/test6.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | //init data 3 | var json = { 4 | "id": "root", 5 | "name": "Colors", 6 | "data": {}, 7 | "children": [ { 8 | "id": "Red", 9 | "name": "Red", 10 | "data": { 11 | "$area": 32.01, 12 | "$color": "#FF0000" 13 | }, 14 | "children": [] 15 | }, { 16 | "id": "Gray", 17 | "name": "Gray", 18 | "data": { 19 | "$area": 9.01, 20 | "$color": "#808080" 21 | }, 22 | "children": [] 23 | }, { 24 | "id": "Orange", 25 | "name": "Orange", 26 | "data": { 27 | "$area": 1, 28 | "$color": "#FF8C00" 29 | }, 30 | "children": [] 31 | }, { 32 | "id": "Green", 33 | "name": "Green", 34 | "data": { 35 | "$area": 19.060000000000002, 36 | "$color": "#008000" 37 | }, 38 | "children": [ ] 39 | }, { 40 | "id": "Cyan", 41 | "name": "Cyan", 42 | "data": { 43 | "$area": 1, 44 | "$color": "#00FFFF" 45 | }, 46 | "children": [ ] 47 | } ] 48 | }; 49 | 50 | var json2 = { 51 | "id": "root", 52 | "name": "Colors", 53 | "data": {}, 54 | "children": [ { 55 | "id": "Red", 56 | "name": "Red", 57 | "data": { 58 | "$area": 32.01, 59 | "$color": "#FF00FF" 60 | }, 61 | "children": [] 62 | }, { 63 | "id": "Gray", 64 | "name": "Gray", 65 | "data": { 66 | "$area": 29.01, 67 | "$color": "#87a0cc" 68 | }, 69 | "children": [] 70 | }, { 71 | "id": "Orange", 72 | "name": "Orange", 73 | "data": { 74 | "$area": 7, 75 | "$color": "#CC8C00" 76 | }, 77 | "children": [] 78 | }, { 79 | "id": "Green", 80 | "name": "Green", 81 | "data": { 82 | "$area": 19.060000000000002, 83 | "$color": "#008000" 84 | }, 85 | "children": [ ] 86 | }, { 87 | "id": "Cyan", 88 | "name": "Cyan", 89 | "data": { 90 | "$area": 1, 91 | "$color": "#00FFFF" 92 | }, 93 | "children": [ ] 94 | } ] 95 | }; 96 | 97 | //end 98 | //init TreeMap 99 | var tm = new $jit.TM.Squarified({ 100 | //where to inject the visualization 101 | injectInto: 'infovis', 102 | //parent box title heights 103 | titleHeight: 0, 104 | //enable animations 105 | animate: true, 106 | //box offsets 107 | offset: 1 108 | }); 109 | tm.loadJSON(json); 110 | tm.refresh(); 111 | //trigger morph some seconds later 112 | //animate color, with and height node properties 113 | //http://thejit.org/static/v20/Docs/files/Graph/Graph-Op-js.html#Graph.Op.morph 114 | setTimeout(function() { 115 | tm.op.morph(json2, { 116 | type: 'fade' 117 | }, { 118 | 'node-property': ['color', 'width', 'height'] 119 | }); 120 | }, 2500); 121 | //end 122 | } 123 | -------------------------------------------------------------------------------- /Tests/PieChart/test1.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | //init data 3 | var json = { 4 | 'label': ['label A', 'label B', 'label C', 'label D'], 5 | 'values': [ 6 | { 7 | 'label': 'date A', 8 | 'values': [20, 40, 15, 5] 9 | }, 10 | { 11 | 'label': 'date B', 12 | 'values': [30, 10, 45, 10] 13 | }, 14 | { 15 | 'label': 'date E', 16 | 'values': [38, 20, 35, 17] 17 | }, 18 | { 19 | 'label': 'date F', 20 | 'values': [58, 10, 35, 32] 21 | }, 22 | { 23 | 'label': 'date D', 24 | 'values': [55, 60, 34, 38] 25 | }, 26 | { 27 | 'label': 'date C', 28 | 'values': [26, 40, 25, 40] 29 | }] 30 | 31 | }; 32 | //end 33 | var json2 = { 34 | 'values': [ 35 | { 36 | 'label': 'date A', 37 | 'values': [10, 40, 15, 7] 38 | }, 39 | { 40 | 'label': 'date B', 41 | 'values': [30, 40, 45, 9] 42 | }, 43 | { 44 | 'label': 'date D', 45 | 'values': [55, 30, 34, 26] 46 | }, 47 | { 48 | 'label': 'date C', 49 | 'values': [26, 40, 85, 28] 50 | }] 51 | 52 | }; 53 | //init PieChart 54 | var pieChart = new $jit.PieChart({ 55 | //id of the visualization container 56 | injectInto: 'infovis', 57 | //whether to add animations 58 | animate: true, 59 | //offsets 60 | offset: 30, 61 | sliceOffset: 0, 62 | labelOffset: 20, 63 | //slice style 64 | type: useGradients? 'stacked:gradient' : 'stacked', 65 | //whether to show the labels for the slices 66 | showLabels:true, 67 | //resize labels according to 68 | //pie slices values set 7px as 69 | //min label size 70 | resizeLabels: 7, 71 | //label styling 72 | Label: { 73 | type: labelType, //Native or HTML 74 | size: 20, 75 | family: 'Arial', 76 | color: 'white' 77 | }, 78 | //enable tips 79 | Tips: { 80 | enable: true, 81 | onShow: function(tip, elem) { 82 | tip.innerHTML = "" + elem.name + ": " + elem.value; 83 | } 84 | } 85 | }); 86 | //load JSON data. 87 | pieChart.loadJSON(json); 88 | //end 89 | var list = $jit.id('id-list'), 90 | button = $jit.id('update'); 91 | //update json on click 92 | $jit.util.addEvent(button, 'click', function() { 93 | var util = $jit.util; 94 | if(util.hasClass(button, 'gray')) return; 95 | util.removeClass(button, 'white'); 96 | util.addClass(button, 'gray'); 97 | pieChart.updateJSON(json2); 98 | }); 99 | //dynamically add legend to list 100 | var legend = pieChart.getLegend(), 101 | listItems = []; 102 | for(var name in legend) { 103 | listItems.push('
 
' + name); 105 | } 106 | list.innerHTML = '
  • ' + listItems.join('
  • ') + '
  • '; 107 | } 108 | -------------------------------------------------------------------------------- /Tests/BarChart/test2.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | //init data 3 | var json = { 4 | 'label': ['label A', 'label B', 'label C', 'label D'], 5 | 'values': [ 6 | { 7 | 'label': 'date A', 8 | 'values': [20, 40, 15, 5] 9 | }, 10 | { 11 | 'label': 'date B', 12 | 'values': [30, 10, 45, 10] 13 | }, 14 | { 15 | 'label': 'date E', 16 | 'values': [38, 20, 35, 17] 17 | }, 18 | { 19 | 'label': 'date F', 20 | 'values': [58, 10, 35, 32] 21 | }, 22 | { 23 | 'label': 'date D', 24 | 'values': [55, 60, 34, 38] 25 | }, 26 | { 27 | 'label': 'date C', 28 | 'values': [26, 40, 25, 40] 29 | }] 30 | 31 | }; 32 | //end 33 | var json2 = { 34 | 'values': [ 35 | { 36 | 'label': 'date A', 37 | 'values': [10, 40, 15, 7] 38 | }, 39 | { 40 | 'label': 'date B', 41 | 'values': [30, 40, 45, 9] 42 | }, 43 | { 44 | 'label': 'date D', 45 | 'values': [55, 30, 34, 26] 46 | }, 47 | { 48 | 'label': 'date C', 49 | 'values': [26, 40, 85, 28] 50 | }] 51 | 52 | }; 53 | //init BarChart 54 | var barChart = new $jit.BarChart({ 55 | //id of the visualization container 56 | injectInto: 'infovis', 57 | //whether to add animations 58 | animate: true, 59 | //horizontal or vertical barcharts 60 | orientation: 'horizontal', 61 | //bars separation 62 | barsOffset: 0.5, 63 | //visualization offset 64 | Margin: { 65 | top: 5, 66 | left: 5, 67 | right: 5, 68 | bottom: 5 69 | }, 70 | //labels offset position 71 | labelOffset:5, 72 | //bars style 73 | type:'stacked', 74 | //whether to show the aggregation of the values 75 | showAggregates:true, 76 | //whether to show the labels for the bars 77 | showLabels:true, 78 | //label styles 79 | Label: { 80 | type: labelType, //Native or HTML 81 | size: 13, 82 | family: 'Arial', 83 | color: 'white' 84 | }, 85 | //tooltip options 86 | Tips: { 87 | enable: true, 88 | onShow: function(tip, elem) { 89 | tip.innerHTML = "" + elem.name + ": " + elem.value; 90 | } 91 | } 92 | }); 93 | //load JSON data. 94 | barChart.loadJSON(json); 95 | //end 96 | var list = $jit.id('id-list'), 97 | button = $jit.id('update'); 98 | //update json on click 'Update Data' 99 | $jit.util.addEvent(button, 'click', function() { 100 | var util = $jit.util; 101 | if(util.hasClass(button, 'gray')) return; 102 | util.removeClass(button, 'white'); 103 | util.addClass(button, 'gray'); 104 | barChart.updateJSON(json2); 105 | }); 106 | //dynamically add legend to list 107 | var legend = barChart.getLegend(), 108 | listItems = []; 109 | for(var name in legend) { 110 | listItems.push('
     
    ' + name); 112 | } 113 | list.innerHTML = '
  • ' + listItems.join('
  • ') + '
  • '; 114 | } 115 | -------------------------------------------------------------------------------- /Templates/Spacetree/test12.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |

    Actions

    4 | Morph Styles 5 | Restore Styles 6 | 7 |

    Node Styles

    8 | 9 | 10 | 13 | 16 | 17 | 18 | 21 | 24 | 25 | 26 | 29 | 32 | 33 | 34 | 37 | 40 | 41 | 42 | 45 | 48 | 49 | 50 | 53 | 56 | 57 |
    11 | 12 | 14 | 15 |
    19 | 20 | 22 | 23 |
    27 | 28 | 30 | 31 |
    35 | 36 | 38 | 39 |
    43 | 44 | 46 | 47 |
    51 | 52 | 54 | 55 |
    58 | 59 |

    Edge Styles

    60 | 61 | 62 | 65 | 68 | 69 | 70 | 73 | 76 | 77 | 78 | 81 | 84 | 85 |
    63 | 64 | 66 | 67 |
    71 | 72 | 74 | 75 |
    79 | 80 | 82 | 83 |
    86 | 87 |

    Label Styles

    88 | 89 | 90 | 93 | 96 | 97 | 98 | 101 | 104 | 105 | 106 | 109 | 112 | 113 |
    91 | 92 | 94 | 95 |
    99 | 100 | 102 | 103 |
    107 | 108 | 110 | 111 |
    114 | 115 | -------------------------------------------------------------------------------- /Source/Geometry/Vector3.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Vector3 class based on three.js http://github.com/mrdoob/three.js, Copyright (c) Mr.doob http://mrdoob.com/, MIT License http://github.com/mrdoob/three.js/blob/master/LICENSE 3 | */ 4 | 5 | var Vector3 = function(x, y, z) { 6 | this.x = x || 0; 7 | this.y = y || 0; 8 | this.z = z || 0; 9 | }; 10 | 11 | $jit.Vector3 = Vector3; 12 | 13 | Vector3.prototype = { 14 | set: function(v) { 15 | this.x = v.x; 16 | this.y = v.y; 17 | this.z = v.z; 18 | }, 19 | 20 | setc: function(x, y, z) { 21 | this.x = x; 22 | this.y = y; 23 | this.z = z; 24 | }, 25 | 26 | getc: function() { 27 | return this; 28 | }, 29 | 30 | //TODO(nico): getp 31 | 32 | add: function(v1, v2) { 33 | this.x = v1.x + v2.x; 34 | this.y = v1.y + v2.y; 35 | this.z = v1.z + v2.z; 36 | return this; 37 | }, 38 | 39 | $add: function(v) { 40 | this.x += v.x; 41 | this.y += v.y; 42 | this.z += v.z; 43 | return this; 44 | }, 45 | 46 | addScalar: function(s) { 47 | this.x += s; 48 | this.y += s; 49 | this.z += s; 50 | return this; 51 | }, 52 | 53 | sub: function(v1, v2) { 54 | this.x = v1.x - v2.x; 55 | this.y = v1.y - v2.y; 56 | this.z = v1.z - v2.z; 57 | return this; 58 | }, 59 | 60 | $sub: function(v) { 61 | this.x -= v.x; 62 | this.y -= v.y; 63 | this.z -= v.z; 64 | return this; 65 | }, 66 | 67 | cross: function(v1, v2) { 68 | this.x = v1.y * v2.z - v1.z * v2.y; 69 | this.y = v1.z * v2.x - v1.x * v2.z; 70 | this.z = v1.x * v2.y - v1.y * v2.x; 71 | return this; 72 | }, 73 | 74 | $cross: function(v) { 75 | var tx = this.x, ty = this.y, tz = this.z; 76 | 77 | this.x = ty * v.z - tz * v.y; 78 | this.y = tz * v.x - tx * v.z; 79 | this.z = tx * v.y - ty * v.x; 80 | return this; 81 | }, 82 | 83 | $multiply: function(v) { 84 | this.x *= v.x; 85 | this.y *= v.y; 86 | this.z *= v.z; 87 | return this; 88 | }, 89 | 90 | $scale: function(s) { 91 | this.x *= s; 92 | this.y *= s; 93 | this.z *= s; 94 | return this; 95 | }, 96 | 97 | dot: function(v) { 98 | return this.x * v.x + this.y * v.y + this.z * v.z; 99 | }, 100 | 101 | distanceTo: function(v) { 102 | return Math.sqrt(this.distanceToSquared(v)); 103 | }, 104 | 105 | distanceToSquared: function(v) { 106 | var dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z; 107 | return dx * dx + dy * dy + dz * dz; 108 | }, 109 | 110 | norm: function() { 111 | return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); 112 | }, 113 | 114 | normSquared: function() { 115 | return this.x * this.x + this.y * this.y + this.z * this.z; 116 | }, 117 | 118 | negate: function() { 119 | this.x = - this.x; 120 | this.y = - this.y; 121 | this.z = - this.z; 122 | return this; 123 | }, 124 | 125 | normalize: function() { 126 | var len = this.norm(); 127 | if ( len > 0 ) { 128 | this.$scale(1 / len); 129 | } 130 | return this; 131 | }, 132 | 133 | isZero: function() { 134 | var almostZero = 0.0001, 135 | abs = Math.abs; 136 | 137 | return abs(this.x) < almostZero && abs(this.y) < almostZero && abs(this.z) < almostZero; 138 | }, 139 | 140 | clone: function() { 141 | return new Vector3(this.x, this.y, this.z); 142 | } 143 | }; 144 | 145 | var $V3 = function(a, b, c) { return new Vector3(a, b, c); }; -------------------------------------------------------------------------------- /Tests/BarChart/test1.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | //init data 3 | var json = { 4 | 'label': ['label A', 'label B', 'label C', 'label D'], 5 | 'values': [ 6 | { 7 | 'label': 'date A', 8 | 'values': [20, 40, 15, 5] 9 | }, 10 | { 11 | 'label': 'date B', 12 | 'values': [30, 10, 45, 10] 13 | }, 14 | { 15 | 'label': 'date E', 16 | 'values': [38, 20, 35, 17] 17 | }, 18 | { 19 | 'label': 'date F', 20 | 'values': [58, 10, 35, 32] 21 | }, 22 | { 23 | 'label': 'date D', 24 | 'values': [55, 60, 34, 38] 25 | }, 26 | { 27 | 'label': 'date C', 28 | 'values': [26, 40, 25, 40] 29 | }] 30 | 31 | }; 32 | //end 33 | var json2 = { 34 | 'values': [ 35 | { 36 | 'label': 'date A', 37 | 'values': [10, 40, 15, 7] 38 | }, 39 | { 40 | 'label': 'date B', 41 | 'values': [30, 40, 45, 9] 42 | }, 43 | { 44 | 'label': 'date D', 45 | 'values': [55, 30, 34, 26] 46 | }, 47 | { 48 | 'label': 'date C', 49 | 'values': [26, 40, 85, 28] 50 | }] 51 | 52 | }; 53 | //init BarChart 54 | var barChart = new $jit.BarChart({ 55 | //id of the visualization container 56 | injectInto: 'infovis', 57 | //whether to add animations 58 | animate: true, 59 | //horizontal or vertical barcharts 60 | orientation: 'vertical', 61 | //bars separation 62 | barsOffset: 20, 63 | //visualization offset 64 | Margin: { 65 | top:5, 66 | left: 5, 67 | right: 5, 68 | bottom:5 69 | }, 70 | //labels offset position 71 | labelOffset: 5, 72 | //bars style 73 | type: useGradients? 'stacked:gradient' : 'stacked', 74 | //whether to show the aggregation of the values 75 | showAggregates:true, 76 | //whether to show the labels for the bars 77 | showLabels:true, 78 | //labels style 79 | Label: { 80 | type: labelType, //Native or HTML 81 | size: 13, 82 | family: 'Arial', 83 | color: 'white' 84 | }, 85 | //add tooltips 86 | Tips: { 87 | enable: true, 88 | onShow: function(tip, elem) { 89 | tip.innerHTML = "" + elem.name + ": " + elem.value; 90 | } 91 | } 92 | }); 93 | //load JSON data. 94 | barChart.loadJSON(json); 95 | //end 96 | var list = $jit.id('id-list'), 97 | button = $jit.id('update'), 98 | orn = $jit.id('switch-orientation'); 99 | //update json on click 'Update Data' 100 | $jit.util.addEvent(button, 'click', function() { 101 | var util = $jit.util; 102 | if(util.hasClass(button, 'gray')) return; 103 | util.removeClass(button, 'white'); 104 | util.addClass(button, 'gray'); 105 | barChart.updateJSON(json2); 106 | }); 107 | //dynamically add legend to list 108 | var legend = barChart.getLegend(), 109 | listItems = []; 110 | for(var name in legend) { 111 | listItems.push('
     
    ' + name); 113 | } 114 | list.innerHTML = '
  • ' + listItems.join('
  • ') + '
  • '; 115 | } 116 | -------------------------------------------------------------------------------- /Tests/PieChart/test3.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | //init data 3 | var json = { 4 | 'label': ['label A', 'label B', 'label C', 'label D'], 5 | 'values': [ 6 | { 7 | 'label': 'date A', 8 | 'values': [20, 40, 15, 5] 9 | }, 10 | { 11 | 'label': 'date B', 12 | 'values': [30, 10, 45, 10] 13 | }, 14 | { 15 | 'label': 'date E', 16 | 'values': [38, 20, 35, 17] 17 | }, 18 | { 19 | 'label': 'date F', 20 | 'values': [58, 10, 35, 32] 21 | }, 22 | { 23 | 'label': 'date D', 24 | 'values': [55, 60, 34, 38] 25 | }, 26 | { 27 | 'label': 'date C', 28 | 'values': [26, 40, 25, 40] 29 | }] 30 | 31 | }; 32 | //end 33 | var json2 = { 34 | 'values': [ 35 | { 36 | 'label': 'date A', 37 | 'values': [10, 40, 15, 7] 38 | }, 39 | { 40 | 'label': 'date B', 41 | 'values': [30, 40, 45, 9] 42 | }, 43 | { 44 | 'label': 'date D', 45 | 'values': [55, 30, 34, 26] 46 | }, 47 | { 48 | 'label': 'date C', 49 | 'values': [26, 40, 85, 28] 50 | }] 51 | 52 | }; 53 | //init PieChart 54 | var pieChart = new $jit.PieChart({ 55 | //id of the visualization container 56 | injectInto: 'infovis', 57 | //whether to add animations 58 | animate: true, 59 | //offsets 60 | offset: 30, 61 | sliceOffset: 0, 62 | labelOffset: 20, 63 | //slice style 64 | type: useGradients? 'stacked:gradient' : 'stacked', 65 | //whether to show the labels for the slices 66 | showLabels:true, 67 | //resize labels according to 68 | //pie slices values set 7px as 69 | //min label size 70 | resizeLabels: 7, 71 | //label styling 72 | Label: { 73 | type: labelType, //Native or HTML 74 | size: 20, 75 | family: 'Arial', 76 | color: 'white' 77 | }, 78 | //enable tips 79 | Tips: { 80 | enable: true, 81 | onShow: function(tip, elem) { 82 | tip.innerHTML = "" + elem.name + ": " + elem.value; 83 | } 84 | }, 85 | //enable Events 86 | Events: { 87 | enable: true, 88 | onClick: function(elem) { 89 | console.log(elem); 90 | } 91 | } 92 | }); 93 | //load JSON data. 94 | pieChart.loadJSON(json); 95 | //end 96 | var list = $jit.id('id-list'), 97 | button = $jit.id('update'); 98 | //update json on click 99 | $jit.util.addEvent(button, 'click', function() { 100 | var util = $jit.util; 101 | if(util.hasClass(button, 'gray')) return; 102 | util.removeClass(button, 'white'); 103 | util.addClass(button, 'gray'); 104 | pieChart.updateJSON(json2); 105 | }); 106 | //dynamically add legend to list 107 | var legend = pieChart.getLegend(), 108 | listItems = []; 109 | for(var name in legend) { 110 | listItems.push('
     
    ' + name); 112 | } 113 | list.innerHTML = '
  • ' + listItems.join('
  • ') + '
  • '; 114 | } 115 | -------------------------------------------------------------------------------- /Tests/css/BarChart.css: -------------------------------------------------------------------------------- 1 | #right-container { 2 | display: none; 3 | } 4 | 5 | #center-container { 6 | width:800px; 7 | } 8 | 9 | #infovis { 10 | width:800px; 11 | } 12 | 13 | #id-list { 14 | background-color:#EEEEEE; 15 | border:1px solid #CCCCCC; 16 | margin:10px 20px 0 20px; 17 | padding:5px; 18 | text-align:left; 19 | text-indent:2px; 20 | } 21 | 22 | #id-list li { 23 | list-style: none; 24 | margin-bottom:3px; 25 | 26 | } 27 | 28 | .query-color { 29 | border:1px solid #999999; 30 | float:left; 31 | height:10px; 32 | margin:3px 3px 0 0; 33 | width:10px; 34 | } 35 | 36 | #update { 37 | margin:10px 40px; 38 | } 39 | 40 | .button { 41 | display: inline-block; 42 | outline: none; 43 | cursor: pointer; 44 | text-align: center; 45 | text-decoration: none; 46 | font: 14px / 100% Arial, Helvetica, sans-serif; 47 | padding: 0.5em 1em 0.55em; 48 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3); 49 | -webkit-border-radius: 0.5em; 50 | -moz-border-radius: 0.5em; 51 | border-radius: 0.5em; 52 | -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 53 | -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 54 | box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 55 | } 56 | 57 | .button:hover { 58 | text-decoration: none; 59 | } 60 | 61 | .button:active { 62 | position: relative; 63 | top: 1px; 64 | } 65 | 66 | /* gray */ 67 | .gray { 68 | color: #e9e9e9; 69 | border: solid 1px #555; 70 | background: #6e6e6e; 71 | background: -webkit-gradient(linear, left top, left bottom, from(#888), to(#575757)); 72 | background: -moz-linear-gradient(top, #888, #575757); 73 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#888888', endColorstr='#575757'); 74 | } 75 | 76 | .gray:hover { 77 | background: #616161; 78 | background: -webkit-gradient(linear, left top, left bottom, from(#757575), to(#4b4b4b)); 79 | background: -moz-linear-gradient(top, #757575, #4b4b4b); 80 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#757575', endColorstr='#4b4b4b'); 81 | } 82 | 83 | .gray:active { 84 | color: #afafaf; 85 | background: -webkit-gradient(linear, left top, left bottom, from(#575757), to(#888)); 86 | background: -moz-linear-gradient(top, #575757, #888); 87 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#575757', endColorstr='#888888'); 88 | } 89 | 90 | /* white */ 91 | .white { 92 | color: #606060; 93 | border: solid 1px #b7b7b7; 94 | background: #fff; 95 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed)); 96 | background: -moz-linear-gradient(top, #fff, #ededed); 97 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed'); 98 | } 99 | 100 | .white:hover { 101 | background: #ededed; 102 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#dcdcdc)); 103 | background: -moz-linear-gradient(top, #fff, #dcdcdc); 104 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dcdcdc'); 105 | } 106 | 107 | .white:active { 108 | color: #999; 109 | background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#fff)); 110 | background: -moz-linear-gradient(top, #ededed, #fff); 111 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff'); 112 | } 113 | -------------------------------------------------------------------------------- /Tests/css/PieChart.css: -------------------------------------------------------------------------------- 1 | #right-container { 2 | display: none; 3 | } 4 | 5 | #center-container { 6 | width:800px; 7 | } 8 | 9 | #infovis { 10 | width:800px; 11 | } 12 | 13 | #id-list { 14 | background-color:#EEEEEE; 15 | border:1px solid #CCCCCC; 16 | margin:10px 20px 0 20px; 17 | padding:5px; 18 | text-align:left; 19 | text-indent:2px; 20 | } 21 | 22 | #id-list li { 23 | list-style: none; 24 | margin-bottom:3px; 25 | 26 | } 27 | 28 | .query-color { 29 | border:1px solid #999999; 30 | float:left; 31 | height:10px; 32 | margin:3px 3px 0 0; 33 | width:10px; 34 | } 35 | 36 | #update { 37 | margin:10px 40px; 38 | } 39 | 40 | .button { 41 | display: inline-block; 42 | outline: none; 43 | cursor: pointer; 44 | text-align: center; 45 | text-decoration: none; 46 | font: 14px / 100% Arial, Helvetica, sans-serif; 47 | padding: 0.5em 1em 0.55em; 48 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3); 49 | -webkit-border-radius: 0.5em; 50 | -moz-border-radius: 0.5em; 51 | border-radius: 0.5em; 52 | -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 53 | -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 54 | box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 55 | } 56 | 57 | .button:hover { 58 | text-decoration: none; 59 | } 60 | 61 | .button:active { 62 | position: relative; 63 | top: 1px; 64 | } 65 | 66 | /* gray */ 67 | .gray { 68 | color: #e9e9e9; 69 | border: solid 1px #555; 70 | background: #6e6e6e; 71 | background: -webkit-gradient(linear, left top, left bottom, from(#888), to(#575757)); 72 | background: -moz-linear-gradient(top, #888, #575757); 73 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#888888', endColorstr='#575757'); 74 | } 75 | 76 | .gray:hover { 77 | background: #616161; 78 | background: -webkit-gradient(linear, left top, left bottom, from(#757575), to(#4b4b4b)); 79 | background: -moz-linear-gradient(top, #757575, #4b4b4b); 80 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#757575', endColorstr='#4b4b4b'); 81 | } 82 | 83 | .gray:active { 84 | color: #afafaf; 85 | background: -webkit-gradient(linear, left top, left bottom, from(#575757), to(#888)); 86 | background: -moz-linear-gradient(top, #575757, #888); 87 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#575757', endColorstr='#888888'); 88 | } 89 | 90 | /* white */ 91 | .white { 92 | color: #606060; 93 | border: solid 1px #b7b7b7; 94 | background: #fff; 95 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed)); 96 | background: -moz-linear-gradient(top, #fff, #ededed); 97 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed'); 98 | } 99 | 100 | .white:hover { 101 | background: #ededed; 102 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#dcdcdc)); 103 | background: -moz-linear-gradient(top, #fff, #dcdcdc); 104 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dcdcdc'); 105 | } 106 | 107 | .white:active { 108 | color: #999; 109 | background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#fff)); 110 | background: -moz-linear-gradient(top, #ededed, #fff); 111 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff'); 112 | } 113 | -------------------------------------------------------------------------------- /Tests/css/TimeGraph.css: -------------------------------------------------------------------------------- 1 | #right-container { 2 | display: none; 3 | } 4 | 5 | #center-container { 6 | width:800px; 7 | } 8 | 9 | #infovis { 10 | width:800px; 11 | /*height: 250px;*/ 12 | } 13 | 14 | #id-list { 15 | background-color:#EEEEEE; 16 | border:1px solid #CCCCCC; 17 | margin:10px 20px 0 20px; 18 | padding:5px; 19 | text-align:left; 20 | text-indent:2px; 21 | } 22 | 23 | #id-list li { 24 | list-style: none; 25 | margin-bottom:3px; 26 | 27 | } 28 | 29 | .query-color { 30 | border:1px solid #999999; 31 | float:left; 32 | height:10px; 33 | margin:3px 3px 0 0; 34 | width:10px; 35 | } 36 | 37 | #update { 38 | margin:10px 40px; 39 | } 40 | 41 | .button { 42 | display: inline-block; 43 | outline: none; 44 | cursor: pointer; 45 | text-align: center; 46 | text-decoration: none; 47 | font: 14px / 100% Arial, Helvetica, sans-serif; 48 | padding: 0.5em 1em 0.55em; 49 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3); 50 | -webkit-border-radius: 0.5em; 51 | -moz-border-radius: 0.5em; 52 | border-radius: 0.5em; 53 | -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 54 | -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 55 | box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 56 | } 57 | 58 | .button:hover { 59 | text-decoration: none; 60 | } 61 | 62 | .button:active { 63 | position: relative; 64 | top: 1px; 65 | } 66 | 67 | /* gray */ 68 | .gray { 69 | color: #e9e9e9; 70 | border: solid 1px #555; 71 | background: #6e6e6e; 72 | background: -webkit-gradient(linear, left top, left bottom, from(#888), to(#575757)); 73 | background: -moz-linear-gradient(top, #888, #575757); 74 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#888888', endColorstr='#575757'); 75 | } 76 | 77 | .gray:hover { 78 | background: #616161; 79 | background: -webkit-gradient(linear, left top, left bottom, from(#757575), to(#4b4b4b)); 80 | background: -moz-linear-gradient(top, #757575, #4b4b4b); 81 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#757575', endColorstr='#4b4b4b'); 82 | } 83 | 84 | .gray:active { 85 | color: #afafaf; 86 | background: -webkit-gradient(linear, left top, left bottom, from(#575757), to(#888)); 87 | background: -moz-linear-gradient(top, #575757, #888); 88 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#575757', endColorstr='#888888'); 89 | } 90 | 91 | /* white */ 92 | .white { 93 | color: #606060; 94 | border: solid 1px #b7b7b7; 95 | background: #fff; 96 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed)); 97 | background: -moz-linear-gradient(top, #fff, #ededed); 98 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed'); 99 | } 100 | 101 | .white:hover { 102 | background: #ededed; 103 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#dcdcdc)); 104 | background: -moz-linear-gradient(top, #fff, #dcdcdc); 105 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dcdcdc'); 106 | } 107 | 108 | .white:active { 109 | color: #999; 110 | background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#fff)); 111 | background: -moz-linear-gradient(top, #ededed, #fff); 112 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff'); 113 | } 114 | -------------------------------------------------------------------------------- /Tests/css/AreaChart.css: -------------------------------------------------------------------------------- 1 | #right-container { 2 | display: none; 3 | } 4 | 5 | #center-container { 6 | width:800px; 7 | } 8 | 9 | #infovis { 10 | width:800px; 11 | } 12 | 13 | #id-list { 14 | background-color:#EEEEEE; 15 | border:1px solid #CCCCCC; 16 | margin:10px 20px 0 20px; 17 | padding:5px; 18 | text-align:left; 19 | text-indent:2px; 20 | } 21 | 22 | #id-list li { 23 | list-style: none; 24 | margin-bottom:3px; 25 | 26 | } 27 | 28 | .query-color { 29 | border:1px solid #999999; 30 | float:left; 31 | height:10px; 32 | margin:3px 3px 0 0; 33 | width:10px; 34 | } 35 | 36 | #update, #restore { 37 | text-align: center; 38 | width: 100px; 39 | margin:10px 35px; 40 | } 41 | 42 | .button { 43 | display: inline-block; 44 | outline: none; 45 | cursor: pointer; 46 | text-align: center; 47 | text-decoration: none; 48 | font: 14px / 100% Arial, Helvetica, sans-serif; 49 | padding: 0.5em 1em 0.55em; 50 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3); 51 | -webkit-border-radius: 0.5em; 52 | -moz-border-radius: 0.5em; 53 | border-radius: 0.5em; 54 | -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 55 | -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 56 | box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); 57 | } 58 | 59 | .button:hover { 60 | text-decoration: none; 61 | } 62 | 63 | .button:active { 64 | position: relative; 65 | top: 1px; 66 | } 67 | 68 | /* gray */ 69 | .gray { 70 | color: #e9e9e9; 71 | border: solid 1px #555; 72 | background: #6e6e6e; 73 | background: -webkit-gradient(linear, left top, left bottom, from(#888), to(#575757)); 74 | background: -moz-linear-gradient(top, #888, #575757); 75 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#888888', endColorstr='#575757'); 76 | } 77 | 78 | .gray:hover { 79 | background: #616161; 80 | background: -webkit-gradient(linear, left top, left bottom, from(#757575), to(#4b4b4b)); 81 | background: -moz-linear-gradient(top, #757575, #4b4b4b); 82 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#757575', endColorstr='#4b4b4b'); 83 | } 84 | 85 | .gray:active { 86 | color: #afafaf; 87 | background: -webkit-gradient(linear, left top, left bottom, from(#575757), to(#888)); 88 | background: -moz-linear-gradient(top, #575757, #888); 89 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#575757', endColorstr='#888888'); 90 | } 91 | 92 | /* white */ 93 | .white { 94 | color: #606060; 95 | border: solid 1px #b7b7b7; 96 | background: #fff; 97 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed)); 98 | background: -moz-linear-gradient(top, #fff, #ededed); 99 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed'); 100 | } 101 | 102 | .white:hover { 103 | background: #ededed; 104 | background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#dcdcdc)); 105 | background: -moz-linear-gradient(top, #fff, #dcdcdc); 106 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dcdcdc'); 107 | } 108 | 109 | .white:active { 110 | color: #999; 111 | background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#fff)); 112 | background: -moz-linear-gradient(top, #ededed, #fff); 113 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff'); 114 | } 115 | -------------------------------------------------------------------------------- /Tests/BarChart/test3.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | //init data 3 | var json = { 4 | 'label': ['label A', 'label B', 'label C', 'label D'], 5 | 'values': [ 6 | { 7 | 'label': 'date A', 8 | 'values': [20, 40, 15, 5] 9 | }, 10 | { 11 | 'label': 'date B', 12 | 'values': [30, 10, 45, 10] 13 | }, 14 | { 15 | 'label': 'date E', 16 | 'values': [38, 20, 35, 17] 17 | }, 18 | { 19 | 'label': 'date F', 20 | 'values': [58, 10, 35, 32] 21 | }, 22 | { 23 | 'label': 'date D', 24 | 'values': [55, 60, 34, 38] 25 | }, 26 | { 27 | 'label': 'date C', 28 | 'values': [26, 40, 25, 40] 29 | }] 30 | 31 | }; 32 | //end 33 | var json2 = { 34 | 'values': [ 35 | { 36 | 'label': 'date A', 37 | 'values': [10, 40, 15, 7] 38 | }, 39 | { 40 | 'label': 'date B', 41 | 'values': [30, 40, 45, 9] 42 | }, 43 | { 44 | 'label': 'date D', 45 | 'values': [55, 30, 34, 26] 46 | }, 47 | { 48 | 'label': 'date C', 49 | 'values': [26, 40, 85, 28] 50 | }] 51 | 52 | }; 53 | //init BarChart 54 | var barChart = new $jit.BarChart({ 55 | //id of the visualization container 56 | injectInto: 'infovis', 57 | //whether to add animations 58 | animate: true, 59 | //horizontal or vertical barcharts 60 | orientation: 'vertical', 61 | //bars separation 62 | barsOffset: 20, 63 | //visualization offset 64 | Margin: { 65 | top:5, 66 | left: 5, 67 | right: 5, 68 | bottom:5 69 | }, 70 | //labels offset position 71 | labelOffset: 5, 72 | //bars style 73 | type: useGradients? 'stacked:gradient' : 'stacked', 74 | //whether to show the aggregation of the values 75 | showAggregates:true, 76 | //whether to show the labels for the bars 77 | showLabels:true, 78 | //labels style 79 | Label: { 80 | type: labelType, //Native or HTML 81 | size: 13, 82 | family: 'Arial', 83 | color: 'white' 84 | }, 85 | //add tooltips 86 | Tips: { 87 | enable: true, 88 | onShow: function(tip, elem) { 89 | tip.innerHTML = "" + elem.name + ": " + elem.value; 90 | } 91 | }, 92 | //enable Events 93 | Events: { 94 | enable: true, 95 | onClick: function(elem) { 96 | console.log(elem); 97 | } 98 | } 99 | }); 100 | //load JSON data. 101 | barChart.loadJSON(json); 102 | //end 103 | var list = $jit.id('id-list'), 104 | button = $jit.id('update'), 105 | orn = $jit.id('switch-orientation'); 106 | //update json on click 'Update Data' 107 | $jit.util.addEvent(button, 'click', function() { 108 | var util = $jit.util; 109 | if(util.hasClass(button, 'gray')) return; 110 | util.removeClass(button, 'white'); 111 | util.addClass(button, 'gray'); 112 | barChart.updateJSON(json2); 113 | }); 114 | //dynamically add legend to list 115 | var legend = barChart.getLegend(), 116 | listItems = []; 117 | for(var name in legend) { 118 | listItems.push('
     
    ' + name); 120 | } 121 | list.innerHTML = '
  • ' + listItems.join('
  • ') + '
  • '; 122 | } 123 | -------------------------------------------------------------------------------- /Source/Options/Options.Fx.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.Fx.js 3 | * 4 | */ 5 | 6 | /* 7 | Object: Options.Fx 8 | 9 | Provides animation options like duration of the animations, frames per second and animation transitions. 10 | 11 | Syntax: 12 | 13 | (start code js) 14 | Options.Fx = { 15 | fps:40, 16 | duration: 2500, 17 | transition: $jit.Trans.Quart.easeInOut, 18 | clearCanvas: true 19 | }; 20 | (end code) 21 | 22 | Example: 23 | 24 | (start code js) 25 | var viz = new $jit.Viz({ 26 | duration: 1000, 27 | fps: 35, 28 | transition: $jit.Trans.linear 29 | }); 30 | (end code) 31 | 32 | Parameters: 33 | 34 | clearCanvas - (boolean) Default's *true*. Whether to clear the frame/canvas when the viz is plotted or animated. 35 | duration - (number) Default's *2500*. Duration of the animation in milliseconds. 36 | fps - (number) Default's *40*. Frames per second. 37 | transition - (object) Default's *$jit.Trans.Quart.easeInOut*. The transition used for the animations. See below for a more detailed explanation. 38 | 39 | Object: $jit.Trans 40 | 41 | This object is used for specifying different animation transitions in all visualizations. 42 | 43 | There are many different type of animation transitions. 44 | 45 | linear: 46 | 47 | Displays a linear transition 48 | 49 | >Trans.linear 50 | 51 | (see Linear.png) 52 | 53 | Quad: 54 | 55 | Displays a Quadratic transition. 56 | 57 | >Trans.Quad.easeIn 58 | >Trans.Quad.easeOut 59 | >Trans.Quad.easeInOut 60 | 61 | (see Quad.png) 62 | 63 | Cubic: 64 | 65 | Displays a Cubic transition. 66 | 67 | >Trans.Cubic.easeIn 68 | >Trans.Cubic.easeOut 69 | >Trans.Cubic.easeInOut 70 | 71 | (see Cubic.png) 72 | 73 | Quart: 74 | 75 | Displays a Quartetic transition. 76 | 77 | >Trans.Quart.easeIn 78 | >Trans.Quart.easeOut 79 | >Trans.Quart.easeInOut 80 | 81 | (see Quart.png) 82 | 83 | Quint: 84 | 85 | Displays a Quintic transition. 86 | 87 | >Trans.Quint.easeIn 88 | >Trans.Quint.easeOut 89 | >Trans.Quint.easeInOut 90 | 91 | (see Quint.png) 92 | 93 | Expo: 94 | 95 | Displays an Exponential transition. 96 | 97 | >Trans.Expo.easeIn 98 | >Trans.Expo.easeOut 99 | >Trans.Expo.easeInOut 100 | 101 | (see Expo.png) 102 | 103 | Circ: 104 | 105 | Displays a Circular transition. 106 | 107 | >Trans.Circ.easeIn 108 | >Trans.Circ.easeOut 109 | >Trans.Circ.easeInOut 110 | 111 | (see Circ.png) 112 | 113 | Sine: 114 | 115 | Displays a Sineousidal transition. 116 | 117 | >Trans.Sine.easeIn 118 | >Trans.Sine.easeOut 119 | >Trans.Sine.easeInOut 120 | 121 | (see Sine.png) 122 | 123 | Back: 124 | 125 | >Trans.Back.easeIn 126 | >Trans.Back.easeOut 127 | >Trans.Back.easeInOut 128 | 129 | (see Back.png) 130 | 131 | Bounce: 132 | 133 | Bouncy transition. 134 | 135 | >Trans.Bounce.easeIn 136 | >Trans.Bounce.easeOut 137 | >Trans.Bounce.easeInOut 138 | 139 | (see Bounce.png) 140 | 141 | Elastic: 142 | 143 | Elastic curve. 144 | 145 | >Trans.Elastic.easeIn 146 | >Trans.Elastic.easeOut 147 | >Trans.Elastic.easeInOut 148 | 149 | (see Elastic.png) 150 | 151 | Based on: 152 | 153 | Easing and Transition animation methods are based in the MooTools Framework . Copyright (c) 2006-2010 Valerio Proietti, . MIT license . 154 | 155 | 156 | */ 157 | Options.Fx = { 158 | $extend: true, 159 | 160 | fps:40, 161 | duration: 2500, 162 | transition: $jit.Trans.Quart.easeInOut, 163 | clearCanvas: true 164 | }; -------------------------------------------------------------------------------- /Tests/AreaChart/test1.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | //init data 3 | var json = { 4 | 'label': ['label A', 'label B', 'label C', 'label D'], 5 | 'values': [ 6 | { 7 | 'label': 'date A', 8 | 'values': [20, 40, 15, 5] 9 | }, 10 | { 11 | 'label': 'date B', 12 | 'values': [30, 10, 45, 10] 13 | }, 14 | { 15 | 'label': 'date E', 16 | 'values': [38, 20, 35, 17] 17 | }, 18 | { 19 | 'label': 'date F', 20 | 'values': [58, 10, 35, 32] 21 | }, 22 | { 23 | 'label': 'date D', 24 | 'values': [55, 60, 34, 38] 25 | }, 26 | { 27 | 'label': 'date C', 28 | 'values': [26, 40, 25, 40] 29 | }] 30 | 31 | }; 32 | var json2 = { 33 | 'values': [ 34 | { 35 | 'label': 'date A', 36 | 'values': [10, 40, 15, 7] 37 | }, 38 | { 39 | 'label': 'date B', 40 | 'values': [30, 40, 45, 9] 41 | }, 42 | { 43 | 'label': 'date D', 44 | 'values': [55, 30, 34, 26] 45 | }, 46 | { 47 | 'label': 'date C', 48 | 'values': [26, 40, 85, 28] 49 | }] 50 | 51 | }; 52 | //end 53 | var infovis = document.getElementById('infovis'); 54 | //init AreaChart 55 | var areaChart = new $jit.AreaChart({ 56 | //id of the visualization container 57 | injectInto: 'infovis', 58 | //add animations 59 | animate: true, 60 | //separation offsets 61 | Margin: { 62 | top: 5, 63 | left: 5, 64 | right: 5, 65 | bottom: 5 66 | }, 67 | labelOffset: 10, 68 | //whether to display sums 69 | showAggregates: true, 70 | //whether to display labels at all 71 | showLabels: true, 72 | //could also be 'stacked' 73 | type: useGradients? 'stacked:gradient' : 'stacked', 74 | //label styling 75 | Label: { 76 | type: labelType, //can be 'Native' or 'HTML' 77 | size: 13, 78 | family: 'Arial', 79 | color: 'white' 80 | }, 81 | //enable tips 82 | Tips: { 83 | enable: true, 84 | onShow: function(tip, elem) { 85 | tip.innerHTML = "" + elem.name + ": " + elem.value; 86 | } 87 | }, 88 | //add left and right click handlers 89 | filterOnClick: true, 90 | restoreOnRightClick:true 91 | }); 92 | //load JSON data. 93 | areaChart.loadJSON(json); 94 | //end 95 | var list = $jit.id('id-list'), 96 | button = $jit.id('update'), 97 | restoreButton = $jit.id('restore'); 98 | //update json on click 99 | $jit.util.addEvent(button, 'click', function() { 100 | var util = $jit.util; 101 | if(util.hasClass(button, 'gray')) return; 102 | util.removeClass(button, 'white'); 103 | util.addClass(button, 'gray'); 104 | areaChart.updateJSON(json2); 105 | }); 106 | //restore graph on click 107 | $jit.util.addEvent(restoreButton, 'click', function() { 108 | areaChart.restore(); 109 | }); 110 | //dynamically add legend to list 111 | var legend = areaChart.getLegend(), 112 | listItems = []; 113 | for(var name in legend) { 114 | listItems.push('
     
    ' + name); 116 | } 117 | list.innerHTML = '
  • ' + listItems.join('
  • ') + '
  • '; 118 | } 119 | -------------------------------------------------------------------------------- /Source/Options/Options.Node.js: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Options.Node.js 3 | * 4 | */ 5 | 6 | /* 7 | Object: Options.Node 8 | 9 | Provides Node rendering options for Tree and Graph based visualizations. 10 | 11 | Syntax: 12 | 13 | (start code js) 14 | Options.Node = { 15 | overridable: false, 16 | type: 'circle', 17 | color: '#ccb', 18 | alpha: 1, 19 | dim: 3, 20 | height: 20, 21 | width: 90, 22 | autoHeight: false, 23 | autoWidth: false, 24 | lineWidth: 1, 25 | transform: true, 26 | align: "center", 27 | angularWidth:1, 28 | span:1, 29 | CanvasStyles: {} 30 | }; 31 | (end code) 32 | 33 | Example: 34 | 35 | (start code js) 36 | var viz = new $jit.Viz({ 37 | Node: { 38 | overridable: true, 39 | width: 30, 40 | autoHeight: true, 41 | type: 'rectangle' 42 | } 43 | }); 44 | (end code) 45 | 46 | Parameters: 47 | 48 | overridable - (boolean) Default's *false*. Determine whether or not general node properties can be overridden by a particular . 49 | type - (string) Default's *circle*. Node's shape. Node built-in types include 'circle', 'rectangle', 'square', 'ellipse', 'triangle', 'star'. The default Node type might vary in each visualization. You can also implement (non built-in) custom Node types into your visualizations. 50 | color - (string) Default's *#ccb*. Node color. 51 | alpha - (number) Default's *1*. The Node's alpha value. *1* is for full opacity. 52 | dim - (number) Default's *3*. An extra parameter used by 'circle', 'square', 'triangle' and 'star' node types. Depending on each shape, this parameter can set the radius of a circle, half the length of the side of a square, half the base and half the height of a triangle or the length of a side of a star (concave decagon). 53 | height - (number) Default's *20*. Used by 'rectangle' and 'ellipse' node types. The height of the node shape. 54 | width - (number) Default's *90*. Used by 'rectangle' and 'ellipse' node types. The width of the node shape. 55 | autoHeight - (boolean) Default's *false*. Whether to set an auto height for the node depending on the content of the Node's label. 56 | autoWidth - (boolean) Default's *false*. Whether to set an auto width for the node depending on the content of the Node's label. 57 | lineWidth - (number) Default's *1*. Used only by some Node shapes. The line width of the strokes of a node. 58 | transform - (boolean) Default's *true*. Only used by the visualization. Whether to scale the nodes according to the moebius transformation. 59 | align - (string) Default's *center*. Possible values are 'center', 'left' or 'right'. Used only by the visualization, these parameters are used for aligning nodes when some of they dimensions vary. 60 | angularWidth - (number) Default's *1*. Used in radial layouts (like or visualizations). The amount of relative 'space' set for a node. 61 | span - (number) Default's *1*. Used in radial layouts (like or visualizations). The angle span amount set for a node. 62 | CanvasStyles - (object) Default's an empty object (i.e. {}). Attach any other canvas specific property that you'd set to the canvas context before plotting a Node. 63 | 64 | */ 65 | Options.Node = { 66 | $extend: false, 67 | 68 | overridable: false, 69 | type: 'circle', 70 | color: '#ccb', 71 | alpha: 1, 72 | dim: 3, 73 | height: 20, 74 | width: 90, 75 | autoHeight: false, 76 | autoWidth: false, 77 | lineWidth: 1, 78 | transform: true, 79 | align: "center", 80 | angularWidth:1, 81 | span:1, 82 | //Raw canvas styles to be 83 | //applied to the context instance 84 | //before plotting a node 85 | CanvasStyles: {} 86 | }; 87 | -------------------------------------------------------------------------------- /Tests/AreaChart/test2.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | //init data 3 | var json = { 4 | 'label': ['label A', 'label B', 'label C', 'label D'], 5 | 'values': [ 6 | { 7 | 'label': 'date A', 8 | 'values': [20, 40, 15, 5] 9 | }, 10 | { 11 | 'label': 'date B', 12 | 'values': [30, 10, 45, 10] 13 | }, 14 | { 15 | 'label': 'date E', 16 | 'values': [38, 20, 35, 17] 17 | }, 18 | { 19 | 'label': 'date F', 20 | 'values': [58, 10, 35, 32] 21 | }, 22 | { 23 | 'label': 'date D', 24 | 'values': [55, 60, 34, 38] 25 | }, 26 | { 27 | 'label': 'date C', 28 | 'values': [26, 40, 25, 40] 29 | }] 30 | 31 | }; 32 | var json2 = { 33 | 'values': [ 34 | { 35 | 'label': 'date A', 36 | 'values': [10, 40, 15, 7] 37 | }, 38 | { 39 | 'label': 'date B', 40 | 'values': [30, 40, 45, 9] 41 | }, 42 | { 43 | 'label': 'date D', 44 | 'values': [55, 30, 34, 26] 45 | }, 46 | { 47 | 'label': 'date C', 48 | 'values': [26, 40, 85, 28] 49 | }] 50 | 51 | }; 52 | //end 53 | var infovis = document.getElementById('infovis'); 54 | //init AreaChart 55 | var areaChart = new $jit.AreaChart({ 56 | //id of the visualization container 57 | injectInto: 'infovis', 58 | //add animations 59 | animate: true, 60 | //separation offsets 61 | //separation offsets 62 | Margin: { 63 | top: 5, 64 | left: 5, 65 | right: 5, 66 | bottom: 5 67 | }, 68 | labelOffset: 10, 69 | //whether to display sums 70 | showAggregates: true, 71 | //whether to display labels at all 72 | showLabels: true, 73 | //could also be 'stacked' 74 | type: useGradients? 'stacked:gradient' : 'stacked', 75 | //label styling 76 | Label: { 77 | type: labelType, //can be 'Native' or 'HTML' 78 | size: 13, 79 | family: 'Arial', 80 | color: 'white' 81 | }, 82 | //enable tips 83 | Tips: { 84 | enable: true, 85 | onShow: function(tip, elem) { 86 | tip.innerHTML = "" + elem.name + ": " + elem.value; 87 | } 88 | }, 89 | //enable Events 90 | Events: { 91 | enable: true, 92 | onClick: function(elem) { 93 | console.log(elem); 94 | } 95 | }, 96 | //add left and right click handlers 97 | filterOnClick: true, 98 | restoreOnRightClick:true 99 | }); 100 | //load JSON data. 101 | areaChart.loadJSON(json); 102 | //end 103 | var list = $jit.id('id-list'), 104 | button = $jit.id('update'), 105 | restoreButton = $jit.id('restore'); 106 | //update json on click 107 | $jit.util.addEvent(button, 'click', function() { 108 | var util = $jit.util; 109 | if(util.hasClass(button, 'gray')) return; 110 | util.removeClass(button, 'white'); 111 | util.addClass(button, 'gray'); 112 | areaChart.updateJSON(json2); 113 | }); 114 | //restore graph on click 115 | $jit.util.addEvent(restoreButton, 'click', function() { 116 | areaChart.restore(); 117 | }); 118 | //dynamically add legend to list 119 | var legend = areaChart.getLegend(), 120 | listItems = []; 121 | for(var name in legend) { 122 | listItems.push('
     
    ' + name); 124 | } 125 | list.innerHTML = '
  • ' + listItems.join('
  • ') + '
  • '; 126 | } 127 | -------------------------------------------------------------------------------- /Tests/AreaChart/test3.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | //init data 3 | var json = { 4 | 'label': ['label A', 'label B', 'label C', 'label D'], 5 | 'values': [ 6 | { 7 | 'label': 'date A', 8 | 'values': [20, 40, 15, 5] 9 | }, 10 | { 11 | 'label': 'date B', 12 | 'values': [30, 10, 45, 10] 13 | }, 14 | { 15 | 'label': 'date E', 16 | 'values': [38, 20, 35, 17] 17 | }, 18 | { 19 | 'label': 'date F', 20 | 'values': [58, 10, 35, 32] 21 | }, 22 | { 23 | 'label': 'date D', 24 | 'values': [55, 60, 34, 38] 25 | }, 26 | { 27 | 'label': 'date C', 28 | 'values': [26, 40, 25, 40] 29 | }] 30 | 31 | }; 32 | var json2 = { 33 | 'values': [ 34 | { 35 | 'label': 'date A', 36 | 'values': [10, 40, 15, 7] 37 | }, 38 | { 39 | 'label': 'date B', 40 | 'values': [30, 40, 45, 9] 41 | }, 42 | { 43 | 'label': 'date D', 44 | 'values': [55, 30, 34, 26] 45 | }, 46 | { 47 | 'label': 'date C', 48 | 'values': [26, 40, 85, 28] 49 | }] 50 | 51 | }; 52 | //end 53 | var infovis = document.getElementById('infovis'); 54 | //init AreaChart 55 | var areaChart = new $jit.AreaChart({ 56 | //id of the visualization container 57 | injectInto: 'infovis', 58 | //add animations 59 | animate: true, 60 | //separation offsets 61 | Margin: { 62 | top: 5, 63 | left: 5, 64 | right: 5, 65 | bottom: 5 66 | }, 67 | labelOffset: 10, 68 | // function to modify sums 69 | showAggregates: function(name, left, right, node, acum) { 70 | if ( acum > 120 ) { return acum; } 71 | return false; 72 | }, 73 | // function to modify labels 74 | showLabels: function(name, left, right, node) { 75 | if ( name.indexOf('B') != -1 ) { return name; } 76 | return false; 77 | }, 78 | //could also be 'stacked' 79 | type: useGradients? 'stacked:gradient' : 'stacked', 80 | //label styling 81 | Label: { 82 | type: labelType, //can be 'Native' or 'HTML' 83 | size: 13, 84 | family: 'Arial', 85 | color: 'white' 86 | }, 87 | //enable tips 88 | Tips: { 89 | enable: true, 90 | onShow: function(tip, elem) { 91 | tip.innerHTML = "" + elem.name + ": " + elem.value; 92 | } 93 | }, 94 | //add left and right click handlers 95 | filterOnClick: true, 96 | restoreOnRightClick:true 97 | }); 98 | //load JSON data. 99 | areaChart.loadJSON(json); 100 | //end 101 | var list = $jit.id('id-list'), 102 | button = $jit.id('update'), 103 | restoreButton = $jit.id('restore'); 104 | //update json on click 105 | $jit.util.addEvent(button, 'click', function() { 106 | var util = $jit.util; 107 | if(util.hasClass(button, 'gray')) return; 108 | util.removeClass(button, 'white'); 109 | util.addClass(button, 'gray'); 110 | areaChart.updateJSON(json2); 111 | }); 112 | //restore graph on click 113 | $jit.util.addEvent(restoreButton, 'click', function() { 114 | areaChart.restore(); 115 | }); 116 | //dynamically add legend to list 117 | var legend = areaChart.getLegend(), 118 | listItems = []; 119 | for(var name in legend) { 120 | listItems.push('
     
    ' + name); 122 | } 123 | list.innerHTML = '
  • ' + listItems.join('
  • ') + '
  • '; 124 | } 125 | -------------------------------------------------------------------------------- /Templates/RGraph/test8.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |

    Global Options

    4 | 5 | 6 | 7 | 10 | 16 | 17 | 18 | 21 | 28 | 29 | 30 | 33 | 36 | 37 | 38 | 41 | 42 |
    8 | duration: 9 | 11 | 15 |
    19 | fps: 20 | 22 | 27 |
    31 | hide labels: 32 | 34 | 35 |
    39 | 40 |
    43 | 44 |

    1.- Remove Nodes

    45 | 46 | 47 | 48 | 51 | 59 | 60 | 61 | 64 | 67 | 68 |
    49 | type: 50 | 52 | 58 |
    62 | 63 | 65 | 66 |
    69 | 70 |

    2.- Remove Edges

    71 | 72 | 73 | 74 | 77 | 85 | 86 | 87 | 90 | 93 | 94 |
    75 | type: 76 | 78 | 84 |
    88 | 89 | 91 | 92 |
    95 | 96 |

    3.- Add Graph (Sum)

    97 | 98 | 99 | 100 | 103 | 110 | 111 | 112 | 115 | 118 | 119 |
    101 | type: 102 | 104 | 109 |
    113 | 114 | 116 | 117 |
    120 | 121 |

    4.- Morph

    122 | 123 | 124 | 125 | 128 | 134 | 135 | 136 | 139 | 142 | 143 |
    126 | type: 127 | 129 | 133 |
    137 | 138 | 140 | 141 |
    -------------------------------------------------------------------------------- /Templates/Hypertree/test11.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |

    Global Options

    4 | 5 | 6 | 7 | 10 | 16 | 17 | 18 | 21 | 28 | 29 | 30 | 33 | 36 | 37 | 38 | 41 | 42 |
    8 | duration: 9 | 11 | 15 |
    19 | fps: 20 | 22 | 27 |
    31 | hide labels: 32 | 34 | 35 |
    39 | 40 |
    43 | 44 |

    1.- Remove Nodes

    45 | 46 | 47 | 48 | 51 | 59 | 60 | 61 | 64 | 67 | 68 |
    49 | type: 50 | 52 | 58 |
    62 | 63 | 65 | 66 |
    69 | 70 |

    2.- Remove Edges

    71 | 72 | 73 | 74 | 77 | 85 | 86 | 87 | 90 | 93 | 94 |
    75 | type: 76 | 78 | 84 |
    88 | 89 | 91 | 92 |
    95 | 96 |

    3.- Add Graph (Sum)

    97 | 98 | 99 | 100 | 103 | 110 | 111 | 112 | 115 | 118 | 119 |
    101 | type: 102 | 104 | 109 |
    113 | 114 | 116 | 117 |
    120 | 121 |

    4.- Morph

    122 | 123 | 124 | 125 | 128 | 134 | 135 | 136 | 139 | 142 | 143 |
    126 | type: 127 | 129 | 133 |
    137 | 138 | 140 | 141 |
    -------------------------------------------------------------------------------- /Tests/Spacetree/test5.js: -------------------------------------------------------------------------------- 1 | function init(){ 2 | var infovis = document.getElementById('infovis'); 3 | var w = infovis.offsetWidth, h = infovis.offsetHeight; 4 | var json = Feeder.makeTree({ 5 | idPrefix: "node" + new Date().getTime(), 6 | levelStart: 0, 7 | levelEnd: 3, 8 | maxChildrenPerNode: 5, 9 | minChildrenPerNode: 0, 10 | counter: 0 11 | }); 12 | //Create a new ST instance 13 | st = new $jit.ST({ 14 | 'injectInto': 'infovis', 15 | 'width': w, 16 | 'height': h, 17 | 18 | orientation: "left", 19 | levelDistance: 50, 20 | Node: { 21 | overridable: true, 22 | align: "left", 23 | height: 20 24 | }, 25 | 26 | Edge: { 27 | overridable: true, 28 | 'type': 'bezier', 29 | dim: 15 30 | }, 31 | 32 | onBeforeCompute: function(node){ 33 | Log.write("loading " + node.name); 34 | }, 35 | 36 | onAfterCompute: function(node){ 37 | Log.write("done"); 38 | }, 39 | 40 | onCreateLabel: function(label, node){ 41 | label.id = node.id; 42 | label.style.cursor = 'pointer'; 43 | label.innerHTML = node.name; 44 | label.onclick = function() { 45 | st.onClick(node.id); 46 | }; 47 | }, 48 | 49 | onBeforePlotNode: function(node){ 50 | if (node.selected) { 51 | node.data.$color = "#ff7"; 52 | } 53 | else { 54 | delete node.data.$color; 55 | } 56 | }, 57 | 58 | onBeforePlotLine: function(adj){ 59 | if (adj.nodeFrom.selected && adj.nodeTo.selected) { 60 | adj.data.$color = "#eed"; 61 | adj.data.$lineWidth = 3; 62 | } 63 | else { 64 | delete adj.data.$color; 65 | delete adj.data.$lineWidth; 66 | } 67 | } 68 | }); 69 | //load json data 70 | st.loadJSON(json); 71 | $jit.Graph.Util.eachNode(st.graph, function(node){ 72 | node.data.$width = 30 + Math.random() * 30; 73 | node.data.$height = 30 + Math.random() * 30; 74 | }); 75 | //compute node positions and layout 76 | st.compute(); 77 | //optional: make a translation of the tree 78 | st.geom.translate(new $jit.Complex(-200, 0), "current"); 79 | //Emulate a click on the root node. 80 | // Tree.Plot.plot(st.tree, st.canvas); 81 | st.onClick(st.root); 82 | 83 | //Add input handler to switch spacetree orientation. 84 | var select = document.getElementById('switch'); 85 | select.onchange = function(){ 86 | var index = select.selectedIndex; 87 | var or = select.options[index].text; 88 | select.disabled = true; 89 | st.switchPosition(or, "animate", { 90 | onComplete: function(){ 91 | select.disabled = false; 92 | } 93 | }); 94 | }; 95 | 96 | var align = document.getElementById('align'); 97 | align.onchange = function() { 98 | var index = align.selectedIndex; 99 | var or = align.options[index].text; 100 | st.config.Node.align = or; 101 | st.refresh(); 102 | }; 103 | 104 | //make node list 105 | var elemUl = document.createElement('ul'); 106 | $jit.Graph.Util.eachNode(st.graph, function(elem){ 107 | var elemLi = document.createElement('li'); 108 | elemLi.onclick = function() { 109 | st.select(elem.id); 110 | }; 111 | elemLi.innerHTML = elem.name; 112 | elemUl.appendChild(elemLi); 113 | }); 114 | document.getElementById('id-list').appendChild(elemUl); 115 | } 116 | -------------------------------------------------------------------------------- /webpy/web/contrib/template.py: -------------------------------------------------------------------------------- 1 | """ 2 | Interface to various templating engines. 3 | """ 4 | import os.path 5 | 6 | __all__ = [ 7 | "render_cheetah", "render_genshi", "render_mako", 8 | "cache", 9 | ] 10 | 11 | class render_cheetah: 12 | """Rendering interface to Cheetah Templates. 13 | 14 | Example: 15 | 16 | render = render_cheetah('templates') 17 | render.hello(name="cheetah") 18 | """ 19 | def __init__(self, path): 20 | # give error if Chetah is not installed 21 | from Cheetah.Template import Template 22 | self.path = path 23 | 24 | def __getattr__(self, name): 25 | from Cheetah.Template import Template 26 | path = os.path.join(self.path, name + ".html") 27 | 28 | def template(**kw): 29 | t = Template(file=path, searchList=[kw]) 30 | return t.respond() 31 | 32 | return template 33 | 34 | class render_genshi: 35 | """Rendering interface genshi templates. 36 | Example: 37 | 38 | for xml/html templates. 39 | 40 | render = render_genshi(['templates/']) 41 | render.hello(name='genshi') 42 | 43 | For text templates: 44 | 45 | render = render_genshi(['templates/'], type='text') 46 | render.hello(name='genshi') 47 | """ 48 | 49 | def __init__(self, *a, **kwargs): 50 | from genshi.template import TemplateLoader 51 | 52 | self._type = kwargs.pop('type', None) 53 | self._loader = TemplateLoader(*a, **kwargs) 54 | 55 | def __getattr__(self, name): 56 | # Assuming all templates are html 57 | path = name + ".html" 58 | 59 | if self._type == "text": 60 | from genshi.template import TextTemplate 61 | cls = TextTemplate 62 | type = "text" 63 | else: 64 | cls = None 65 | type = None 66 | 67 | t = self._loader.load(path, cls=cls) 68 | def template(**kw): 69 | stream = t.generate(**kw) 70 | if type: 71 | return stream.render(type) 72 | else: 73 | return stream.render() 74 | return template 75 | 76 | class render_jinja: 77 | """Rendering interface to Jinja2 Templates 78 | 79 | Example: 80 | 81 | render= render_jinja('templates') 82 | render.hello(name='jinja2') 83 | """ 84 | def __init__(self, *a, **kwargs): 85 | from jinja2 import Environment,FileSystemLoader 86 | self._lookup = Environment(loader=FileSystemLoader(*a, **kwargs)) 87 | 88 | def __getattr__(self, name): 89 | # Assuming all templates end with .html 90 | path = name + '.html' 91 | t = self._lookup.get_template(path) 92 | return t.render 93 | 94 | class render_mako: 95 | """Rendering interface to Mako Templates. 96 | 97 | Example: 98 | 99 | render = render_mako(directories=['templates']) 100 | render.hello(name="mako") 101 | """ 102 | def __init__(self, *a, **kwargs): 103 | from mako.lookup import TemplateLookup 104 | self._lookup = TemplateLookup(*a, **kwargs) 105 | 106 | def __getattr__(self, name): 107 | # Assuming all templates are html 108 | path = name + ".html" 109 | t = self._lookup.get_template(path) 110 | return t.render 111 | 112 | class cache: 113 | """Cache for any rendering interface. 114 | 115 | Example: 116 | 117 | render = cache(render_cheetah("templates/")) 118 | render.hello(name='cache') 119 | """ 120 | def __init__(self, render): 121 | self._render = render 122 | self._cache = {} 123 | 124 | def __getattr__(self, name): 125 | if name not in self._cache: 126 | self._cache[name] = getattr(self._render, name) 127 | return self._cache[name] 128 | -------------------------------------------------------------------------------- /Templates/ForceDirected/test3.html: -------------------------------------------------------------------------------- 1 | $def with (model) 2 | 3 |

    Global Options

    4 | 5 | 6 | 7 | 10 | 17 | 18 | 19 | 22 | 29 | 30 | 31 | 34 | 37 | 38 | 39 | 42 | 43 |
    8 | duration: 9 | 11 | 16 |
    20 | fps: 21 | 23 | 28 |
    32 | hide labels: 33 | 35 | 36 |
    40 | 41 |
    44 | 45 |

    1.- Remove Nodes

    46 | 47 | 48 | 49 | 52 | 60 | 61 | 62 | 65 | 68 | 69 |
    50 | type: 51 | 53 | 59 |
    63 | 64 | 66 | 67 |
    70 | 71 |

    2.- Remove Edges

    72 | 73 | 74 | 75 | 78 | 86 | 87 | 88 | 91 | 94 | 95 |
    76 | type: 77 | 79 | 85 |
    89 | 90 | 92 | 93 |
    96 | 97 |

    3.- Add Graph (Sum)

    98 | 99 | 100 | 101 | 104 | 111 | 112 | 113 | 116 | 119 | 120 |
    102 | type: 103 | 105 | 110 |
    114 | 115 | 117 | 118 |
    121 | 122 |

    4.- Morph

    123 | 124 | 125 | 126 | 129 | 135 | 136 | 137 | 140 | 143 | 144 |
    127 | type: 128 | 130 | 134 |
    138 | 139 | 141 | 142 |
    -------------------------------------------------------------------------------- /Extras/generators.js: -------------------------------------------------------------------------------- 1 | //Just a random tree generator. 2 | var Feeder = { 3 | counter:0, 4 | 5 | p: { 6 | idPrefix: "node", 7 | levelStart: 0, 8 | levelEnd: 3, 9 | maxChildrenPerNode: 5, 10 | minChildrenPerNode: 1, 11 | counter: 0, 12 | color: true, 13 | dim: true 14 | }, 15 | 16 | makeTree: function (p) { 17 | p = p || this.p; 18 | var le = this.p.levelEnd; 19 | if(le == 0) return {children: []}; 20 | this.counter = 1; 21 | return this.makeTreeWithParameters(p.idPrefix, 22 | p.levelStart, 23 | p.levelEnd, 24 | p.maxChildrenPerNode, 25 | p.minChildrenPerNode, 26 | p.color, 27 | p.dim); 28 | }, 29 | 30 | makeTreeWithParameters: function(idPrefix, levelStart, levelEnd, maxChildrenPerNode, minChildrenPerNode, color, dim) { 31 | if(levelStart == levelEnd) return null; 32 | this.counter++; 33 | var numb = Math.floor(Math.random() * 10) + 1; 34 | var numb2 = Math.floor(Math.random() * 200 - 100); 35 | var data = {}; 36 | data.$area = numb; 37 | if(dim) data.$dim = numb; 38 | if(color) data.$color = numb2; 39 | var ans= { 40 | id: idPrefix + levelStart + this.counter, 41 | name: levelStart + "." + this.counter, 42 | data: data, 43 | children: [] 44 | }; 45 | var childCount= Math.round(Math.random() * (maxChildrenPerNode - minChildrenPerNode) + minChildrenPerNode); 46 | levelStart++; 47 | for(var i=0; i