Browse Source

refactored fdg js changed label to uri

master
Paul Pound 9 years ago
parent
commit
0e8c80fb52
  1. 20
      js/fdg.js
  2. 4
      src/Graph/FdgGraph.php

20
js/fdg.js

@ -42,17 +42,6 @@ d3.json("/islandora_herbarium_object/fdg_json", function (error, graph) {
return d.id; return d.id;
}); });
/*var textElement = svg.append('g')
.attr('class', 'text')
.selectAll('text')
.data(graph.nodes)
.enter().append('text')
.text(function(d) {return d.name;})
.attr('font-size', 10)
.attr('font-weight', 'bolder')
.attr('dx', 15)
.attr('dy', 4)*/
var uriElement = svg.append('g') var uriElement = svg.append('g')
.attr('class', 'uri') .attr('class', 'uri')
.attr('x', 8) .attr('x', 8)
@ -62,7 +51,7 @@ d3.json("/islandora_herbarium_object/fdg_json", function (error, graph) {
.enter().append('a') .enter().append('a')
.attr("target", "_blank") .attr("target", "_blank")
.attr('xlink:href', function (d) { .attr('xlink:href', function (d) {
return d.label return d.uri
}) })
.append('text') .append('text')
.text(function (d) { .text(function (d) {
@ -70,12 +59,7 @@ d3.json("/islandora_herbarium_object/fdg_json", function (error, graph) {
}) })
.attr('font-size', 10) .attr('font-size', 10)
.attr('font-weight', 'bolder'); .attr('font-weight', 'bolder');
//.attr('dx', 15)
//.attr('dy', 28);
//uriElement.select("a")
// .attr("xlink:href", function(d) {
// return d.label;
// });
simulation simulation
.nodes(graph.nodes) .nodes(graph.nodes)

4
src/Graph/FdgGraph.php

@ -41,7 +41,7 @@ class FdgGraph {
$outputArr['nodes'][] = [ $outputArr['nodes'][] = [
'id' => $result['municipality']['value'], 'id' => $result['municipality']['value'],
'name' => $result['municipality']['value'], 'name' => $result['municipality']['value'],
'label' => $result['municipalityIRI']['value'], 'uri' => $result['municipalityIRI']['value'],
'group' => 1, 'group' => 1,
]; ];
$idArr[$result['municipality']['value']] = ''; $idArr[$result['municipality']['value']] = '';
@ -49,7 +49,7 @@ class FdgGraph {
$outputArr['nodes'][] = [ $outputArr['nodes'][] = [
'id' => $result['name']['value'], 'id' => $result['name']['value'],
'name' => $result['name']['value'], 'name' => $result['name']['value'],
'label' => $result['scientificNameIRI']['value'], 'uri' => $result['scientificNameIRI']['value'],
'group' => 2, 'group' => 2,
]; ];
$outputArr['links'][] = [ $outputArr['links'][] = [

Loading…
Cancel
Save