├── .gitignore ├── img ├── plugin.png ├── svgLoad.png ├── svgMetrics.png ├── svgDefaults.png ├── svgLocation.png ├── renderEditorTab.png ├── svgAttributes.png └── dataProcessingEditorTab.png ├── dist ├── libs │ └── d3 │ │ ├── img │ │ ├── axis-v3.png │ │ ├── axis-v4.png │ │ ├── pack-v3.png │ │ ├── pack-v4.png │ │ └── stratify.png │ │ ├── rollup.config.js │ │ ├── ISSUE_TEMPLATE.md │ │ ├── rollup.node.js │ │ ├── index.js │ │ ├── LICENSE │ │ ├── build │ │ ├── package.js │ │ └── d3.node.js │ │ ├── README.md │ │ └── package.json ├── features │ ├── feature │ │ ├── __feature__Editor.html │ │ ├── __feature__Defaults.js.map │ │ ├── __feature__Defaults.js │ │ ├── __feature__Editor.js.map │ │ ├── __feature__Controller.js.map │ │ ├── __feature__Editor.js │ │ └── __feature__Controller.js │ ├── panelActions │ │ ├── panelActionsEditor.html │ │ ├── panelActionsDefaults.js.map │ │ ├── panelActionsDefaults.js │ │ ├── panelActionsEditor.js.map │ │ ├── panelActionsEditor.js │ │ ├── panelActionsController.js.map │ │ └── panelActionsController.js │ ├── render │ │ ├── renderDefaults.js │ │ ├── renderDefaults.js.map │ │ ├── renderEditor.js │ │ └── renderEditor.html │ └── dataProcessing │ │ ├── dataProcessingEditor.html │ │ ├── dataProcessingDefaults.js │ │ ├── dataProcessingDefaults.js.map │ │ ├── dataProcessingEditor.js.map │ │ └── dataProcessingEditor.js ├── partials │ └── module.html ├── module.js.map ├── module.js ├── plugin.json ├── panelDefaults.js.map ├── panelDefaults.js ├── heatmapCtrl.js.map ├── heatmapCtrl.js └── README.md ├── src ├── libs │ └── d3 │ │ ├── img │ │ ├── axis-v3.png │ │ ├── axis-v4.png │ │ ├── pack-v3.png │ │ ├── pack-v4.png │ │ └── stratify.png │ │ ├── rollup.config.js │ │ ├── ISSUE_TEMPLATE.md │ │ ├── rollup.node.js │ │ ├── index.js │ │ ├── LICENSE │ │ ├── build │ │ ├── package.js │ │ └── d3.node.js │ │ ├── README.md │ │ └── package.json ├── module.js ├── features │ ├── feature │ │ ├── __feature__Editor.html │ │ ├── __feature__Defaults.ts │ │ ├── __feature__Editor.ts │ │ └── __feature__Controller.ts │ ├── panelActions │ │ ├── panelActionsEditor.html │ │ ├── panelActionsDefaults.ts │ │ ├── panelActionsEditor.ts │ │ └── panelActionsController.ts │ ├── render │ │ ├── renderDefaults.ts │ │ └── renderEditor.ts │ └── dataProcessing │ │ ├── dataProcessingDefaults.ts │ │ ├── dataProcessingEditor.html │ │ ├── dataProcessingEditor.ts │ │ └── dataProcessingController.ts ├── partials │ └── module.html ├── panelDefaults.js ├── plugin.json └── heatmapCtrl.js ├── docs ├── fonts │ ├── OpenSans-Bold-webfont.eot │ ├── OpenSans-Bold-webfont.woff │ ├── OpenSans-Italic-webfont.eot │ ├── OpenSans-Light-webfont.eot │ ├── OpenSans-Light-webfont.woff │ ├── OpenSans-Italic-webfont.woff │ ├── OpenSans-Regular-webfont.eot │ ├── OpenSans-Regular-webfont.woff │ ├── OpenSans-BoldItalic-webfont.eot │ ├── OpenSans-BoldItalic-webfont.woff │ ├── OpenSans-LightItalic-webfont.eot │ └── OpenSans-LightItalic-webfont.woff ├── scripts │ ├── linenumber.js │ └── prettify │ │ └── lang-css.js ├── index.html ├── styles │ ├── prettify-jsdoc.css │ ├── prettify-tomorrow.css │ └── jsdoc-default.css ├── features_panelActions_panelActionsController.ts.html ├── features_dataProcessing_dataProcessingEditor.ts.html ├── heatmapCtrl.js.html ├── panelActionsFeature.html ├── HeatmapController.html ├── features_render_renderEditor.ts.html ├── features_render_renderController.ts.html ├── features_dataProcessing_dataProcessingController.ts.html └── dataProcessingEditor.html ├── actualizar.sh ├── genDocs.sh ├── package.json ├── Gruntfile.js └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/**/* 2 | node_modules/* 3 | -------------------------------------------------------------------------------- /img/plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/img/plugin.png -------------------------------------------------------------------------------- /img/svgLoad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/img/svgLoad.png -------------------------------------------------------------------------------- /img/svgMetrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/img/svgMetrics.png -------------------------------------------------------------------------------- /img/svgDefaults.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/img/svgDefaults.png -------------------------------------------------------------------------------- /img/svgLocation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/img/svgLocation.png -------------------------------------------------------------------------------- /img/renderEditorTab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/img/renderEditorTab.png -------------------------------------------------------------------------------- /img/svgAttributes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/img/svgAttributes.png -------------------------------------------------------------------------------- /dist/libs/d3/img/axis-v3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/dist/libs/d3/img/axis-v3.png -------------------------------------------------------------------------------- /dist/libs/d3/img/axis-v4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/dist/libs/d3/img/axis-v4.png -------------------------------------------------------------------------------- /dist/libs/d3/img/pack-v3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/dist/libs/d3/img/pack-v3.png -------------------------------------------------------------------------------- /dist/libs/d3/img/pack-v4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/dist/libs/d3/img/pack-v4.png -------------------------------------------------------------------------------- /src/libs/d3/img/axis-v3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/src/libs/d3/img/axis-v3.png -------------------------------------------------------------------------------- /src/libs/d3/img/axis-v4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/src/libs/d3/img/axis-v4.png -------------------------------------------------------------------------------- /src/libs/d3/img/pack-v3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/src/libs/d3/img/pack-v3.png -------------------------------------------------------------------------------- /src/libs/d3/img/pack-v4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/src/libs/d3/img/pack-v4.png -------------------------------------------------------------------------------- /src/libs/d3/img/stratify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/src/libs/d3/img/stratify.png -------------------------------------------------------------------------------- /src/module.js: -------------------------------------------------------------------------------- 1 | import {HeatmapController} from './heatmapCtrl.js'; 2 | 3 | export{ HeatmapController as PanelCtrl }; 4 | -------------------------------------------------------------------------------- /dist/libs/d3/img/stratify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/dist/libs/d3/img/stratify.png -------------------------------------------------------------------------------- /img/dataProcessingEditorTab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/img/dataProcessingEditorTab.png -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/docs/fonts/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/docs/fonts/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/docs/fonts/OpenSans-Italic-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/docs/fonts/OpenSans-Light-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/docs/fonts/OpenSans-Light-webfont.woff -------------------------------------------------------------------------------- /dist/features/feature/__feature__Editor.html: -------------------------------------------------------------------------------- 1 |

esto es una prueba

2 | Haz click aqui 3 | -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/docs/fonts/OpenSans-Italic-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/docs/fonts/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/docs/fonts/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /src/features/feature/__feature__Editor.html: -------------------------------------------------------------------------------- 1 |

esto es una prueba

2 | Haz click aqui 3 | -------------------------------------------------------------------------------- /dist/features/panelActions/panelActionsEditor.html: -------------------------------------------------------------------------------- 1 |

esto es una prueba

2 | Haz click aqui 3 | -------------------------------------------------------------------------------- /docs/fonts/OpenSans-BoldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/docs/fonts/OpenSans-BoldItalic-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-BoldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/docs/fonts/OpenSans-BoldItalic-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-LightItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/docs/fonts/OpenSans-LightItalic-webfont.eot -------------------------------------------------------------------------------- /src/features/panelActions/panelActionsEditor.html: -------------------------------------------------------------------------------- 1 |

esto es una prueba

2 | Haz click aqui 3 | -------------------------------------------------------------------------------- /docs/fonts/OpenSans-LightItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Janchorizo/jancho-heatmap-panel/HEAD/docs/fonts/OpenSans-LightItalic-webfont.woff -------------------------------------------------------------------------------- /src/features/feature/__feature__Defaults.ts: -------------------------------------------------------------------------------- 1 | export const __feature__Defaults = { 2 | __feature__ : { 3 | feature: '__feature__', 4 | desc: '__feature__ description', 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /src/features/panelActions/panelActionsDefaults.ts: -------------------------------------------------------------------------------- 1 | export const panelActionsDefaults = { 2 | panelActions : { 3 | feature: 'panelActions', 4 | desc: 'panelActions description', 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /dist/partials/module.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | -------------------------------------------------------------------------------- /src/partials/module.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | -------------------------------------------------------------------------------- /actualizar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | service grafana-server stop 3 | rm -r /var/lib/grafana/plugins/jancho-heatmap-panel 4 | cp -r ../jancho-heatmap-panel /var/lib/grafana/plugins/jancho-heatmap-panel 5 | service grafana-server start 6 | service grafana-server restart 7 | -------------------------------------------------------------------------------- /dist/module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/module.js"],"names":["HeatmapController"],"mappings":";;;;;;;;AAAQA,uB,kBAAAA,iB;;;2BAEAA,iB","file":"module.js","sourcesContent":["import {HeatmapController} from './heatmapCtrl.js';\n\nexport{ HeatmapController as PanelCtrl };\n"]} -------------------------------------------------------------------------------- /dist/libs/d3/rollup.config.js: -------------------------------------------------------------------------------- 1 | import ascii from "rollup-plugin-ascii"; 2 | import node from "rollup-plugin-node-resolve"; 3 | 4 | export default { 5 | input: "index", 6 | plugins: [node(), ascii()], 7 | output: { 8 | extend: true, 9 | file: "build/d3.js", 10 | format: "umd", 11 | name: "d3" 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /src/libs/d3/rollup.config.js: -------------------------------------------------------------------------------- 1 | import ascii from "rollup-plugin-ascii"; 2 | import node from "rollup-plugin-node-resolve"; 3 | 4 | export default { 5 | input: "index", 6 | plugins: [node(), ascii()], 7 | output: { 8 | extend: true, 9 | file: "build/d3.js", 10 | format: "umd", 11 | name: "d3" 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /dist/module.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register(['./heatmapCtrl.js'], function (_export, _context) { 4 | "use strict"; 5 | 6 | var HeatmapController; 7 | return { 8 | setters: [function (_heatmapCtrlJs) { 9 | HeatmapController = _heatmapCtrlJs.HeatmapController; 10 | }], 11 | execute: function () { 12 | _export('PanelCtrl', HeatmapController); 13 | } 14 | }; 15 | }); 16 | //# sourceMappingURL=module.js.map 17 | -------------------------------------------------------------------------------- /dist/features/feature/__feature__Defaults.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../../src/features/feature/__feature__Defaults.ts"],"names":["__feature__Defaults","__feature__","feature","desc"],"mappings":";;;;;;;;;;qCAAaA,mB,GAAsB;AACjCC,qBAAc;AACZC,mBAAS,aADG;AAEZC,gBAAM;AAFM;AADmB,O","file":"__feature__Defaults.js","sourcesContent":["export const __feature__Defaults = {\n __feature__ : {\n feature: '__feature__',\n desc: '__feature__ description',\n },\n};\n"]} -------------------------------------------------------------------------------- /src/panelDefaults.js: -------------------------------------------------------------------------------- 1 | export const panelDefaults = { 2 | data : [], // data values from operating over the received 3 | mappedData : [], 4 | rawData: [], 5 | panelDivId: '', 6 | legend: { 7 | show: true, // disable/enable legend 8 | values: false, // disable/enable legend values 9 | min: false, 10 | max: false, 11 | current: false, 12 | total: false, 13 | avg: false 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /dist/features/panelActions/panelActionsDefaults.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../../src/features/panelActions/panelActionsDefaults.ts"],"names":["panelActionsDefaults","panelActions","feature","desc"],"mappings":";;;;;;;;;sCAAaA,oB,GAAuB;AAClCC,sBAAe;AACbC,mBAAS,cADI;AAEbC,gBAAM;AAFO;AADmB,O","file":"panelActionsDefaults.js","sourcesContent":["export const panelActionsDefaults = {\n panelActions : {\n feature: 'panelActions',\n desc: 'panelActions description',\n },\n};\n"]} -------------------------------------------------------------------------------- /dist/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "id":"jancho-heatmap-panel", 3 | "type":"panel", 4 | "name":"HP HeatMap", 5 | "info":{ 6 | "description":"Heatmap generator for visualization o timeseries data over SVG figures", 7 | "author":{ 8 | "name":"Alejandro Rodríguez Díaz", 9 | "url":"none" 10 | }, 11 | "keywords":["panel", "d3", "heatmap", "plugin"], 12 | "version":"1.1" 13 | }, 14 | "dependencies":{ 15 | "grafanaVersion":"5.0.3", 16 | "plugins":[] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "id":"jancho-heatmap-panel", 3 | "type":"panel", 4 | "name":"HP HeatMap", 5 | "info":{ 6 | "description":"Heatmap generator for visualization o timeseries data over SVG figures", 7 | "author":{ 8 | "name":"Alejandro Rodríguez Díaz", 9 | "url":"none" 10 | }, 11 | "keywords":["panel", "d3", "heatmap", "plugin"], 12 | "version":"1.1" 13 | }, 14 | "dependencies":{ 15 | "grafanaVersion":"5.0.3", 16 | "plugins":[] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /dist/features/feature/__feature__Defaults.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register([], function (_export, _context) { 4 | "use strict"; 5 | 6 | var __feature__Defaults; 7 | 8 | return { 9 | setters: [], 10 | execute: function () { 11 | _export('__feature__Defaults', __feature__Defaults = { 12 | __feature__: { 13 | feature: '__feature__', 14 | desc: '__feature__ description' 15 | } 16 | }); 17 | 18 | _export('__feature__Defaults', __feature__Defaults); 19 | } 20 | }; 21 | }); 22 | //# sourceMappingURL=__feature__Defaults.js.map 23 | -------------------------------------------------------------------------------- /dist/features/panelActions/panelActionsDefaults.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register([], function (_export, _context) { 4 | "use strict"; 5 | 6 | var panelActionsDefaults; 7 | return { 8 | setters: [], 9 | execute: function () { 10 | _export('panelActionsDefaults', panelActionsDefaults = { 11 | panelActions: { 12 | feature: 'panelActions', 13 | desc: 'panelActions description' 14 | } 15 | }); 16 | 17 | _export('panelActionsDefaults', panelActionsDefaults); 18 | } 19 | }; 20 | }); 21 | //# sourceMappingURL=panelActionsDefaults.js.map 22 | -------------------------------------------------------------------------------- /src/features/render/renderDefaults.ts: -------------------------------------------------------------------------------- 1 | export const renderDefaults = { 2 | render : { 3 | feature: 'render', 4 | desc: 'rendering SVG map', 5 | source: { 6 | local: true, 7 | remote: false 8 | }, 9 | baseMapRoute: 'public/plugins/jancho-heatmap-panel/resources/', 10 | elementIdentifyer:'sala', 11 | unknownDataColor: 'white', 12 | availableMaps: ['plano',], 13 | mapRoute: 'plano', 14 | mapUrl: '', 15 | legend:true, 16 | discrete_continuous: true, 17 | colors: ['rgb(98, 158, 81)', 'rgb(31, 29, 29)', 'red'], 18 | domain: [0, 10, 20], 19 | thresholds: [7.5, 15], 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /genDocs.sh: -------------------------------------------------------------------------------- 1 | mv ./dist ./_dist 2 | mv ./node_modules ./_node_modules 3 | echo ' 4 | { 5 | "plugins": [], 6 | "recurseDepth": 10, 7 | "source": { 8 | "includePattern": ".+\\.(t|j)s(doc|x)?$", 9 | "excludePattern": "(^|\\/|\\\\)_" 10 | }, 11 | "sourceType": "module", 12 | "tags": { 13 | "allowUnknownTags": true, 14 | "dictionaries": ["jsdoc","closure"] 15 | }, 16 | "templates": { 17 | "cleverLinks": false, 18 | "monospaceLinks": false 19 | } 20 | } 21 | 22 | ' > conf.json 23 | jsdoc -c conf.json --destination ./docs -r . 24 | rm conf.json 25 | mv ./_dist ./dist 26 | mv ./_node_modules ./node_modules 27 | -------------------------------------------------------------------------------- /dist/libs/d3/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | PLEASE READ THIS BEFORE SUBMITTING A NEW ISSUE. 2 | 3 | ARE YOU ASKING FOR HELP? Please use Stack Overflow tag d3.js and include a link to a live, minimal example, preferably on bl.ocks.org. If you have a question, consider the d3-js Google Group or the d3-js Slack. 4 | 5 | For more: https://gist.github.com/mbostock/7f063e44c57ecb5828dd5643e61f92d3 6 | 7 | ARE YOU REPORTING AN ISSUE? Please file an issue on the relevant D3 module, not here; see https://github.com/d3. Please isolate the specific methods that exhibit unexpected behavior and precisely describe how your expectations were not met. 8 | 9 | For more: https://gist.github.com/mbostock/370b737ce71bed0749e103b01ce1bfaf 10 | -------------------------------------------------------------------------------- /src/libs/d3/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | PLEASE READ THIS BEFORE SUBMITTING A NEW ISSUE. 2 | 3 | ARE YOU ASKING FOR HELP? Please use Stack Overflow tag d3.js and include a link to a live, minimal example, preferably on bl.ocks.org. If you have a question, consider the d3-js Google Group or the d3-js Slack. 4 | 5 | For more: https://gist.github.com/mbostock/7f063e44c57ecb5828dd5643e61f92d3 6 | 7 | ARE YOU REPORTING AN ISSUE? Please file an issue on the relevant D3 module, not here; see https://github.com/d3. Please isolate the specific methods that exhibit unexpected behavior and precisely describe how your expectations were not met. 8 | 9 | For more: https://gist.github.com/mbostock/370b737ce71bed0749e103b01ce1bfaf 10 | -------------------------------------------------------------------------------- /src/features/feature/__feature__Editor.ts: -------------------------------------------------------------------------------- 1 | export class __Feature__EditorController { 2 | constructor( $scope) { 3 | $scope.editor = this; 4 | this.panelCtrl = $scope.ctrl; 5 | this.panel = this.panelCtrl.panel; 6 | } 7 | 8 | hola(){ 9 | console.info('Qué pasa chavalada'); 10 | } 11 | } 12 | 13 | export function __feature__Editor( scope){ 14 | 'use strict'; 15 | let pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/__feature__/__feature__Editor.html'; 16 | return function(){ 17 | return{ 18 | restrict: 'E', 19 | scope: true, 20 | templateUrl: pathToTemplate, 21 | controller: __Feature__EditorController, 22 | }; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /src/features/panelActions/panelActionsEditor.ts: -------------------------------------------------------------------------------- 1 | export class PanelActionsEditorController { 2 | constructor( $scope) { 3 | $scope.editor = this; 4 | this.panelCtrl = $scope.ctrl; 5 | this.panel = this.panelCtrl.panel; 6 | } 7 | 8 | hola(){ 9 | console.info('Qué pasa panelActions'); 10 | } 11 | } 12 | 13 | export function panelActionsEditor( scope){ 14 | 'use strict'; 15 | let pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/panelActions/panelActionsEditor.html'; 16 | return function(){ 17 | return{ 18 | restrict: 'E', 19 | scope: true, 20 | templateUrl: pathToTemplate, 21 | controller: PanelActionsEditorController, 22 | }; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /dist/libs/d3/rollup.node.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"), 2 | rollup = require("rollup"), 3 | dependencies = require("./package.json").dependencies; 4 | 5 | rollup.rollup({ 6 | input: "index.js", 7 | external: Object.keys(dependencies) 8 | }).then(function(bundle) { 9 | return bundle.generate({format: "cjs"}); 10 | }).then(function(result) { 11 | var code = result.code + "Object.defineProperty(exports, \"event\", {get: function() { return d3Selection.event; }});\n"; 12 | return new Promise(function(resolve, reject) { 13 | fs.writeFile("build/d3.node.js", code, "utf8", function(error) { 14 | if (error) return reject(error); 15 | else resolve(); 16 | }); 17 | }); 18 | }).catch(abort); 19 | 20 | function abort(error) { 21 | console.error(error.stack); 22 | } 23 | -------------------------------------------------------------------------------- /src/libs/d3/rollup.node.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"), 2 | rollup = require("rollup"), 3 | dependencies = require("./package.json").dependencies; 4 | 5 | rollup.rollup({ 6 | input: "index.js", 7 | external: Object.keys(dependencies) 8 | }).then(function(bundle) { 9 | return bundle.generate({format: "cjs"}); 10 | }).then(function(result) { 11 | var code = result.code + "Object.defineProperty(exports, \"event\", {get: function() { return d3Selection.event; }});\n"; 12 | return new Promise(function(resolve, reject) { 13 | fs.writeFile("build/d3.node.js", code, "utf8", function(error) { 14 | if (error) return reject(error); 15 | else resolve(); 16 | }); 17 | }); 18 | }).catch(abort); 19 | 20 | function abort(error) { 21 | console.error(error.stack); 22 | } 23 | -------------------------------------------------------------------------------- /docs/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | /*global document */ 2 | (function() { 3 | var source = document.getElementsByClassName('prettyprint source linenums'); 4 | var i = 0; 5 | var lineNumber = 0; 6 | var lineId; 7 | var lines; 8 | var totalLines; 9 | var anchorHash; 10 | 11 | if (source && source[0]) { 12 | anchorHash = document.location.hash.substring(1); 13 | lines = source[0].getElementsByTagName('li'); 14 | totalLines = lines.length; 15 | 16 | for (; i < totalLines; i++) { 17 | lineNumber++; 18 | lineId = 'line' + lineNumber; 19 | lines[i].id = lineId; 20 | if (lineId === anchorHash) { 21 | lines[i].className += ' selected'; 22 | } 23 | } 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /docs/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jancho-heatmapGenerator-panel", 3 | "version": "1.0.0", 4 | "description": "Plugin for visualizing time series over SVG figures", 5 | "main": "Gruntfile.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Alejandro Rodríguez Díaz", 10 | "license": "ISC", 11 | "dependencies": { 12 | "babel": "^6.23.0", 13 | "babel-preset-es2015": "^6.24.1", 14 | "d3": "^4.13.0", 15 | "grunt": "^1.0.3", 16 | "grunt-babel": "^7.0.0", 17 | "grunt-contrib-clean": "^1.1.0", 18 | "grunt-contrib-copy": "^1.0.0", 19 | "grunt-contrib-uglify": "^3.3.0", 20 | "grunt-contrib-watch": "^1.0.0", 21 | "jsdoc": "^3.5.5" 22 | }, 23 | "devDependencies": { 24 | "babel-core": "^6.26.0", 25 | "babel-preset-env": "^1.6.1", 26 | "grunt-babel": "^7.0.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dist/panelDefaults.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/panelDefaults.js"],"names":["panelDefaults","data","mappedData","rawData","panelDivId","legend","show","values","min","max","current","total","avg"],"mappings":";;;;;;;;;qCAAaA,a,GAAgB;AACzBC,sBAAO,EADkB,EACT;AAChBC,4BAAa,EAFY;AAGzBC,yBAAS,EAHgB;AAIzBC,4BAAY,EAJa;AAKzBC,wBAAQ;AACJC,0BAAM,IADF,EACQ;AACZC,4BAAQ,KAFJ,EAEW;AACfC,yBAAK,KAHD;AAIJC,yBAAK,KAJD;AAKJC,6BAAS,KALL;AAMJC,2BAAO,KANH;AAOJC,yBAAK;AAPD;AALiB,a","file":"panelDefaults.js","sourcesContent":["export const panelDefaults = {\n data : [], // data values from operating over the received\n mappedData : [],\n rawData: [],\n panelDivId: '',\n legend: {\n show: true, // disable/enable legend\n values: false, // disable/enable legend values\n min: false,\n max: false,\n current: false,\n total: false,\n avg: false\n },\n};\n"]} -------------------------------------------------------------------------------- /dist/libs/d3/index.js: -------------------------------------------------------------------------------- 1 | export {version} from "./build/package"; 2 | export * from "d3-array"; 3 | export * from "d3-axis"; 4 | export * from "d3-brush"; 5 | export * from "d3-chord"; 6 | export * from "d3-collection"; 7 | export * from "d3-color"; 8 | export * from "d3-dispatch"; 9 | export * from "d3-drag"; 10 | export * from "d3-dsv"; 11 | export * from "d3-ease"; 12 | export * from "d3-force"; 13 | export * from "d3-format"; 14 | export * from "d3-geo"; 15 | export * from "d3-hierarchy"; 16 | export * from "d3-interpolate"; 17 | export * from "d3-path"; 18 | export * from "d3-polygon"; 19 | export * from "d3-quadtree"; 20 | export * from "d3-queue"; 21 | export * from "d3-random"; 22 | export * from "d3-request"; 23 | export * from "d3-scale"; 24 | export * from "d3-selection"; 25 | export * from "d3-shape"; 26 | export * from "d3-time"; 27 | export * from "d3-time-format"; 28 | export * from "d3-timer"; 29 | export * from "d3-transition"; 30 | export * from "d3-voronoi"; 31 | export * from "d3-zoom"; 32 | -------------------------------------------------------------------------------- /dist/panelDefaults.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register([], function (_export, _context) { 4 | "use strict"; 5 | 6 | var panelDefaults; 7 | return { 8 | setters: [], 9 | execute: function () { 10 | _export('panelDefaults', panelDefaults = { 11 | data: [], // data values from operating over the received 12 | mappedData: [], 13 | rawData: [], 14 | panelDivId: '', 15 | legend: { 16 | show: true, // disable/enable legend 17 | values: false, // disable/enable legend values 18 | min: false, 19 | max: false, 20 | current: false, 21 | total: false, 22 | avg: false 23 | } 24 | }); 25 | 26 | _export('panelDefaults', panelDefaults); 27 | } 28 | }; 29 | }); 30 | //# sourceMappingURL=panelDefaults.js.map 31 | -------------------------------------------------------------------------------- /src/libs/d3/index.js: -------------------------------------------------------------------------------- 1 | export {version} from "./build/package"; 2 | export * from "d3-array"; 3 | export * from "d3-axis"; 4 | export * from "d3-brush"; 5 | export * from "d3-chord"; 6 | export * from "d3-collection"; 7 | export * from "d3-color"; 8 | export * from "d3-dispatch"; 9 | export * from "d3-drag"; 10 | export * from "d3-dsv"; 11 | export * from "d3-ease"; 12 | export * from "d3-force"; 13 | export * from "d3-format"; 14 | export * from "d3-geo"; 15 | export * from "d3-hierarchy"; 16 | export * from "d3-interpolate"; 17 | export * from "d3-path"; 18 | export * from "d3-polygon"; 19 | export * from "d3-quadtree"; 20 | export * from "d3-queue"; 21 | export * from "d3-random"; 22 | export * from "d3-request"; 23 | export * from "d3-scale"; 24 | export * from "d3-selection"; 25 | export * from "d3-shape"; 26 | export * from "d3-time"; 27 | export * from "d3-time-format"; 28 | export * from "d3-timer"; 29 | export * from "d3-transition"; 30 | export * from "d3-voronoi"; 31 | export * from "d3-zoom"; 32 | -------------------------------------------------------------------------------- /dist/features/render/renderDefaults.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register([], function (_export, _context) { 4 | "use strict"; 5 | 6 | var renderDefaults; 7 | return { 8 | setters: [], 9 | execute: function () { 10 | _export('renderDefaults', renderDefaults = { 11 | render: { 12 | feature: 'render', 13 | desc: 'rendering SVG map', 14 | source: { 15 | local: true, 16 | remote: false 17 | }, 18 | baseMapRoute: 'public/plugins/jancho-heatmap-panel/resources/', 19 | elementIdentifyer: 'sala', 20 | unknownDataColor: 'white', 21 | availableMaps: ['plano'], 22 | mapRoute: 'plano', 23 | mapUrl: '', 24 | legend: true, 25 | discrete_continuous: true, 26 | colors: ['rgb(98, 158, 81)', 'rgb(31, 29, 29)', 'red'], 27 | domain: [0, 10, 20], 28 | thresholds: [7.5, 15] 29 | } 30 | }); 31 | 32 | _export('renderDefaults', renderDefaults); 33 | } 34 | }; 35 | }); 36 | //# sourceMappingURL=renderDefaults.js.map 37 | -------------------------------------------------------------------------------- /dist/features/render/renderDefaults.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../../src/features/render/renderDefaults.ts"],"names":["renderDefaults","render","feature","desc","source","local","remote","baseMapRoute","elementIdentifyer","unknownDataColor","availableMaps","mapRoute","mapUrl","legend","discrete_continuous","colors","domain","thresholds"],"mappings":";;;;;;;;;gCAAaA,c,GAAiB;AAC5BC,gBAAS;AACPC,mBAAS,QADF;AAEPC,gBAAM,mBAFC;AAGPC,kBAAQ;AACJC,mBAAO,IADH;AAEJC,oBAAQ;AAFJ,WAHD;AAOPC,wBAAc,gDAPP;AAQPC,6BAAkB,MARX;AASPC,4BAAkB,OATX;AAUPC,yBAAe,CAAC,OAAD,CAVR;AAWPC,oBAAU,OAXH;AAYPC,kBAAQ,EAZD;AAaPC,kBAAO,IAbA;AAcPC,+BAAqB,IAdd;AAePC,kBAAQ,CAAC,kBAAD,EAAqB,iBAArB,EAAwC,KAAxC,CAfD;AAgBPC,kBAAQ,CAAC,CAAD,EAAI,EAAJ,EAAQ,EAAR,CAhBD;AAiBPC,sBAAY,CAAC,GAAD,EAAM,EAAN;AAjBL;AADmB,O","file":"renderDefaults.js","sourcesContent":["export const renderDefaults = {\n render : {\n feature: 'render',\n desc: 'rendering SVG map',\n source: {\n local: true,\n remote: false\n },\n baseMapRoute: 'public/plugins/jancho-heatmap-panel/resources/',\n elementIdentifyer:'sala',\n unknownDataColor: 'white',\n availableMaps: ['plano',],\n mapRoute: 'plano',\n mapUrl: '',\n legend:true,\n discrete_continuous: true,\n colors: ['rgb(98, 158, 81)', 'rgb(31, 29, 29)', 'red'],\n domain: [0, 10, 20],\n thresholds: [7.5, 15],\n },\n};\n"]} -------------------------------------------------------------------------------- /src/features/dataProcessing/dataProcessingDefaults.ts: -------------------------------------------------------------------------------- 1 | export const dataProcessingDefaults = { 2 | dataProcessing : { 3 | feature: 'dataProcessing', 4 | desc: 'dataProcessing description', 5 | valueStat: 'current', 6 | showDescription: false, 7 | valueStatOptions: [ 8 | { value: 'min', text: 'Min', desc: 'Minimum value registered in the current data subset.' }, 9 | { value: 'max', text: 'Max', desc: 'Maximum value registered in the current data subset.' }, 10 | { value: 'avg', text: 'Average', desc: 'Average value registered in the current data subset.' }, 11 | { value: 'current', text: 'Current', desc: 'Current value registered in the current data subset.' }, 12 | { value: 'total', text: 'Total', desc: 'Acumulated sum of the values registered in the current data subset.' }, 13 | { value: 'first', text: 'First', desc: 'First value registered in the current data subset.' }, 14 | { value: 'diff', text: 'Difference', desc: 'Greatest difference between two consequent values in the current data subset.' }, 15 | { value: 'range', text: 'Range', desc: 'Difference between the maximum and minimum values of the current data subset' }, 16 | { value: 'last_time', text: 'Time of last point', desc: 'Last time register for the data subset. (Useful to see update time disparities)' }, 17 | ], 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /dist/features/feature/__feature__Editor.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../../src/features/feature/__feature__Editor.ts"],"names":["__feature__Editor","scope","pathToTemplate","ctrl","panel","type","restrict","templateUrl","controller","__Feature__EditorController","$scope","editor","panelCtrl","console","info"],"mappings":";;;;;;;;;;;;;AAYO,WAASA,iBAAT,CAA4BC,KAA5B,EAAkC;AACvC;;AACA,QAAIC,iBAAiB,oBAAoBD,MAAME,IAAN,CAAWC,KAAX,CAAiBC,IAArC,GAA4C,8CAAjE;AACA,WAAO,YAAU;AACf,aAAM;AACJC,kBAAU,GADN;AAEJL,eAAO,IAFH;AAGJM,qBAAaL,cAHT;AAIJM,oBAAYC;AAJR,OAAN;AAMD,KAPD;AAQD;;+BAXeT,iB;;;;;;;;;;;;;;;;;;;;;;;6CAZHS,2B;AACX,6CAAaC,MAAb,EAAqB;AAAA;;AACnBA,iBAAOC,MAAP,GAAgB,IAAhB;AACA,eAAKC,SAAL,GAAiBF,OAAOP,IAAxB;AACA,eAAKC,KAAL,GAAa,KAAKQ,SAAL,CAAeR,KAA5B;AACD;;;;iCAEK;AACJS,oBAAQC,IAAR,CAAa,oBAAb;AACD","file":"__feature__Editor.js","sourcesContent":["export class __Feature__EditorController {\n constructor( $scope) {\n $scope.editor = this;\n this.panelCtrl = $scope.ctrl;\n this.panel = this.panelCtrl.panel;\n }\n\n hola(){\n console.info('Qué pasa chavalada');\n }\n}\n\nexport function __feature__Editor( scope){\n 'use strict';\n let pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/__feature__/__feature__Editor.html';\n return function(){\n return{\n restrict: 'E',\n scope: true,\n templateUrl: pathToTemplate,\n controller: __Feature__EditorController,\n };\n };\n}\n"]} -------------------------------------------------------------------------------- /dist/features/panelActions/panelActionsEditor.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../../src/features/panelActions/panelActionsEditor.ts"],"names":["panelActionsEditor","scope","pathToTemplate","ctrl","panel","type","restrict","templateUrl","controller","PanelActionsEditorController","$scope","editor","panelCtrl","console","info"],"mappings":";;;;;;;;;;;;;AAYO,WAASA,kBAAT,CAA6BC,KAA7B,EAAmC;AACxC;;AACA,QAAIC,iBAAiB,oBAAoBD,MAAME,IAAN,CAAWC,KAAX,CAAiBC,IAArC,GAA4C,gDAAjE;AACA,WAAO,YAAU;AACf,aAAM;AACJC,kBAAU,GADN;AAEJL,eAAO,IAFH;AAGJM,qBAAaL,cAHT;AAIJM,oBAAYC;AAJR,OAAN;AAMD,KAPD;AAQD;;gCAXeT,kB;;;;;;;;;;;;;;;;;;;;;;;8CAZHS,4B;AACX,8CAAaC,MAAb,EAAqB;AAAA;;AACnBA,iBAAOC,MAAP,GAAgB,IAAhB;AACA,eAAKC,SAAL,GAAiBF,OAAOP,IAAxB;AACA,eAAKC,KAAL,GAAa,KAAKQ,SAAL,CAAeR,KAA5B;AACD;;;;iCAEK;AACJS,oBAAQC,IAAR,CAAa,uBAAb;AACD","file":"panelActionsEditor.js","sourcesContent":["export class PanelActionsEditorController {\n constructor( $scope) {\n $scope.editor = this;\n this.panelCtrl = $scope.ctrl;\n this.panel = this.panelCtrl.panel;\n }\n\n hola(){\n console.info('Qué pasa panelActions');\n }\n}\n\nexport function panelActionsEditor( scope){\n 'use strict';\n let pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/panelActions/panelActionsEditor.html';\n return function(){\n return{\n restrict: 'E',\n scope: true,\n templateUrl: pathToTemplate,\n controller: PanelActionsEditorController,\n };\n };\n}\n"]} -------------------------------------------------------------------------------- /src/features/feature/__feature__Controller.ts: -------------------------------------------------------------------------------- 1 | import {MetricsPanelCtrl} from 'app/plugins/sdk'; 2 | import TimeSeries from 'app/core/time_series2'; 3 | import _ from 'lodash'; 4 | //import * as d3 from './libs/d3/build/d3.js' ; 5 | 6 | import { __feature__Defaults } from "./__feature__Defaults.js"; 7 | import { __feature__Editor } from "./__feature__Editor.js"; 8 | 9 | export default class Feature{ 10 | constructor( $scope){ 11 | this.$scope = $scope; 12 | this.panelController = $scope.ctrl; 13 | this.panel = $scope.ctrl.panel; 14 | 15 | const defaults = _.cloneDeep(__feature__Defaults) 16 | _.defaults( this.panel, defaults); 17 | 18 | this.panelController.events.on( 'init-edit-mode', this.onInitEditMode.bind(this)); 19 | //this.panelController.events.on( 'data-received', this.onDataReceived.bind(this)); 20 | //this.panelController.events.on( 'panel-initialized', this.onPanelInitialized.bind(this)); 21 | //this.panelController.events.on( 'render', this.onRender.bind(this)); 22 | //this.panelController.events.on( 'refresh', this.onRefresh.bind(this)); 23 | //this.events.on('init-panel-actions', this.onInitPanelActions.bind(this)); 24 | } 25 | 26 | onInitEditMode(){ 27 | this.panelController.addEditorTab( '__Feature__', __feature__Editor( this.$scope), 2); 28 | } 29 | 30 | onInitPanelActions(actions) { 31 | actions.push({text: 'event button text', click: 'ctrl.panelEvent()'}); 32 | } 33 | 34 | panelEvent(){} 35 | } 36 | -------------------------------------------------------------------------------- /dist/features/dataProcessing/dataProcessingEditor.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Values
4 |

Select the statistic to represent on the SVG resource.

5 | 20 |
21 |
22 |
Available statistics
23 |

A complete list of available statistics for incoming data.

24 | 29 |
30 |
31 | -------------------------------------------------------------------------------- /src/features/dataProcessing/dataProcessingEditor.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Values
4 |

Select the statistic to represent on the SVG resource.

5 | 20 |
21 |
22 |
Available statistics
23 |

A complete list of available statistics for incoming data.

24 | 29 |
30 |
31 | -------------------------------------------------------------------------------- /dist/libs/d3/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2010-2017 Mike Bostock 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, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of contributors may be used to 15 | endorse or promote products derived from this software without specific prior 16 | written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /src/libs/d3/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2010-2017 Mike Bostock 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, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of contributors may be used to 15 | endorse or promote products derived from this software without specific prior 16 | written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Home 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Home

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |

30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
51 | 52 | 55 | 56 |
57 | 58 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /dist/features/dataProcessing/dataProcessingDefaults.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register([], function (_export, _context) { 4 | "use strict"; 5 | 6 | var dataProcessingDefaults; 7 | return { 8 | setters: [], 9 | execute: function () { 10 | _export('dataProcessingDefaults', dataProcessingDefaults = { 11 | dataProcessing: { 12 | feature: 'dataProcessing', 13 | desc: 'dataProcessing description', 14 | valueStat: 'current', 15 | showDescription: false, 16 | valueStatOptions: [{ value: 'min', text: 'Min', desc: 'Minimum value registered in the current data subset.' }, { value: 'max', text: 'Max', desc: 'Maximum value registered in the current data subset.' }, { value: 'avg', text: 'Average', desc: 'Average value registered in the current data subset.' }, { value: 'current', text: 'Current', desc: 'Current value registered in the current data subset.' }, { value: 'total', text: 'Total', desc: 'Acumulated sum of the values registered in the current data subset.' }, { value: 'first', text: 'First', desc: 'First value registered in the current data subset.' }, { value: 'diff', text: 'Difference', desc: 'Greatest difference between two consequent values in the current data subset.' }, { value: 'range', text: 'Range', desc: 'Difference between the maximum and minimum values of the current data subset' }, { value: 'last_time', text: 'Time of last point', desc: 'Last time register for the data subset. (Useful to see update time disparities)' }] 17 | } 18 | }); 19 | 20 | _export('dataProcessingDefaults', dataProcessingDefaults); 21 | } 22 | }; 23 | }); 24 | //# sourceMappingURL=dataProcessingDefaults.js.map 25 | -------------------------------------------------------------------------------- /src/features/dataProcessing/dataProcessingEditor.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @alias dataProcessingEditor 4 | * @classdesc

dataProcessing editor controller

5 | * Implementation for a feature editor.
6 | * Controller for the editor tab of the plugin for this specific feature.
7 | * It is the controller of the AngularJS component for the editor 8 | *
9 | */ 10 | export class DataProcessingEditorController { 11 | /** 12 | * constructor - description 13 | * 14 | * @param {type} $scope A reference to the plugin's scope for editing panel's variables 15 | * @return {type} New instance of DataProcessingEditorController 16 | * @memberof dataProcessingEditor 17 | */ 18 | constructor( $scope) { 19 | $scope.editor = this; 20 | this.panelCtrl = $scope.ctrl; 21 | this.panel = this.panelCtrl.panel; 22 | } 23 | 24 | /** 25 | * toggleDescVisibility - handler for an editor tab event
26 | * Toggles the state of showDescription variable to display or not
27 | * the descriptions for the data mapping options. 28 | * 29 | * @memberof dataProcessingEditor 30 | */ 31 | toggleDescVisibility(){ 32 | this.panel.dataProcessing.showDescription = !this.panel.dataProcessing.showDescription; 33 | } 34 | } 35 | 36 | /** 37 | * dataProcessingEditor - function exported to be used as the AngularJs component 38 | * 39 | * @param {type} scope A reference to the scope of the plugin to route functions and variables 40 | * @return AngularJS Component New dataProcessingEditor 41 | * @memberof dataProcessingEditor 42 | */ 43 | export function dataProcessingEditor( scope){ 44 | 'use strict'; 45 | let pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/dataProcessing/dataProcessingEditor.html'; 46 | return function(){ 47 | return{ 48 | restrict: 'E', 49 | scope: true, 50 | templateUrl: pathToTemplate, 51 | controller: DataProcessingEditorController, 52 | }; 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /src/features/panelActions/panelActionsController.ts: -------------------------------------------------------------------------------- 1 | import {MetricsPanelCtrl} from 'app/plugins/sdk'; 2 | import TimeSeries from 'app/core/time_series2'; 3 | import _ from 'lodash'; 4 | import * as d3 from '../.././libs/d3/build/d3.js' ; 5 | 6 | import { panelActionsDefaults } from "./panelActionsDefaults.js"; 7 | import { panelActionsEditor } from "./panelActionsEditor.js"; 8 | 9 | /** 10 | * @alias panelActionsFeature 11 | * @classdesc

panelActions feature

12 | * Implementación de una funcionalidad
13 | * Mediante el patrón mediador, se suscribe a los eventos del plugin a través 14 | * de la referencia al $scope que se le pasa. 15 | *
16 | *

Funcionalidad

17 | * Proporciona funcionalidad añadida para el menú contextual del panel
18 | *

Eventos suscritos

19 | * ninguno 20 | */ 21 | export default class Feature{ 22 | /** 23 | * constructor - description 24 | * 25 | * @param {type} $scope Es el contexto del plugin que se pasa para poder suscribirse 26 | * a los eventos. 27 | * @return {type} Nueva instancia de un Feature 28 | */ 29 | constructor( $scope){ 30 | this.$scope = $scope; 31 | this.panelController = $scope.ctrl; 32 | _.defaults( this.panelController.panel, panelActionsDefaults); 33 | 34 | //this.panelController.events.on( 'init-edit-mode', this.onInitEditMode.bind(this)); 35 | //this.panelController.events.on( 'data-received', this.onDataReceived); 36 | //this.panelController.events.on( 'panel-initialized', this.onPanelInitialized); 37 | this.panelController.events.on( 'render', this.onRender); 38 | //this.panelController.events.on( 'refresh', this.onRefresh); 39 | this.panelController.events.on('init-panel-actions', this.onInitPanelActions.bind(this)); 40 | 41 | } 42 | 43 | onInitPanelActions(actions) { 44 | actions.push({text: 'Toggle legend', click: 'ctrl.panelEvent()'}); 45 | } 46 | //onInitEditMode(){ 47 | // this.panelController.addEditorTab( 'PanelActions', panelActionsEditor( this.$scope), 2); 48 | //} 49 | panelEvent(){ 50 | 51 | 52 | } 53 | 54 | onRender(){ 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /docs/styles/prettify-jsdoc.css: -------------------------------------------------------------------------------- 1 | /* JSDoc prettify.js theme */ 2 | 3 | /* plain text */ 4 | .pln { 5 | color: #000000; 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | /* string content */ 11 | .str { 12 | color: #006400; 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | 17 | /* a keyword */ 18 | .kwd { 19 | color: #000000; 20 | font-weight: bold; 21 | font-style: normal; 22 | } 23 | 24 | /* a comment */ 25 | .com { 26 | font-weight: normal; 27 | font-style: italic; 28 | } 29 | 30 | /* a type name */ 31 | .typ { 32 | color: #000000; 33 | font-weight: normal; 34 | font-style: normal; 35 | } 36 | 37 | /* a literal value */ 38 | .lit { 39 | color: #006400; 40 | font-weight: normal; 41 | font-style: normal; 42 | } 43 | 44 | /* punctuation */ 45 | .pun { 46 | color: #000000; 47 | font-weight: bold; 48 | font-style: normal; 49 | } 50 | 51 | /* lisp open bracket */ 52 | .opn { 53 | color: #000000; 54 | font-weight: bold; 55 | font-style: normal; 56 | } 57 | 58 | /* lisp close bracket */ 59 | .clo { 60 | color: #000000; 61 | font-weight: bold; 62 | font-style: normal; 63 | } 64 | 65 | /* a markup tag name */ 66 | .tag { 67 | color: #006400; 68 | font-weight: normal; 69 | font-style: normal; 70 | } 71 | 72 | /* a markup attribute name */ 73 | .atn { 74 | color: #006400; 75 | font-weight: normal; 76 | font-style: normal; 77 | } 78 | 79 | /* a markup attribute value */ 80 | .atv { 81 | color: #006400; 82 | font-weight: normal; 83 | font-style: normal; 84 | } 85 | 86 | /* a declaration */ 87 | .dec { 88 | color: #000000; 89 | font-weight: bold; 90 | font-style: normal; 91 | } 92 | 93 | /* a variable name */ 94 | .var { 95 | color: #000000; 96 | font-weight: normal; 97 | font-style: normal; 98 | } 99 | 100 | /* a function name */ 101 | .fun { 102 | color: #000000; 103 | font-weight: bold; 104 | font-style: normal; 105 | } 106 | 107 | /* Specify class=linenums on a pre to get line numbering */ 108 | ol.linenums { 109 | margin-top: 0; 110 | margin-bottom: 0; 111 | } 112 | -------------------------------------------------------------------------------- /src/heatmapCtrl.js: -------------------------------------------------------------------------------- 1 | import {MetricsPanelCtrl} from 'app/plugins/sdk'; 2 | import _ from 'lodash'; 3 | 4 | import { panelDefaults } from './panelDefaults.js'; 5 | 6 | import RenderFeature from './features/render/renderController.js'; 7 | import PanelActionsFeature from './features/panelActions/panelActionsController.js'; 8 | import DataProcessingFeature from './features/dataProcessing/dataProcessingController.js' 9 | 10 | 11 | /** 12 | * HeatmapController - Class HeatmapController 13 | *
14 | * Implements the responsabilities pattern, and acts as mediator for the plugin's 15 | * events.

16 | * The $scope and $injector of this parent class is passed to each new instance 17 | * of a feature to make it posible for the feature to subscribe to Grafana events. 18 | *

19 | * The class does not implement any kind of functionality, nor control. Each new 20 | * instance of a feature is responsible of implementing any of it, and should not 21 | * make assumptions about the existance of other plugins; otherwise should be 22 | * specified.

23 | * Actually, the following features:
24 | * 29 | */ 30 | export class HeatmapController extends MetricsPanelCtrl{ 31 | 32 | /** 33 | * constructor - Constructor for HeatmapController 34 | *
35 | * Instances each one of the registered features. 36 | * 37 | * @param {type} $scope description 38 | * @param {type} $injector description 39 | * @return {type} New panel plugin controller 40 | */ 41 | constructor( $scope, $injector){ 42 | super( $scope, $injector); 43 | const defaults = _.cloneDeep(panelDefaults); 44 | this.panel = _.defaultsDeep( this.panel, defaults); 45 | this.panel.panelDivId = 'heatmap-'+this.$scope.$id; 46 | 47 | this.dataProcessingFeature = new DataProcessingFeature( this.$scope); 48 | this.panelActionsFeature = new PanelActionsFeature( this.$scope); 49 | this.renderFeature = new RenderFeature( this.$scope); 50 | 51 | this.refresh(); 52 | this.render(); 53 | } 54 | } 55 | 56 | HeatmapController.templateUrl = 'partials/module.html'; 57 | -------------------------------------------------------------------------------- /dist/features/dataProcessing/dataProcessingDefaults.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../../src/features/dataProcessing/dataProcessingDefaults.ts"],"names":["dataProcessingDefaults","dataProcessing","feature","desc","valueStat","showDescription","valueStatOptions","value","text"],"mappings":";;;;;;;;;wCAAaA,sB,GAAyB;AACpCC,wBAAiB;AACfC,mBAAS,gBADM;AAEfC,gBAAM,4BAFS;AAGfC,qBAAW,SAHI;AAIfC,2BAAiB,KAJF;AAKfC,4BAAkB,CAChB,EAAEC,OAAO,KAAT,EAAgBC,MAAM,KAAtB,EAA6BL,MAAM,sDAAnC,EADgB,EAEhB,EAAEI,OAAO,KAAT,EAAgBC,MAAM,KAAtB,EAA6BL,MAAM,sDAAnC,EAFgB,EAGhB,EAAEI,OAAO,KAAT,EAAgBC,MAAM,SAAtB,EAAiCL,MAAM,sDAAvC,EAHgB,EAIhB,EAAEI,OAAO,SAAT,EAAoBC,MAAM,SAA1B,EAAqCL,MAAM,sDAA3C,EAJgB,EAKhB,EAAEI,OAAO,OAAT,EAAkBC,MAAM,OAAxB,EAAiCL,MAAM,qEAAvC,EALgB,EAMhB,EAAEI,OAAO,OAAT,EAAkBC,MAAM,OAAxB,EAAiCL,MAAM,oDAAvC,EANgB,EAOhB,EAAEI,OAAO,MAAT,EAAiBC,MAAM,YAAvB,EAAqCL,MAAM,+EAA3C,EAPgB,EAQhB,EAAEI,OAAO,OAAT,EAAkBC,MAAM,OAAxB,EAAiCL,MAAM,8EAAvC,EARgB,EAShB,EAAEI,OAAO,WAAT,EAAsBC,MAAM,oBAA5B,EAAkDL,MAAM,iFAAxD,EATgB;AALH;AADmB,O","file":"dataProcessingDefaults.js","sourcesContent":["export const dataProcessingDefaults = {\n dataProcessing : {\n feature: 'dataProcessing',\n desc: 'dataProcessing description',\n valueStat: 'current',\n showDescription: false,\n valueStatOptions: [\n { value: 'min', text: 'Min', desc: 'Minimum value registered in the current data subset.' },\n { value: 'max', text: 'Max', desc: 'Maximum value registered in the current data subset.' },\n { value: 'avg', text: 'Average', desc: 'Average value registered in the current data subset.' },\n { value: 'current', text: 'Current', desc: 'Current value registered in the current data subset.' },\n { value: 'total', text: 'Total', desc: 'Acumulated sum of the values registered in the current data subset.' },\n { value: 'first', text: 'First', desc: 'First value registered in the current data subset.' },\n { value: 'diff', text: 'Difference', desc: 'Greatest difference between two consequent values in the current data subset.' },\n { value: 'range', text: 'Range', desc: 'Difference between the maximum and minimum values of the current data subset' },\n { value: 'last_time', text: 'Time of last point', desc: 'Last time register for the data subset. (Useful to see update time disparities)' },\n ],\n },\n};\n"]} -------------------------------------------------------------------------------- /dist/libs/d3/build/package.js: -------------------------------------------------------------------------------- 1 | export var name = "d3"; 2 | export var version = "4.12.2"; 3 | export var description = "Data-Driven Documents"; 4 | export var keywords = ["dom","visualization","svg","animation","canvas"]; 5 | export var homepage = "https://d3js.org"; 6 | export var license = "BSD-3-Clause"; 7 | export var author = {"name":"Mike Bostock","url":"https://bost.ocks.org/mike"}; 8 | export var main = "build/d3.node.js"; 9 | export var unpkg = "build/d3.min.js"; 10 | export var jsdelivr = "build/d3.min.js"; 11 | export var module = "index"; 12 | export var repository = {"type":"git","url":"https://github.com/d3/d3.git"}; 13 | export var scripts = {"pretest":"rimraf build && mkdir build && json2module package.json > build/package.js && node rollup.node","test":"tape 'test/**/*-test.js'","prepublishOnly":"npm run test && rollup -c --banner \"$(preamble)\" && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" build/d3.js -c negate_iife=false -m -o build/d3.min.js","postpublish":"git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3/build/d3.js d3.v4.js && cp ../d3/build/d3.min.js d3.v4.min.js && git add d3.v4.js d3.v4.min.js && git commit -m \"d3 ${npm_package_version}\" && git push && cd - && cd ../d3-bower && git pull && cp ../d3/LICENSE ../d3/README.md ../d3/build/d3.js ../d3/build/d3.min.js . && git add -- LICENSE README.md d3.js d3.min.js && git commit -m \"${npm_package_version}\" && git tag -am \"${npm_package_version}\" v${npm_package_version} && git push && git push --tags && cd - && zip -j build/d3.zip -- LICENSE README.md API.md CHANGES.md build/d3.js build/d3.min.js"}; 14 | export var devDependencies = {"json2module":"0.0","package-preamble":"0.1","rimraf":"2","rollup":"0.53","rollup-plugin-ascii":"0.0","rollup-plugin-node-resolve":"3","tape":"4","uglify-js":"3.2"}; 15 | export var dependencies = {"d3-array":"1.2.1","d3-axis":"1.0.8","d3-brush":"1.0.4","d3-chord":"1.0.4","d3-collection":"1.0.4","d3-color":"1.0.3","d3-dispatch":"1.0.3","d3-drag":"1.2.1","d3-dsv":"1.0.8","d3-ease":"1.0.3","d3-force":"1.1.0","d3-format":"1.2.1","d3-geo":"1.9.1","d3-hierarchy":"1.1.5","d3-interpolate":"1.1.6","d3-path":"1.0.5","d3-polygon":"1.0.3","d3-quadtree":"1.0.3","d3-queue":"3.0.7","d3-random":"1.1.0","d3-request":"1.0.6","d3-scale":"1.0.7","d3-selection":"1.2.0","d3-shape":"1.2.0","d3-time":"1.0.8","d3-time-format":"2.1.1","d3-timer":"1.0.7","d3-transition":"1.1.1","d3-voronoi":"1.1.2","d3-zoom":"1.7.1"}; 16 | -------------------------------------------------------------------------------- /src/libs/d3/build/package.js: -------------------------------------------------------------------------------- 1 | export var name = "d3"; 2 | export var version = "4.12.2"; 3 | export var description = "Data-Driven Documents"; 4 | export var keywords = ["dom","visualization","svg","animation","canvas"]; 5 | export var homepage = "https://d3js.org"; 6 | export var license = "BSD-3-Clause"; 7 | export var author = {"name":"Mike Bostock","url":"https://bost.ocks.org/mike"}; 8 | export var main = "build/d3.node.js"; 9 | export var unpkg = "build/d3.min.js"; 10 | export var jsdelivr = "build/d3.min.js"; 11 | export var module = "index"; 12 | export var repository = {"type":"git","url":"https://github.com/d3/d3.git"}; 13 | export var scripts = {"pretest":"rimraf build && mkdir build && json2module package.json > build/package.js && node rollup.node","test":"tape 'test/**/*-test.js'","prepublishOnly":"npm run test && rollup -c --banner \"$(preamble)\" && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" build/d3.js -c negate_iife=false -m -o build/d3.min.js","postpublish":"git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3/build/d3.js d3.v4.js && cp ../d3/build/d3.min.js d3.v4.min.js && git add d3.v4.js d3.v4.min.js && git commit -m \"d3 ${npm_package_version}\" && git push && cd - && cd ../d3-bower && git pull && cp ../d3/LICENSE ../d3/README.md ../d3/build/d3.js ../d3/build/d3.min.js . && git add -- LICENSE README.md d3.js d3.min.js && git commit -m \"${npm_package_version}\" && git tag -am \"${npm_package_version}\" v${npm_package_version} && git push && git push --tags && cd - && zip -j build/d3.zip -- LICENSE README.md API.md CHANGES.md build/d3.js build/d3.min.js"}; 14 | export var devDependencies = {"json2module":"0.0","package-preamble":"0.1","rimraf":"2","rollup":"0.53","rollup-plugin-ascii":"0.0","rollup-plugin-node-resolve":"3","tape":"4","uglify-js":"3.2"}; 15 | export var dependencies = {"d3-array":"1.2.1","d3-axis":"1.0.8","d3-brush":"1.0.4","d3-chord":"1.0.4","d3-collection":"1.0.4","d3-color":"1.0.3","d3-dispatch":"1.0.3","d3-drag":"1.2.1","d3-dsv":"1.0.8","d3-ease":"1.0.3","d3-force":"1.1.0","d3-format":"1.2.1","d3-geo":"1.9.1","d3-hierarchy":"1.1.5","d3-interpolate":"1.1.6","d3-path":"1.0.5","d3-polygon":"1.0.3","d3-quadtree":"1.0.3","d3-queue":"3.0.7","d3-random":"1.1.0","d3-request":"1.0.6","d3-scale":"1.0.7","d3-selection":"1.2.0","d3-shape":"1.2.0","d3-time":"1.0.8","d3-time-format":"2.1.1","d3-timer":"1.0.7","d3-transition":"1.1.1","d3-voronoi":"1.1.2","d3-zoom":"1.7.1"}; 16 | -------------------------------------------------------------------------------- /dist/features/feature/__feature__Controller.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../../src/features/feature/__feature__Controller.ts"],"names":["MetricsPanelCtrl","TimeSeries","_","__feature__Defaults","__feature__Editor","Feature","$scope","panelController","ctrl","panel","defaults","cloneDeep","events","on","onInitEditMode","bind","addEditorTab","actions","push","text","click"],"mappings":";;;;;;;;;;;;;;;AAAQA,4B,kBAAAA,gB;;AACDC,sB;;AACAC,a;;AAGEC,+B,wBAAAA,mB;;AACAC,6B,sBAAAA,iB;;;;;;;;;;;;;;;;;;;;;AAEYC,mB;AACnB,iCAAaC,MAAb,EAAoB;AAAA;;AAChB,yBAAKA,MAAL,GAAcA,MAAd;AACA,yBAAKC,eAAL,GAAuBD,OAAOE,IAA9B;AACA,yBAAKC,KAAL,GAAaH,OAAOE,IAAP,CAAYC,KAAzB;;AAEA,wBAAMC,WAAWR,EAAES,SAAF,CAAYR,mBAAZ,CAAjB;AACAD,sBAAEQ,QAAF,CAAY,KAAKD,KAAjB,EAAwBC,QAAxB;;AAEA,yBAAKH,eAAL,CAAqBK,MAArB,CAA4BC,EAA5B,CAAgC,gBAAhC,EAAkD,KAAKC,cAAL,CAAoBC,IAApB,CAAyB,IAAzB,CAAlD;AACA;AACA;AACA;AACA;AACA;AACH;;;;qDAEe;AACZ,6BAAKR,eAAL,CAAqBS,YAArB,CAAmC,aAAnC,EAAkDZ,kBAAmB,KAAKE,MAAxB,CAAlD,EAAmF,CAAnF;AACH;;;uDAEkBW,O,EAAS;AAC1BA,gCAAQC,IAAR,CAAa,EAACC,MAAM,mBAAP,EAA4BC,OAAO,mBAAnC,EAAb;AACD;;;iDAEW,CAAE;;;;;;+BAzBKf,O","file":"__feature__Controller.js","sourcesContent":["import {MetricsPanelCtrl} from 'app/plugins/sdk';\nimport TimeSeries from 'app/core/time_series2';\nimport _ from 'lodash';\n//import * as d3 from './libs/d3/build/d3.js' ;\n\nimport { __feature__Defaults } from \"./__feature__Defaults.js\";\nimport { __feature__Editor } from \"./__feature__Editor.js\";\n\nexport default class Feature{\n constructor( $scope){\n this.$scope = $scope;\n this.panelController = $scope.ctrl;\n this.panel = $scope.ctrl.panel;\n\n const defaults = _.cloneDeep(__feature__Defaults)\n _.defaults( this.panel, defaults);\n\n this.panelController.events.on( 'init-edit-mode', this.onInitEditMode.bind(this));\n //this.panelController.events.on( 'data-received', this.onDataReceived.bind(this));\n //this.panelController.events.on( 'panel-initialized', this.onPanelInitialized.bind(this));\n //this.panelController.events.on( 'render', this.onRender.bind(this));\n //this.panelController.events.on( 'refresh', this.onRefresh.bind(this));\n //this.events.on('init-panel-actions', this.onInitPanelActions.bind(this));\n }\n\n onInitEditMode(){\n this.panelController.addEditorTab( '__Feature__', __feature__Editor( this.$scope), 2);\n }\n\n onInitPanelActions(actions) {\n actions.push({text: 'event button text', click: 'ctrl.panelEvent()'});\n }\n\n panelEvent(){}\n}\n"]} -------------------------------------------------------------------------------- /dist/libs/d3/README.md: -------------------------------------------------------------------------------- 1 | # D3: Data-Driven Documents 2 | 3 | 4 | 5 | **D3** (or **D3.js**) is a JavaScript library for visualizing data using web standards. D3 helps you bring data to life using SVG, Canvas and HTML. D3 combines powerful visualization and interaction techniques with a data-driven approach to DOM manipulation, giving you the full capabilities of modern browsers and the freedom to design the right visual interface for your data. 6 | 7 | ## Resources 8 | 9 | * [API Reference](https://github.com/d3/d3/blob/master/API.md) 10 | * [Release Notes](https://github.com/d3/d3/releases) 11 | * [Gallery](https://github.com/d3/d3/wiki/Gallery) 12 | * [Examples](https://bl.ocks.org/mbostock) 13 | * [Wiki](https://github.com/d3/d3/wiki) 14 | 15 | ## Installing 16 | 17 | If you use npm, `npm install d3`. Otherwise, download the [latest release](https://github.com/d3/d3/releases/latest). The released bundle supports anonymous AMD, CommonJS, and vanilla environments. You can load directly from [d3js.org](https://d3js.org), [CDNJS](https://cdnjs.com/libraries/d3), or [unpkg](https://unpkg.com/d3/). For example: 18 | 19 | ```html 20 | 21 | ``` 22 | 23 | For the minified version: 24 | 25 | ```html 26 | 27 | ``` 28 | 29 | You can also use the standalone D3 microlibraries. For example, [d3-selection](https://github.com/d3/d3-selection): 30 | 31 | ```html 32 | 33 | ``` 34 | 35 | D3 is written using [ES2015 modules](http://www.2ality.com/2014/09/es6-modules-final.html). Create a [custom bundle using Rollup](https://bl.ocks.org/mbostock/bb09af4c39c79cffcde4), Webpack, or your preferred bundler. To import D3 into an ES2015 application, either import specific symbols from specific D3 modules: 36 | 37 | ```js 38 | import {scaleLinear} from "d3-scale"; 39 | ``` 40 | 41 | Or import everything into a namespace (here, `d3`): 42 | 43 | ```js 44 | import * as d3 from "d3"; 45 | ``` 46 | 47 | In Node: 48 | 49 | ```js 50 | var d3 = require("d3"); 51 | ``` 52 | 53 | You can also require individual modules and combine them into a `d3` object using [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign): 54 | 55 | ```js 56 | var d3 = Object.assign({}, require("d3-format"), require("d3-geo"), require("d3-geo-projection")); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/libs/d3/README.md: -------------------------------------------------------------------------------- 1 | # D3: Data-Driven Documents 2 | 3 | 4 | 5 | **D3** (or **D3.js**) is a JavaScript library for visualizing data using web standards. D3 helps you bring data to life using SVG, Canvas and HTML. D3 combines powerful visualization and interaction techniques with a data-driven approach to DOM manipulation, giving you the full capabilities of modern browsers and the freedom to design the right visual interface for your data. 6 | 7 | ## Resources 8 | 9 | * [API Reference](https://github.com/d3/d3/blob/master/API.md) 10 | * [Release Notes](https://github.com/d3/d3/releases) 11 | * [Gallery](https://github.com/d3/d3/wiki/Gallery) 12 | * [Examples](https://bl.ocks.org/mbostock) 13 | * [Wiki](https://github.com/d3/d3/wiki) 14 | 15 | ## Installing 16 | 17 | If you use npm, `npm install d3`. Otherwise, download the [latest release](https://github.com/d3/d3/releases/latest). The released bundle supports anonymous AMD, CommonJS, and vanilla environments. You can load directly from [d3js.org](https://d3js.org), [CDNJS](https://cdnjs.com/libraries/d3), or [unpkg](https://unpkg.com/d3/). For example: 18 | 19 | ```html 20 | 21 | ``` 22 | 23 | For the minified version: 24 | 25 | ```html 26 | 27 | ``` 28 | 29 | You can also use the standalone D3 microlibraries. For example, [d3-selection](https://github.com/d3/d3-selection): 30 | 31 | ```html 32 | 33 | ``` 34 | 35 | D3 is written using [ES2015 modules](http://www.2ality.com/2014/09/es6-modules-final.html). Create a [custom bundle using Rollup](https://bl.ocks.org/mbostock/bb09af4c39c79cffcde4), Webpack, or your preferred bundler. To import D3 into an ES2015 application, either import specific symbols from specific D3 modules: 36 | 37 | ```js 38 | import {scaleLinear} from "d3-scale"; 39 | ``` 40 | 41 | Or import everything into a namespace (here, `d3`): 42 | 43 | ```js 44 | import * as d3 from "d3"; 45 | ``` 46 | 47 | In Node: 48 | 49 | ```js 50 | var d3 = require("d3"); 51 | ``` 52 | 53 | You can also require individual modules and combine them into a `d3` object using [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign): 54 | 55 | ```js 56 | var d3 = Object.assign({}, require("d3-format"), require("d3-geo"), require("d3-geo-projection")); 57 | ``` 58 | -------------------------------------------------------------------------------- /dist/features/feature/__feature__Editor.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register([], function (_export, _context) { 4 | "use strict"; 5 | 6 | var _createClass, __Feature__EditorController; 7 | 8 | function _classCallCheck(instance, Constructor) { 9 | if (!(instance instanceof Constructor)) { 10 | throw new TypeError("Cannot call a class as a function"); 11 | } 12 | } 13 | 14 | function __feature__Editor(scope) { 15 | 'use strict'; 16 | 17 | var pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/__feature__/__feature__Editor.html'; 18 | return function () { 19 | return { 20 | restrict: 'E', 21 | scope: true, 22 | templateUrl: pathToTemplate, 23 | controller: __Feature__EditorController 24 | }; 25 | }; 26 | } 27 | 28 | _export('__feature__Editor', __feature__Editor); 29 | 30 | return { 31 | setters: [], 32 | execute: function () { 33 | _createClass = function () { 34 | function defineProperties(target, props) { 35 | for (var i = 0; i < props.length; i++) { 36 | var descriptor = props[i]; 37 | descriptor.enumerable = descriptor.enumerable || false; 38 | descriptor.configurable = true; 39 | if ("value" in descriptor) descriptor.writable = true; 40 | Object.defineProperty(target, descriptor.key, descriptor); 41 | } 42 | } 43 | 44 | return function (Constructor, protoProps, staticProps) { 45 | if (protoProps) defineProperties(Constructor.prototype, protoProps); 46 | if (staticProps) defineProperties(Constructor, staticProps); 47 | return Constructor; 48 | }; 49 | }(); 50 | 51 | _export('__Feature__EditorController', __Feature__EditorController = function () { 52 | function __Feature__EditorController($scope) { 53 | _classCallCheck(this, __Feature__EditorController); 54 | 55 | $scope.editor = this; 56 | this.panelCtrl = $scope.ctrl; 57 | this.panel = this.panelCtrl.panel; 58 | } 59 | 60 | _createClass(__Feature__EditorController, [{ 61 | key: 'hola', 62 | value: function hola() { 63 | console.info('Qué pasa chavalada'); 64 | } 65 | }]); 66 | 67 | return __Feature__EditorController; 68 | }()); 69 | 70 | _export('__Feature__EditorController', __Feature__EditorController); 71 | } 72 | }; 73 | }); 74 | //# sourceMappingURL=__feature__Editor.js.map 75 | -------------------------------------------------------------------------------- /dist/features/panelActions/panelActionsEditor.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register([], function (_export, _context) { 4 | "use strict"; 5 | 6 | var _createClass, PanelActionsEditorController; 7 | 8 | function _classCallCheck(instance, Constructor) { 9 | if (!(instance instanceof Constructor)) { 10 | throw new TypeError("Cannot call a class as a function"); 11 | } 12 | } 13 | 14 | function panelActionsEditor(scope) { 15 | 'use strict'; 16 | 17 | var pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/panelActions/panelActionsEditor.html'; 18 | return function () { 19 | return { 20 | restrict: 'E', 21 | scope: true, 22 | templateUrl: pathToTemplate, 23 | controller: PanelActionsEditorController 24 | }; 25 | }; 26 | } 27 | 28 | _export('panelActionsEditor', panelActionsEditor); 29 | 30 | return { 31 | setters: [], 32 | execute: function () { 33 | _createClass = function () { 34 | function defineProperties(target, props) { 35 | for (var i = 0; i < props.length; i++) { 36 | var descriptor = props[i]; 37 | descriptor.enumerable = descriptor.enumerable || false; 38 | descriptor.configurable = true; 39 | if ("value" in descriptor) descriptor.writable = true; 40 | Object.defineProperty(target, descriptor.key, descriptor); 41 | } 42 | } 43 | 44 | return function (Constructor, protoProps, staticProps) { 45 | if (protoProps) defineProperties(Constructor.prototype, protoProps); 46 | if (staticProps) defineProperties(Constructor, staticProps); 47 | return Constructor; 48 | }; 49 | }(); 50 | 51 | _export('PanelActionsEditorController', PanelActionsEditorController = function () { 52 | function PanelActionsEditorController($scope) { 53 | _classCallCheck(this, PanelActionsEditorController); 54 | 55 | $scope.editor = this; 56 | this.panelCtrl = $scope.ctrl; 57 | this.panel = this.panelCtrl.panel; 58 | } 59 | 60 | _createClass(PanelActionsEditorController, [{ 61 | key: 'hola', 62 | value: function hola() { 63 | console.info('Qué pasa panelActions'); 64 | } 65 | }]); 66 | 67 | return PanelActionsEditorController; 68 | }()); 69 | 70 | _export('PanelActionsEditorController', PanelActionsEditorController); 71 | } 72 | }; 73 | }); 74 | //# sourceMappingURL=panelActionsEditor.js.map 75 | -------------------------------------------------------------------------------- /dist/features/dataProcessing/dataProcessingEditor.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../../src/features/dataProcessing/dataProcessingEditor.ts"],"names":["dataProcessingEditor","scope","pathToTemplate","ctrl","panel","type","restrict","templateUrl","controller","DataProcessingEditorController","$scope","editor","panelCtrl","dataProcessing","showDescription"],"mappings":";;;;;;;;;;;;;AAmCA;;;;;;;AAOO,WAASA,oBAAT,CAA+BC,KAA/B,EAAqC;AAC1C;;AACA,QAAIC,iBAAiB,oBAAoBD,MAAME,IAAN,CAAWC,KAAX,CAAiBC,IAArC,GAA4C,oDAAjE;AACA,WAAO,YAAU;AACf,aAAM;AACJC,kBAAU,GADN;AAEJL,eAAO,IAFH;AAGJM,qBAAaL,cAHT;AAIJM,oBAAYC;AAJR,OAAN;AAMD,KAPD;AAQD;;kCAXeT,oB;;;;;;;;;;;;;;;;;;;;;;;gDAjCHS,8B;AACX;;;;;;;AAOA,gDAAaC,MAAb,EAAqB;AAAA;;AACnBA,iBAAOC,MAAP,GAAgB,IAAhB;AACA,eAAKC,SAAL,GAAiBF,OAAOP,IAAxB;AACA,eAAKC,KAAL,GAAa,KAAKQ,SAAL,CAAeR,KAA5B;AACD;;AAED;;;;;;;;;;;iDAOsB;AACpB,iBAAKA,KAAL,CAAWS,cAAX,CAA0BC,eAA1B,GAA4C,CAAC,KAAKV,KAAL,CAAWS,cAAX,CAA0BC,eAAvE;AACD","file":"dataProcessingEditor.js","sourcesContent":["\n/**\n * @alias dataProcessingEditor\n * @classdesc

dataProcessing editor controller

\n * Implementation for a feature editor.
\n * Controller for the editor tab of the plugin for this specific feature.
\n * It is the controller of the AngularJS component for the editor\n *
\n */\nexport class DataProcessingEditorController {\n /**\n * constructor - description\n *\n * @param {type} $scope A reference to the plugin's scope for editing panel's variables\n * @return {type} New instance of DataProcessingEditorController\n * @memberof dataProcessingEditor\n */\n constructor( $scope) {\n $scope.editor = this;\n this.panelCtrl = $scope.ctrl;\n this.panel = this.panelCtrl.panel;\n }\n\n /**\n * toggleDescVisibility - handler for an editor tab event
\n * Toggles the state of showDescription variable to display or not
\n * the descriptions for the data mapping options.\n *\n * @memberof dataProcessingEditor\n */\n toggleDescVisibility(){\n this.panel.dataProcessing.showDescription = !this.panel.dataProcessing.showDescription;\n }\n}\n\n/**\n * dataProcessingEditor - function exported to be used as the AngularJs component\n *\n * @param {type} scope A reference to the scope of the plugin to route functions and variables\n * @return AngularJS Component New dataProcessingEditor\n * @memberof dataProcessingEditor\n */\nexport function dataProcessingEditor( scope){\n 'use strict';\n let pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/dataProcessing/dataProcessingEditor.html';\n return function(){\n return{\n restrict: 'E',\n scope: true,\n templateUrl: pathToTemplate,\n controller: DataProcessingEditorController,\n };\n };\n}\n"]} -------------------------------------------------------------------------------- /docs/styles/prettify-tomorrow.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* Pretty printing styles. Used with prettify.js. */ 4 | /* SPAN elements with the classes below are added by prettyprint. */ 5 | /* plain text */ 6 | .pln { 7 | color: #4d4d4c; } 8 | 9 | @media screen { 10 | /* string content */ 11 | .str { 12 | color: #718c00; } 13 | 14 | /* a keyword */ 15 | .kwd { 16 | color: #8959a8; } 17 | 18 | /* a comment */ 19 | .com { 20 | color: #8e908c; } 21 | 22 | /* a type name */ 23 | .typ { 24 | color: #4271ae; } 25 | 26 | /* a literal value */ 27 | .lit { 28 | color: #f5871f; } 29 | 30 | /* punctuation */ 31 | .pun { 32 | color: #4d4d4c; } 33 | 34 | /* lisp open bracket */ 35 | .opn { 36 | color: #4d4d4c; } 37 | 38 | /* lisp close bracket */ 39 | .clo { 40 | color: #4d4d4c; } 41 | 42 | /* a markup tag name */ 43 | .tag { 44 | color: #c82829; } 45 | 46 | /* a markup attribute name */ 47 | .atn { 48 | color: #f5871f; } 49 | 50 | /* a markup attribute value */ 51 | .atv { 52 | color: #3e999f; } 53 | 54 | /* a declaration */ 55 | .dec { 56 | color: #f5871f; } 57 | 58 | /* a variable name */ 59 | .var { 60 | color: #c82829; } 61 | 62 | /* a function name */ 63 | .fun { 64 | color: #4271ae; } } 65 | /* Use higher contrast and text-weight for printable form. */ 66 | @media print, projection { 67 | .str { 68 | color: #060; } 69 | 70 | .kwd { 71 | color: #006; 72 | font-weight: bold; } 73 | 74 | .com { 75 | color: #600; 76 | font-style: italic; } 77 | 78 | .typ { 79 | color: #404; 80 | font-weight: bold; } 81 | 82 | .lit { 83 | color: #044; } 84 | 85 | .pun, .opn, .clo { 86 | color: #440; } 87 | 88 | .tag { 89 | color: #006; 90 | font-weight: bold; } 91 | 92 | .atn { 93 | color: #404; } 94 | 95 | .atv { 96 | color: #060; } } 97 | /* Style */ 98 | /* 99 | pre.prettyprint { 100 | background: white; 101 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 102 | font-size: 12px; 103 | line-height: 1.5; 104 | border: 1px solid #ccc; 105 | padding: 10px; } 106 | */ 107 | 108 | /* Specify class=linenums on a pre to get line numbering */ 109 | ol.linenums { 110 | margin-top: 0; 111 | margin-bottom: 0; } 112 | 113 | /* IE indents via margin-left */ 114 | li.L0, 115 | li.L1, 116 | li.L2, 117 | li.L3, 118 | li.L4, 119 | li.L5, 120 | li.L6, 121 | li.L7, 122 | li.L8, 123 | li.L9 { 124 | /* */ } 125 | 126 | /* Alternate shading for lines */ 127 | li.L1, 128 | li.L3, 129 | li.L5, 130 | li.L7, 131 | li.L9 { 132 | /* */ } 133 | -------------------------------------------------------------------------------- /dist/features/panelActions/panelActionsController.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../../src/features/panelActions/panelActionsController.ts"],"names":["MetricsPanelCtrl","TimeSeries","_","d3","panelActionsDefaults","panelActionsEditor","Feature","$scope","panelController","ctrl","defaults","panel","events","on","onRender","onInitPanelActions","bind","actions","push","text","click"],"mappings":";;;;;;;;;;;;;;;AAAQA,sB,kBAAAA,gB;;AACDC,gB;;AACAC,O;;AACKC,Q;;AAEHC,0B,2BAAAA,oB;;AACAC,wB,yBAAAA,kB;;;;;;;;;;;;;;;;;;;;;AAcYC,a;AACnB;;;;;;;AAOA,yBAAaC,MAAb,EAAoB;AAAA;;AAChB,eAAKA,MAAL,GAAcA,MAAd;AACA,eAAKC,eAAL,GAAuBD,OAAOE,IAA9B;AACAP,YAAEQ,QAAF,CAAY,KAAKF,eAAL,CAAqBG,KAAjC,EAAwCP,oBAAxC;;AAEA;AACA;AACA;AACA,eAAKI,eAAL,CAAqBI,MAArB,CAA4BC,EAA5B,CAAgC,QAAhC,EAA0C,KAAKC,QAA/C;AACA;AACA,eAAKN,eAAL,CAAqBI,MAArB,CAA4BC,EAA5B,CAA+B,oBAA/B,EAAqD,KAAKE,kBAAL,CAAwBC,IAAxB,CAA6B,IAA7B,CAArD;AAEH;;;;6CAEkBC,O,EAAS;AAC1BA,oBAAQC,IAAR,CAAa,EAACC,MAAM,eAAP,EAAwBC,OAAO,mBAA/B,EAAb;AACD;;;uCAIW,CAGX;;;qCAES,CAET;;;;;;yBAnCkBd,O","file":"panelActionsController.js","sourcesContent":["import {MetricsPanelCtrl} from 'app/plugins/sdk';\nimport TimeSeries from 'app/core/time_series2';\nimport _ from 'lodash';\nimport * as d3 from '../.././libs/d3/build/d3.js' ;\n\nimport { panelActionsDefaults } from \"./panelActionsDefaults.js\";\nimport { panelActionsEditor } from \"./panelActionsEditor.js\";\n\n/**\n * @alias panelActionsFeature\n * @classdesc

panelActions feature

\n * Implementación de una funcionalidad
\n * Mediante el patrón mediador, se suscribe a los eventos del plugin a través\n * de la referencia al $scope que se le pasa.\n *
\n *

Funcionalidad

\n * Proporciona funcionalidad añadida para el menú contextual del panel
\n *

Eventos suscritos

\n * ninguno\n */\nexport default class Feature{\n /**\n * constructor - description\n *\n * @param {type} $scope Es el contexto del plugin que se pasa para poder suscribirse\n * a los eventos.\n * @return {type} Nueva instancia de un Feature\n */\n constructor( $scope){\n this.$scope = $scope;\n this.panelController = $scope.ctrl;\n _.defaults( this.panelController.panel, panelActionsDefaults);\n\n //this.panelController.events.on( 'init-edit-mode', this.onInitEditMode.bind(this));\n //this.panelController.events.on( 'data-received', this.onDataReceived);\n //this.panelController.events.on( 'panel-initialized', this.onPanelInitialized);\n this.panelController.events.on( 'render', this.onRender);\n //this.panelController.events.on( 'refresh', this.onRefresh);\n this.panelController.events.on('init-panel-actions', this.onInitPanelActions.bind(this));\n\n }\n\n onInitPanelActions(actions) {\n actions.push({text: 'Toggle legend', click: 'ctrl.panelEvent()'});\n }\n //onInitEditMode(){\n // this.panelController.addEditorTab( 'PanelActions', panelActionsEditor( this.$scope), 2);\n //}\n panelEvent(){\n\n\n }\n\n onRender(){\n\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/heatmapCtrl.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/heatmapCtrl.js"],"names":["MetricsPanelCtrl","_","panelDefaults","RenderFeature","PanelActionsFeature","DataProcessingFeature","HeatmapController","$scope","$injector","defaults","cloneDeep","panel","defaultsDeep","panelDivId","$id","dataProcessingFeature","panelActionsFeature","renderFeature","refresh","render","templateUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAQA,sB,kBAAAA,gB;;AACDC,O;;AAEEC,mB,oBAAAA,a;;AAEFC,mB;;AACAC,yB;;AACAC,2B;;;mCAsBMC,iB;;;AAET;;;;;;;;;AASA,mCAAaC,MAAb,EAAqBC,SAArB,EAA+B;AAAA;;AAAA,4IACpBD,MADoB,EACZC,SADY;;AAE3B,cAAMC,WAAWR,EAAES,SAAF,CAAYR,aAAZ,CAAjB;AACA,gBAAKS,KAAL,GAAaV,EAAEW,YAAF,CAAgB,MAAKD,KAArB,EAA4BF,QAA5B,CAAb;AACA,gBAAKE,KAAL,CAAWE,UAAX,GAAwB,aAAW,MAAKN,MAAL,CAAYO,GAA/C;;AAEA,gBAAKC,qBAAL,GAA6B,IAAIV,qBAAJ,CAA2B,MAAKE,MAAhC,CAA7B;AACA,gBAAKS,mBAAL,GAA2B,IAAIZ,mBAAJ,CAAyB,MAAKG,MAA9B,CAA3B;AACA,gBAAKU,aAAL,GAAqB,IAAId,aAAJ,CAAmB,MAAKI,MAAxB,CAArB;;AAEA,gBAAKW,OAAL;AACA,gBAAKC,MAAL;AAX2B;AAY9B;;;QAvBkCnB,gB;;;;AA0BvCM,wBAAkBc,WAAlB,GAAgC,sBAAhC","file":"heatmapCtrl.js","sourcesContent":["import {MetricsPanelCtrl} from 'app/plugins/sdk';\nimport _ from 'lodash';\n\nimport { panelDefaults } from './panelDefaults.js';\n\nimport RenderFeature from './features/render/renderController.js';\nimport PanelActionsFeature from './features/panelActions/panelActionsController.js';\nimport DataProcessingFeature from './features/dataProcessing/dataProcessingController.js'\n\n\n/**\n * HeatmapController - Class HeatmapController\n *
\n * Implements the responsabilities pattern, and acts as mediator for the plugin's\n * events.

\n * The $scope and $injector of this parent class is passed to each new instance\n * of a feature to make it posible for the feature to subscribe to Grafana events.\n *

\n * The class does not implement any kind of functionality, nor control. Each new\n * instance of a feature is responsible of implementing any of it, and should not\n * make assumptions about the existance of other plugins; otherwise should be\n * specified.

\n * Actually, the following features:
\n * \n */\nexport class HeatmapController extends MetricsPanelCtrl{\n\n /**\n * constructor - Constructor for HeatmapController\n *
\n * Instances each one of the registered features.\n *\n * @param {type} $scope description\n * @param {type} $injector description\n * @return {type} New panel plugin controller\n */\n constructor( $scope, $injector){\n super( $scope, $injector);\n const defaults = _.cloneDeep(panelDefaults);\n this.panel = _.defaultsDeep( this.panel, defaults);\n this.panel.panelDivId = 'heatmap-'+this.$scope.$id;\n\n this.dataProcessingFeature = new DataProcessingFeature( this.$scope);\n this.panelActionsFeature = new PanelActionsFeature( this.$scope);\n this.renderFeature = new RenderFeature( this.$scope);\n\n this.refresh();\n this.render();\n }\n}\n\nHeatmapController.templateUrl = 'partials/module.html';\n"]} -------------------------------------------------------------------------------- /dist/features/dataProcessing/dataProcessingEditor.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register([], function (_export, _context) { 4 | "use strict"; 5 | 6 | var _createClass, DataProcessingEditorController; 7 | 8 | function _classCallCheck(instance, Constructor) { 9 | if (!(instance instanceof Constructor)) { 10 | throw new TypeError("Cannot call a class as a function"); 11 | } 12 | } 13 | 14 | /** 15 | * dataProcessingEditor - function exported to be used as the AngularJs component 16 | * 17 | * @param {type} scope A reference to the scope of the plugin to route functions and variables 18 | * @return AngularJS Component New dataProcessingEditor 19 | * @memberof dataProcessingEditor 20 | */ 21 | function dataProcessingEditor(scope) { 22 | 'use strict'; 23 | 24 | var pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/dataProcessing/dataProcessingEditor.html'; 25 | return function () { 26 | return { 27 | restrict: 'E', 28 | scope: true, 29 | templateUrl: pathToTemplate, 30 | controller: DataProcessingEditorController 31 | }; 32 | }; 33 | } 34 | 35 | _export('dataProcessingEditor', dataProcessingEditor); 36 | 37 | return { 38 | setters: [], 39 | execute: function () { 40 | _createClass = function () { 41 | function defineProperties(target, props) { 42 | for (var i = 0; i < props.length; i++) { 43 | var descriptor = props[i]; 44 | descriptor.enumerable = descriptor.enumerable || false; 45 | descriptor.configurable = true; 46 | if ("value" in descriptor) descriptor.writable = true; 47 | Object.defineProperty(target, descriptor.key, descriptor); 48 | } 49 | } 50 | 51 | return function (Constructor, protoProps, staticProps) { 52 | if (protoProps) defineProperties(Constructor.prototype, protoProps); 53 | if (staticProps) defineProperties(Constructor, staticProps); 54 | return Constructor; 55 | }; 56 | }(); 57 | 58 | _export('DataProcessingEditorController', DataProcessingEditorController = function () { 59 | /** 60 | * constructor - description 61 | * 62 | * @param {type} $scope A reference to the plugin's scope for editing panel's variables 63 | * @return {type} New instance of DataProcessingEditorController 64 | * @memberof dataProcessingEditor 65 | */ 66 | function DataProcessingEditorController($scope) { 67 | _classCallCheck(this, DataProcessingEditorController); 68 | 69 | $scope.editor = this; 70 | this.panelCtrl = $scope.ctrl; 71 | this.panel = this.panelCtrl.panel; 72 | } 73 | 74 | /** 75 | * toggleDescVisibility - handler for an editor tab event
76 | * Toggles the state of showDescription variable to display or not
77 | * the descriptions for the data mapping options. 78 | * 79 | * @memberof dataProcessingEditor 80 | */ 81 | 82 | 83 | _createClass(DataProcessingEditorController, [{ 84 | key: 'toggleDescVisibility', 85 | value: function toggleDescVisibility() { 86 | this.panel.dataProcessing.showDescription = !this.panel.dataProcessing.showDescription; 87 | } 88 | }]); 89 | 90 | return DataProcessingEditorController; 91 | }()); 92 | 93 | _export('DataProcessingEditorController', DataProcessingEditorController); 94 | } 95 | }; 96 | }); 97 | //# sourceMappingURL=dataProcessingEditor.js.map 98 | -------------------------------------------------------------------------------- /docs/features_panelActions_panelActionsController.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: features/panelActions/panelActionsController.ts 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: features/panelActions/panelActionsController.ts

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
import {MetricsPanelCtrl} from 'app/plugins/sdk';
30 | import TimeSeries from 'app/core/time_series2';
31 | import _ from 'lodash';
32 | //import * as d3 from './libs/d3/build/d3.js' ;
33 | 
34 | import { panelActionsDefaults } from "./panelActionsDefaults.js";
35 | import { panelActionsEditor } from "./panelActionsEditor.js";
36 | 
37 | /**
38 |  * @alias panelActionsFeature
39 |  * @classdesc <h2>panelActions feature</h2>
40 |  * Implementación de una funcionalidad<br>
41 |  * Mediante el patrón mediador, se suscribe a los eventos del plugin a través
42 |  * de la referencia al $scope que se le pasa.
43 |  * <br>
44 |  * <br><h3>Funcionalidad</h3>
45 |  * Proporciona funcionalidad añadida para el menú contextual del panel<br>
46 |  * <br><h3>Eventos suscritos</h3>
47 |  * ninguno
48 |  */
49 | export default class Feature{
50 |   /**
51 |    * constructor - description
52 |    *
53 |    * @param  {type} $scope Es el contexto del plugin que se pasa para poder suscribirse
54 |    * a los eventos.
55 |    * @return {type}        Nueva instancia de un Feature
56 |    */
57 |   constructor( $scope){
58 |       this.$scope = $scope;
59 |       this.panelController = $scope.ctrl;
60 |       _.defaults( this.panelController.panel, panelActionsDefaults);
61 | 
62 |       //this.panelController.events.on( 'init-edit-mode', this.onInitEditMode.bind(this));
63 |       //this.panelController.events.on( 'data-received', this.onDataReceived);
64 |       //this.panelController.events.on( 'panel-initialized', this.onPanelInitialized);
65 |       //this.panelController.events.on( 'render', this.onRender);
66 |       //this.panelController.events.on( 'refresh', this.onRefresh);
67 | 
68 |   }
69 | 
70 |   //onInitEditMode(){
71 |   //    this.panelController.addEditorTab( 'PanelActions', panelActionsEditor( this.$scope), 2);
72 |   //}
73 | }
74 | 
75 |
76 |
77 | 78 | 79 | 80 | 81 |
82 | 83 | 86 | 87 |
88 | 89 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt){ 2 | //Configuración de las tareas 3 | grunt.initConfig({ 4 | clean:['dist'], 5 | copy: { 6 | libs_to_dist:{ 7 | expand:true, 8 | cwd:'src/libs/', 9 | src:['**'], 10 | dest:'dist/libs' 11 | }, 12 | partials_to_dist:{ 13 | expand:true, 14 | cwd:'src/partials', 15 | src:['**'], 16 | dest:'dist/partials' 17 | }, 18 | resources_to_dist:{ 19 | expand:true, 20 | cwd:'src/resources', 21 | src:['**'], 22 | dest:'dist/resources' 23 | }, 24 | meta_to_dist:{ 25 | expand:true, 26 | flatten:true, 27 | src:['README.md','src/plugin.json'], 28 | dest:'dist/' 29 | }, 30 | html: { 31 | files: [{ 32 | cwd: 'src/features', 33 | expand: true, 34 | src: ['*/*.html'], 35 | dest: 'dist/features', 36 | }] 37 | } 38 | }, 39 | babel:{ 40 | options: { 41 | sourceMap: true, 42 | presets: ['es2015'], 43 | plugins: ['transform-es2015-modules-systemjs', 'transform-es2015-for-of'], 44 | }, 45 | dist: { 46 | files: [{ 47 | cwd: 'src', 48 | expand: true, 49 | src: ['*.js'], 50 | dest: 'dist', 51 | ext:'.js' 52 | }] 53 | }, 54 | ts: { 55 | files: [{ 56 | cwd: 'src/features', 57 | expand: true, 58 | src: ['*/*.ts'], 59 | dest: 'dist/features', 60 | ext:'.js' 61 | }] 62 | } 63 | 64 | }, 65 | watch: { 66 | partials:{ 67 | files:['src/partials/*'], 68 | tasks:['copy:partials_to_dist'], 69 | options:{ 70 | debounceDelay: 200, 71 | } 72 | }, 73 | meta:{ 74 | files:['README.md','src/plugin.json'], 75 | tasks:['copy:meta_to_dist'], 76 | options:{ 77 | debounceDelay: 200, 78 | } 79 | }, 80 | scripts:{ 81 | files:['src/*.js', 'src/features/**/*'], 82 | tasks:['babel'], 83 | options:{ 84 | debounceDelay: 200, 85 | } 86 | }, 87 | html:{ 88 | files:['src/*.html', 'src/features/**/*'], 89 | tasks:['copy'], 90 | options:{ 91 | debounceDelay: 200, 92 | } 93 | } 94 | } 95 | }); 96 | 97 | //Cargar las tareas instaladas a través de npm 98 | //grunt.loadNpmTasks(); 99 | grunt.loadNpmTasks('grunt-contrib-copy'); 100 | grunt.loadNpmTasks('grunt-contrib-watch'); 101 | grunt.loadNpmTasks('grunt-contrib-clean'); 102 | grunt.loadNpmTasks('grunt-babel'); 103 | 104 | grunt.registerTask('buildClean', ['clean', 'copy', 'babel']); 105 | grunt.registerTask('build', ['copy', 'babel']); 106 | //Tarea por defecto 107 | grunt.registerTask('default', ['copy', 'babel', 'watch']); 108 | }; 109 | -------------------------------------------------------------------------------- /dist/features/panelActions/panelActionsController.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register(['app/plugins/sdk', 'app/core/time_series2', 'lodash', '../.././libs/d3/build/d3.js', './panelActionsDefaults.js', './panelActionsEditor.js'], function (_export, _context) { 4 | "use strict"; 5 | 6 | var MetricsPanelCtrl, TimeSeries, _, d3, panelActionsDefaults, panelActionsEditor, _createClass, Feature; 7 | 8 | function _classCallCheck(instance, Constructor) { 9 | if (!(instance instanceof Constructor)) { 10 | throw new TypeError("Cannot call a class as a function"); 11 | } 12 | } 13 | 14 | return { 15 | setters: [function (_appPluginsSdk) { 16 | MetricsPanelCtrl = _appPluginsSdk.MetricsPanelCtrl; 17 | }, function (_appCoreTime_series) { 18 | TimeSeries = _appCoreTime_series.default; 19 | }, function (_lodash) { 20 | _ = _lodash.default; 21 | }, function (_libsD3BuildD3Js) { 22 | d3 = _libsD3BuildD3Js; 23 | }, function (_panelActionsDefaultsJs) { 24 | panelActionsDefaults = _panelActionsDefaultsJs.panelActionsDefaults; 25 | }, function (_panelActionsEditorJs) { 26 | panelActionsEditor = _panelActionsEditorJs.panelActionsEditor; 27 | }], 28 | execute: function () { 29 | _createClass = function () { 30 | function defineProperties(target, props) { 31 | for (var i = 0; i < props.length; i++) { 32 | var descriptor = props[i]; 33 | descriptor.enumerable = descriptor.enumerable || false; 34 | descriptor.configurable = true; 35 | if ("value" in descriptor) descriptor.writable = true; 36 | Object.defineProperty(target, descriptor.key, descriptor); 37 | } 38 | } 39 | 40 | return function (Constructor, protoProps, staticProps) { 41 | if (protoProps) defineProperties(Constructor.prototype, protoProps); 42 | if (staticProps) defineProperties(Constructor, staticProps); 43 | return Constructor; 44 | }; 45 | }(); 46 | 47 | Feature = function () { 48 | /** 49 | * constructor - description 50 | * 51 | * @param {type} $scope Es el contexto del plugin que se pasa para poder suscribirse 52 | * a los eventos. 53 | * @return {type} Nueva instancia de un Feature 54 | */ 55 | function Feature($scope) { 56 | _classCallCheck(this, Feature); 57 | 58 | this.$scope = $scope; 59 | this.panelController = $scope.ctrl; 60 | _.defaults(this.panelController.panel, panelActionsDefaults); 61 | 62 | //this.panelController.events.on( 'init-edit-mode', this.onInitEditMode.bind(this)); 63 | //this.panelController.events.on( 'data-received', this.onDataReceived); 64 | //this.panelController.events.on( 'panel-initialized', this.onPanelInitialized); 65 | this.panelController.events.on('render', this.onRender); 66 | //this.panelController.events.on( 'refresh', this.onRefresh); 67 | this.panelController.events.on('init-panel-actions', this.onInitPanelActions.bind(this)); 68 | } 69 | 70 | _createClass(Feature, [{ 71 | key: 'onInitPanelActions', 72 | value: function onInitPanelActions(actions) { 73 | actions.push({ text: 'Toggle legend', click: 'ctrl.panelEvent()' }); 74 | } 75 | }, { 76 | key: 'panelEvent', 77 | value: function panelEvent() {} 78 | }, { 79 | key: 'onRender', 80 | value: function onRender() {} 81 | }]); 82 | 83 | return Feature; 84 | }(); 85 | 86 | _export('default', Feature); 87 | } 88 | }; 89 | }); 90 | //# sourceMappingURL=panelActionsController.js.map 91 | -------------------------------------------------------------------------------- /docs/features_dataProcessing_dataProcessingEditor.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: features/dataProcessing/dataProcessingEditor.ts 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: features/dataProcessing/dataProcessingEditor.ts

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |

 30 | /**
 31 |  * @alias dataProcessingEditor
 32 |  * @classdesc <h2>dataProcessing editor controller</h2>
 33 |  * Implementation for a feature editor.<br>
 34 |  * Controller for the editor tab of the plugin for this specific feature. <br>
 35 |  * <i>It is the controller of the AngularJS component for the editor</i>
 36 |  * <br>
 37 |  */
 38 | export class DataProcessingEditorController {
 39 |   /**
 40 |    * constructor - description
 41 |    *
 42 |    * @param  {type} $scope A reference to the plugin's scope for editing panel's variables
 43 |    * @return {type}        New instance of DataProcessingEditorController
 44 |    * @memberof dataProcessingEditor
 45 |    */
 46 |   constructor( $scope) {
 47 |     $scope.editor = this;
 48 |     this.panelCtrl = $scope.ctrl;
 49 |     this.panel = this.panelCtrl.panel;
 50 |   }
 51 | 
 52 |   /**
 53 |    * toggleDescVisibility - handler for an editor tab event <br>
 54 |    * Toggles the state of <i>showDescription</i> variable to display or not <br>
 55 |    * the descriptions for the data mapping options.
 56 |    *
 57 |    * @memberof dataProcessingEditor
 58 |    */
 59 |   toggleDescVisibility(){
 60 |     this.panel.dataProcessing.showDescription = !this.panel.dataProcessing.showDescription;
 61 |   }
 62 | }
 63 | 
 64 | /**
 65 |  * dataProcessingEditor - function exported to be used as the AngularJs component
 66 |  *
 67 |  * @param  {type} scope A reference to the scope of the plugin to route functions and variables
 68 |  * @return AngularJS Component       New dataProcessingEditor
 69 |  * @memberof dataProcessingEditor
 70 |  */
 71 | export function dataProcessingEditor( scope){
 72 |   'use strict';
 73 |   let pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/dataProcessing/dataProcessingEditor.html';
 74 |   return function(){
 75 |     return{
 76 |       restrict: 'E',
 77 |       scope: true,
 78 |       templateUrl: pathToTemplate,
 79 |       controller: DataProcessingEditorController,
 80 |     };
 81 |   };
 82 | }
 83 | 
84 |
85 |
86 | 87 | 88 | 89 | 90 |
91 | 92 | 95 | 96 |
97 | 98 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /dist/libs/d3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "d3", 3 | "_id": "d3@4.12.2", 4 | "_inBundle": false, 5 | "_integrity": "sha512-aKAlpgTmpuGeEpezB+GvPpX1x+gCMs/PHpuse6sCpkgw4Un3ZeqUobIc87eIy9adcl+wxPAnEyKyO5oulH3MOw==", 6 | "_location": "/d3", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "d3", 12 | "name": "d3", 13 | "escapedName": "d3", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER", 20 | "/" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/d3/-/d3-4.12.2.tgz", 23 | "_shasum": "12f775564c6a9de229f63db03446e2cb7bb56c8f", 24 | "_spec": "d3", 25 | "_where": "/home/alex/Documentos/primer-plugin", 26 | "author": { 27 | "name": "Mike Bostock", 28 | "url": "https://bost.ocks.org/mike" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/d3/d3/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": { 35 | "d3-array": "1.2.1", 36 | "d3-axis": "1.0.8", 37 | "d3-brush": "1.0.4", 38 | "d3-chord": "1.0.4", 39 | "d3-collection": "1.0.4", 40 | "d3-color": "1.0.3", 41 | "d3-dispatch": "1.0.3", 42 | "d3-drag": "1.2.1", 43 | "d3-dsv": "1.0.8", 44 | "d3-ease": "1.0.3", 45 | "d3-force": "1.1.0", 46 | "d3-format": "1.2.1", 47 | "d3-geo": "1.9.1", 48 | "d3-hierarchy": "1.1.5", 49 | "d3-interpolate": "1.1.6", 50 | "d3-path": "1.0.5", 51 | "d3-polygon": "1.0.3", 52 | "d3-quadtree": "1.0.3", 53 | "d3-queue": "3.0.7", 54 | "d3-random": "1.1.0", 55 | "d3-request": "1.0.6", 56 | "d3-scale": "1.0.7", 57 | "d3-selection": "1.2.0", 58 | "d3-shape": "1.2.0", 59 | "d3-time": "1.0.8", 60 | "d3-time-format": "2.1.1", 61 | "d3-timer": "1.0.7", 62 | "d3-transition": "1.1.1", 63 | "d3-voronoi": "1.1.2", 64 | "d3-zoom": "1.7.1" 65 | }, 66 | "deprecated": false, 67 | "description": "Data-Driven Documents", 68 | "devDependencies": { 69 | "json2module": "0.0", 70 | "package-preamble": "0.1", 71 | "rimraf": "2", 72 | "rollup": "0.53", 73 | "rollup-plugin-ascii": "0.0", 74 | "rollup-plugin-node-resolve": "3", 75 | "tape": "4", 76 | "uglify-js": "3.2" 77 | }, 78 | "homepage": "https://d3js.org", 79 | "jsdelivr": "build/d3.min.js", 80 | "jsnext:main": "index", 81 | "keywords": [ 82 | "dom", 83 | "visualization", 84 | "svg", 85 | "animation", 86 | "canvas" 87 | ], 88 | "license": "BSD-3-Clause", 89 | "main": "build/d3.node.js", 90 | "module": "index", 91 | "name": "d3", 92 | "repository": { 93 | "type": "git", 94 | "url": "git+https://github.com/d3/d3.git" 95 | }, 96 | "scripts": { 97 | "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3/build/d3.js d3.v4.js && cp ../d3/build/d3.min.js d3.v4.min.js && git add d3.v4.js d3.v4.min.js && git commit -m \"d3 ${npm_package_version}\" && git push && cd - && cd ../d3-bower && git pull && cp ../d3/LICENSE ../d3/README.md ../d3/build/d3.js ../d3/build/d3.min.js . && git add -- LICENSE README.md d3.js d3.min.js && git commit -m \"${npm_package_version}\" && git tag -am \"${npm_package_version}\" v${npm_package_version} && git push && git push --tags && cd - && zip -j build/d3.zip -- LICENSE README.md API.md CHANGES.md build/d3.js build/d3.min.js", 98 | "prepublishOnly": "npm run test && rollup -c --banner \"$(preamble)\" && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" build/d3.js -c negate_iife=false -m -o build/d3.min.js", 99 | "pretest": "rimraf build && mkdir build && json2module package.json > build/package.js && node rollup.node", 100 | "test": "tape 'test/**/*-test.js'" 101 | }, 102 | "unpkg": "build/d3.min.js", 103 | "version": "4.12.2" 104 | } 105 | -------------------------------------------------------------------------------- /src/libs/d3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "d3", 3 | "_id": "d3@4.12.2", 4 | "_inBundle": false, 5 | "_integrity": "sha512-aKAlpgTmpuGeEpezB+GvPpX1x+gCMs/PHpuse6sCpkgw4Un3ZeqUobIc87eIy9adcl+wxPAnEyKyO5oulH3MOw==", 6 | "_location": "/d3", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "d3", 12 | "name": "d3", 13 | "escapedName": "d3", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER", 20 | "/" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/d3/-/d3-4.12.2.tgz", 23 | "_shasum": "12f775564c6a9de229f63db03446e2cb7bb56c8f", 24 | "_spec": "d3", 25 | "_where": "/home/alex/Documentos/primer-plugin", 26 | "author": { 27 | "name": "Mike Bostock", 28 | "url": "https://bost.ocks.org/mike" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/d3/d3/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": { 35 | "d3-array": "1.2.1", 36 | "d3-axis": "1.0.8", 37 | "d3-brush": "1.0.4", 38 | "d3-chord": "1.0.4", 39 | "d3-collection": "1.0.4", 40 | "d3-color": "1.0.3", 41 | "d3-dispatch": "1.0.3", 42 | "d3-drag": "1.2.1", 43 | "d3-dsv": "1.0.8", 44 | "d3-ease": "1.0.3", 45 | "d3-force": "1.1.0", 46 | "d3-format": "1.2.1", 47 | "d3-geo": "1.9.1", 48 | "d3-hierarchy": "1.1.5", 49 | "d3-interpolate": "1.1.6", 50 | "d3-path": "1.0.5", 51 | "d3-polygon": "1.0.3", 52 | "d3-quadtree": "1.0.3", 53 | "d3-queue": "3.0.7", 54 | "d3-random": "1.1.0", 55 | "d3-request": "1.0.6", 56 | "d3-scale": "1.0.7", 57 | "d3-selection": "1.2.0", 58 | "d3-shape": "1.2.0", 59 | "d3-time": "1.0.8", 60 | "d3-time-format": "2.1.1", 61 | "d3-timer": "1.0.7", 62 | "d3-transition": "1.1.1", 63 | "d3-voronoi": "1.1.2", 64 | "d3-zoom": "1.7.1" 65 | }, 66 | "deprecated": false, 67 | "description": "Data-Driven Documents", 68 | "devDependencies": { 69 | "json2module": "0.0", 70 | "package-preamble": "0.1", 71 | "rimraf": "2", 72 | "rollup": "0.53", 73 | "rollup-plugin-ascii": "0.0", 74 | "rollup-plugin-node-resolve": "3", 75 | "tape": "4", 76 | "uglify-js": "3.2" 77 | }, 78 | "homepage": "https://d3js.org", 79 | "jsdelivr": "build/d3.min.js", 80 | "jsnext:main": "index", 81 | "keywords": [ 82 | "dom", 83 | "visualization", 84 | "svg", 85 | "animation", 86 | "canvas" 87 | ], 88 | "license": "BSD-3-Clause", 89 | "main": "build/d3.node.js", 90 | "module": "index", 91 | "name": "d3", 92 | "repository": { 93 | "type": "git", 94 | "url": "git+https://github.com/d3/d3.git" 95 | }, 96 | "scripts": { 97 | "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3/build/d3.js d3.v4.js && cp ../d3/build/d3.min.js d3.v4.min.js && git add d3.v4.js d3.v4.min.js && git commit -m \"d3 ${npm_package_version}\" && git push && cd - && cd ../d3-bower && git pull && cp ../d3/LICENSE ../d3/README.md ../d3/build/d3.js ../d3/build/d3.min.js . && git add -- LICENSE README.md d3.js d3.min.js && git commit -m \"${npm_package_version}\" && git tag -am \"${npm_package_version}\" v${npm_package_version} && git push && git push --tags && cd - && zip -j build/d3.zip -- LICENSE README.md API.md CHANGES.md build/d3.js build/d3.min.js", 98 | "prepublishOnly": "npm run test && rollup -c --banner \"$(preamble)\" && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" build/d3.js -c negate_iife=false -m -o build/d3.min.js", 99 | "pretest": "rimraf build && mkdir build && json2module package.json > build/package.js && node rollup.node", 100 | "test": "tape 'test/**/*-test.js'" 101 | }, 102 | "unpkg": "build/d3.min.js", 103 | "version": "4.12.2" 104 | } 105 | -------------------------------------------------------------------------------- /dist/heatmapCtrl.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register(['app/plugins/sdk', 'lodash', './panelDefaults.js', './features/render/renderController.js', './features/panelActions/panelActionsController.js', './features/dataProcessing/dataProcessingController.js'], function (_export, _context) { 4 | "use strict"; 5 | 6 | var MetricsPanelCtrl, _, panelDefaults, RenderFeature, PanelActionsFeature, DataProcessingFeature, HeatmapController; 7 | 8 | function _classCallCheck(instance, Constructor) { 9 | if (!(instance instanceof Constructor)) { 10 | throw new TypeError("Cannot call a class as a function"); 11 | } 12 | } 13 | 14 | function _possibleConstructorReturn(self, call) { 15 | if (!self) { 16 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 17 | } 18 | 19 | return call && (typeof call === "object" || typeof call === "function") ? call : self; 20 | } 21 | 22 | function _inherits(subClass, superClass) { 23 | if (typeof superClass !== "function" && superClass !== null) { 24 | throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); 25 | } 26 | 27 | subClass.prototype = Object.create(superClass && superClass.prototype, { 28 | constructor: { 29 | value: subClass, 30 | enumerable: false, 31 | writable: true, 32 | configurable: true 33 | } 34 | }); 35 | if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; 36 | } 37 | 38 | return { 39 | setters: [function (_appPluginsSdk) { 40 | MetricsPanelCtrl = _appPluginsSdk.MetricsPanelCtrl; 41 | }, function (_lodash) { 42 | _ = _lodash.default; 43 | }, function (_panelDefaultsJs) { 44 | panelDefaults = _panelDefaultsJs.panelDefaults; 45 | }, function (_featuresRenderRenderControllerJs) { 46 | RenderFeature = _featuresRenderRenderControllerJs.default; 47 | }, function (_featuresPanelActionsPanelActionsControllerJs) { 48 | PanelActionsFeature = _featuresPanelActionsPanelActionsControllerJs.default; 49 | }, function (_featuresDataProcessingDataProcessingControllerJs) { 50 | DataProcessingFeature = _featuresDataProcessingDataProcessingControllerJs.default; 51 | }], 52 | execute: function () { 53 | _export('HeatmapController', HeatmapController = function (_MetricsPanelCtrl) { 54 | _inherits(HeatmapController, _MetricsPanelCtrl); 55 | 56 | /** 57 | * constructor - Constructor for HeatmapController 58 | *
59 | * Instances each one of the registered features. 60 | * 61 | * @param {type} $scope description 62 | * @param {type} $injector description 63 | * @return {type} New panel plugin controller 64 | */ 65 | function HeatmapController($scope, $injector) { 66 | _classCallCheck(this, HeatmapController); 67 | 68 | var _this = _possibleConstructorReturn(this, (HeatmapController.__proto__ || Object.getPrototypeOf(HeatmapController)).call(this, $scope, $injector)); 69 | 70 | var defaults = _.cloneDeep(panelDefaults); 71 | _this.panel = _.defaultsDeep(_this.panel, defaults); 72 | _this.panel.panelDivId = 'heatmap-' + _this.$scope.$id; 73 | 74 | _this.dataProcessingFeature = new DataProcessingFeature(_this.$scope); 75 | _this.panelActionsFeature = new PanelActionsFeature(_this.$scope); 76 | _this.renderFeature = new RenderFeature(_this.$scope); 77 | 78 | _this.refresh(); 79 | _this.render(); 80 | return _this; 81 | } 82 | 83 | return HeatmapController; 84 | }(MetricsPanelCtrl)); 85 | 86 | _export('HeatmapController', HeatmapController); 87 | 88 | HeatmapController.templateUrl = 'partials/module.html'; 89 | } 90 | }; 91 | }); 92 | //# sourceMappingURL=heatmapCtrl.js.map 93 | -------------------------------------------------------------------------------- /dist/libs/d3/build/d3.node.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, '__esModule', { value: true }); 4 | 5 | var d3Array = require('d3-array'); 6 | var d3Axis = require('d3-axis'); 7 | var d3Brush = require('d3-brush'); 8 | var d3Chord = require('d3-chord'); 9 | var d3Collection = require('d3-collection'); 10 | var d3Color = require('d3-color'); 11 | var d3Dispatch = require('d3-dispatch'); 12 | var d3Drag = require('d3-drag'); 13 | var d3Dsv = require('d3-dsv'); 14 | var d3Ease = require('d3-ease'); 15 | var d3Force = require('d3-force'); 16 | var d3Format = require('d3-format'); 17 | var d3Geo = require('d3-geo'); 18 | var d3Hierarchy = require('d3-hierarchy'); 19 | var d3Interpolate = require('d3-interpolate'); 20 | var d3Path = require('d3-path'); 21 | var d3Polygon = require('d3-polygon'); 22 | var d3Quadtree = require('d3-quadtree'); 23 | var d3Queue = require('d3-queue'); 24 | var d3Random = require('d3-random'); 25 | var d3Request = require('d3-request'); 26 | var d3Scale = require('d3-scale'); 27 | var d3Selection = require('d3-selection'); 28 | var d3Shape = require('d3-shape'); 29 | var d3Time = require('d3-time'); 30 | var d3TimeFormat = require('d3-time-format'); 31 | var d3Timer = require('d3-timer'); 32 | var d3Transition = require('d3-transition'); 33 | var d3Voronoi = require('d3-voronoi'); 34 | var d3Zoom = require('d3-zoom'); 35 | 36 | var version = "4.12.2"; 37 | 38 | exports.version = version; 39 | Object.keys(d3Array).forEach(function (key) { exports[key] = d3Array[key]; }); 40 | Object.keys(d3Axis).forEach(function (key) { exports[key] = d3Axis[key]; }); 41 | Object.keys(d3Brush).forEach(function (key) { exports[key] = d3Brush[key]; }); 42 | Object.keys(d3Chord).forEach(function (key) { exports[key] = d3Chord[key]; }); 43 | Object.keys(d3Collection).forEach(function (key) { exports[key] = d3Collection[key]; }); 44 | Object.keys(d3Color).forEach(function (key) { exports[key] = d3Color[key]; }); 45 | Object.keys(d3Dispatch).forEach(function (key) { exports[key] = d3Dispatch[key]; }); 46 | Object.keys(d3Drag).forEach(function (key) { exports[key] = d3Drag[key]; }); 47 | Object.keys(d3Dsv).forEach(function (key) { exports[key] = d3Dsv[key]; }); 48 | Object.keys(d3Ease).forEach(function (key) { exports[key] = d3Ease[key]; }); 49 | Object.keys(d3Force).forEach(function (key) { exports[key] = d3Force[key]; }); 50 | Object.keys(d3Format).forEach(function (key) { exports[key] = d3Format[key]; }); 51 | Object.keys(d3Geo).forEach(function (key) { exports[key] = d3Geo[key]; }); 52 | Object.keys(d3Hierarchy).forEach(function (key) { exports[key] = d3Hierarchy[key]; }); 53 | Object.keys(d3Interpolate).forEach(function (key) { exports[key] = d3Interpolate[key]; }); 54 | Object.keys(d3Path).forEach(function (key) { exports[key] = d3Path[key]; }); 55 | Object.keys(d3Polygon).forEach(function (key) { exports[key] = d3Polygon[key]; }); 56 | Object.keys(d3Quadtree).forEach(function (key) { exports[key] = d3Quadtree[key]; }); 57 | Object.keys(d3Queue).forEach(function (key) { exports[key] = d3Queue[key]; }); 58 | Object.keys(d3Random).forEach(function (key) { exports[key] = d3Random[key]; }); 59 | Object.keys(d3Request).forEach(function (key) { exports[key] = d3Request[key]; }); 60 | Object.keys(d3Scale).forEach(function (key) { exports[key] = d3Scale[key]; }); 61 | Object.keys(d3Selection).forEach(function (key) { exports[key] = d3Selection[key]; }); 62 | Object.keys(d3Shape).forEach(function (key) { exports[key] = d3Shape[key]; }); 63 | Object.keys(d3Time).forEach(function (key) { exports[key] = d3Time[key]; }); 64 | Object.keys(d3TimeFormat).forEach(function (key) { exports[key] = d3TimeFormat[key]; }); 65 | Object.keys(d3Timer).forEach(function (key) { exports[key] = d3Timer[key]; }); 66 | Object.keys(d3Transition).forEach(function (key) { exports[key] = d3Transition[key]; }); 67 | Object.keys(d3Voronoi).forEach(function (key) { exports[key] = d3Voronoi[key]; }); 68 | Object.keys(d3Zoom).forEach(function (key) { exports[key] = d3Zoom[key]; }); 69 | Object.defineProperty(exports, "event", {get: function() { return d3Selection.event; }}); 70 | -------------------------------------------------------------------------------- /src/libs/d3/build/d3.node.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, '__esModule', { value: true }); 4 | 5 | var d3Array = require('d3-array'); 6 | var d3Axis = require('d3-axis'); 7 | var d3Brush = require('d3-brush'); 8 | var d3Chord = require('d3-chord'); 9 | var d3Collection = require('d3-collection'); 10 | var d3Color = require('d3-color'); 11 | var d3Dispatch = require('d3-dispatch'); 12 | var d3Drag = require('d3-drag'); 13 | var d3Dsv = require('d3-dsv'); 14 | var d3Ease = require('d3-ease'); 15 | var d3Force = require('d3-force'); 16 | var d3Format = require('d3-format'); 17 | var d3Geo = require('d3-geo'); 18 | var d3Hierarchy = require('d3-hierarchy'); 19 | var d3Interpolate = require('d3-interpolate'); 20 | var d3Path = require('d3-path'); 21 | var d3Polygon = require('d3-polygon'); 22 | var d3Quadtree = require('d3-quadtree'); 23 | var d3Queue = require('d3-queue'); 24 | var d3Random = require('d3-random'); 25 | var d3Request = require('d3-request'); 26 | var d3Scale = require('d3-scale'); 27 | var d3Selection = require('d3-selection'); 28 | var d3Shape = require('d3-shape'); 29 | var d3Time = require('d3-time'); 30 | var d3TimeFormat = require('d3-time-format'); 31 | var d3Timer = require('d3-timer'); 32 | var d3Transition = require('d3-transition'); 33 | var d3Voronoi = require('d3-voronoi'); 34 | var d3Zoom = require('d3-zoom'); 35 | 36 | var version = "4.12.2"; 37 | 38 | exports.version = version; 39 | Object.keys(d3Array).forEach(function (key) { exports[key] = d3Array[key]; }); 40 | Object.keys(d3Axis).forEach(function (key) { exports[key] = d3Axis[key]; }); 41 | Object.keys(d3Brush).forEach(function (key) { exports[key] = d3Brush[key]; }); 42 | Object.keys(d3Chord).forEach(function (key) { exports[key] = d3Chord[key]; }); 43 | Object.keys(d3Collection).forEach(function (key) { exports[key] = d3Collection[key]; }); 44 | Object.keys(d3Color).forEach(function (key) { exports[key] = d3Color[key]; }); 45 | Object.keys(d3Dispatch).forEach(function (key) { exports[key] = d3Dispatch[key]; }); 46 | Object.keys(d3Drag).forEach(function (key) { exports[key] = d3Drag[key]; }); 47 | Object.keys(d3Dsv).forEach(function (key) { exports[key] = d3Dsv[key]; }); 48 | Object.keys(d3Ease).forEach(function (key) { exports[key] = d3Ease[key]; }); 49 | Object.keys(d3Force).forEach(function (key) { exports[key] = d3Force[key]; }); 50 | Object.keys(d3Format).forEach(function (key) { exports[key] = d3Format[key]; }); 51 | Object.keys(d3Geo).forEach(function (key) { exports[key] = d3Geo[key]; }); 52 | Object.keys(d3Hierarchy).forEach(function (key) { exports[key] = d3Hierarchy[key]; }); 53 | Object.keys(d3Interpolate).forEach(function (key) { exports[key] = d3Interpolate[key]; }); 54 | Object.keys(d3Path).forEach(function (key) { exports[key] = d3Path[key]; }); 55 | Object.keys(d3Polygon).forEach(function (key) { exports[key] = d3Polygon[key]; }); 56 | Object.keys(d3Quadtree).forEach(function (key) { exports[key] = d3Quadtree[key]; }); 57 | Object.keys(d3Queue).forEach(function (key) { exports[key] = d3Queue[key]; }); 58 | Object.keys(d3Random).forEach(function (key) { exports[key] = d3Random[key]; }); 59 | Object.keys(d3Request).forEach(function (key) { exports[key] = d3Request[key]; }); 60 | Object.keys(d3Scale).forEach(function (key) { exports[key] = d3Scale[key]; }); 61 | Object.keys(d3Selection).forEach(function (key) { exports[key] = d3Selection[key]; }); 62 | Object.keys(d3Shape).forEach(function (key) { exports[key] = d3Shape[key]; }); 63 | Object.keys(d3Time).forEach(function (key) { exports[key] = d3Time[key]; }); 64 | Object.keys(d3TimeFormat).forEach(function (key) { exports[key] = d3TimeFormat[key]; }); 65 | Object.keys(d3Timer).forEach(function (key) { exports[key] = d3Timer[key]; }); 66 | Object.keys(d3Transition).forEach(function (key) { exports[key] = d3Transition[key]; }); 67 | Object.keys(d3Voronoi).forEach(function (key) { exports[key] = d3Voronoi[key]; }); 68 | Object.keys(d3Zoom).forEach(function (key) { exports[key] = d3Zoom[key]; }); 69 | Object.defineProperty(exports, "event", {get: function() { return d3Selection.event; }}); 70 | -------------------------------------------------------------------------------- /dist/features/feature/__feature__Controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register(['app/plugins/sdk', 'app/core/time_series2', 'lodash', './__feature__Defaults.js', './__feature__Editor.js'], function (_export, _context) { 4 | "use strict"; 5 | 6 | var MetricsPanelCtrl, TimeSeries, _, __feature__Defaults, __feature__Editor, _createClass, Feature; 7 | 8 | function _classCallCheck(instance, Constructor) { 9 | if (!(instance instanceof Constructor)) { 10 | throw new TypeError("Cannot call a class as a function"); 11 | } 12 | } 13 | 14 | return { 15 | setters: [function (_appPluginsSdk) { 16 | MetricsPanelCtrl = _appPluginsSdk.MetricsPanelCtrl; 17 | }, function (_appCoreTime_series) { 18 | TimeSeries = _appCoreTime_series.default; 19 | }, function (_lodash) { 20 | _ = _lodash.default; 21 | }, function (_feature__DefaultsJs) { 22 | __feature__Defaults = _feature__DefaultsJs.__feature__Defaults; 23 | }, function (_feature__EditorJs) { 24 | __feature__Editor = _feature__EditorJs.__feature__Editor; 25 | }], 26 | execute: function () { 27 | _createClass = function () { 28 | function defineProperties(target, props) { 29 | for (var i = 0; i < props.length; i++) { 30 | var descriptor = props[i]; 31 | descriptor.enumerable = descriptor.enumerable || false; 32 | descriptor.configurable = true; 33 | if ("value" in descriptor) descriptor.writable = true; 34 | Object.defineProperty(target, descriptor.key, descriptor); 35 | } 36 | } 37 | 38 | return function (Constructor, protoProps, staticProps) { 39 | if (protoProps) defineProperties(Constructor.prototype, protoProps); 40 | if (staticProps) defineProperties(Constructor, staticProps); 41 | return Constructor; 42 | }; 43 | }(); 44 | 45 | Feature = function () { 46 | function Feature($scope) { 47 | _classCallCheck(this, Feature); 48 | 49 | this.$scope = $scope; 50 | this.panelController = $scope.ctrl; 51 | this.panel = $scope.ctrl.panel; 52 | 53 | var defaults = _.cloneDeep(__feature__Defaults); 54 | _.defaults(this.panel, defaults); 55 | 56 | this.panelController.events.on('init-edit-mode', this.onInitEditMode.bind(this)); 57 | //this.panelController.events.on( 'data-received', this.onDataReceived.bind(this)); 58 | //this.panelController.events.on( 'panel-initialized', this.onPanelInitialized.bind(this)); 59 | //this.panelController.events.on( 'render', this.onRender.bind(this)); 60 | //this.panelController.events.on( 'refresh', this.onRefresh.bind(this)); 61 | //this.events.on('init-panel-actions', this.onInitPanelActions.bind(this)); 62 | } 63 | 64 | _createClass(Feature, [{ 65 | key: 'onInitEditMode', 66 | value: function onInitEditMode() { 67 | this.panelController.addEditorTab('__Feature__', __feature__Editor(this.$scope), 2); 68 | } 69 | }, { 70 | key: 'onInitPanelActions', 71 | value: function onInitPanelActions(actions) { 72 | actions.push({ text: 'event button text', click: 'ctrl.panelEvent()' }); 73 | } 74 | }, { 75 | key: 'panelEvent', 76 | value: function panelEvent() {} 77 | }]); 78 | 79 | return Feature; 80 | }(); 81 | 82 | _export('default', Feature); 83 | } 84 | }; 85 | }); 86 | //# sourceMappingURL=__feature__Controller.js.map 87 | -------------------------------------------------------------------------------- /docs/heatmapCtrl.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: heatmapCtrl.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: heatmapCtrl.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
import {MetricsPanelCtrl} from 'app/plugins/sdk';
 30 | import _ from 'lodash';
 31 | 
 32 | import { panelDefaults } from './panelDefaults.js';
 33 | 
 34 | import RenderFeature from './features/render/renderController.js';
 35 | import PanelActionsFeature from './features/panelActions/panelActionsController.js';
 36 | import DataProcessingFeature from './features/dataProcessing/dataProcessingController.js'
 37 | 
 38 | 
 39 | /**
 40 |  * HeatmapController - Class HeatmapController
 41 |  * <br>
 42 |  * Implements the responsabilities pattern, and acts as mediator for the plugin's
 43 |  * events. <br><br>
 44 |  * The $scope and $injector of this parent class is passed to each new instance
 45 |  * of a feature to make it posible for the feature to subscribe to Grafana events.
 46 |  * <br><br>
 47 |  * The class does not implement any kind of functionality, nor control. Each new
 48 |  * instance of a feature is responsible of implementing any of it, and should not
 49 |  * make assumptions about the existance of other plugins; otherwise should be
 50 |  * specified. <br><br>
 51 |  * Actually, the following features: <br>
 52 |  * <ul>
 53 |  *  <li>dataProcessing</li>
 54 |  *  <li>render</li>
 55 |  *  <li>panelActions</li>
 56 |  * </ul>
 57 |  */
 58 | export class HeatmapController extends MetricsPanelCtrl{
 59 | 
 60 |     /**
 61 |      * constructor - Constructor for HeatmapController
 62 |      * <br>
 63 |      * Instances each one of the registered features.
 64 |      *
 65 |      * @param  {type} $scope    description
 66 |      * @param  {type} $injector description
 67 |      * @return {type}           New panel plugin controller
 68 |      */
 69 |     constructor( $scope, $injector){
 70 |         super( $scope, $injector);
 71 |         const defaults = _.cloneDeep(panelDefaults);
 72 |         this.panel = _.defaultsDeep( this.panel, defaults);
 73 |         this.panel.panelDivId = 'heatmap-'+this.$scope.$id;
 74 | 
 75 |         console.info('Loading Features for v1.0...');
 76 |         this.dataProcessingFeature = new DataProcessingFeature( this.$scope);
 77 |         this.panelActionsFeature = new PanelActionsFeature( this.$scope);
 78 |         this.renderFeature = new RenderFeature( this.$scope);
 79 | 
 80 |         this.refresh();
 81 |         this.render();
 82 |     }
 83 | }
 84 | 
 85 | HeatmapController.templateUrl = 'partials/module.html';
 86 | 
