Commit 4c9c57cd authored by Fintan Mc Gee's avatar Fintan Mc Gee

added first basic versin of right clich charts, used via a new service, need...

added first basic versin of right clich charts, used via a new service, need to be able to show multiiple charts still
parent 497b08c4
......@@ -704,6 +704,13 @@ var getAvailableViews_cb = function (req, res) {
res.json({views : viewSet});
};
var getNodeChartFormats_cb = function (req, res) {
// returns the list of views ) specified in config file) that are permissible for this user
var nodeChartFormats= cfg.neo4j.nodeChartFormats[req.body.graphSource];
res.json({nodeChartFormats : nodeChartFormats});
};
var getDataSetIcons_cb = function (req, res) {
sLog.debug_log("***********getDataSetIcons" + JSON.stringify(req.body) + "\n\n");
sLog.debug_log("***********graphDB.userGraphs" + JSON.stringify(graphDB.userGraphs) + "\n\n");
......@@ -873,6 +880,7 @@ simple_serve.post("/buildNodeSetQueryGraph", blizaarSystem.ensureAuthenticated,
simple_serve.post("/doNodeSetQuery", blizaarSystem.ensureAuthenticated, doNodeSetQuery_cb);
simple_serve.post("/saveNodeSetQuery", blizaarSystem.ensureAuthenticated,saveNodeSetQuery_cb);
simple_serve.post("/getAvailableViews", blizaarSystem.ensureAuthenticated, getAvailableViews_cb );
simple_serve.post("/getNodeChartFormats", blizaarSystem.ensureAuthenticated, getNodeChartFormats_cb );
simple_serve.get('/getNodeSetQueryList', blizaarSystem.ensureAuthenticated, getNodeSetQueryList_cb);
simple_serve.get('/clearNameCache', blizaarSystem.ensureAuthenticated, blizaarSystem.ensureAdmin, function(req,res){ blizaarSystem.clearNameCache(res)});
simple_serve.get('/clearMetaDataCache', blizaarSystem.ensureAuthenticated, blizaarSystem.ensureAdmin, function(req,res){ blizaarSystem.clearMetaDataCache(res)});
......
......@@ -191,4 +191,5 @@
<script src="./js/services/attributeDisplayService.js"></script>
<script src="./js/services/attributeBarChartDataService.js"></script>
<script src="./js/services/userActionLoggingService.js"></script>
<script src="./js/services/nodeChartService.js"></script>
</html>
\ No newline at end of file
......@@ -104,11 +104,14 @@ angular.module('blizaarModule.controllers', [])
// Send the message once the dom is ready
$scope.model.multiLayerGraph = multiLayerGraphService.getGraph();
graphLayeringService.doLayeringByGraphType(graphFileAndRenderingService.getValues().fileName)
angular.element(document).ready(function () {
$rootScope.$broadcast ('graphDataChanged');
// $scope.initNodeLabelList();
// $scope.getEdgeTypes();
});
});
};
......
......@@ -8,8 +8,8 @@
*
*******************************/
angular.module('blizaarModule.controllers')
.controller('bioListViewCtrl', ['$scope', 'graphFileAndRenderingService', 'dataService', 'filteringService', 'multiLayerGraphService', 'metaDataService','graphLayeringService','tooltipService','masterDataConstraintsService','$rootScope',
function ($scope, graphFileAndRenderingService, dataService, filteringService,multiLayerGraphService, metaDataService, graphLayeringService,tooltipService, masterDataConstraintsService,$rootScope) {
.controller('bioListViewCtrl', ['$scope', 'graphFileAndRenderingService', 'dataService', 'nodeChartService', 'filteringService', 'multiLayerGraphService', 'metaDataService','graphLayeringService','tooltipService','masterDataConstraintsService','$rootScope',
function ($scope, graphFileAndRenderingService, dataService, nodeChartService, filteringService,multiLayerGraphService, metaDataService, graphLayeringService,tooltipService, masterDataConstraintsService,$rootScope) {
// Will store the name of the Entity to used to build layers
$scope.model.inputName = "";
......@@ -44,6 +44,7 @@ angular.module('blizaarModule.controllers')
$scope.initializeBioListView = function(){
if(dataService.currentGraphName !== "Bio") {
dataService.initGraphData("Bio")
nodeChartService.initialise("Bio");
}
$scope.resetControlVisibility();
......
......@@ -165,7 +165,7 @@ angular.module('blizaarModule.directives')
//"height": 200,
"data": {
"name": "barData",
"values": barData[ glyphNode.uid]
"values": barData[glyphNode.uid]
},
"mark": "bar",
"encoding": {
......
......@@ -513,7 +513,7 @@ angular.module('blizaarModule.directives')
.on("click", clickFunction)
.on("contextmenu", function (n) {
d3.event.preventDefault();
nodeInfoService.showCustomInfoForNode(n);
nodeInfoService.showCustomInfoForNode(n,layer.name);
});
node.append("rect")
.attr("width", function () {
......
......@@ -76,6 +76,19 @@ angular.module('blizaarModule.services')
else {
this.nodePrintBarData = {}
}
},
resetNodePrintAttributeNames:function(){
this.nodePrintAttributeNames = ["BLZ_degree","BLZ_clustering_coefficient", "BLZ_betweenness",
"BLZ_normalized_betweenness", "BLZ_closeness","BLZ_eigenvector"];
},
setNodePrintAttributeNames:function(attribNames){
this.nodePrintAttributeNames = [];
attribNames.forEach(function(attrib) {
this.nodePrintAttributeNames.push(attrib);
})
}
};
}]);
\ No newline at end of file
/**
* Created by Fintan MCGee on 10/12/2018.
*
* This service is used to create and stor individual ndoe charts, used by node INfo boxes etc
*
*
*/
angular.module('blizaarModule.services')
.factory('nodeChartService', ['$http','multiLayerGraphService', function ($http,multiLayerGraphService) {
return {
fieldChartsByType:{}, //
primaryChartName: "",
initialise: function(dataSetName){
// fetch from the server the chart field names for nodes
var theService = this;
return $http({
method: 'POST',
url: '/getNodeChartFormats', // url where to get data.
data: {graphSource: dataSetName},
headers: { 'Content-Type': 'application/json' }
})
// Success case
.then(function (data) {
// Return centralities directly via this
theService.fieldChartsByType = {};
data.data.nodeChartFormats.forEach(function(format) {
if(!theService.fieldChartsByType.hasOwnProperty(format.nodeType)) {
theService.fieldChartsByType[format.nodeType] = []
}
theService.fieldChartsByType[format.nodeType].push(format)
});
},
// error case
function (err) {
alert("getClusteringList " + err);
});
},
addChart:function(chartTargetHTMLTag,nodeUid, layer){
var chartData= [];
var nodeType = multiLayerGraphService.getNodePropertyValue(nodeUid,"type", layer);
var attribNames =[];
var chartTitle = "";
if(this.fieldChartsByType[nodeType] && this.fieldChartsByType[nodeType].length ) {
// for now only darw the first chart unless asked to draw all
attribNames = this.fieldChartsByType[nodeType][0].attribs;
chartTitle = this.fieldChartsByType[nodeType][0].chartName;
} else {
return;
}
var createNodeChartGlyph = function (chartID,chartBarData) {
var vlData = {
"$schema": "https://vega.github.io/schema/vega-lite/v2.0.json",
//"height": 200,
"data": {
"name": "barData",
"values": chartBarData
},
"mark": "bar",
"encoding": {
"x": {"field": "name", "type": "nominal", "scale": {"rangeStep": 10},axis: {labels:true,title:null,ticks:false}},
"y": {"field": "val", "type": "quantitative",axis: {labels:true,title:chartTitle,ticks:false}},
"tooltip": {"field": "name", "type": "nominal"}
},
"height": 64,
"width": 256,
"padding": 0
};
var vegaView = null;
vegaEmbed("#" + chartID, vlData, {
actions: false,
renderer: "canvas"
}).then(function (data1) {
vegaView = data1.view;
vegaView.hover().run(); // .enable hover event processing
});
};
var createChartData = function(nodeUid, layer, attributes) {
var retData =[]
var targetLayer = multiLayerGraphService.getLayerByName(layer)
attributes.forEach(function(attrib) {
var attributeVal = targetLayer.getNodeProperty(nodeUid,attrib);
var dataCol = {};
if(attributeVal) {
dataCol.id = nodeUid + "_" + attrib ;
dataCol.name = attrib;
dataCol.val = attributeVal
retData.push(dataCol);
}
});
return retData;
}
chartData = createChartData(nodeUid, layer, attribNames);
if(chartData && chartData.length) {
createNodeChartGlyph(chartTargetHTMLTag, chartData)
}
}
};
}]);
\ No newline at end of file
......@@ -4,7 +4,7 @@
* This service is used to display information about hovered node
*/
angular.module('blizaarModule.services')
.factory('nodeInfoService', ['multiLayerGraphService', 'dataService',function (multiLayerGraphService,dataService) {
.factory('nodeInfoService', ['multiLayerGraphService', 'dataService', 'nodeChartService',function (multiLayerGraphService,dataService,nodeChartService) {
return {
......@@ -77,13 +77,25 @@ angular.module('blizaarModule.services')
// get the #tooltip div
//
if(!layerName) {
layerName = "MasterLayer";
}
var nodeInfo = d3.select('#nodeInfo');
var nodeInfoText = "";
var chartID = "ch_" + layerName + "_" + node.uid;
// var chartData = createChartData(node.uid,layerName,chartFields);
// if(chartData.length) {
// nodeInfoText += '<div id="' + chartID + '"></div>';
// }
// tooltipText = " (" + d3.event.pageX+ "," + d3.event.pageY+ ")<br>"; // DEBUG text
nodeInfoText += '<div id="' + chartID + '"></div>';
for(var i=0;i<this.nodesAttributes.length;i++){
if(typeof(node[this.nodesAttributes[i]]) !== 'undefined')
if(this.nodeImages.indexOf(this.nodesAttributes[i]) > -1){
......@@ -98,6 +110,8 @@ angular.module('blizaarModule.services')
nodeInfoText += "<b>" + this.nodesAttributes[i] + ": </b>" + multiLayerGraphService.getNodePropertyValue(node.uid,this.nodesAttributes[i],layerName)+ "<br>";
}
}
//tooltipText+="<b>"+"Zserie"+": </b>"+node["zseri"]+"<br>";
if(nodeInfoText === "")
return;
......@@ -145,6 +159,10 @@ angular.module('blizaarModule.services')
nodeInfoDiv.style('top',y_pos+"px")
}
// console.log("TooltipDrawn");
nodeChartService.addChart(chartID, node.uid, layerName);
},
showCustomInfoForDHNode : function(node, layerName){
// Remove old one
......
module.exports = {
db_txn_url: ":7474/db/data/transaction/commit",
db_login_url:":7474/user/neo4j",
db_login_url: ":7474/user/neo4j",
username: "neo4j",
password: "blizaar" ,
password: "blizaar",
datasets: {
admin: ["imdb", "histograph", "Bio", "BioExp","graphMLFiles"],
cvce: ["histograph","graphMLFiles"],
biology: ["Bio", "BioExp"],
admin: ["imdb", "histograph", "Bio", "BioExp", "graphMLFiles"],
cvce: ["histograph", "graphMLFiles"],
biology: ["Bio", "BioExp"],
default: ["imdb"]
},
datasetNamesFields: {
// list all labels associate with fields
imdb: {Movie: "title",
Person: "name"},
histograph: {person: "name",
imdb: {
Movie: "title",
Person: "name"
},
histograph: {
person: "name",
audio: "title",
organization: "name",
organization: "name",
collection: "name",
topic: "name",
location:"name",
location: "name",
institution: "name",
epublication: "title",
map: "title",
resource:"name",
subunit:"title",
social_group:"name",
theme:"name"
resource: "name",
subunit: "title",
social_group: "name",
theme: "name"
},
Bio: {
Metabolite: "Id_single",
GOTerm: "Id",
CazyFamily: "Id",
Protein: "Id",
Gene: "Id",
//Bio:"Id",
Experiment: "Id",
DataLine: "Id"
},
Bio: {Metabolite: "Id_single",
GOTerm: "Id",
CazyFamily : "Id",
Protein: "Id",
Gene: "Id",
//Bio:"Id",
Experiment: "Id",
DataLine: "Id"},
BioExp: {BioExp:"Id"}
BioExp: {BioExp: "Id"}
},
dataSetIcons:{
imdb:{
dataSetIcons: {
imdb: {
Movie: "/icons/film.svg",
Person: "/icons/user.svg",
default: "/icons/default.svg"
},
histograph: {
audio: "/icons/audio.svg",
organization: "/icons/organisation.svg",
organization: "/icons/organisation.svg",
person: "/icons/user.svg",
collection: "/icons/books.svg",
topic: "/icons/star.svg",
location:"/icons/location_pin.svg",
location: "/icons/location_pin.svg",
institution: "/icon/institution.svg",
epublication: "/icon/eReader.svg",
map: "/icon/map.svg",
......@@ -59,7 +64,7 @@ module.exports = {
},
Bio: {
Protein: "/icons/dna.svg",
Gene: "/icons/dna2.svg",
Gene: "/icons/dna2.svg",
Metabolite: "/icons/small_network.svg",
GOTerm: "/icons/classification.svg",
CazyFamily: "/icons/gears.svg",
......@@ -71,33 +76,38 @@ module.exports = {
GeneExp: "/icons/bug.svg",
default: "/icons/default.svg"
},
BioExp: {
BioExp: {
Protein: "/icons/dna.svg",
Gene: "/icons/dna2.svg",
Gene: "/icons/dna2.svg",
Metabolite: "/icons/small_network.svg",
default: ""
}
},
dataSetAttributes:{
Bio:["Id","Id_single"],
histograph:["name","title","source","language","country"]
},
dataSetRelevantNodes:{
Bio:["CazyFamily","DataLine","Experiment","Gene","Metabolite","Protein","GOTerm"],
histograph:["person","resource","audio","organization","collection","topic","location","institution","epublication","map"]
},
dataSetRelevantEdges:{
histograph:["appears_in","appear_in_same_document","belongs_to","is_part_of"]
},
dataSetBarChartAttributes:{
dataSetAttributes: {
Bio: ["Id", "Id_single"],
histograph: ["name", "title", "source", "language", "country"]
},
dataSetRelevantNodes: {
Bio: ["CazyFamily", "DataLine", "Experiment", "Gene", "Metabolite", "Protein", "GOTerm"],
histograph: ["person", "resource", "audio", "organization", "collection", "topic", "location", "institution", "epublication", "map"]
},
dataSetRelevantEdges: {
histograph: ["appears_in", "appear_in_same_document", "belongs_to", "is_part_of"]
},
dataSetBarChartAttributes: {
default: [],
histograph:["BLZ_betweenness","BLZ_normalized_betweenness","BLZ_closeness","BLZ_eigenvector",
"BLZ_clustering_coefficient", "BLZ_degree","creation_time","celebrity","df",
"BLZ_degree_back_end","score","specificity","status","BLZ_order","depth",
"firstMentionDate","lastMentionDate","birth_time","death_time", "creation_time","score",
"tf","tdf","tfidf","frequency","df","jaccard","overlapping","cdiff","union",
"intersections","type","weight"]
histograph: ["BLZ_betweenness", "BLZ_normalized_betweenness", "BLZ_closeness", "BLZ_eigenvector",
"BLZ_clustering_coefficient", "BLZ_degree", "creation_time", "celebrity", "df",
"BLZ_degree_back_end", "score", "specificity", "status", "BLZ_order", "depth",
"firstMentionDate", "lastMentionDate", "birth_time", "death_time", "creation_time", "score",
"tf", "tdf", "tfidf", "frequency", "df", "jaccard", "overlapping", "cdiff", "union",
"intersections", "type", "weight"]
} ,
nodeChartFormats: {
Bio: [{chartName: "Metab1", nodeType: "Metabolite", attribs: ["mt_H9A", "mt_H9B", "mt_H9C", "mt_H9D"]},
{chartName: "Metab2", nodeType: "Metabolite", attribs: ["mt_H9A", "mt_H9B", "mt_H9C", "mt_H9D"]}],
histograph:[]
}
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment