├── .gitignore ├── LICENSE ├── README.md ├── image ├── charts.png ├── edit mode toggle.png ├── fillter.png ├── simple_UI.png └── simple_demo.gif ├── index.js ├── package.json ├── public ├── controller │ ├── directive_provider.js │ └── tableCtrl.js ├── dist │ ├── c3.css │ ├── c3.js │ ├── c3.min.js │ ├── c3_renderers.js │ ├── c3_renderers.js.map │ ├── c3_renderers.min.js │ ├── c3_renderers.min.js.map │ ├── d3_renderers.js │ ├── d3_renderers.js.map │ ├── d3_renderers.min.js │ ├── d3_renderers.min.js.map │ ├── export_renderers.js │ ├── export_renderers.js.map │ ├── export_renderers.min.js │ ├── export_renderers.min.js.map │ ├── gchart_renderers.js │ ├── gchart_renderers.js.map │ ├── gchart_renderers.min.js │ ├── gchart_renderers.min.js.map │ ├── jquery-ui.min.js │ ├── jquery.min.js │ ├── pivot.css │ ├── pivot.da.js │ ├── pivot.da.js.map │ ├── pivot.da.min.js │ ├── pivot.da.min.js.map │ ├── pivot.de.js │ ├── pivot.de.js.map │ ├── pivot.de.min.js │ ├── pivot.de.min.js.map │ ├── pivot.es.js │ ├── pivot.es.js.map │ ├── pivot.es.min.js │ ├── pivot.es.min.js.map │ ├── pivot.fr.js │ ├── pivot.fr.js.map │ ├── pivot.fr.min.js │ ├── pivot.fr.min.js.map │ ├── pivot.it.js │ ├── pivot.it.js.map │ ├── pivot.it.min.js │ ├── pivot.it.min.js.map │ ├── pivot.js │ ├── pivot.js.map │ ├── pivot.min.css │ ├── pivot.min.js │ ├── pivot.min.js.map │ ├── pivot.nl.js │ ├── pivot.nl.js.map │ ├── pivot.nl.min.js │ ├── pivot.nl.min.js.map │ ├── pivot.pl.js │ ├── pivot.pl.js.map │ ├── pivot.pl.min.js │ ├── pivot.pl.min.js.map │ ├── pivot.pt.js │ ├── pivot.pt.js.map │ ├── pivot.pt.min.js │ ├── pivot.pt.min.js.map │ ├── pivot.ru.js │ ├── pivot.ru.js.map │ ├── pivot.ru.min.js │ ├── pivot.ru.min.js.map │ ├── pivot.tr.js │ ├── pivot.tr.js.map │ ├── pivot.tr.min.js │ ├── pivot.tr.min.js.map │ ├── pivot.zh.js │ ├── pivot.zh.js.map │ ├── pivot.zh.min.js │ ├── pivot.zh.min.js.map │ ├── pivot_spec.js │ ├── pivot_spec.js.map │ ├── pivot_spec.min.js │ ├── pivot_spec.min.js.map │ └── tips_data.min.js ├── less │ └── main.less ├── templates │ ├── pivot_table.html │ └── pivot_table_editor.html └── vis.js ├── release ├── dv_install_script.sh ├── pivot_table-0.1.0.zip └── pivot_table-5.1.2.zip └── server ├── __tests__ └── index.js └── routes └── example.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | build/ 3 | local/ 4 | npm-debug.log* 5 | package-lock.json 6 | .project 7 | *.zip 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 datavoyagerhk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Pivot Table Plugin for Kibana 5 2 | 3 | A visualization plugin for kibana 5.x . 4 | 5 | Pivot tables are interactive tables that allow the user to group and summarize large amounts of data in a concise. 6 | 7 | Basically a wrapper of [Nicolas Kruchten's Pivot Table](http://nicolas.kruchten.com/pivottable/). 8 | 9 | ![image](https://raw.githubusercontent.com/datavoyagerhk/kibana-pivot-table/master/image/simple_demo.gif) 10 | 11 | ## Feature 12 | 13 | * drag and drop UI 14 | * filtering 15 | * charts 16 | 17 | ## Installation 18 | 19 | ```sh 20 | cd YOUR DOWNLOAD-DIRECTORY 21 | wget https://github.com/datavoyagerhk/kibana-pivot-table/releases/download/v0.1.0/pivot_table-v0.1.0.zip 22 | $KIBANA_HOME/bin/kibana-plugin install file:///YOUR-DOWNLOAD-DIRECTORY/pivot_table-v0.1.0.zip 23 | ``` 24 | 25 | example for Kibana installed with RPM on CentOS 26 | ``` 27 | wget https://github.com/datavoyagerhk/kibana-pivot-table/releases/download/v0.1.0/pivot_table-v0.1.0.zip 28 | /usr/share/bin/kibana-plugin install file:///tmp/pivot_table-v0.1.0.zip 29 | ``` 30 | 31 | ## development 32 | 33 | ### Setting up development environment 34 | 35 | 1. See the [kibana contributing guide](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md) for instructions setting up your development environment. Once you have completed that, use the following npm tasks. 36 | 37 | - `npm start` 38 | 39 | Start kibana and have it include this plugin 40 | 41 | - `npm start -- --config kibana.yml` 42 | 43 | You can pass any argument that you would normally send to `bin/kibana` by putting them after `--` when running `npm start` 44 | 45 | - `npm run build` 46 | 47 | Build a distributable archive 48 | 49 | - `npm run test:browser` 50 | 51 | Run the browser tests in a real web browser 52 | 53 | - `npm run test:server` 54 | 55 | Run the server tests using mocha 56 | 57 | For more information about any of these commands run `npm run ${task} -- --help`. 58 | 59 | 2. Clone this repository to the plugins folder of kibana. 60 | 61 | 3. Modify the contents of the config.json file to point to a local Kibana installation directory. 62 | 63 | ### Coding guidelines 64 | 65 | Please also see [wiki of Nicolas Kruchten's Pivot Table](https://github.com/nicolaskruchten/pivottable/wiki). 66 | 67 | ### Building a package 68 | 69 | 1. First go to the directory of the plugin 70 | 71 | ``` 72 | cd $KIBANA_HOME/plugins/pivot_table 73 | ``` 74 | 75 | 2. Modify the contents of package.json 76 | 77 | change the 'kibana' and '@elastic/plugin-helpers' version to the version of kibana you want to deploy. 78 | 79 | 3. Then create bundled zip file 80 | 81 | ``` 82 | npm run build 83 | ``` 84 | 85 | The bundled zip file will locate in: 86 | ```cd $KIBANA_HOME/kibana/plugins/pivot_table/build``` 87 | -------------------------------------------------------------------------------- /image/charts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewvann/kibana-pivot-table/7769791455eeb6a396a6de2fec9443e6e7c5cecb/image/charts.png -------------------------------------------------------------------------------- /image/edit mode toggle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewvann/kibana-pivot-table/7769791455eeb6a396a6de2fec9443e6e7c5cecb/image/edit mode toggle.png -------------------------------------------------------------------------------- /image/fillter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewvann/kibana-pivot-table/7769791455eeb6a396a6de2fec9443e6e7c5cecb/image/fillter.png -------------------------------------------------------------------------------- /image/simple_UI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewvann/kibana-pivot-table/7769791455eeb6a396a6de2fec9443e6e7c5cecb/image/simple_UI.png -------------------------------------------------------------------------------- /image/simple_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewvann/kibana-pivot-table/7769791455eeb6a396a6de2fec9443e6e7c5cecb/image/simple_demo.gif -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import exampleRoute from './server/routes/example'; 2 | 3 | export default function (kibana) { 4 | return new kibana.Plugin({ 5 | require: ['elasticsearch'], 6 | 7 | uiExports: { 8 | visTypes: [ 'plugins/pivot_table/vis' ] 9 | }, 10 | 11 | config(Joi) { 12 | return Joi.object({ 13 | enabled: Joi.boolean().default(true), 14 | }).default(); 15 | }, 16 | 17 | 18 | init(server, options) { 19 | // Add server routes and initalize the plugin here 20 | exampleRoute(server); 21 | } 22 | 23 | 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pivot_table", 3 | "version": "0.1.0", 4 | "description": "pivot_table", 5 | "main": "index.js", 6 | "kibana": { 7 | "version": "5.6.10" 8 | }, 9 | "scripts": { 10 | "lint": "eslint", 11 | "start": "plugin-helpers start", 12 | "test:server": "plugin-helpers test:server", 13 | "test:browser": "plugin-helpers test:browser", 14 | "build": "plugin-helpers build", 15 | "postinstall": "plugin-helpers postinstall" 16 | }, 17 | "devDependencies": { 18 | "@elastic/eslint-config-kibana": "0.0.2", 19 | "@elastic/plugin-helpers": "5.1.1", 20 | "babel-eslint": "4.1.8", 21 | "chai": "^3.5.0", 22 | "eslint": "1.10.3", 23 | "eslint-plugin-mocha": "1.1.0" 24 | }, 25 | "dependencies": { 26 | "c3": "^0.4.11" 27 | }, 28 | "build": { 29 | "git": {}, 30 | "date": "Thu Jan 19 2017 02:37:24 GMT-0500 (EST)" 31 | } 32 | } -------------------------------------------------------------------------------- /public/controller/directive_provider.js: -------------------------------------------------------------------------------- 1 | import { uiModules } from 'ui/modules'; 2 | 3 | uiModules.get('app/pivot_table', []) 4 | .directive('ngpivottable',function(){ 5 | var instances = 0; 6 | return{ 7 | restrict:"E", 8 | scope:{ 9 | vis:"=", 10 | uiState:"=", 11 | esResponse:"=" 12 | }, 13 | link: function($scope,element){ 14 | $scope.instance=element; 15 | instances++; 16 | }, 17 | controller: 'tableControler' 18 | }; 19 | }); 20 | -------------------------------------------------------------------------------- /public/controller/tableCtrl.js: -------------------------------------------------------------------------------- 1 | import { uiModules } from 'ui/modules'; 2 | import { AggResponseTabifyProvider } from 'ui/agg_response/tabify/tabify'; 3 | 4 | uiModules.get('app/pivot_table', []) 5 | .controller('tableControler',function($scope, $timeout,Private){ 6 | const tabifyAggResponse = Private(AggResponseTabifyProvider); 7 | $scope.title = 'Pivot Table'; 8 | $scope.description = 'pivot_table'; 9 | 10 | // 11 | //Pivot Table 12 | // 13 | 14 | //the table below is the config for initialize 15 | $scope.table = { 16 | data: [], 17 | config: { 18 | rows: [], 19 | cols: [], 20 | aggregatorName: "Count", 21 | vals: [] 22 | }, 23 | editMode: false, 24 | pristine: true 25 | }; 26 | // by default, edit mode must be false during initialization, otherwise it will cause Kibana to crash 27 | $scope.vis.params.editMode = false; 28 | $scope.table.editMode = $scope.vis.params.editMode; 29 | 30 | //PivotTable renderer 31 | $scope.renderPivotTable = function() { 32 | $($scope.instance).pivot($scope.table.data, { 33 | renderers: $.extend( 34 | $.pivotUtilities.renderers, 35 | $.pivotUtilities.c3_renderers 36 | ), 37 | rendererName: $scope.table.config.rendererName, 38 | // turn renderName into render function 39 | // https://github.com/nicolaskruchten/pivottable/issues/451 40 | renderer: $.pivotUtilities.renderers[$scope.table.config.rendererName], 41 | cols: $scope.table.config.cols, 42 | rows: $scope.table.config.rows, 43 | aggregator: $.pivotUtilities.aggregators[$scope.table.config.aggregatorName]($scope.table.config.vals), 44 | vals: $scope.table.config.vals, 45 | onRefresh: function(config) { 46 | var config_copy = JSON.parse(JSON.stringify(config)); 47 | //delete some values which are functions 48 | delete config_copy["aggregators"]; 49 | delete config_copy["renderers"]; 50 | delete config_copy["derivedAttributes"]; 51 | //delete some bulky default values 52 | delete config_copy["rendererOptions"]; 53 | delete config_copy["localeStrings"]; 54 | $scope.table.config = config_copy; 55 | $scope.$apply(); 56 | } 57 | }); 58 | }; 59 | 60 | //PivotTable renderer with drag and drop UI 61 | $scope.renderPivotUITable = function() { 62 | $($scope.instance).pivotUI($scope.table.data, { 63 | renderers: $.extend( 64 | $.pivotUtilities.renderers, 65 | $.pivotUtilities.c3_renderers 66 | ), 67 | // rendererName: "Table", 68 | rendererName: $scope.table.config.rendererName, 69 | renderer: $.pivotUtilities.renderers[$scope.table.config.rendererName], 70 | cols: $scope.table.config.cols, 71 | rows: $scope.table.config.rows, 72 | // aggregators: $.pivotUtilities.aggregators, 73 | aggregatorName: $scope.table.config.aggregatorName, 74 | vals: $scope.table.config.vals, 75 | onRefresh: function(config) { 76 | console.log("renderPivotUITable onRefresh"); 77 | var config_copy = JSON.parse(JSON.stringify(config)); 78 | //delete some values which are functions 79 | delete config_copy["aggregators"]; 80 | delete config_copy["renderers"]; 81 | delete config_copy["derivedAttributes"]; 82 | //delete some bulky default values 83 | delete config_copy["rendererOptions"]; 84 | delete config_copy["localeStrings"]; 85 | $scope.table.config = config_copy; 86 | $scope.$apply(); 87 | } 88 | }); 89 | }; 90 | 91 | $scope.updateUI = function(){ 92 | if ($scope.vis.params.editMode) { 93 | $scope.renderPivotUITable(); 94 | } else { 95 | $scope.renderPivotTable(); 96 | } 97 | }; 98 | //update UI when new config apply 99 | $scope.$watch('vis.params.editMode', function(newValue, oldValue) { 100 | $scope.updateUI(); 101 | }, true); 102 | $scope.$watch('table.config', function(newValue, oldValue) { 103 | $scope.updateUI(); 104 | if($scope.table.pristine==false){ 105 | $scope.uiState.set('config',$scope.table.config); 106 | console.log("$scope.uiState.set", $scope.table.config); 107 | } 108 | }, true); 109 | //update the config of table when open a saved visualization 110 | $scope.$watch('uiState', function(newValue, oldValue) { 111 | $scope.table.config=$scope.uiState.get('config',{rows: [],cols: [],aggregatorName: "Count",vals: []}); 112 | $scope.table.pristine=false; 113 | }, true); 114 | 115 | 116 | // 117 | //process the data from ES 118 | // 119 | //after process each entry, it would return a array of object 120 | //eg.[{ "ip: Descending": "28.168.231.16", "memory: Descending": 19400, "Count": 1 }, 121 | // { "ip: Descending": "140.87.53.85", "memory: Descending": 98560, "Count": 1 }, 122 | // { "ip: Descending": "140.87.53.85", "memory: Descending": 140960, "Count": 1 }] 123 | var processEntry = function(tabifyData){ 124 | var columnsName =[]; 125 | var result = []; 126 | for (var i = 0; i < tabifyData.tables[0]["columns"].length; i++) { 127 | columnsName.push(tabifyData.tables[0]["columns"][i]["title"]); 128 | } 129 | for (var rows = 0; rows < tabifyData.tables[0]["rows"].length; rows++) { 130 | var tempObj={}; 131 | for (var columns = 0; columns < columnsName.length; columns++) { 132 | tempObj[columnsName[columns]]=tabifyData.tables[0]["rows"][rows][columns]; 133 | } 134 | result.push(tempObj); 135 | } 136 | return result; 137 | }; 138 | 139 | //process data and update UI after query elastic search 140 | $scope.$watch('esResponse', function (resp) { 141 | if (resp) { 142 | var tabifyData = tabifyAggResponse($scope.vis, resp); 143 | 144 | $scope.table.data=processEntry(tabifyData); 145 | $scope.updateUI(); 146 | } 147 | }); 148 | 149 | }); 150 | -------------------------------------------------------------------------------- /public/dist/c3.css: -------------------------------------------------------------------------------- 1 | /*-- Chart --*/ 2 | .c3 svg { 3 | font: 10px sans-serif; 4 | -webkit-tap-highlight-color: transparent; } 5 | 6 | .c3 path, .c3 line { 7 | fill: none; 8 | stroke: #000; } 9 | 10 | .c3 text { 11 | -webkit-user-select: none; 12 | -moz-user-select: none; 13 | user-select: none; } 14 | 15 | .c3-legend-item-tile, 16 | .c3-xgrid-focus, 17 | .c3-ygrid, 18 | .c3-event-rect, 19 | .c3-bars path { 20 | shape-rendering: crispEdges; } 21 | 22 | .c3-chart-arc path { 23 | stroke: #fff; } 24 | 25 | .c3-chart-arc text { 26 | fill: #fff; 27 | font-size: 13px; } 28 | 29 | /*-- Axis --*/ 30 | /*-- Grid --*/ 31 | .c3-grid line { 32 | stroke: #aaa; } 33 | 34 | .c3-grid text { 35 | fill: #aaa; } 36 | 37 | .c3-xgrid, .c3-ygrid { 38 | stroke-dasharray: 3 3; } 39 | 40 | /*-- Text on Chart --*/ 41 | .c3-text.c3-empty { 42 | fill: #808080; 43 | font-size: 2em; } 44 | 45 | /*-- Line --*/ 46 | .c3-line { 47 | stroke-width: 1px; } 48 | 49 | /*-- Point --*/ 50 | .c3-circle._expanded_ { 51 | stroke-width: 1px; 52 | stroke: white; } 53 | 54 | .c3-selected-circle { 55 | fill: white; 56 | stroke-width: 2px; } 57 | 58 | /*-- Bar --*/ 59 | .c3-bar { 60 | stroke-width: 0; } 61 | 62 | .c3-bar._expanded_ { 63 | fill-opacity: 0.75; } 64 | 65 | /*-- Focus --*/ 66 | .c3-target.c3-focused { 67 | opacity: 1; } 68 | 69 | .c3-target.c3-focused path.c3-line, .c3-target.c3-focused path.c3-step { 70 | stroke-width: 2px; } 71 | 72 | .c3-target.c3-defocused { 73 | opacity: 0.3 !important; } 74 | 75 | /*-- Region --*/ 76 | .c3-region { 77 | fill: steelblue; 78 | fill-opacity: .1; } 79 | 80 | /*-- Brush --*/ 81 | .c3-brush .extent { 82 | fill-opacity: .1; } 83 | 84 | /*-- Select - Drag --*/ 85 | /*-- Legend --*/ 86 | .c3-legend-item { 87 | font-size: 12px; } 88 | 89 | .c3-legend-item-hidden { 90 | opacity: 0.15; } 91 | 92 | .c3-legend-background { 93 | opacity: 0.75; 94 | fill: white; 95 | stroke: lightgray; 96 | stroke-width: 1; } 97 | 98 | /*-- Title --*/ 99 | .c3-title { 100 | font: 14px sans-serif; } 101 | 102 | /*-- Tooltip --*/ 103 | .c3-tooltip-container { 104 | z-index: 10; } 105 | 106 | .c3-tooltip { 107 | border-collapse: collapse; 108 | border-spacing: 0; 109 | background-color: #fff; 110 | empty-cells: show; 111 | -webkit-box-shadow: 7px 7px 12px -9px #777777; 112 | -moz-box-shadow: 7px 7px 12px -9px #777777; 113 | box-shadow: 7px 7px 12px -9px #777777; 114 | opacity: 0.9; } 115 | 116 | .c3-tooltip tr { 117 | border: 1px solid #CCC; } 118 | 119 | .c3-tooltip th { 120 | background-color: #aaa; 121 | font-size: 14px; 122 | padding: 2px 5px; 123 | text-align: left; 124 | color: #FFF; } 125 | 126 | .c3-tooltip td { 127 | font-size: 13px; 128 | padding: 3px 6px; 129 | background-color: #fff; 130 | border-left: 1px dotted #999; } 131 | 132 | .c3-tooltip td > span { 133 | display: inline-block; 134 | width: 10px; 135 | height: 10px; 136 | margin-right: 6px; } 137 | 138 | .c3-tooltip td.value { 139 | text-align: right; } 140 | 141 | /*-- Area --*/ 142 | .c3-area { 143 | stroke-width: 0; 144 | opacity: 0.2; } 145 | 146 | /*-- Arc --*/ 147 | .c3-chart-arcs-title { 148 | dominant-baseline: middle; 149 | font-size: 1.3em; } 150 | 151 | .c3-chart-arcs .c3-chart-arcs-background { 152 | fill: #e0e0e0; 153 | stroke: none; } 154 | 155 | .c3-chart-arcs .c3-chart-arcs-gauge-unit { 156 | fill: #000; 157 | font-size: 16px; } 158 | 159 | .c3-chart-arcs .c3-chart-arcs-gauge-max { 160 | fill: #777; } 161 | 162 | .c3-chart-arcs .c3-chart-arcs-gauge-min { 163 | fill: #777; } 164 | 165 | .c3-chart-arc .c3-gauge-value { 166 | fill: #000; 167 | /* font-size: 28px !important;*/ } 168 | -------------------------------------------------------------------------------- /public/dist/c3_renderers.min.js: -------------------------------------------------------------------------------- 1 | (function(){var t;(t=function(t){return"object"==typeof exports&&"object"==typeof module?t(require("jquery"),require("c3")):"function"==typeof define&&define.amd?define(["jquery","c3"],t):t(jQuery,c3)})(function(t,e){var n;return n=function(n){return null==n&&(n={}),function(r,a){var o,l,i,s,c,u,h,d,g,p,f,y,x,v,b,j,z,w,A,k,m,C,S,q,B,F,H,_,K,T,L,N,P,Q,R,U,W,D,E,G,I,J,M,O,V,X,Y,Z,$,tt,et,nt,rt,at;if(b={localeStrings:{vs:"vs",by:"by"},c3:{}},a=t.extend(!0,{},b,a),null==(i=a.c3).size&&(i.size={}),null==(s=a.c3.size).width&&(s.width=window.innerWidth/1.4),null==(c=a.c3.size).height&&(c.height=window.innerHeight/1.4-50),null==n.type&&(n.type="line"),null==n.horizontal&&(n.horizontal=!1),null==n.stacked&&(n.stacked=!1),O=r.getRowKeys(),0===O.length&&O.push([]),y=r.getColKeys(),0===y.length&&y.push([]),k=function(){var t,e,n;for(n=[],t=0,e=y.length;e>t;t++)w=y[t],n.push(w.join("-"));return n}(),G=0,j=r.aggregatorName,r.valAttrs.length&&(j+="("+r.valAttrs.join(", ")+")"),"scatter"===n.type)for(X={x:{},y:{},t:{}},l=r.rowAttrs.concat(r.colAttrs),tt=null!=(Q=l[0])?Q:"",A=null!=(R=l[1])?R:"",z=l.slice(2).join("-"),$=tt,""!==A&&($+=" "+a.localeStrings.vs+" "+A),""!==z&&($+=" "+a.localeStrings.by+" "+z),m=0,B=O.length;B>m;m++)for(M=O[m],C=0,F=y.length;F>C;C++)f=y[C],o=r.getAggregator(M,f),null!=o.value()&&(nt=M.concat(f),Y=nt.slice(2).join("-"),""===Y&&(Y="series"),null==(u=X.x)[Y]&&(u[Y]=[]),null==(h=X.y)[Y]&&(h[Y]=[]),null==(d=X.t)[Y]&&(d[Y]=[]),X.y[Y].push(null!=(U=nt[0])?U:0),X.x[Y].push(null!=(W=nt[1])?W:0),X.t[Y].push(o.format(o.value())));else{for(L=0,S=0,H=k.length;H>S;S++)rt=k[S],L+=rt.length;for(L>50&&(G=45),x=[],q=0,_=O.length;_>q;q++){for(M=O[q],J=M.join("-"),I=[""===J?j:J],T=0,K=y.length;K>T;T++)f=y[T],et=parseFloat(r.getAggregator(M,f).value()),I.push(isFinite(et)?1>et?et.toPrecision(3):et.toFixed(3):null);x.push(I)}tt=j,n.horizontal?(A=r.rowAttrs.join("-"),z=r.colAttrs.join("-")):(A=r.colAttrs.join("-"),z=r.rowAttrs.join("-")),$=j,""!==A&&($+=" "+a.localeStrings.vs+" "+A),""!==z&&($+=" "+a.localeStrings.by+" "+z)}if(Z=t("

",{style:"text-align: center; font-weight: bold"}),Z.text($),P={axis:{rotated:n.horizontal,y:{label:tt},x:{label:A,tick:{rotate:G,multiline:!1}}},data:{type:n.type,order:null},tooltip:{grouped:!1},color:{pattern:["#3366cc","#dc3912","#ff9900","#109618","#990099","#0099c6","#dd4477","#66aa00","#b82e2e","#316395","#994499","#22aa99","#aaaa11","#6633cc","#e67300","#8b0707","#651067","#329262","#5574a6","#3b3eac"]}},P=t.extend(!0,{},P,a.c3),"scatter"===n.type){at={},N=0,v=[];for(V in X.x)N+=1,at[V]=V+"_x",v.push([V+"_x"].concat(X.x[V])),v.push([V].concat(X.y[V]));P.data.xs=at,P.data.columns=v,P.axis.x.tick={fit:!1},1===N&&(P.legend={show:!1}),P.tooltip.format={title:function(){return j},name:function(){return""},value:function(t,e,n,r){return X.t[n][r]}}}else P.axis.x.type="category",n.horizontal?(p=function(){var t,e,n;for(n=[],e=0,t=x.length;t>e;e++)g=x[e],n.push(g.shift());return n}(),1===p.length&&p[0]===j&&(p=[""]),P.axis.x.categories=p,1===k.length&&""===k[0]&&(k=[j]),x.unshift(k),P.data.rows=x):(P.axis.x.categories=k,P.data.columns=x);return n.stacked&&(P.data.groups=n.horizontal?[function(){var t,e,n;for(n=[],e=0,t=y.length;t>e;e++)rt=y[e],n.push(rt.join("-"));return n}()]:[function(){var t,e,n;for(n=[],e=0,t=O.length;t>e;e++)rt=O[e],n.push(rt.join("-"));return n}()]),D=t("

",{style:"display:none;"}).appendTo(t("body")),E=t("
").appendTo(D),P.bindto=E[0],e.generate(P),E.detach(),D.remove(),t("
").append(Z,E)}},t.pivotUtilities.c3_renderers={"Horizontal Bar Chart":n({type:"bar",horizontal:!0}),"Horizontal Stacked Bar Chart":n({type:"bar",stacked:!0,horizontal:!0}),"Bar Chart":n({type:"bar"}),"Stacked Bar Chart":n({type:"bar",stacked:!0}),"Line Chart":n(),"Area Chart":n({type:"area",stacked:!0}),"Scatter Chart":n({type:"scatter"})}})}).call(this); 2 | //# sourceMappingURL=c3_renderers.min.js.map -------------------------------------------------------------------------------- /public/dist/d3_renderers.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var callWithJQuery; 3 | 4 | callWithJQuery = function(pivotModule) { 5 | if (typeof exports === "object" && typeof module === "object") { 6 | return pivotModule(require("jquery"), require("d3")); 7 | } else if (typeof define === "function" && define.amd) { 8 | return define(["jquery", "d3"], pivotModule); 9 | } else { 10 | return pivotModule(jQuery, d3); 11 | } 12 | }; 13 | 14 | callWithJQuery(function($, d3) { 15 | return $.pivotUtilities.d3_renderers = { 16 | Treemap: function(pivotData, opts) { 17 | var addToTree, color, defaults, height, i, len, ref, result, rowKey, tree, treemap, value, width; 18 | defaults = { 19 | localeStrings: {}, 20 | d3: { 21 | width: function() { 22 | return $(window).width() / 1.4; 23 | }, 24 | height: function() { 25 | return $(window).height() / 1.4; 26 | } 27 | } 28 | }; 29 | opts = $.extend(true, {}, defaults, opts); 30 | result = $("
").css({ 31 | width: "100%", 32 | height: "100%" 33 | }); 34 | tree = { 35 | name: "All", 36 | children: [] 37 | }; 38 | addToTree = function(tree, path, value) { 39 | var child, i, len, newChild, ref, x; 40 | if (path.length === 0) { 41 | tree.value = value; 42 | return; 43 | } 44 | if (tree.children == null) { 45 | tree.children = []; 46 | } 47 | x = path.shift(); 48 | ref = tree.children; 49 | for (i = 0, len = ref.length; i < len; i++) { 50 | child = ref[i]; 51 | if (!(child.name === x)) { 52 | continue; 53 | } 54 | addToTree(child, path, value); 55 | return; 56 | } 57 | newChild = { 58 | name: x 59 | }; 60 | addToTree(newChild, path, value); 61 | return tree.children.push(newChild); 62 | }; 63 | ref = pivotData.getRowKeys(); 64 | for (i = 0, len = ref.length; i < len; i++) { 65 | rowKey = ref[i]; 66 | value = pivotData.getAggregator(rowKey, []).value(); 67 | if (value != null) { 68 | addToTree(tree, rowKey, value); 69 | } 70 | } 71 | color = d3.scale.category10(); 72 | width = opts.d3.width(); 73 | height = opts.d3.height(); 74 | treemap = d3.layout.treemap().size([width, height]).sticky(true).value(function(d) { 75 | return d.size; 76 | }); 77 | d3.select(result[0]).append("div").style("position", "relative").style("width", width + "px").style("height", height + "px").datum(tree).selectAll(".node").data(treemap.padding([15, 0, 0, 0]).value(function(d) { 78 | return d.value; 79 | }).nodes).enter().append("div").attr("class", "node").style("background", function(d) { 80 | if (d.children != null) { 81 | return "lightgrey"; 82 | } else { 83 | return color(d.name); 84 | } 85 | }).text(function(d) { 86 | return d.name; 87 | }).call(function() { 88 | this.style("left", function(d) { 89 | return d.x + "px"; 90 | }).style("top", function(d) { 91 | return d.y + "px"; 92 | }).style("width", function(d) { 93 | return Math.max(0, d.dx - 1) + "px"; 94 | }).style("height", function(d) { 95 | return Math.max(0, d.dy - 1) + "px"; 96 | }); 97 | }); 98 | return result; 99 | } 100 | }; 101 | }); 102 | 103 | }).call(this); 104 | 105 | //# sourceMappingURL=d3_renderers.js.map -------------------------------------------------------------------------------- /public/dist/d3_renderers.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["d3_renderers.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA,cAAA;;AAAA,EAAA,cAAA,GAAiB,SAAC,WAAD,GAAA;AACb,IAAA,IAAG,MAAA,CAAA,OAAA,KAAkB,QAAlB,IAA+B,MAAA,CAAA,MAAA,KAAiB,QAAnD;aACI,WAAA,CAAY,OAAA,CAAQ,QAAR,CAAZ,EAA+B,OAAA,CAAQ,IAAR,CAA/B,EADJ;KAAA,MAEK,IAAG,MAAA,CAAA,MAAA,KAAiB,UAAjB,IAAgC,MAAM,CAAC,GAA1C;aACD,MAAA,CAAO,CAAC,QAAD,EAAW,IAAX,CAAP,EAAyB,WAAzB,EADC;KAAA,MAAA;aAID,WAAA,CAAY,MAAZ,EAAoB,EAApB,EAJC;KAHQ;EAAA,CAAjB,CAAA;;AAAA,EASA,cAAA,CAAe,SAAC,CAAD,EAAI,EAAJ,GAAA;WAEX,CAAC,CAAC,cAAc,CAAC,YAAjB,GAAgC;AAAA,MAAA,OAAA,EAAS,SAAC,SAAD,EAAY,IAAZ,GAAA;AACrC,YAAA,4FAAA;AAAA,QAAA,QAAA,GACI;AAAA,UAAA,aAAA,EAAe,EAAf;AAAA,UACA,EAAA,EACI;AAAA,YAAA,KAAA,EAAO,SAAA,GAAA;qBAAG,CAAA,CAAE,MAAF,CAAS,CAAC,KAAV,CAAA,CAAA,GAAoB,IAAvB;YAAA,CAAP;AAAA,YACA,MAAA,EAAQ,SAAA,GAAA;qBAAG,CAAA,CA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,KATL,CASW,YATX,EASyB,SAAC,CAAD,GAAA;AAAO,UAAA,IAAG,kBAAH;mBAAoB,YAApB;WAAA,MAAA;mBAAqC,KAAA,CAAM,CAAC,CAAC,IAAR,EAArC;WAAP;QAAA,CATzB,CAUI,CAAC,IAVL,CAUW,SAAC,CAAD,GAAA;iBAAO,CAAC,CAAC,KAAT;QAAA,CAVX,CAWI,CAAC,IAXL,CAWU,SAAA,GAAA;AACE,UAAA,IAAI,CAAC,KAAL,CAAW,MAAX,EAAoB,SAAC,CAAD,GAAA;mBAAO,CAAC,CAAC,CAAF,GAAI,KAAX;UAAA,CAApB,CACI,CAAC,KADL,CACW,KADX,EACoB,SAAC,CAAD,GAAA;mBAAO,CAAC,CAAC,CAAF,GAAI,KAAX;UAAA,CADpB,CAEI,CAAC,KAFL,CAEW,OAFX,EAEoB,SAAC,CAAD,GAAA;mBAAO,IAAI,CAAC,GAAL,CAAS,CAAT,EAAY,CAAC,CAAC,EAAF,GAAO,CAAnB,CAAA,GAAsB,KAA7B;UAAA,CAFpB,CAGI,CAAC,KAHL,CAGW,QAHX,EAGoB,SAAC,CAAD,GAAA;mBAAO,IAAI,CAAC,GAAL,CAAS,CAAT,EAAY,CAAC,CAAC,EAAF,GAAO,CAAnB,CAAA,GAAsB,KAA7B;UAAA,CAHpB,CAAA,CADF;QAAA,CAXV,CAvCA,CAAA;AAyDA,eAAO,MAAP,CA1DqC;MAAA,CAAT;MAFrB;EAAA,CAAf,CATA,CAAA;AAAA","file":"d3_renderers.js","sourceRoot":"/source/","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"d3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"d3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, d3\n\ncallWithJQuery ($, d3) ->\n\n $.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->\n defaults =\n localeStrings: {}\n d3:\n width: -> $(window).width() / 1.4\n height: -> $(window).height() / 1.4\n\n opts = $.extend(true, {}, defaults, opts)\n\n\n result = $(\"
\").css(width: \"100%\", height: \"100%\")\n\n tree = name: \"All\", children: []\n addToTree = (tree, path, value) ->\n if path.length == 0\n tree.value = value\n return\n tree.children ?= []\n x = path.shift()\n for child in tree.children when child.name == x\n addToTree(child, path, value)\n return\n newChild = name: x\n addToTree(newChild, path, value)\n tree.children.push newChild\n\n for rowKey in pivotData.getRowKeys()\n value = pivotData.getAggregator(rowKey, []).value()\n if value?\n addToTree(tree, rowKey, value)\n\n color = d3.scale.category10()\n width = opts.d3.width()\n height = opts.d3.height()\n\n treemap = d3.layout.treemap()\n .size([width, height])\n .sticky(true)\n .value( (d) -> d.size )\n\n d3.select(result[0])\n .append(\"div\")\n .style(\"position\", \"relative\")\n .style(\"width\", width + \"px\")\n .style(\"height\", height + \"px\")\n .datum(tree).selectAll(\".node\")\n .data(treemap.padding([15,0,0,0]).value( (d) -> d.value ).nodes)\n .enter().append(\"div\")\n .attr(\"class\", \"node\")\n .style(\"background\", (d) -> if d.children? then \"lightgrey\" else color(d.name) )\n .text( (d) -> d.name )\n .call ->\n this.style(\"left\", (d) -> d.x+\"px\" )\n .style(\"top\", (d) -> d.y+\"px\" )\n .style(\"width\", (d) -> Math.max(0, d.dx - 1)+\"px\" )\n .style(\"height\",(d) -> Math.max(0, d.dy - 1)+\"px\" )\n return\n\n return result\n\n\n\n"]} -------------------------------------------------------------------------------- /public/dist/d3_renderers.min.js: -------------------------------------------------------------------------------- 1 | (function(){var e;(e=function(e){return"object"==typeof exports&&"object"==typeof module?e(require("jquery"),require("d3")):"function"==typeof define&&define.amd?define(["jquery","d3"],e):e(jQuery,d3)})(function(e,t){return e.pivotUtilities.d3_renderers={Treemap:function(n,i){var r,u,l,d,o,a,c,h,f,s,p,y,g;for(l={localeStrings:{},d3:{width:function(){return e(window).width()/1.4},height:function(){return e(window).height()/1.4}}},i=e.extend(!0,{},l,i),h=e("
").css({width:"100%",height:"100%"}),s={name:"All",children:[]},r=function(e,t,n){var i,u,l,d,o,a;if(0===t.length)return void(e.value=n);for(null==e.children&&(e.children=[]),a=t.shift(),o=e.children,u=0,l=o.length;l>u;u++)if(i=o[u],i.name===a)return void r(i,t,n);return d={name:a},r(d,t,n),e.children.push(d)},c=n.getRowKeys(),o=0,a=c.length;a>o;o++)f=c[o],y=n.getAggregator(f,[]).value(),null!=y&&r(s,f,y);return u=t.scale.category10(),g=i.d3.width(),d=i.d3.height(),p=t.layout.treemap().size([g,d]).sticky(!0).value(function(e){return e.size}),t.select(h[0]).append("div").style("position","relative").style("width",g+"px").style("height",d+"px").datum(s).selectAll(".node").data(p.padding([15,0,0,0]).value(function(e){return e.value}).nodes).enter().append("div").attr("class","node").style("background",function(e){return null!=e.children?"lightgrey":u(e.name)}).text(function(e){return e.name}).call(function(){this.style("left",function(e){return e.x+"px"}).style("top",function(e){return e.y+"px"}).style("width",function(e){return Math.max(0,e.dx-1)+"px"}).style("height",function(e){return Math.max(0,e.dy-1)+"px"})}),h}}})}).call(this); 2 | //# sourceMappingURL=d3_renderers.min.js.map -------------------------------------------------------------------------------- /public/dist/d3_renderers.min.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["/source/d3_renderers.coffee","d3_renderers.min.js"],"names":["callWithJQuery","pivotModule","exports","module","require","define","amd","jQuery","d3","$","pivotUtilities","d3_renderers","Treemap","pivotData","opts","addToTree","color","defaults","height","i","len","ref","result","rowKey","tree","treemap","value","width","localeStrings","window","extend","css","name","children","path","child","newChild","x","length","shift","push","getRowKeys","getAggregator","scale","category10","layout","size","sticky","d","select","append","style","datum","selectAll","data","padding","nodes","enter","attr","text","call","this","y","Math","max","dx","dy"],"mappings":"CAAA,WAAA,GAAAA,IAAAA,EAAiB,SAACC,GACd,MAAqB,gBAAlBC,UAAgD,gBAAjBC,QAC9BF,EAAYG,QAAQ,UAAWA,QAAQ,OAClB,kBAAjBC,SAAgCA,OAAOC,IAC3CD,QA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U,SAEjBO,EAAUjB,EAAGqC,OAAOpB,UACfqB,MAAMnB,EAAOT,IACb6B,QAAO,GACPrB,MAAO,SAACsB,GCyBX,MDzBiBA,GAAEF,OAErBtC,EAAGyC,OAAO3B,EAAO,IACZ4B,OAAO,OACHC,MAAM,WAAY,YAClBA,MAAM,QAASxB,EAAQ,MACvBwB,MAAM,SAAUjC,EAAS,MAC7BkC,MAAM5B,GAAM6B,UAAU,SAClBC,KAAK7B,EAAQ8B,SAAS,GAAG,EAAE,EAAE,IAAI7B,MAAO,SAACsB,GCoBhD,MDpBsDA,GAAEtB,QAAQ8B,OAC7DC,QAAQP,OAAO,OACfQ,KAAK,QAAS,QACdP,MAAM,aAAc,SAACH,GAAM,MAAG,OAAAA,EAAAf,SAAiB,YAAiBjB,EAAMgC,EAAEhB,QACxE2B,KAAM,SAACX,GCwBV,MDxBgBA,GAAEhB,OACf4B,KAAK,WACEC,KAAKV,MAAM,OAAS,SAACH,GCyB7B,MDzBmCA,GAAEX,EAAE,OAC1Bc,MAAM,MAAS,SAACH,GC0B7B,MD1BmCA,GAAEc,EAAE,OAC1BX,MAAM,QAAS,SAACH,GC2B7B,MD3BmCe,MAAKC,IAAI,EAAGhB,EAAEiB,GAAK,GAAG,OAC5Cd,MAAM,SAAS,SAACH,GC4B7B,MD5BmCe,MAAKC,IAAI,EAAGhB,EAAEkB,GAAK,GAAG,SAGtD5C,QCiCZsC,KAAKC","file":"d3_renderers.min.js","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"d3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"d3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, d3\n\ncallWithJQuery ($, d3) ->\n\n $.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->\n defaults =\n localeStrings: {}\n d3:\n width: -> $(window).width() / 1.4\n height: -> $(window).height() / 1.4\n\n opts = $.extend(true, {}, defaults, opts)\n\n\n result = $(\"
\").css(width: \"100%\", height: \"100%\")\n\n tree = name: \"All\", children: []\n addToTree = (tree, path, value) ->\n if path.length == 0\n tree.value = value\n return\n tree.children ?= []\n x = path.shift()\n for child in tree.children when child.name == x\n addToTree(child, path, value)\n return\n newChild = name: x\n addToTree(newChild, path, value)\n tree.children.push newChild\n\n for rowKey in pivotData.getRowKeys()\n value = pivotData.getAggregator(rowKey, []).value()\n if value?\n addToTree(tree, rowKey, value)\n\n color = d3.scale.category10()\n width = opts.d3.width()\n height = opts.d3.height()\n\n treemap = d3.layout.treemap()\n .size([width, height])\n .sticky(true)\n .value( (d) -> d.size )\n\n d3.select(result[0])\n .append(\"div\")\n .style(\"position\", \"relative\")\n .style(\"width\", width + \"px\")\n .style(\"height\", height + \"px\")\n .datum(tree).selectAll(\".node\")\n .data(treemap.padding([15,0,0,0]).value( (d) -> d.value ).nodes)\n .enter().append(\"div\")\n .attr(\"class\", \"node\")\n .style(\"background\", (d) -> if d.children? then \"lightgrey\" else color(d.name) )\n .text( (d) -> d.name )\n .call ->\n this.style(\"left\", (d) -> d.x+\"px\" )\n .style(\"top\", (d) -> d.y+\"px\" )\n .style(\"width\", (d) -> Math.max(0, d.dx - 1)+\"px\" )\n .style(\"height\",(d) -> Math.max(0, d.dy - 1)+\"px\" )\n return\n\n return result\n\n\n\n","(function(){var e;(e=function(e){return\"object\"==typeof exports&&\"object\"==typeof module?e(require(\"jquery\"),require(\"d3\")):\"function\"==typeof define&&define.amd?define([\"jquery\",\"d3\"],e):e(jQuery,d3)})(function(e,t){return e.pivotUtilities.d3_renderers={Treemap:function(n,i){var r,u,l,d,o,a,c,h,f,s,p,y,g;for(l={localeStrings:{},d3:{width:function(){return e(window).width()/1.4},height:function(){return e(window).height()/1.4}}},i=e.extend(!0,{},l,i),h=e(\"
\").css({width:\"100%\",height:\"100%\"}),s={name:\"All\",children:[]},r=function(e,t,n){var i,u,l,d,o,a;if(0===t.length)return void(e.value=n);for(null==e.children&&(e.children=[]),a=t.shift(),o=e.children,u=0,l=o.length;l>u;u++)if(i=o[u],i.name===a)return void r(i,t,n);return d={name:a},r(d,t,n),e.children.push(d)},c=n.getRowKeys(),o=0,a=c.length;a>o;o++)f=c[o],y=n.getAggregator(f,[]).value(),null!=y&&r(s,f,y);return u=t.scale.category10(),g=i.d3.width(),d=i.d3.height(),p=t.layout.treemap().size([g,d]).sticky(!0).value(function(e){return e.size}),t.select(h[0]).append(\"div\").style(\"position\",\"relative\").style(\"width\",g+\"px\").style(\"height\",d+\"px\").datum(s).selectAll(\".node\").data(p.padding([15,0,0,0]).value(function(e){return e.value}).nodes).enter().append(\"div\").attr(\"class\",\"node\").style(\"background\",function(e){return null!=e.children?\"lightgrey\":u(e.name)}).text(function(e){return e.name}).call(function(){this.style(\"left\",function(e){return e.x+\"px\"}).style(\"top\",function(e){return e.y+\"px\"}).style(\"width\",function(e){return Math.max(0,e.dx-1)+\"px\"}).style(\"height\",function(e){return Math.max(0,e.dy-1)+\"px\"})}),h}}})}).call(this);\n//# sourceMappingURL=d3_renderers.min.js.map"],"sourceRoot":"/source/"} -------------------------------------------------------------------------------- /public/dist/export_renderers.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var callWithJQuery; 3 | 4 | callWithJQuery = function(pivotModule) { 5 | if (typeof exports === "object" && typeof module === "object") { 6 | return pivotModule(require("jquery")); 7 | } else if (typeof define === "function" && define.amd) { 8 | return define(["jquery"], pivotModule); 9 | } else { 10 | return pivotModule(jQuery); 11 | } 12 | }; 13 | 14 | callWithJQuery(function($) { 15 | return $.pivotUtilities.export_renderers = { 16 | "TSV Export": function(pivotData, opts) { 17 | var agg, colAttrs, colKey, colKeys, defaults, i, j, k, l, len, len1, len2, len3, len4, len5, m, n, r, result, row, rowAttr, rowAttrs, rowKey, rowKeys, text; 18 | defaults = { 19 | localeStrings: {} 20 | }; 21 | opts = $.extend(true, {}, defaults, opts); 22 | rowKeys = pivotData.getRowKeys(); 23 | if (rowKeys.length === 0) { 24 | rowKeys.push([]); 25 | } 26 | colKeys = pivotData.getColKeys(); 27 | if (colKeys.length === 0) { 28 | colKeys.push([]); 29 | } 30 | rowAttrs = pivotData.rowAttrs; 31 | colAttrs = pivotData.colAttrs; 32 | result = []; 33 | row = []; 34 | for (i = 0, len = rowAttrs.length; i < len; i++) { 35 | rowAttr = rowAttrs[i]; 36 | row.push(rowAttr); 37 | } 38 | if (colKeys.length === 1 && colKeys[0].length === 0) { 39 | row.push(pivotData.aggregatorName); 40 | } else { 41 | for (j = 0, len1 = colKeys.length; j < len1; j++) { 42 | colKey = colKeys[j]; 43 | row.push(colKey.join("-")); 44 | } 45 | } 46 | result.push(row); 47 | for (k = 0, len2 = rowKeys.length; k < len2; k++) { 48 | rowKey = rowKeys[k]; 49 | row = []; 50 | for (l = 0, len3 = rowKey.length; l < len3; l++) { 51 | r = rowKey[l]; 52 | row.push(r); 53 | } 54 | for (m = 0, len4 = colKeys.length; m < len4; m++) { 55 | colKey = colKeys[m]; 56 | agg = pivotData.getAggregator(rowKey, colKey); 57 | if (agg.value() != null) { 58 | row.push(agg.value()); 59 | } else { 60 | row.push(""); 61 | } 62 | } 63 | result.push(row); 64 | } 65 | text = ""; 66 | for (n = 0, len5 = result.length; n < len5; n++) { 67 | r = result[n]; 68 | text += r.join("\t") + "\n"; 69 | } 70 | return $("