87 |
88 |
89 | 90 | 91 | 92 | 93 |
94 | 95 | 98 | 99 |
100 | 101 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Heatmap Generator 2 | Heatmap generator panel plugin for Grafana 3 | This plugin allows for the creation of configurable heatmaps from 4 | SVG figures with class and id tags to identify elements to fill. 5 | Documentation for the actual implementation of the plugin [can be found here](https://janchorizo.github.io/jancho-heatmap-panel/). 6 | 7 | ## Example of use case 8 | Already with an static SVG image representing some model of the data provided 9 | by some timeseries, and would like to represent such data (or a specific statistic 10 | from it) on the image. 11 | 12 | This is a common use case for the heatmap generator. Just adding an arbitrary class 13 | to all svg elements whished to be updated- differenciating between them through an id 14 | selector and 15 | 16 | ## How to use 17 | The plugin needs a base svg file on top of which to represent data by coloring the 18 | regions of the svg according to the identifiers, the values and color scale specified. 19 | 20 | > Now, it is possible to import an svg image directly through the Render editor tab. 21 | > Inserting the URL into the box and clicking in the adyacent import button is everything 22 | > needed to use the image in the plugin. 23 | > _Note that, given that the image is added client-side, it will not appear in the available 24 | > images, as there is not a possibility to store it locally_ 25 | 26 | Firstly, save the svg resources under the _resources_ folder of the plugin. 27 | 28 | ![svg location](/img/svgLocation.png) 29 | 30 | These svg files should have, for each region desired to be colored, a class attribute 31 | common to all regions which will be used to locate every one of them; and an unique 32 | identifier _(id attribute)_ for each of them, which will be used as an alias in the metrics 33 | tab to associate the data to the regions of the image. 34 | 35 | ![svg attributes](/img/svgAttributes.png) 36 | 37 | Additionally, the name _(without the .svg extension)_ of the resource can be written in 38 | the defaults file of the render feature, so that it can be easily selected from a dropdown menu. 39 | 40 | ![svg defaults](/img/svgDefaults.png) 41 | 42 | In the render editor tab, specify the name of the file from the dropdown menu or manually. 43 | Define too the class attribute that each element to be colored has. 44 | 45 | ![svg ](/img/svgLoad.png) 46 | 47 | Use the identifier in the Alias field of a metric to associate incoming data to that region. 48 | 49 | ![svg ](/img/svgMetrics.png) 50 | 51 | Now, the svg elements will be colored according to the value of statistic applied to data incoming, 52 | and to the alias of the metrics. 53 | 54 | ![svg ](/img/plugin.png) 55 | 56 | 57 | 58 | ## Available editor options 59 | ### Render tab 60 | ![Render Editor Tab](/img/renderEditorTab.png) 61 | All visually affecting options are groupped in this tab. Currently implemented options are : 62 | * SVG resurce name _excluding the .svg extension_ 63 | 64 | * URL pointing to an SVG image online, to import it into the plugin 65 | 66 | * Class attribute for elements to be updated 67 | 68 | * Discrete / Continuous color scale 69 | 70 | * Domain and thresholds for the color scales 71 | 72 | * Colors to be used for data visualization 73 | 74 | * Color to be used for SVG elements without data 75 | 76 | * Legend for displaying the alias, value and color for each metric 77 | 78 | ### DataProcessing tab 79 | ![Data Processing Editor Tab](/img/dataProcessingEditorTab.png) 80 | Refered to the the manipulation of incomming data, it is possible 81 | to select a statistic to be applied to each of the metrics. 82 | 83 | The following are supported : 84 | 85 | * Min 86 | Minimum value registered in the current data subset. 87 | * Max 88 | Maximum value registered in the current data subset. 89 | * Average 90 | Average value registered in the current data subset. 91 | * Current 92 | Current value registered in the current data subset. 93 | * Total 94 | Acumulated sum of the values registered in the current data subset. 95 | * First 96 | First value registered in the current data subset. 97 | * Difference 98 | Greatest difference between two consequent values in the current data subset. 99 | * Range 100 | Difference between the maximum and minimum values of the current data subset 101 | * Time of last point 102 | Last time register for the data subset. (Useful to see update time disparities) 103 | 104 | 105 | ### Known Issues 106 | 107 | ### Changelog 108 | It is now possible to load images directly from an url
109 | It is now possible to select wether select wether to use an online resource, 110 | or a local image. This makes it possible to have Snapshots that load correctly 111 | when online images are selected. 112 | -------------------------------------------------------------------------------- /dist/README.md: -------------------------------------------------------------------------------- 1 | # Heatmap Generator 2 | Heatmap generator panel plugin for Grafana 3 | This plugin allows for the creation of configurable heatmaps from 4 | SVG figures with class and id tags to identify elements to fill. 5 | Documentation for the actual implementation of the plugin [can be found here](https://janchorizo.github.io/jancho-heatmap-panel/). 6 | 7 | ## Example of use case 8 | Already with an static SVG image representing some model of the data provided 9 | by some timeseries, and would like to represent such data (or a specific statistic 10 | from it) on the image. 11 | 12 | This is a common use case for the heatmap generator. Just adding an arbitrary class 13 | to all svg elements whished to be updated- differenciating between them through an id 14 | selector and 15 | 16 | ## How to use 17 | The plugin needs a base svg file on top of which to represent data by coloring the 18 | regions of the svg according to the identifiers, the values and color scale specified. 19 | 20 | > Now, it is possible to import an svg image directly through the Render editor tab. 21 | > Inserting the URL into the box and clicking in the adyacent import button is everything 22 | > needed to use the image in the plugin. 23 | > _Note that, given that the image is added client-side, it will not appear in the available 24 | > images, as there is not a possibility to store it locally_ 25 | 26 | Firstly, save the svg resources under the _resources_ folder of the plugin. 27 | 28 | ![svg location](/img/svgLocation.png) 29 | 30 | These svg files should have, for each region desired to be colored, a class attribute 31 | common to all regions which will be used to locate every one of them; and an unique 32 | identifier _(id attribute)_ for each of them, which will be used as an alias in the metrics 33 | tab to associate the data to the regions of the image. 34 | 35 | ![svg attributes](/img/svgAttributes.png) 36 | 37 | Additionally, the name _(without the .svg extension)_ of the resource can be written in 38 | the defaults file of the render feature, so that it can be easily selected from a dropdown menu. 39 | 40 | ![svg defaults](/img/svgDefaults.png) 41 | 42 | In the render editor tab, specify the name of the file from the dropdown menu or manually. 43 | Define too the class attribute that each element to be colored has. 44 | 45 | ![svg ](/img/svgLoad.png) 46 | 47 | Use the identifier in the Alias field of a metric to associate incoming data to that region. 48 | 49 | ![svg ](/img/svgMetrics.png) 50 | 51 | Now, the svg elements will be colored according to the value of statistic applied to data incoming, 52 | and to the alias of the metrics. 53 | 54 | ![svg ](/img/plugin.png) 55 | 56 | 57 | 58 | ## Available editor options 59 | ### Render tab 60 | ![Render Editor Tab](/img/renderEditorTab.png) 61 | All visually affecting options are groupped in this tab. Currently implemented options are : 62 | * SVG resurce name _excluding the .svg extension_ 63 | 64 | * URL pointing to an SVG image online, to import it into the plugin 65 | 66 | * Class attribute for elements to be updated 67 | 68 | * Discrete / Continuous color scale 69 | 70 | * Domain and thresholds for the color scales 71 | 72 | * Colors to be used for data visualization 73 | 74 | * Color to be used for SVG elements without data 75 | 76 | * Legend for displaying the alias, value and color for each metric 77 | 78 | ### DataProcessing tab 79 | ![Data Processing Editor Tab](/img/dataProcessingEditorTab.png) 80 | Refered to the the manipulation of incomming data, it is possible 81 | to select a statistic to be applied to each of the metrics. 82 | 83 | The following are supported : 84 | 85 | * Min 86 | Minimum value registered in the current data subset. 87 | * Max 88 | Maximum value registered in the current data subset. 89 | * Average 90 | Average value registered in the current data subset. 91 | * Current 92 | Current value registered in the current data subset. 93 | * Total 94 | Acumulated sum of the values registered in the current data subset. 95 | * First 96 | First value registered in the current data subset. 97 | * Difference 98 | Greatest difference between two consequent values in the current data subset. 99 | * Range 100 | Difference between the maximum and minimum values of the current data subset 101 | * Time of last point 102 | Last time register for the data subset. (Useful to see update time disparities) 103 | 104 | 105 | ### Known Issues 106 | 107 | ### Changelog 108 | It is now possible to load images directly from an url
109 | It is now possible to select wether select wether to use an online resource, 110 | or a local image. This makes it possible to have Snapshots that load correctly 111 | when online images are selected. 112 | -------------------------------------------------------------------------------- /docs/panelActionsFeature.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Class: panelActionsFeature 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Class: panelActionsFeature

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 |

panelActionsFeature($scope)

32 | 33 |

panelActions feature

34 | Implementación de una funcionalidad
35 | Mediante el patrón mediador, se suscribe a los eventos del plugin a través 36 | de la referencia al $scope que se le pasa. 37 |
38 |

Funcionalidad

39 | Proporciona funcionalidad añadida para el menú contextual del panel
40 |

Eventos suscritos

41 | ninguno
42 | 43 | 44 |
45 | 46 |
47 |
48 | 49 | 50 | 51 | 52 |

Constructor

53 | 54 | 55 | 56 |

new panelActionsFeature($scope)

57 | 58 | 59 | 60 | 61 | 62 | 63 |
64 | constructor - description 65 |
66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 |
Parameters:
76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 111 | 112 | 113 | 114 | 115 | 116 | 118 | 119 | 120 | 121 | 122 |
NameTypeDescription
$scope 104 | 105 | 106 | type 107 | 108 | 109 | 110 | Es el contexto del plugin que se pasa para poder suscribirse 117 | a los eventos.
123 | 124 | 125 | 126 | 127 | 128 | 129 |
130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 |
Source:
157 |
160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 |
168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 |
188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 |
209 | 210 |
211 | 212 | 213 | 214 | 215 |
216 | 217 | 220 | 221 |
222 | 223 | 226 | 227 | 228 | 229 | 230 | -------------------------------------------------------------------------------- /docs/HeatmapController.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Class: HeatmapController 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Class: HeatmapController

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 |

HeatmapController($scope, $injector)

32 | 33 |
HeatmapController - Class HeatmapController 34 |
35 | Implements the responsabilities pattern, and acts as mediator for the plugin's 36 | events.

37 | The $scope and $injector of this parent class is passed to each new instance 38 | of a feature to make it posible for the feature to subscribe to Grafana events. 39 |

40 | The class does not implement any kind of functionality, nor control. Each new 41 | instance of a feature is responsible of implementing any of it, and should not 42 | make assumptions about the existance of other plugins; otherwise should be 43 | specified.

44 | Actually, the following features:
45 |
    46 |
  • dataProcessing
  • 47 |
  • render
  • 48 |
  • panelActions
  • 49 |
50 | 51 | 52 |
53 | 54 |
55 |
56 | 57 | 58 | 59 | 60 |

Constructor

61 | 62 | 63 | 64 |

new HeatmapController($scope, $injector)

65 | 66 | 67 | 68 | 69 | 70 | 71 |
72 | constructor - Constructor for HeatmapController 73 |
74 | Instances each one of the registered features. 75 |
76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
Parameters:
86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 |
NameTypeDescription
$scope 114 | 115 | 116 | type 117 | 118 | 119 | 120 | description
$injector 137 | 138 | 139 | type 140 | 141 | 142 | 143 | description
155 | 156 | 157 | 158 | 159 | 160 | 161 |
162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 |
Source:
189 |
192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 |
200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 |
220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 |
241 | 242 |
243 | 244 | 245 | 246 | 247 |
248 | 249 | 252 | 253 |
254 | 255 | 258 | 259 | 260 | 261 | 262 | -------------------------------------------------------------------------------- /docs/features_render_renderEditor.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: features/render/renderEditor.ts 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: features/render/renderEditor.ts

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
import * as d3 from '../../libs/d3/build/d3.js' ;
 30 | 
 31 | /**
 32 |  * @alias renderEditor
 33 |  * @classdesc <h2>render editor controller</h2>
 34 |  * Implementation for a feature editor.<br>
 35 |  * Controller for the editor tab of the plugin for this specific feature. <br>
 36 |  * <i>It is the controller of the AngularJS component for the editor</i>
 37 |  * <br>
 38 |  * @requires D3.js
 39 |  */
 40 | export class RenderEditorController {
 41 | 
 42 |   /**
 43 |    * constructor - description
 44 |    *
 45 |    * @param  {type} $scope A reference to the plugin's scope for editing panel's variables
 46 |    * @return {type}        New instance of RenderEditorController
 47 |    * @memberof renderEditor
 48 |    */
 49 |   constructor( $scope) {
 50 |     $scope.editor = this;
 51 |     this.panelCtrl = $scope.ctrl;
 52 |     this.panel = $scope.ctrl.panel;
 53 |   }
 54 | 
 55 |   /**
 56 |    * invertirColores - handler for an editor tab event <br>
 57 |    * Reverts the order of the colors applied on the scale.
 58 |    *
 59 |    * @memberof renderEditor
 60 |    */
 61 |   invertirColores(){
 62 |     let temp = this.panel.render.colors[0];
 63 |     this.panel.render.colors[0] = this.panel.render.colors[2];
 64 |     this.panel.render.colors[2] = temp;
 65 |     if(this.panel.render.discrete_continuous != true){
 66 |       this.actualizarColores();
 67 |     }
 68 |     this.panelCtrl.render();
 69 |   }
 70 | 
 71 |   /**
 72 |    * actualizarMapa - handler for an editor tab event <br>
 73 |    * Loads the svg resource on the DOM, after flushing the older one.<br>
 74 |    * It is follwed by a render event call.
 75 |    *
 76 |    * @memberof renderEditor
 77 |    */
 78 |   actualizarMapa(){
 79 |     let target = this.panel.panelDivId;
 80 |     let dir = this.panel.render.baseMapRoute + this.panel.render.mapRoute + ".svg";
 81 | 
 82 |     d3.xml( dir).mimeType( "image/svg+xml").get( function( error, xml){
 83 |       if( error){ throw( error);}
 84 |       let div = document.getElementById( target);
 85 |       div.removeChild(div.childNodes[0]);
 86 |       div.appendChild(xml.documentElement);
 87 |     });
 88 |     this.panelCtrl.render();
 89 |   }
 90 | 
 91 |   /**
 92 |    * actualizarColores - handler for an editor tab event <br>
 93 |    * Changes the instance of color scale to be used by D3.<br>
 94 |    * For discrete representation (fixed number of colors) an ad-hoc function is done.<br>
 95 |    * For continous representation (range of colors) a D3.js scale function is used, based on <br>
 96 |    * domain and color selected.
 97 |    *
 98 |    * @memberof renderEditor
 99 |    */
100 |   actualizarColores(){
101 |     if(this.panel.render.discrete_continuous == true){
102 |       this.panelCtrl.renderFeature.scaleColor = (function( value){
103 |         if( value <= this.panel.render.thresholds[0]){
104 |           return( this.panel.render.colors[0]);
105 |         }else if( value <= this.panel.render.thresholds[1]){
106 |           return( this.panel.render.colors[1]);
107 |         }else{
108 |           return( this.panel.render.colors[2]);
109 |         }
110 |       });
111 |     }else{
112 |       this.panelCtrl.renderFeature.scaleColor =  d3.scaleLinear()
113 |         .domain( this.panel.render.domain)
114 |         .range( this.panel.render.colors);
115 |     }
116 |     this.panelCtrl.render();
117 |   }
118 | }
119 | 
120 | /**
121 |  * renderEditor - function exported to be used as the AngularJs component
122 |  *
123 |  * @param  {type} scope A reference to the scope of the plugin to route functions and variables
124 |  * @return AngularJS Component       New renderEditor
125 |  * @memberof renderEditor
126 |  */
127 | export function renderEditor( scope){
128 |   'use strict';
129 |   let pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/render/renderEditor.html';
130 |   return function(){
131 |     return{
132 |       restrict: 'E',
133 |       scope: true,
134 |       templateUrl: pathToTemplate,
135 |       controller: RenderEditorController,
136 |     };
137 |   };
138 | }
139 | 
140 |
141 |
142 | 143 | 144 | 145 | 146 |
147 | 148 | 151 | 152 |
153 | 154 | 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /src/features/dataProcessing/dataProcessingController.ts: -------------------------------------------------------------------------------- 1 | import {MetricsPanelCtrl} from 'app/plugins/sdk'; 2 | import TimeSeries from 'app/core/time_series2'; 3 | import _ from 'lodash'; 4 | 5 | import { dataProcessingDefaults } from "./dataProcessingDefaults.js"; 6 | import { dataProcessingEditor } from "./dataProcessingEditor.js"; 7 | 8 | /** 9 | * @alias dataProcessingFeature 10 | * @classdesc

dataProcessingFeature feature

11 | * Implementation for a feature.
12 | * Makes use of the mediator pattern in order to subscribe the feature to 13 | * the plugin's event, through the $scope reference which is passed to it. 14 | *
15 | *

Functionaliy

16 | * This feature is responsible for managing data from TimeSeries, process it,
17 | * and applying the specified statistic. 18 | * Subscribed events 19 | * 24 | */ 25 | export default class Feature{ 26 | /** 27 | * constructor - description
28 | * Important the use of _.cloneDeep to ensure that no two instances of the same plugin 29 | * share references of the same variables. 30 | * 31 | * @param {type} $scope A reference to the plugin's scope for the subscription to events 32 | * @return {type} New instance of Feature 33 | */ 34 | constructor( $scope){ 35 | this.$scope = $scope; 36 | this.panelController = $scope.ctrl; 37 | this.panel = this.panelController.panel; 38 | 39 | const defaults = _.cloneDeep(dataProcessingDefaults); 40 | _.defaults( this.panelController.panel, defaults); 41 | 42 | this.panelController.events.on( 'init-edit-mode', this.onInitEditMode.bind(this)); 43 | this.panelController.events.on( 'data-received', this.onDataReceived.bind(this)); 44 | //this.panelController.events.on( 'panel-initialized', this.onPanelInitialized); 45 | this.panelController.events.on( 'refresh', this.onRefresh.bind(this)); 46 | } 47 | 48 | /** 49 | * onInitEditMode - Handler for the event : init-edit-mode
50 | * 51 | * @memberof dataProcessingFeature 52 | */ 53 | onInitEditMode(){ 54 | this.panelController.addEditorTab( 'DataProcessing', dataProcessingEditor( this.$scope), 2); 55 | } 56 | 57 | /** 58 | * onDataReceived - Handler for the event : data-received
59 | * When new data is received, it is converted into a simpler data structure;
60 | * then the selected statistic is applied to each of the metrics received. 61 | * 62 | * @param {type} dataList description 63 | * @memberof dataProcessingFeature 64 | */ 65 | onDataReceived( dataList){ 66 | if( dataList.length > 0){ 67 | this.panel.rawData = dataList; 68 | let data = dataList.map( this.seriesHandler.bind( this)); 69 | this.panel.data = []; 70 | this.panel.data = data.map( this.mapSeriesToValue.bind( this)); 71 | }else{ return;} 72 | this.panelController.render(); 73 | } 74 | 75 | /** 76 | * onRefresh - Handler for the event : refresh
77 | * When configuration is modified, data is converted into a simpler data structure;
78 | * then the selected statistic is applied to each of the metrics received.
79 | * Previous data received, stored in the rawData attribute, is used. 80 | * 81 | * @memberof dataProcessingFeature 82 | */ 83 | onRefresh(){ 84 | if( this.panel.rawData.length > 0){ 85 | let data = this.panel.rawData.map( this.seriesHandler.bind( this)); 86 | this.panel.data = data.map( this.mapSeriesToValue.bind( this)); 87 | }else{ return;} 88 | this.panelController.render(); 89 | } 90 | 91 | /** 92 | * seriesHandler - Extracts a simpler data structure.
93 | * 94 | * @param {type} dataList Original data structure 95 | * @return {TimeSeries} TimeSeries created from the original one 96 | * @memberof dataProcessingFeature 97 | */ 98 | seriesHandler( dataList){ 99 | //tratar nulos 100 | let series = new TimeSeries({ 101 | datapoints: dataList.datapoints, 102 | alias: dataList.target 103 | }); 104 | return( series); 105 | } 106 | 107 | /** 108 | * mapSeriesToValue - Applies statistics to obtain a [metric, value] pair from a TimeSeries.
109 | * 110 | * @param {Timeseries} timeseries receives a timeseries object containing all values registered for 111 | * a metric. 112 | * @return {Object} Object containing both the name and value for a specific metric. 113 | * @memberof dataProcessingFeature 114 | */ 115 | mapSeriesToValue( timeseries){ 116 | let value = {}; 117 | value['metric'] = timeseries.id; 118 | const elements = timeseries.datapoints.map(function(s){ return( s[0]);}); 119 | 120 | switch( this.panel.dataProcessing.valueStat){ 121 | case 'min': 122 | value['value'] = Math.min( ...elements); 123 | break; 124 | case 'max': 125 | value['value'] = Math.max( ...elements); 126 | break; 127 | case 'avg': 128 | value['value'] = elements.reduce( (a,b)=>a+b, 0) / timeseries.datapoints.length 129 | break; 130 | case 'current': 131 | value['value'] = elements[ timeseries.datapoints.length -1]; 132 | break; 133 | case 'total':; 134 | value['value'] = elements.reduce( (a,b)=>a+b, 0); 135 | break; 136 | case 'first': 137 | value['value'] = elements[0]; 138 | break; 139 | case 'diff': 140 | const pairs = _.map( elements, (a,b,c)=>{ return (b< c.length -1)?([a, c[b+1]]):([0,0]); }); 141 | const differences = _.map( pairs, (a)=>{return Math.abs(a[0]-a[1]);}); 142 | value['value'] =_.max( differences); 143 | break; 144 | case 'range': 145 | value['value'] = _.max(elements) - _.min(elements); 146 | break; 147 | case 'last_time': 148 | value['value'] = timeseries.datapoints[ timeseries.datapoints.length -1][1]; 149 | break; 150 | } 151 | return( value); 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /src/features/render/renderEditor.ts: -------------------------------------------------------------------------------- 1 | import * as d3 from '../../libs/d3/build/d3.js' ; 2 | 3 | /** 4 | * @alias renderEditor 5 | * @classdesc

render editor controller

6 | * Implementation for a feature editor.
7 | * Controller for the editor tab of the plugin for this specific feature.
8 | * It is the controller of the AngularJS component for the editor 9 | *
10 | * @requires D3.js 11 | */ 12 | export class RenderEditorController { 13 | 14 | /** 15 | * constructor - description 16 | * 17 | * @param {type} $scope A reference to the plugin's scope for editing panel's variables 18 | * @return {type} New instance of RenderEditorController 19 | * @memberof renderEditor 20 | */ 21 | constructor( $scope) { 22 | $scope.editor = this; 23 | this.panelCtrl = $scope.ctrl; 24 | this.panel = $scope.ctrl.panel; 25 | } 26 | 27 | /** 28 | * invertirColores - handler for an editor tab event
29 | * Reverts the order of the colors applied on the scale. 30 | * 31 | * @memberof renderEditor 32 | */ 33 | invertirColores(){ 34 | let temp = this.panel.render.colors[0]; 35 | this.panel.render.colors[0] = this.panel.render.colors[2]; 36 | this.panel.render.colors[2] = temp; 37 | if(this.panel.render.discrete_continuous != true){ 38 | this.actualizarColores(); 39 | } 40 | this.panelCtrl.render(); 41 | } 42 | 43 | /** 44 | * actualizarMapa - handler for an editor tab event
45 | * Loads the svg resource on the DOM, after flushing the older one.
46 | * It is follwed by a render event call. 47 | * 48 | * @memberof renderEditor 49 | */ 50 | actualizarMapa(){ 51 | let target = this.panel.panelDivId; 52 | let dir = this.panel.render.baseMapRoute + this.panel.render.mapRoute + ".svg"; 53 | 54 | d3.xml( dir).mimeType( "image/svg+xml").get( function( error, xml){ 55 | if( error){ throw( error);} 56 | let root = document.getElementById(target); 57 | let div = root.getElementsByClassName('image')[0] 58 | while (div.hasChildNodes()) { 59 | div.removeChild(div.firstChild); 60 | } 61 | div.appendChild(xml.documentElement); 62 | const h = (d3.select('div#'+target+' div.image svg').style('height').split('px')[0])*1.1; 63 | const w = (d3.select('div#'+target+' div.image svg').style('width').split('px')[0])*1.1; 64 | const panel = document.getElementById(target); 65 | const h = (d3.select('div#'+target+' div.image svg').style('height').split('px')[0]); 66 | const w = (d3.select('div#'+target+' div.image svg').style('width').split('px')[0]); 67 | 68 | d3.select('div#'+target+' div.image svg') 69 | .attr('viewBox', '0 0 '+w+' '+h) 70 | .attr('preserveAspectRatio', 'xMinYMin meet'); 71 | 72 | if(panel.clientWidth < panel.clientHeight){ 73 | d3.select('div#'+target+' div.image svg') 74 | .attr('width','100%') 75 | .attr('height','auto'); 76 | }else{ 77 | d3.select('div#'+target+' div.image svg') 78 | .attr('width','auto') 79 | .attr('height','100%'); 80 | } 81 | }); 82 | this.panelCtrl.render(); 83 | } 84 | 85 | /** 86 | * importarMapa - handler for an editor tab event
87 | * Loads the svg resource on the DOM, after flushing the older one, and 88 | * retrieving the svg from the url given.
89 | * It is follwed by a render event call. 90 | * 91 | * @memberof renderEditor 92 | */ 93 | importarMapa(){ 94 | 95 | window.fetch(this.panel.render.mapUrl) 96 | .then((response) => response.text()) 97 | .then(svg => { 98 | let target = this.panel.panelDivId; 99 | let root = document.getElementById(target); 100 | let div = root.getElementsByClassName('image')[0] 101 | 102 | while (div.hasChildNodes()) { 103 | div.removeChild(div.firstChild); 104 | } 105 | div.insertAdjacentHTML("afterbegin", svg); 106 | const h = (d3.select('div#'+target+' div.image svg').style('height').split('px')[0]); 107 | const w = (d3.select('div#'+target+' div.image svg').style('width').split('px')[0]); 108 | 109 | d3.select('div#'+target+' div.image svg') 110 | .attr('viewBox', '0 0 '+w+' '+h) 111 | .attr('preserveAspectRatio', 'xMinYMin meet'); 112 | 113 | if(panel.clientWidth < panel.clientHeight){ 114 | d3.select('div#'+target+' div.image svg') 115 | .attr('width','100%') 116 | .attr('height','auto'); 117 | }else{ 118 | d3.select('div#'+target+' div.image svg') 119 | .attr('width','auto') 120 | .attr('height','100%'); 121 | } 122 | this.panelCtrl.render(); 123 | }); 124 | } 125 | 126 | cambiarFuente(){ 127 | if(this.panel.render.source.local === true){ 128 | this.panel.render.source.remote = false; 129 | this.actualizarMapa(); 130 | }else if(this.panel.render.source.local === false){ 131 | this.panel.render.source.remote = true; 132 | this.importarMapa(); 133 | } 134 | } 135 | 136 | /** 137 | * actualizarColores - handler for an editor tab event
138 | * Changes the instance of color scale to be used by D3.
139 | * For discrete representation (fixed number of colors) an ad-hoc function is done.
140 | * For continous representation (range of colors) a D3.js scale function is used, based on
141 | * domain and color selected. 142 | * 143 | * @memberof renderEditor 144 | */ 145 | actualizarColores(){ 146 | if(this.panel.render.discrete_continuous == true){ 147 | this.panelCtrl.renderFeature.scaleColor = (function( value){ 148 | if( value <= this.panel.render.thresholds[0]){ 149 | return( this.panel.render.colors[0]); 150 | }else if( value <= this.panel.render.thresholds[1]){ 151 | return( this.panel.render.colors[1]); 152 | }else{ 153 | return( this.panel.render.colors[2]); 154 | } 155 | }); 156 | }else{ 157 | this.panelCtrl.renderFeature.scaleColor = d3.scaleLinear() 158 | .domain( this.panel.render.domain) 159 | .range( this.panel.render.colors); 160 | } 161 | this.panelCtrl.render(); 162 | } 163 | } 164 | 165 | /** 166 | * renderEditor - function exported to be used as the AngularJs component 167 | * 168 | * @param {type} scope A reference to the scope of the plugin to route functions and variables 169 | * @return AngularJS Component New renderEditor 170 | * @memberof renderEditor 171 | */ 172 | export function renderEditor( scope){ 173 | 'use strict'; 174 | let pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/render/renderEditor.html'; 175 | return function(){ 176 | return{ 177 | restrict: 'E', 178 | scope: true, 179 | templateUrl: pathToTemplate, 180 | controller: RenderEditorController, 181 | }; 182 | }; 183 | } 184 | -------------------------------------------------------------------------------- /dist/features/render/renderEditor.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | System.register(["../../libs/d3/build/d3.js"], function (_export, _context) { 4 | "use strict"; 5 | 6 | var d3, _createClass, RenderEditorController; 7 | 8 | function _classCallCheck(instance, Constructor) { 9 | if (!(instance instanceof Constructor)) { 10 | throw new TypeError("Cannot call a class as a function"); 11 | } 12 | } 13 | 14 | /** 15 | * renderEditor - function exported to be used as the AngularJs component 16 | * 17 | * @param {type} scope A reference to the scope of the plugin to route functions and variables 18 | * @return AngularJS Component New renderEditor 19 | * @memberof renderEditor 20 | */ 21 | function renderEditor(scope) { 22 | 'use strict'; 23 | 24 | var pathToTemplate = 'public/plugins/' + scope.ctrl.panel.type + '/features/render/renderEditor.html'; 25 | return function () { 26 | return { 27 | restrict: 'E', 28 | scope: true, 29 | templateUrl: pathToTemplate, 30 | controller: RenderEditorController 31 | }; 32 | }; 33 | } 34 | 35 | _export("renderEditor", renderEditor); 36 | 37 | return { 38 | setters: [function (_libsD3BuildD3Js) { 39 | d3 = _libsD3BuildD3Js; 40 | }], 41 | execute: function () { 42 | _createClass = function () { 43 | function defineProperties(target, props) { 44 | for (var i = 0; i < props.length; i++) { 45 | var descriptor = props[i]; 46 | descriptor.enumerable = descriptor.enumerable || false; 47 | descriptor.configurable = true; 48 | if ("value" in descriptor) descriptor.writable = true; 49 | Object.defineProperty(target, descriptor.key, descriptor); 50 | } 51 | } 52 | 53 | return function (Constructor, protoProps, staticProps) { 54 | if (protoProps) defineProperties(Constructor.prototype, protoProps); 55 | if (staticProps) defineProperties(Constructor, staticProps); 56 | return Constructor; 57 | }; 58 | }(); 59 | 60 | _export("RenderEditorController", RenderEditorController = function () { 61 | 62 | /** 63 | * constructor - description 64 | * 65 | * @param {type} $scope A reference to the plugin's scope for editing panel's variables 66 | * @return {type} New instance of RenderEditorController 67 | * @memberof renderEditor 68 | */ 69 | function RenderEditorController($scope) { 70 | _classCallCheck(this, RenderEditorController); 71 | 72 | $scope.editor = this; 73 | this.panelCtrl = $scope.ctrl; 74 | this.panel = $scope.ctrl.panel; 75 | } 76 | 77 | /** 78 | * invertirColores - handler for an editor tab event
79 | * Reverts the order of the colors applied on the scale. 80 | * 81 | * @memberof renderEditor 82 | */ 83 | 84 | 85 | _createClass(RenderEditorController, [{ 86 | key: "invertirColores", 87 | value: function invertirColores() { 88 | var temp = this.panel.render.colors[0]; 89 | this.panel.render.colors[0] = this.panel.render.colors[2]; 90 | this.panel.render.colors[2] = temp; 91 | if (this.panel.render.discrete_continuous != true) { 92 | this.actualizarColores(); 93 | } 94 | this.panelCtrl.render(); 95 | } 96 | }, { 97 | key: "actualizarMapa", 98 | value: function actualizarMapa() { 99 | var target = this.panel.panelDivId; 100 | var dir = this.panel.render.baseMapRoute + this.panel.render.mapRoute + ".svg"; 101 | 102 | d3.xml(dir).mimeType("image/svg+xml").get(function (error, xml) { 103 | if (error) { 104 | throw error; 105 | } 106 | var root = document.getElementById(target); 107 | var div = root.getElementsByClassName('image')[0]; 108 | while (div.hasChildNodes()) { 109 | div.removeChild(div.firstChild); 110 | } 111 | div.appendChild(xml.documentElement); 112 | var h = d3.select('div#' + target + ' div.image svg').style('height').split('px')[0] * 1.1; 113 | var w = d3.select('div#' + target + ' div.image svg').style('width').split('px')[0] * 1.1; 114 | d3.select('div#' + target + ' div.image svg').attr('width', '100%').attr('height', '100%').attr('viewBox', '0 0 ' + w + ' ' + h).attr('preserveAspectRatio', 'xMinYMin meet'); 115 | }); 116 | this.panelCtrl.render(); 117 | } 118 | }, { 119 | key: "importarMapa", 120 | value: function importarMapa() { 121 | var _this = this; 122 | 123 | window.fetch(this.panel.render.mapUrl).then(function (response) { 124 | return response.text(); 125 | }).then(function (svg) { 126 | var target = _this.panel.panelDivId; 127 | var root = document.getElementById(target); 128 | var div = root.getElementsByClassName('image')[0]; 129 | 130 | while (div.hasChildNodes()) { 131 | div.removeChild(div.firstChild); 132 | } 133 | div.insertAdjacentHTML("afterbegin", svg); 134 | var h = d3.select('div#' + target + ' div.image svg').style('height').split('px')[0] * 1.1; 135 | var w = d3.select('div#' + target + ' div.image svg').style('width').split('px')[0] * 1.1; 136 | d3.select('div#' + target + ' div.image svg').attr('width', '100%').attr('height', '100%').attr('viewBox', '0 0 ' + w + ' ' + h).attr('preserveAspectRatio', 'xMinYMin meet'); 137 | _this.panelCtrl.render(); 138 | }); 139 | } 140 | }, { 141 | key: "cambiarFuente", 142 | value: function cambiarFuente() { 143 | if (this.panel.render.source.local === true) { 144 | this.panel.render.source.remote = false; 145 | this.actualizarMapa(); 146 | } else if (this.panel.render.source.local === false) { 147 | this.panel.render.source.remote = true; 148 | this.importarMapa(); 149 | } 150 | } 151 | }, { 152 | key: "actualizarColores", 153 | value: function actualizarColores() { 154 | if (this.panel.render.discrete_continuous == true) { 155 | this.panelCtrl.renderFeature.scaleColor = function (value) { 156 | if (value <= this.panel.render.thresholds[0]) { 157 | return this.panel.render.colors[0]; 158 | } else if (value <= this.panel.render.thresholds[1]) { 159 | return this.panel.render.colors[1]; 160 | } else { 161 | return this.panel.render.colors[2]; 162 | } 163 | }; 164 | } else { 165 | this.panelCtrl.renderFeature.scaleColor = d3.scaleLinear().domain(this.panel.render.domain).range(this.panel.render.colors); 166 | } 167 | this.panelCtrl.render(); 168 | } 169 | }]); 170 | 171 | return RenderEditorController; 172 | }()); 173 | 174 | _export("RenderEditorController", RenderEditorController); 175 | } 176 | }; 177 | }); 178 | //# sourceMappingURL=renderEditor.js.map 179 | -------------------------------------------------------------------------------- /docs/styles/jsdoc-default.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Open Sans'; 3 | font-weight: normal; 4 | font-style: normal; 5 | src: url('../fonts/OpenSans-Regular-webfont.eot'); 6 | src: 7 | local('Open Sans'), 8 | local('OpenSans'), 9 | url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), 10 | url('../fonts/OpenSans-Regular-webfont.woff') format('woff'), 11 | url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg'); 12 | } 13 | 14 | @font-face { 15 | font-family: 'Open Sans Light'; 16 | font-weight: normal; 17 | font-style: normal; 18 | src: url('../fonts/OpenSans-Light-webfont.eot'); 19 | src: 20 | local('Open Sans Light'), 21 | local('OpenSans Light'), 22 | url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'), 23 | url('../fonts/OpenSans-Light-webfont.woff') format('woff'), 24 | url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg'); 25 | } 26 | 27 | html 28 | { 29 | overflow: auto; 30 | background-color: #fff; 31 | font-size: 14px; 32 | } 33 | 34 | body 35 | { 36 | font-family: 'Open Sans', sans-serif; 37 | line-height: 1.5; 38 | color: #4d4e53; 39 | background-color: white; 40 | } 41 | 42 | a, a:visited, a:active { 43 | color: #0095dd; 44 | text-decoration: none; 45 | } 46 | 47 | a:hover { 48 | text-decoration: underline; 49 | } 50 | 51 | header 52 | { 53 | display: block; 54 | padding: 0px 4px; 55 | } 56 | 57 | tt, code, kbd, samp { 58 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 59 | } 60 | 61 | .class-description { 62 | font-size: 130%; 63 | line-height: 140%; 64 | margin-bottom: 1em; 65 | margin-top: 1em; 66 | } 67 | 68 | .class-description:empty { 69 | margin: 0; 70 | } 71 | 72 | #main { 73 | float: left; 74 | width: 70%; 75 | } 76 | 77 | article dl { 78 | margin-bottom: 40px; 79 | } 80 | 81 | article img { 82 | max-width: 100%; 83 | } 84 | 85 | section 86 | { 87 | display: block; 88 | background-color: #fff; 89 | padding: 12px 24px; 90 | border-bottom: 1px solid #ccc; 91 | margin-right: 30px; 92 | } 93 | 94 | .variation { 95 | display: none; 96 | } 97 | 98 | .signature-attributes { 99 | font-size: 60%; 100 | color: #aaa; 101 | font-style: italic; 102 | font-weight: lighter; 103 | } 104 | 105 | nav 106 | { 107 | display: block; 108 | float: right; 109 | margin-top: 28px; 110 | width: 30%; 111 | box-sizing: border-box; 112 | border-left: 1px solid #ccc; 113 | padding-left: 16px; 114 | } 115 | 116 | nav ul { 117 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif; 118 | font-size: 100%; 119 | line-height: 17px; 120 | padding: 0; 121 | margin: 0; 122 | list-style-type: none; 123 | } 124 | 125 | nav ul a, nav ul a:visited, nav ul a:active { 126 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 127 | line-height: 18px; 128 | color: #4D4E53; 129 | } 130 | 131 | nav h3 { 132 | margin-top: 12px; 133 | } 134 | 135 | nav li { 136 | margin-top: 6px; 137 | } 138 | 139 | footer { 140 | display: block; 141 | padding: 6px; 142 | margin-top: 12px; 143 | font-style: italic; 144 | font-size: 90%; 145 | } 146 | 147 | h1, h2, h3, h4 { 148 | font-weight: 200; 149 | margin: 0; 150 | } 151 | 152 | h1 153 | { 154 | font-family: 'Open Sans Light', sans-serif; 155 | font-size: 48px; 156 | letter-spacing: -2px; 157 | margin: 12px 24px 20px; 158 | } 159 | 160 | h2, h3.subsection-title 161 | { 162 | font-size: 30px; 163 | font-weight: 700; 164 | letter-spacing: -1px; 165 | margin-bottom: 12px; 166 | } 167 | 168 | h3 169 | { 170 | font-size: 24px; 171 | letter-spacing: -0.5px; 172 | margin-bottom: 12px; 173 | } 174 | 175 | h4 176 | { 177 | font-size: 18px; 178 | letter-spacing: -0.33px; 179 | margin-bottom: 12px; 180 | color: #4d4e53; 181 | } 182 | 183 | h5, .container-overview .subsection-title 184 | { 185 | font-size: 120%; 186 | font-weight: bold; 187 | letter-spacing: -0.01em; 188 | margin: 8px 0 3px 0; 189 | } 190 | 191 | h6 192 | { 193 | font-size: 100%; 194 | letter-spacing: -0.01em; 195 | margin: 6px 0 3px 0; 196 | font-style: italic; 197 | } 198 | 199 | table 200 | { 201 | border-spacing: 0; 202 | border: 0; 203 | border-collapse: collapse; 204 | } 205 | 206 | td, th 207 | { 208 | border: 1px solid #ddd; 209 | margin: 0px; 210 | text-align: left; 211 | vertical-align: top; 212 | padding: 4px 6px; 213 | display: table-cell; 214 | } 215 | 216 | thead tr 217 | { 218 | background-color: #ddd; 219 | font-weight: bold; 220 | } 221 | 222 | th { border-right: 1px solid #aaa; } 223 | tr > th:last-child { border-right: 1px solid #ddd; } 224 | 225 | .ancestors, .attribs { color: #999; } 226 | .ancestors a, .attribs a 227 | { 228 | color: #999 !important; 229 | text-decoration: none; 230 | } 231 | 232 | .clear 233 | { 234 | clear: both; 235 | } 236 | 237 | .important 238 | { 239 | font-weight: bold; 240 | color: #950B02; 241 | } 242 | 243 | .yes-def { 244 | text-indent: -1000px; 245 | } 246 | 247 | .type-signature { 248 | color: #aaa; 249 | } 250 | 251 | .name, .signature { 252 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 253 | } 254 | 255 | .details { margin-top: 14px; border-left: 2px solid #DDD; } 256 | .details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } 257 | .details dd { margin-left: 70px; } 258 | .details ul { margin: 0; } 259 | .details ul { list-style-type: none; } 260 | .details li { margin-left: 30px; padding-top: 6px; } 261 | .details pre.prettyprint { margin: 0 } 262 | .details .object-value { padding-top: 0; } 263 | 264 | .description { 265 | margin-bottom: 1em; 266 | margin-top: 1em; 267 | } 268 | 269 | .code-caption 270 | { 271 | font-style: italic; 272 | font-size: 107%; 273 | margin: 0; 274 | } 275 | 276 | .prettyprint 277 | { 278 | border: 1px solid #ddd; 279 | width: 80%; 280 | overflow: auto; 281 | } 282 | 283 | .prettyprint.source { 284 | width: inherit; 285 | } 286 | 287 | .prettyprint code 288 | { 289 | font-size: 100%; 290 | line-height: 18px; 291 | display: block; 292 | padding: 4px 12px; 293 | margin: 0; 294 | background-color: #fff; 295 | color: #4D4E53; 296 | } 297 | 298 | .prettyprint code span.line 299 | { 300 | display: inline-block; 301 | } 302 | 303 | .prettyprint.linenums 304 | { 305 | padding-left: 70px; 306 | -webkit-user-select: none; 307 | -moz-user-select: none; 308 | -ms-user-select: none; 309 | user-select: none; 310 | } 311 | 312 | .prettyprint.linenums ol 313 | { 314 | padding-left: 0; 315 | } 316 | 317 | .prettyprint.linenums li 318 | { 319 | border-left: 3px #ddd solid; 320 | } 321 | 322 | .prettyprint.linenums li.selected, 323 | .prettyprint.linenums li.selected * 324 | { 325 | background-color: lightyellow; 326 | } 327 | 328 | .prettyprint.linenums li * 329 | { 330 | -webkit-user-select: text; 331 | -moz-user-select: text; 332 | -ms-user-select: text; 333 | user-select: text; 334 | } 335 | 336 | .params .name, .props .name, .name code { 337 | color: #4D4E53; 338 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 339 | font-size: 100%; 340 | } 341 | 342 | .params td.description > p:first-child, 343 | .props td.description > p:first-child 344 | { 345 | margin-top: 0; 346 | padding-top: 0; 347 | } 348 | 349 | .params td.description > p:last-child, 350 | .props td.description > p:last-child 351 | { 352 | margin-bottom: 0; 353 | padding-bottom: 0; 354 | } 355 | 356 | .disabled { 357 | color: #454545; 358 | } 359 | -------------------------------------------------------------------------------- /docs/features_render_renderController.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: features/render/renderController.ts 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: features/render/renderController.ts

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
import {MetricsPanelCtrl} from 'app/plugins/sdk';
 30 | import TimeSeries from 'app/core/time_series2';
 31 | import _ from 'lodash';
 32 | import * as d3 from '../../libs/d3/build/d3.js' ;
 33 | 
 34 | import { renderDefaults } from "./renderDefaults.js";
 35 | import { renderEditor } from "./renderEditor.js";
 36 | 
 37 | /**
 38 |  * @alias renderFeature
 39 |  * @classdesc <h2>render feature</h2>
 40 |  * Implementation for a feature.<br>
 41 |  * Makes use of the mediator pattern in order to subscribe the feature to
 42 |  * the plugin's event, through the $scope reference which is passed to it.
 43 |  * <br>
 44 |  * <br><h3>Functionaliy<h3><br>
 45 |  * This feature is responsible for representing data values in an svg, including <br>
 46 |  * the load of the svg in the DOM.
 47 |  * <i>Subscribed events</i>
 48 |  * <ul>
 49 |  *   <li>init-edit-mode</li>
 50 |  *   <li>panel-initialized</li>
 51 |  *   <li>render</li>
 52 |  * </ul>
 53 |  * @requires D3.js
 54 |  */
 55 | export default class Feature{
 56 |   /**
 57 |    * constructor - description <br>
 58 |    * Important the use of _.cloneDeep to ensure that no two instances of the same plugin
 59 |    * share references of the same variables.
 60 |    *
 61 |    * @param  {type} $scope A reference to the plugin's scope for the subscription to events
 62 |    * @return {type}        New instance of Feature
 63 |    */
 64 |   constructor( $scope){
 65 |       this.$scope = $scope;
 66 |       this.panelController = $scope.ctrl;
 67 |       this.panel = this.panelController.panel;
 68 | 
 69 |       const defaults = _.cloneDeep(renderDefaults)
 70 |       _.defaults( this.panelController.panel, defaults);
 71 | 
 72 |       this.panelController.events.on( 'init-edit-mode', this.onInitEditMode.bind(this));
 73 |       //this.panelController.events.on( 'data-received', this.onDataReceived);
 74 |       this.panelController.events.on( 'panel-initialized', this.onPanelInitialized.bind(this));
 75 |       this.panelController.events.on( 'render', this.onRender.bind(this));
 76 |       //this.panelController.events.on( 'refresh', this.onRefresh);
 77 |   }
 78 | 
 79 |   /**
 80 |    * onInitEditMode - Handler for the event : init-edit-mode<br>
 81 |    *
 82 |    * @memberof renderFeature
 83 |    */
 84 |   onInitEditMode(){
 85 |     this.panelController.addEditorTab( 'Render', renderEditor( this.$scope), 2);
 86 |   }
 87 | 
 88 |   /**
 89 |    * onRender - Handler for the event : render<br>
 90 |    * Requires of an element containing the svg to update based on the data
 91 |    * @memberof renderFeature
 92 |    */
 93 |   onRender(){
 94 |     this.renderSala( '#'+this.panel.panelDivId, this.panel.data);
 95 |   }
 96 | 
 97 |   /**
 98 |    * onPanelInitialized - Handler for the event : panel-initialized <br>
 99 |    * Renders the svg and data for the first time. Including :
100 |    * <ol>
101 |    * <li>Create a first instance of the color scale</li>
102 |    * <li>Load and append it to the specified element by the panelDivId identyfier</li>
103 |    * <li>Create an event for rendering the data over the svg</li>
104 |    * </ol>
105 |    *
106 |    * @memberof renderFeature
107 |    */
108 |   onPanelInitialized(){
109 |     this.actualizarColores();
110 |     this.cargarPlano( this.panel.panelDivId, this.panel.render.baseMapRoute + this.panel.render.mapRoute + ".svg");
111 |     this.panelController.render();
112 |   }
113 | 
114 |   /**
115 |    * actualizarColores - Changes the instance of color scale to be used by D3.<br><br>
116 |    * For discrete representation (fixed number of colors) an ad-hoc function is done.<br>
117 |    * For continous representation (range of colors) a D3.js scale function is used, based on <br>
118 |    * domain and color selected.
119 |    *
120 |    * @memberof renderFeature
121 |    */
122 |   actualizarColores(){
123 |     if(this.panel.render.discrete_continuous == true){
124 |       this.scaleColor = (function( value){
125 |         if( value <= this.panel.render.thresholds[0]){
126 |           return( this.panel.render.colors[0]);
127 |         }else if( value <= this.panel.render.thresholds[1]){
128 |           return( this.panel.render.colors[1]);
129 |         }else{
130 |           return( this.panel.render.colors[2]);
131 |         }
132 |       });
133 |     }else{
134 |       this.scaleColor =  d3.scaleLinear()
135 |         .domain( this.panel.render.domain)
136 |         .range( this.panel.render.colors);
137 |     }
138 |   }
139 | 
140 |   /**
141 |    * cargarPlano - Loads the svg resource into the DOM, hanging from the<br>
142 |    * element specified by the elementIdentifyer id attribute.
143 |    *
144 |    * @param  {type} target id attribute
145 |    * @param  {type} dir    svg resource url from where it is served
146 |    * @memberof renderFeature
147 |    */
148 |   cargarPlano( target, dir){
149 |     // target => id name
150 |     d3.xml( dir).mimeType( "image/svg+xml").get( function( error, xml){
151 |       if( error){ throw( error);}
152 |       let div = document.getElementById(target);
153 |       if(div != null){
154 |         div.removeChild(div.childNodes[0]);
155 |         div.appendChild(xml.documentElement);
156 |       }
157 |     });
158 |   }
159 | 
160 |   /**
161 |    * renderSala - Renders data on the svg resource <br>
162 |    * Color applied to each element specified is provided by the function loaded in scaleColor.
163 |    *
164 |    * @param  {type} target DOM element from which it hangs the svg
165 |    * @param  {type} data   TimeSeries processed data, in the form of pairs [metric, value]
166 |    * @memberof renderFeature
167 |    */
168 |   renderSala (target, data){
169 |     var t = d3.transition()
170 |     .duration(750)
171 |     .ease(d3.easeLinear);
172 | 
173 |     //ClearOutput
174 |     var t = d3.select(target+' svg').selectAll( '.'+this.panel.render.elementIdentifyer).style( 'fill', this.panel.render.unknownDataColor);
175 | 
176 |     //Binding
177 |     var salas = d3.select(target+' svg').selectAll( '.'+this.panel.render.elementIdentifyer)
178 | 
179 |     .data(data, function(d){ return d ? d.metric : this.id; });
180 |     //Update
181 |     salas
182 |       .transition(t)
183 |       .style('fill', $.proxy( function(d){ return this.scaleColor( d.value)}, this));
184 |   }
185 | }
186 | 
187 |
188 |
189 | 190 | 191 | 192 | 193 |
194 | 195 | 198 | 199 |
200 | 201 | 204 | 205 | 206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /docs/features_dataProcessing_dataProcessingController.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: features/dataProcessing/dataProcessingController.ts 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: features/dataProcessing/dataProcessingController.ts

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
import {MetricsPanelCtrl} from 'app/plugins/sdk';
 30 | import TimeSeries from 'app/core/time_series2';
 31 | import _ from 'lodash';
 32 | 
 33 | import { dataProcessingDefaults } from "./dataProcessingDefaults.js";
 34 | import { dataProcessingEditor } from "./dataProcessingEditor.js";
 35 | 
 36 |  /**
 37 |   * @alias dataProcessingFeature
 38 |   * @classdesc <h2>dataProcessingFeature feature</h2>
 39 |   * Implementation for a feature.<br>
 40 |   * Makes use of the mediator pattern in order to subscribe the feature to
 41 |   * the plugin's event, through the $scope reference which is passed to it.
 42 |   * <br>
 43 |   * <br><h3>Functionaliy<h3>
 44 |   * This feature is responsible for managing data from TimeSeries, process it, <br>
 45 |   * and applying the specified statistic.
 46 |   * <i>Subscribed events</i>
 47 |   * <ul>
 48 |   *  <li>init-edit-mode</li>
 49 |   *  <li>data-received</li>
 50 |   *  <li>refresh</li>
 51 |   * </ul>
 52 |   */
 53 | export default class Feature{
 54 |    /**
 55 |     * constructor - description <br>
 56 |     * Important the use of _.cloneDeep to ensure that no two instances of the same plugin
 57 |     * share references of the same variables.
 58 |     *
 59 |     * @param  {type} $scope A reference to the plugin's scope for the subscription to events
 60 |     * @return {type}        New instance of Feature
 61 |     */
 62 |   constructor( $scope){
 63 |       this.$scope = $scope;
 64 |       this.panelController = $scope.ctrl;
 65 |       this.panel = this.panelController.panel;
 66 | 
 67 |       const defaults = _.cloneDeep(dataProcessingDefaults);
 68 |       _.defaults( this.panelController.panel, defaults);
 69 | 
 70 |       this.panelController.events.on( 'init-edit-mode', this.onInitEditMode.bind(this));
 71 |       this.panelController.events.on( 'data-received', this.onDataReceived.bind(this));
 72 |       //this.panelController.events.on( 'panel-initialized', this.onPanelInitialized);
 73 |       this.panelController.events.on( 'refresh', this.onRefresh.bind(this));
 74 |   }
 75 | 
 76 |   /**
 77 |    * onInitEditMode - Handler for the event : init-edit-mode<br>
 78 |    *
 79 |    * @memberof dataProcessingFeature
 80 |    */
 81 |   onInitEditMode(){
 82 |       this.panelController.addEditorTab( 'DataProcessing', dataProcessingEditor( this.$scope), 2);
 83 |   }
 84 | 
 85 |   /**
 86 |    * onDataReceived - Handler for the event : data-received<br>
 87 |    * When new data is received, it is converted into a simpler data structure;<br>
 88 |    * then the selected statistic is applied to each of the metrics received.
 89 |    *
 90 |    * @param  {type} dataList description
 91 |    * @memberof dataProcessingFeature
 92 |    */
 93 |   onDataReceived( dataList){
 94 |     if( dataList.length > 0){
 95 |       this.panel.rawData = dataList;
 96 |       let data = dataList.map( this.seriesHandler.bind( this));
 97 |       this.panel.data = [];
 98 |       this.panel.data = data.map( this.mapSeriesToValue.bind( this));
 99 |     }else{ return;}
100 |     this.panelController.render();
101 |   }
102 | 
103 |   /**
104 |    * onRefresh - Handler for the event : refresh<br>
105 |    * When configuration is modified, data is converted into a simpler data structure;<br>
106 |    * then the selected statistic is applied to each of the metrics received.<br>
107 |    * <i>Previous data received, stored in the rawData attribute, is used.</i>
108 |    *
109 |    * @memberof dataProcessingFeature
110 |    */
111 |   onRefresh(){
112 |     if( this.panel.rawData.length > 0){
113 |       let data = this.panel.rawData.map( this.seriesHandler.bind( this));
114 |       this.panel.data = data.map( this.mapSeriesToValue.bind( this));
115 |     }else{ return;}
116 |     this.panelController.render();
117 |   }
118 | 
119 |   /**
120 |    * seriesHandler - Extracts a simpler data structure.<br>
121 |    *
122 |    * @param  {type} dataList Original data structure
123 |    * @return {TimeSeries}          TimeSeries created from the original one
124 |    * @memberof dataProcessingFeature
125 |    */
126 |   seriesHandler( dataList){
127 |       //tratar nulos
128 |       let series = new TimeSeries({
129 |           datapoints: dataList.datapoints,
130 |           alias: dataList.target
131 |       });
132 |       return( series);
133 |   }
134 | 
135 |   /**
136 |    * mapSeriesToValue - Applies statistics to obtain a [metric, value] pair from a TimeSeries.<br>
137 |    *
138 |    * @param  {Timeseries} timeseries receives a timeseries object containing all values registered for
139 |    * a metric.
140 |    * @return {Object}            Object containing both the name and value for a specific metric.
141 |    * @memberof dataProcessingFeature
142 |    */
143 |   mapSeriesToValue( timeseries){
144 |         let value = {};
145 |         value['metric'] = timeseries.id;
146 |         const elements = timeseries.datapoints.map(function(s){ return( s[0]);});
147 | 
148 |         switch( this.panel.dataProcessing.valueStat){
149 |             case 'min':
150 |                 value['value'] = Math.min( ...elements);
151 |             break;
152 |             case 'max':
153 |                 value['value'] = Math.max( ...elements);
154 |             break;
155 |             case 'avg':
156 |                 value['value'] = elements.reduce( (a,b)=>a+b, 0) / timeseries.datapoints.length
157 |             break;
158 |             case 'current':
159 |                 value['value'] = elements[ timeseries.datapoints.length -1];
160 |             break;
161 |             case 'total':;
162 |                 value['value'] = elements.reduce( (a,b)=>a+b, 0);
163 |             break;
164 |             case 'first':
165 |                 value['value'] = elements[0];
166 |             break;
167 |             case 'diff':
168 |                 const pairs = _.map( elements, (a,b,c)=>{ return (b< c.length -1)?([a, c[b+1]]):([0,0]); });
169 |                 const differences = _.map( pairs, (a)=>{return Math.abs(a[0]-a[1]);});
170 |                 value['value'] =_.max( differences);
171 |             break;
172 |             case 'range':
173 |                 value['value'] = _.max(elements) - _.min(elements);
174 |             break;
175 |             case 'last_time':
176 |                 value['value'] = timeseries.datapoints[ timeseries.datapoints.length -1][1];
177 |             break;
178 |         }
179 |         return( value);
180 |     }
181 | }
182 | 
183 |
184 |
185 | 186 | 187 | 188 | 189 |
190 | 191 | 194 | 195 |
196 | 197 | 200 | 201 | 202 | 203 | 204 | 205 | -------------------------------------------------------------------------------- /docs/dataProcessingEditor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Class: dataProcessingEditor 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Class: dataProcessingEditor

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 |

