diff --git a/css/fdg-graph.css b/css/fdg-graph.css index 897df4b..6271556 100644 --- a/css/fdg-graph.css +++ b/css/fdg-graph.css @@ -11,7 +11,7 @@ #iho-graph { overflow: scroll; width: 100%; - height: 400px; + height: 1400px; } text { diff --git a/islandora_herbarium_object.module b/islandora_herbarium_object.module index 68b53b0..a2da070 100644 --- a/islandora_herbarium_object.module +++ b/islandora_herbarium_object.module @@ -41,7 +41,7 @@ function islandora_herbarium_object_rdf_namespaces() { function islandora_herbarium_object_theme($existing, $type, $theme, $path) { return [ 'fdg_graph' => [ - 'variables' => [], + 'variables' => ['height' => NULL, 'width' => NULL], ], ]; } diff --git a/js/fdg.js b/js/fdg.js index 6c3ad4f..b896f6e 100644 --- a/js/fdg.js +++ b/js/fdg.js @@ -11,7 +11,7 @@ Drupal.behaviors.islandora_herbarium_object_graph = { var simulation = d3.forceSimulation() .force("link", d3.forceLink().id(function (d) { return d.id; - }).distance(100).strength(1)) + }).distance(65).strength(1)) .force("charge", d3.forceManyBody()) .force("center", d3.forceCenter(width / 2, height / 2)); var dataPath = "/" + settings.path.currentPath.replace('fdg', 'fdg_json'); diff --git a/src/Controller/GraphController.php b/src/Controller/GraphController.php index 205a96c..4fca791 100644 --- a/src/Controller/GraphController.php +++ b/src/Controller/GraphController.php @@ -16,8 +16,12 @@ class GraphController extends ControllerBase { * A renderable array. */ public function printFdgGraph($scientificName = NULL, $municipality = NULL) { + $arr = ($scientificName == 'NULL' && $municipality == 'NULL') ? ['height' => + 1400, 'width' => 1000] : ['height' => 400, 'width' => 800]; return [ '#theme' => 'fdg_graph', + '#height' => $arr['height'], + '#width' => $arr['width'], '#attached' => [ 'library' => [ 'islandora_herbarium_object/d3js', diff --git a/templates/fdg-graph.html.twig b/templates/fdg-graph.html.twig index 8df132b..c943c4b 100644 --- a/templates/fdg-graph.html.twig +++ b/templates/fdg-graph.html.twig @@ -1,3 +1,3 @@
- +
\ No newline at end of file