diff --git a/app/partials/analysis/tools/Projector/main.jade b/app/partials/analysis/tools/Projector/main.jade new file mode 100644 index 00000000..e7399f61 --- /dev/null +++ b/app/partials/analysis/tools/Projector/main.jade @@ -0,0 +1,3 @@ +div(ng-controller='ProjectorMainCtrl as mainArea') + div#chart + script(src="https://cdn.jsdelivr.net/gh/lm233/tensorprojector/standalone.js") \ No newline at end of file diff --git a/app/partials/analysis/tools/Projector/sidebar.jade b/app/partials/analysis/tools/Projector/sidebar.jade new file mode 100644 index 00000000..5dbcce5d --- /dev/null +++ b/app/partials/analysis/tools/Projector/sidebar.jade @@ -0,0 +1,2 @@ +div(ng-controller="ProjectorSidebarCtrl as sidebar") + span Projector diff --git a/app/scripts/App/AppMessageMap.coffee b/app/scripts/App/AppMessageMap.coffee index be0cf33f..196789f0 100644 --- a/app/scripts/App/AppMessageMap.coffee +++ b/app/scripts/App/AppMessageMap.coffee @@ -19,8 +19,9 @@ module.exports = class AppMessageMap 'app_analysis_powercalc', 'app_analysis_stats', 'app_analysis_classification', - 'app_analysis_modeler' - 'app_analysis_dimReduction' + 'app_analysis_modeler', + 'app_analysis_dimReduction', + 'app_analysis_projector' ] msgTo: 'type.inferAll' scopeTo: ['app_analysis_datalib'] @@ -37,8 +38,9 @@ module.exports = class AppMessageMap 'app_analysis_powercalc', 'app_analysis_stats', 'app_analysis_classification', - 'app_analysis_modeler' - 'app_analysis_dimReduction' + 'app_analysis_modeler', + 'app_analysis_dimReduction', + 'app_analysis_projector' ] , msgFrom: 'data summary' @@ -50,7 +52,8 @@ module.exports = class AppMessageMap 'app_analysis_reliability', 'app_analysis_powercalc', 'app_analysis_classification', - 'app_analysis_stats' + 'app_analysis_stats', + 'app_analysis_projector' ] msgTo: 'summary' scopeTo: ['app_analysis_datalib'] @@ -66,7 +69,8 @@ module.exports = class AppMessageMap 'app_analysis_reliability', 'app_analysis_powercalc', 'app_analysis_classification', - 'app_analysis_stats' + 'app_analysis_stats', + 'app_analysis_projector' ] , msgFrom: 'data histogram' @@ -76,7 +80,8 @@ module.exports = class AppMessageMap 'app_analysis_cluster', 'app_analysis_charts', 'app_analysis_classification', - 'app_analysis_reliability' + 'app_analysis_reliability', + 'app_analysis_projector' ] msgTo: 'histogram' scopeTo: ['app_analysis_datalib'] @@ -90,7 +95,8 @@ module.exports = class AppMessageMap 'app_analysis_cluster', 'app_analysis_charts', 'app_analysis_classification', - 'app_analysis_reliability' + 'app_analysis_reliability', + 'app_analysis_projector' ] # , # msgFrom: 'upload csv' @@ -118,8 +124,9 @@ module.exports = class AppMessageMap 'app_analysis_powercalc', 'app_analysis_stats', 'app_analysis_classification', - 'app_analysis_modeler' - 'app_analysis_dimReduction' + 'app_analysis_modeler', + 'app_analysis_dimReduction', + 'app_analysis_projector' ] msgTo: 'get table' scopeTo: ['app_analysis_database'] @@ -135,8 +142,9 @@ module.exports = class AppMessageMap 'app_analysis_powercalc', 'app_analysis_stats', 'app_analysis_classification', - 'app_analysis_modeler' - 'app_analysis_dimReduction' + 'app_analysis_modeler', + 'app_analysis_dimReduction', + 'app_analysis_projector' ] ] diff --git a/app/scripts/App/AppModuleList.coffee b/app/scripts/App/AppModuleList.coffee index dbf39617..54908a16 100644 --- a/app/scripts/App/AppModuleList.coffee +++ b/app/scripts/App/AppModuleList.coffee @@ -55,6 +55,8 @@ module.exports = class AppModuleList require 'scripts/analysis/tools/PowerCalc/PowerCalc.module.coffee' , require 'scripts/analysis/tools/Stats/Stats.module.coffee' + , + require 'scripts/analysis/tools/Projector/Projector.module.coffee' ] ] diff --git a/app/scripts/analysis/tools/Projector/Projector.module.coffee b/app/scripts/analysis/tools/Projector/Projector.module.coffee new file mode 100644 index 00000000..16537336 --- /dev/null +++ b/app/scripts/analysis/tools/Projector/Projector.module.coffee @@ -0,0 +1,24 @@ +'use strict' +# import module class +Module = require 'scripts/BaseClasses/BaseModule.coffee' +# export instance of new module +module.exports = Projector = new Module + # module id for registration + id: 'app_analysis_projector' + # module components + components: + services: + 'app_analysis_projector_initService': require 'scripts/analysis/tools/Projector/ProjectorInit.service.coffee' + 'app_analysis_projector_msgService': require 'scripts/analysis/tools/Projector/ProjectorMsgService.service.coffee' + 'app_analysis_projector_dataService': require 'scripts/analysis/tools/Projector/ProjectorDataService.service.coffee' + + controllers: + 'ProjectorMainCtrl': require 'scripts/analysis/tools/Projector/ProjectorMainCtrl.controller.coffee' + 'ProjectorSidebarCtrl': require 'scripts/analysis/tools/Projector/ProjectorSidebarCtrl.controller.coffee' + + + state: + name: 'Projector' + url: '/Projector' + mainTemplate: require 'partials/analysis/tools/Projector/main.jade' + sidebarTemplate: require 'partials/analysis/tools/Projector/sidebar.jade' \ No newline at end of file diff --git a/app/scripts/analysis/tools/Projector/ProjectorDataService.service.coffee b/app/scripts/analysis/tools/Projector/ProjectorDataService.service.coffee new file mode 100644 index 00000000..92e1f458 --- /dev/null +++ b/app/scripts/analysis/tools/Projector/ProjectorDataService.service.coffee @@ -0,0 +1,13 @@ +'use strict' + +BaseModuleDataService = require 'scripts/BaseClasses/BaseModuleDataService.coffee' + +module.exports = class ProjectorDataService extends BaseModuleDataService + @inject '$q', 'app_analysis_projector_msgService' + + # requires renaming message service injection to @msgService + initialize: () -> + @msgManager = @app_analysis_projector_msgService + @getDataRequest = @msgManager.getMsgList().outgoing[0] + @getDataResponse = @msgManager.getMsgList().incoming[0] + diff --git a/app/scripts/analysis/tools/Projector/ProjectorInit.service.coffee b/app/scripts/analysis/tools/Projector/ProjectorInit.service.coffee new file mode 100644 index 00000000..b226d9ed --- /dev/null +++ b/app/scripts/analysis/tools/Projector/ProjectorInit.service.coffee @@ -0,0 +1,13 @@ +'use strict' +# import base init service class +BaseModuleInitService = require 'scripts/BaseClasses/BaseModuleInitService.coffee' +# export custom init service class +module.exports = class ProjectorInitService extends BaseModuleInitService + # requires injection of message service as a dependency + @inject 'app_analysis_projector_msgService' + # entry point function: + initialize: -> + # this renaming is required for initialization! + @msgService = @app_analysis_projector_msgService + # required method call to initiate module messaging interface + @setMsgList() \ No newline at end of file diff --git a/app/scripts/analysis/tools/Projector/ProjectorMainCtrl.controller.coffee b/app/scripts/analysis/tools/Projector/ProjectorMainCtrl.controller.coffee new file mode 100644 index 00000000..c603b195 --- /dev/null +++ b/app/scripts/analysis/tools/Projector/ProjectorMainCtrl.controller.coffee @@ -0,0 +1,37 @@ +'use strict' +BaseCtrl = require 'scripts/BaseClasses/BaseController.coffee' +module.exports = class ProjectorMainCtrl extends BaseCtrl + @inject '$timeout', '$scope', 'app_analysis_projector_dataService', 'app_analysis_projector_msgService' + initialize: -> + @text = "Component Demo" + @hello = "" + @handleHello = () -> + @hello = "hello" + @msgManager = @app_analysis_projector_msgService + @dataService = @app_analysis_projector_dataService + @data_y = null + @data = "1\t1\n2\t2" + debugger + console.log(@dataService.getData()) + @dataService.getData().then (data) => + console.log(data.dataFrame.data) + dataStr = "" + i = 0 + while i < data.dataFrame.data.length + j = 0 + while j < data.dataFrame.data[i].length + if data.dataFrame.data[i][j] + dataStr += data.dataFrame.data[i][j] + if j < data.dataFrame.data[i].length - 1 + dataStr += '\t' + j++ + if i < data.dataFrame.data.length - 1 + dataStr += '\n' + i++ + @data = dataStr + projector = document.createElement('vz-projector-app') + projector.setAttribute("serving-mode", "demo") + projector.setAttribute("projector-config-json-path", "standalone_projector_config.json") + projector.setAttribute("data-input", dataStr) + document.getElementById('chart').appendChild(projector) + true \ No newline at end of file diff --git a/app/scripts/analysis/tools/Projector/ProjectorMsgService.service.coffee b/app/scripts/analysis/tools/Projector/ProjectorMsgService.service.coffee new file mode 100644 index 00000000..bcf383ed --- /dev/null +++ b/app/scripts/analysis/tools/Projector/ProjectorMsgService.service.coffee @@ -0,0 +1,10 @@ +'use strict' +# import base messaging module class +BaseModuleMessageService = require 'scripts/BaseClasses/BaseModuleMessageService.coffee' +# export custom messaging service class +module.exports = class ProjectorMsgService extends BaseModuleMessageService + # required to define module message list + msgList: + outgoing: ['getData'] + incoming: ['takeTable'] + scope: ['app_analysis_projector'] \ No newline at end of file diff --git a/app/scripts/analysis/tools/Projector/ProjectorSidebarCtrl.controller.coffee b/app/scripts/analysis/tools/Projector/ProjectorSidebarCtrl.controller.coffee new file mode 100644 index 00000000..b2255e26 --- /dev/null +++ b/app/scripts/analysis/tools/Projector/ProjectorSidebarCtrl.controller.coffee @@ -0,0 +1,5 @@ +'use strict' + +BaseCtrl = require 'scripts/BaseClasses/BaseController.coffee' + +module.exports = class ProjectorSidebarCtrl extends BaseCtrl \ No newline at end of file