dataProcessingEditor($scope)

32 | 33 |

dataProcessing editor controller

34 | Implementation for a feature editor.
35 | Controller for the editor tab of the plugin for this specific feature.
36 | It is the controller of the AngularJS component for the editor 37 |
38 | 39 | 40 |
41 | 42 |
43 |
44 | 45 | 46 | 47 | 48 |

Constructor

49 | 50 | 51 | 52 |

new dataProcessingEditor($scope)

53 | 54 | 55 | 56 | 57 | 58 | 59 |
60 | constructor - description 61 |
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
Parameters:
72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 |
NameTypeDescription
$scope 100 | 101 | 102 | type 103 | 104 | 105 | 106 | A reference to the plugin's scope for editing panel's variables
118 | 119 | 120 | 121 | 122 | 123 | 124 |
125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 |
Source:
152 |
155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 |
163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 |
183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 |

Methods

200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 |

(static) DataProcessingEditorController#toggleDescVisibility()

208 | 209 | 210 | 211 | 212 | 213 | 214 |
215 | toggleDescVisibility - handler for an editor tab event
216 | Toggles the state of showDescription variable to display or not
217 | the descriptions for the data mapping options. 218 |
219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 |
233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 |
Source:
260 |
263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 |
271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 |

(static) exports.dataProcessingEditor(scope)

296 | 297 | 298 | 299 | 300 | 301 | 302 |
303 | dataProcessingEditor - function exported to be used as the AngularJs component 304 |
305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 |
Parameters:
315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 |
NameTypeDescription
scope 343 | 344 | 345 | type 346 | 347 | 348 | 349 | A reference to the scope of the plugin to route functions and variables
361 | 362 | 363 | 364 | 365 | 366 | 367 |
368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 |
Source:
395 |
398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 |
406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 |
Returns:
420 | 421 | 422 |
423 | AngularJS Component New dataProcessingEditor 424 |
425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 |
441 | 442 |
443 | 444 | 445 | 446 | 447 |
448 | 449 | 452 | 453 |
454 | 455 | 458 | 459 | 460 | 461 | 462 | -------------------------------------------------------------------------------- /dist/features/render/renderEditor.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Svg Resources
4 |

Determine wether the image should be loaded from a local copy,
5 | or from an online url. 6 |

7 | Local 10 | Remote 13 |
14 |

Select the SVG resource to represent on the visualization.
15 | Exclude the .svg extension if entering tha name manually

16 |
17 |
18 | 19 |
20 | 24 |
25 | 26 | 27 | 28 | 29 | 30 |
31 |
32 |
33 |
34 | 35 | 38 |
39 |
40 |
41 |
42 |

Import the SVG from an online resource.
43 | The URL should point to the svg directly

44 |
45 |
46 |
47 |
48 | 49 | 51 |
52 |
53 | 54 | 55 | 56 | 57 | 58 |
59 |
60 |
61 |

The following class selector will determine the SVG elements
62 | to be updated based on the values provided by the metrics.
63 | Do not use the dot notation, just the class name

64 |
65 |
66 | 67 | 70 |
71 |
72 |
73 |
74 |
Coloring
75 |

A discrete colouring will only apply the three specified colors,
while 76 | a continous colouring will create a gradient with the three specfied colors.

77 | Discrete 80 | Continuous 83 | 84 |
85 |


86 | All values will be included in the following three ranges : 87 |

    88 |
  • (-inf., first_threshold]
  • 89 |
  • (first_threshold, second_threshold]
  • 90 |
  • (second_threshold, inf.)
  • 91 |
92 |
93 |

94 |
95 | 96 | 99 | 102 |
103 |
104 | 105 |
106 |

All values should be included between the first and third specified values.

107 |
108 | 109 | 112 | 115 | 118 |
119 |
120 |
121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 137 | 138 | Invert 139 | 140 |
141 |
142 |
143 |
Fill color for unknown data
144 |

SVG elements with a {{ ctrl.panel.render.elementIdentifyer }} class with unknown data
145 | will be filled with the specified color.
146 | It is used to flush colors from no longer available metrics. 147 |

148 | 149 | 150 | 151 |
152 |
153 |
Legend
154 |

Display a legend with the alias, value and color of each metric.

155 | yes 158 | No 161 |
162 |
163 | --------------------------------------------------------------------------------