diff --git a/productMods/css/visualization/mapofscience/layout.css b/productMods/css/visualization/mapofscience/layout.css index cbdb7737..f9fb7761 100644 --- a/productMods/css/visualization/mapofscience/layout.css +++ b/productMods/css/visualization/mapofscience/layout.css @@ -33,6 +33,19 @@ height: 480px; } +#subEntityTableArea { + clear: both; + width: 100%; + padding-top:5px; +} + +.subEntityTable { + width: 32%; + padding-top:5px; + padding-right: 8px; + float: left; +} + #percent-mapped-info { float:right; display: none; @@ -117,9 +130,33 @@ a.clear-selected-entities { margin-left: 9px; } +.drillDownIcon { + width:25px; + margin-left: 9px; + float: right; +} + + .science-areas-filter { margin-bottom: 10px; -} +} + +.organization-header { + margin-bottom: 10px; + font-weight: bold; +} + +.suborganization-title { + vertical-align: middle; + font-weight: bold; +} + +.mapped-result { + font-size: 0.9em; + font-weight: bold; + float: right; + padding-top: 4px; +} /* search in table */ @@ -179,7 +216,12 @@ hr.subtle-hr { width: 100%; } -table.datatable-table tbody tr { +.entity-datatable-table { + font-size: 0.9em; + width: 100%; +} + +table.datatable-table tbody tr { border-top: 3px solid; } @@ -228,6 +270,19 @@ a.map-of-science-links { font-size: 0.81em; } +.subpaginatedtabs { + margin-bottom: 10px; + font-size: 0.81em; + float:right; + margin-top: 15px; +} + +.subpaginatedtabs span { + padding-right: 5px; + cursor: pointer; + color: #2485AE; +} + /* --------------------------------------------------------------> */ /* SPECIAL STYLES FOR THE error */ /* --------------------------------------------------------------> */ diff --git a/productMods/js/visualization/mapofscience/ComparisonDataTableWidget.js b/productMods/js/visualization/mapofscience/ComparisonDataTableWidget.js index a600dc47..7e2f0cc2 100644 --- a/productMods/js/visualization/mapofscience/ComparisonDataTableWidget.js +++ b/productMods/js/visualization/mapofscience/ComparisonDataTableWidget.js @@ -13,9 +13,10 @@ var ComparisonDataTableWidget = Class.extend({ activeFilterClass: "comparison-active-filter", filterInfoIconClass: "comparisonFilterInfoIcon" }, - init: function(sciMapWidget) { + init: function(sciMapWidget, entityTablesWidget) { var me = this; me.sciMapWidget = sciMapWidget; + me.entityTablesWidget = entityTablesWidget; me.widgetType = "COMPARISON_SCIENCE_AREAS"; me.currentSelectedFilter = COMPARISON_TYPE.ORGANIZATION; me.widget = ''; @@ -90,7 +91,7 @@ var ComparisonDataTableWidget = Class.extend({ scienceAreasTH.html('Person'); } - var activityCountTH = $(''); + var activityCountTH = $(''); activityCountTH.html('# of pubs.'); activityCountTH.attr("id", "activity-count-column"); @@ -112,7 +113,7 @@ var ComparisonDataTableWidget = Class.extend({ rowsToInsert[i++] = '' + item.type + ''; rowsToInsert[i++] = ''; rowsToInsert[i++] = '' + item.label + ''; - rowsToInsert[i++] = '' + item.pubs.toFixed(2) + ''; + rowsToInsert[i++] = '' + item.pubs + ''; }); tbody.append(rowsToInsert.join('')); @@ -202,19 +203,10 @@ var ComparisonDataTableWidget = Class.extend({ createToolTip($("#comparisonSearchInfoIcon"), $("#comparisonSearchInfoTooltipText").html(), "topLeft"); /* Create csv download button */ - console.log(comparisonScienceMapCsvDataUrlPrefix + me.uri); var csvButton = '
'; me.tableDiv.append(csvButton); - - /* Create mapping statistic result */ - var totalPublications = me.pubsWithNoJournals + me.pubsWithInvalidJournals + me.pubsMapped; - $("#mapped-publications").text(addCommasToNumber(me.pubsMapped)); - $("#percent-mapped-info").show(); - $("#percent-mapped").text((100 * me.pubsMapped / totalPublications).toFixed(2)); - $("#total-publications").text(addCommasToNumber(totalPublications)); - }, changeFilter: function(filterType) { var me = this; @@ -232,7 +224,6 @@ var ComparisonDataTableWidget = Class.extend({ ACTIVE_DISCIPLINE_SUBDISCIPLINE_FILTER = me.currentSelectedFilter; if (me.widget) { - me.widget.fnSettings()._iDisplayLength = 10; me.widget.fnDraw(); // load one item if no item is selected. Need to be improved if ($("input:checkbox[class=chk]:checked").length == 0) { @@ -253,15 +244,18 @@ var ComparisonDataTableWidget = Class.extend({ // Download data from server and add to markerManager if not gotten already var me = this; var url = scienceMapDataPrefix + uri; - downloader.download(url, function(data) { + downloader.downloadAndWait(url, function(data) { me.sciMapWidget.loadEntity(data[0]); // This is ugly, need fix!!! - $("#comparisonTbody > tr[id=" + index + "]").css("color", me.sciMapWidget.getColor(me.currentSelectedFilter, me.subEntities[index].label)); + var color = me.sciMapWidget.getColor(me.currentSelectedFilter, me.subEntities[index].label); + $("#comparisonTbody > tr[id=" + index + "]").css("color", color); + me.entityTablesWidget.loadEntity(data[0], color); }); }, unloadEntity: function(key, childKey, index) { this.sciMapWidget.unloadEntity(key, childKey); + this.entityTablesWidget.unloadEntity(childKey); // This is ugly, need fix!!! $("#comparisonTbody > tr[id=" + index + "]").css("color", "grey"); diff --git a/productMods/js/visualization/mapofscience/ComparisonScimapWidget.js b/productMods/js/visualization/mapofscience/ComparisonScimapWidget.js index df925e2c..b1b56210 100644 --- a/productMods/js/visualization/mapofscience/ComparisonScimapWidget.js +++ b/productMods/js/visualization/mapofscience/ComparisonScimapWidget.js @@ -1,8 +1,8 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ COMPARISON = { - "one":{ "name": "one", "color": "#1e90ff"}, - "two":{ "name": "two", "color": "#ff69b4"}, - "three":{ "name": "three", "color": "#32cd32"} + "one":{ "name": "one", "color": "#99CC00"}, + "two":{ "name": "two", "color": "#FF9900"}, + "three":{ "name": "three", "color": "#3399FF"} } COMPARISON_TYPE = { @@ -127,7 +127,6 @@ var ComparisonScimapWidget = Class.extend({ } }, loadJsonData: function(data) { - this.isUnloaded = false; }, loadEntity: function(data) { var me = this; @@ -192,6 +191,22 @@ var ComparisonScimapWidget = Class.extend({ compositeManager.mouseOut(childKey); } }, + mouseInNode: function(key, childKey, subdisciplineId) { + var compositeManager = this.getCompositeManager(key); + // Focus if only it is a valid manager + if (compositeManager == this.activeCompositeManager) { + // Focus all + compositeManager.registry.register(childKey).mouseIn(subdisciplineId); + } + }, + mouseOutNode: function(key, childKey, subdisciplineId) { + var compositeManager = this.getCompositeManager(key); + + // Unfocus if only it is a valid manager + if (compositeManager == this.activeCompositeManager) { + compositeManager.registry.register(childKey).mouseOut(subdisciplineId); + } + }, removeManager: function(key, childKey) { var compositeManager = this.getCompositeManager(key); diff --git a/productMods/js/visualization/mapofscience/CustomMarker.js b/productMods/js/visualization/mapofscience/CustomMarker.js index c2f6a675..41be8769 100644 --- a/productMods/js/visualization/mapofscience/CustomMarker.js +++ b/productMods/js/visualization/mapofscience/CustomMarker.js @@ -15,10 +15,10 @@ var ScinodePolygon = CirclePolygon.extend({ this.setZIndex(-size); }, focus: function() { - this.setOptions({strokeWeight: 3.0}); + this.setOptions({strokeWeight: 1.2, strokeColor: '#000'}); }, unfocus: function() { - this.setOptions({strokeWeight: 1.0}); + this.setOptions({strokeWeight: 1.0, strokeColor: '#808080'}); }, setContent: function(content) { this.polygon.content = content; @@ -49,7 +49,7 @@ function createScinodeMarker(map, label, value, radius, color, latlng) { var circleOptions = { label: label, value: value, - strokeColor: '#000', + strokeColor: '#808080', strokeOpacity: 1.0, strokeWeight: 1.0, fillColor: color, diff --git a/productMods/js/visualization/mapofscience/DataTableWidget.js b/productMods/js/visualization/mapofscience/DataTableWidget.js index 9b63ec4c..187cde2f 100644 --- a/productMods/js/visualization/mapofscience/DataTableWidget.js +++ b/productMods/js/visualization/mapofscience/DataTableWidget.js @@ -3,15 +3,17 @@ var DataTableWidget = Class.extend({ dom: { - searchBarParentContainerClass : "searchbar", - paginationContainerClass : "paginatedtabs", + searchBarParentContainerClass: "searchbar", + paginationContainerClass: "paginatedtabs", containerID: "main-science-areas-table-container", footerID: "main-science-areas-table-footer", firstFilterID: "first-filter", secondFilterID: "second-filter", filterOptionClass: "filter-option", activeFilterClass: "active-filter", - filterInfoIconClass: "filterInfoIcon" + filterInfoIconClass: "filterInfoIcon", + + percentMappedInfoID: "percent-mapped-info" }, init: function(sciMapWidget) { var me = this; @@ -21,6 +23,7 @@ var DataTableWidget = Class.extend({ me.subdisciplineInfo = {}; me.disciplineInfo = {}; me.widget = ''; + me.percentMappedDiv = $("#" + me.dom.percentMappedInfoID); me.tableDiv = $('
'); $("#" + me.dom.containerID).append(this.tableDiv); @@ -71,9 +74,11 @@ var DataTableWidget = Class.extend({ }, show: function(key) { this.tableDiv.show(); + this.percentMappedDiv.show(); }, hide: function(key) { this.tableDiv.hide(); + this.percentMappedDiv.hide(); }, cleanView: function() { this.hide(); @@ -233,7 +238,6 @@ var DataTableWidget = Class.extend({ var totalPublications = me.pubsWithNoJournals + me.pubsWithInvalidJournals + me.pubsMapped; $("#mapped-publications").text(addCommasToNumber(me.pubsMapped)); - $("#percent-mapped-info").show(); $("#percent-mapped").text((100 * me.pubsMapped / totalPublications).toFixed(2)); $("#total-publications").text(addCommasToNumber(totalPublications)); diff --git a/productMods/js/visualization/mapofscience/EntityTablesWidget.js b/productMods/js/visualization/mapofscience/EntityTablesWidget.js new file mode 100644 index 00000000..5976a146 --- /dev/null +++ b/productMods/js/visualization/mapofscience/EntityTablesWidget.js @@ -0,0 +1,50 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +var EntityTablesWidget = Class.extend({ + init: function(sciMapWidget) { + this.sciMapWidget = sciMapWidget; + this.keyToDataTable = {}; + this.container = $('
'); + $("#subEntityTableArea").append(this.container); + $("#subEntityTableArea").show(); + }, + initView: function(key) { + this.container.show(); + }, + cleanView: function(key) { + this.container.hide(); + }, + loadJsonData: function(data) { + }, + loadEntity: function(data, color) { + var key = data.label; + var dataTable = this.getDataTable(key); + if (dataTable == null) { + dataTable = this._createDataTable(key, data, color); + } + dataTable.initView(); + }, + unloadEntity: function(key) { + this._removeDataTable(key); + }, + getDataTable: function(key) { + return this.keyToDataTable[key]; + }, + _removeDataTable: function(key) { + var dataTable = this.getDataTable(key); + if (dataTable) { + dataTable.cleanView(); + delete this.keyToDataTable[key]; + } + }, + _createDataTable: function(key, data, color) { + dataTable = new SimpleDataTableWidget({ + sciMapWidget: this.sciMapWidget, + container: this.container + }); + data.color = color; + dataTable.loadJsonData(data); + this.keyToDataTable[key] = dataTable; + return dataTable; + } +}); \ No newline at end of file diff --git a/productMods/js/visualization/mapofscience/InitializeMap.js b/productMods/js/visualization/mapofscience/InitializeMap.js index 30f57ae7..8017d93d 100644 --- a/productMods/js/visualization/mapofscience/InitializeMap.js +++ b/productMods/js/visualization/mapofscience/InitializeMap.js @@ -51,6 +51,7 @@ function initMap() { var mapOptions = { center: centerLatLng, zoom: 1, + streetViewControl: false, mapTypeControlOptions: { mapTypeIds: [] } diff --git a/productMods/js/visualization/mapofscience/SimpleDataTableWidget.js b/productMods/js/visualization/mapofscience/SimpleDataTableWidget.js new file mode 100644 index 00000000..543713c8 --- /dev/null +++ b/productMods/js/visualization/mapofscience/SimpleDataTableWidget.js @@ -0,0 +1,165 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +var SimpleDataTableWidget = Class.extend({ + + dom: { + paginationContainerClass : "subpaginatedtabs" + }, + init: function(options) { + var me = this; + me.options = options; + me.sciMapWidget = options.sciMapWidget; + me.currentSelectedFilter = COMPARISON_TYPE.SUBDISCIPLINE; + me.widget = ''; + me.tableDiv = $('
'); + me.addToContainer(); + }, + loadJsonData: function(data) { + + var me = this; + me.uri = data.uri; + me.label = data.label; + me.pubsWithNoJournals = data.pubsWithNoJournals; + me.pubsWithInvalidJournals = data.pubsWithInvalidJournals; + me.pubsMapped = data.pubsMapped; + me.type = data.type; + me.color = data.color; + me.subdisciplineActivity = data.subdisciplineActivity; + me.setupView(); + }, + addToContainer: function() { + this.options.container.append(this.tableDiv); + }, + removeFromContainer: function() { + this.tableDiv.remove(); + }, + hasKey: function(key) { + return (this.keyToMarkerManagers.hasOwnProperty(key)); + }, + show: function(key) { + this.tableDiv.show(); + }, + hide: function(key) { + this.tableDiv.hide(); + }, + cleanView: function() { + this.removeFromContainer(); + }, + initView: function() { + this.addToContainer(this.tableDiv); + this.show(); + }, + setupView: function() { + + var me = this; + + me.tableDiv.addClass("subEntityTable"); + + /* Create filter */ + entityVivoProfileURLPrefix + var organizationHeader = $('
' + + truncateText(me.label, 23) + 'drill down
'); + me.tableDiv.append(organizationHeader); + + /* Create table */ + var table = $(''); + table.attr('id', 'entityDatatable'); + table.addClass('entity-datatable-table'); + + /* Create table header */ + var thead = $(''); + var tr = $(''); + + /*var levelOfScienceAreaTH = $(''); + + var rowsToInsert = []; + var i = 0; + + $.each(me.subdisciplineActivity, function(index, density) { + rowsToInsert[i++] = ''; + rowsToInsert[i++] = ''; + rowsToInsert[i++] = ''; + }); + + tbody.append(rowsToInsert.join('')); + table.append(tbody); + me.tableDiv.append(table); + + /* Register events */ + table.children("tbody").children("tr").mouseenter(function() { + me.sciMapWidget.mouseInNode(me.type, me.label, $(this).attr("id")); + }); + + table.children("tbody").children("tr").mouseleave(function() { + me.sciMapWidget.mouseOutNode(me.type, me.label, $(this).attr("id")); + }); + + /* Init DataTable object */ + me.widget = table.dataTable({ + "sDom": '<"' + me.dom.paginationContainerClass + '"p><"table-separator"><"datatablewrapper"t>', + "aaSorting": [ + [1, "desc"], [0,'asc'] + ], + "asStripClasses": [], + "aoColumns": [{ "bSearchable": false }, + { "bSearchable": false }], + "iDisplayLength": 10, + "bInfo": true, + "bFilter": false, + "oLanguage": { + "sInfo": "_START_ - _END_ of _TOTAL_", + "sInfoEmpty": "No matching science areas found", + "sInfoFiltered": "" + }, + "sPaginationType": "gmail_style", + "fnDrawCallback": function () { + } + }); + + /* Create csv download button */ + var csvButton = '
'; + me.tableDiv.append(csvButton); + + /* Create mapping statistic result */ + var totalPublications = me.pubsWithNoJournals + me.pubsWithInvalidJournals + me.pubsMapped; + var mappedText = '' + + (100 * me.pubsMapped / totalPublications).toFixed(2) + '% mapped'; + me.tableDiv.append($(mappedText)); + me.widget.fnDraw(); + } +}); + +function truncateText(text, len) { + + var trunc = text; + + if (text.length > len) { + trunc = text.substring(0, len); + trunc = trunc.replace(/\w+$/, '') + '...' + } + + return trunc; +} \ No newline at end of file diff --git a/productMods/js/visualization/mapofscience/VisModeControllers.js b/productMods/js/visualization/mapofscience/VisModeControllers.js index 4da364f9..002c9c15 100644 --- a/productMods/js/visualization/mapofscience/VisModeControllers.js +++ b/productMods/js/visualization/mapofscience/VisModeControllers.js @@ -125,7 +125,8 @@ var ComparisonVisModeController = VisModeController.extend({ initWidgets: function(map) { var widgets = {}; widgets['scimap'] = new ComparisonScimapWidget(map); - widgets['sci_area_table'] = new ComparisonDataTableWidget(widgets['scimap']); + widgets['entity_area_table'] = new EntityTablesWidget(widgets['scimap']); + widgets['sci_area_table'] = new ComparisonDataTableWidget(widgets['scimap'], widgets['entity_area_table']); this.widgets = widgets; } diff --git a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonSetup.ftl b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonSetup.ftl index 8863904e..2eb68300 100644 --- a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonSetup.ftl +++ b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonSetup.ftl @@ -110,7 +110,7 @@ var subOrganizationPublicationTemporalGraphCommonURL = "${subOrganizationPublica var jsonString = '${jsonContent!}'; var vivoDefaultNamespace = '${vivoDefaultNamespace!}'; -var organizationLabel = "${organizationLabel}"; +var organizationLabel = '${organizationLabel}'; var organizationVIVOProfileURL = "${organizationVivoProfileURL}"; var loadingImageLink = contextPath + "/images/visualization/ajax-loader-indicator.gif"; diff --git a/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceSetup.ftl b/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceSetup.ftl index 0563665a..59473d8d 100644 --- a/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceSetup.ftl +++ b/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceSetup.ftl @@ -35,15 +35,19 @@ ', '', '', + '', + '', '', '', '', diff --git a/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceStandalone.ftl b/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceStandalone.ftl index 30e6ae18..301515dc 100644 --- a/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceStandalone.ftl +++ b/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceStandalone.ftl @@ -17,7 +17,7 @@ corresponding changes in the included Templates. -->

${entityLabel}

-
Explore publications activity across 554 scientific sub-disciplines +
Explore publications activity across 554 scientific subdisciplines information icon @@ -34,10 +34,10 @@ corresponding changes in the included Templates. -->
- x - -

#{title}

-

#{text}

+ x + +

#{title}

+

#{text}

@@ -53,18 +53,21 @@ corresponding changes in the included Templates. --> -
-
-mapped % of publications - information icon - +
+
+
+ mapped % of publications + information icon + - +
+
+
+ +
<#-- START TOOLTIP TEXT --> @@ -76,33 +79,33 @@ overlaid on the map of science. This particular page shows the publication activ You can use VIVO's Map of Science visualization to see where ${entityLabel} is active in the world of science -- based solely on publications that have been loaded into this VIVO instance.

-Overlaid circles are larger if ${entityLabel} has many publications in that sub-discipline, and are smaller if ${entityLabel} has -fewer publications in that sub-discipline.

+Overlaid circles are larger if ${entityLabel} has many publications in that subdiscipline, and are smaller if ${entityLabel} has +fewer publications in that subdiscipline.

-Circles are overlaid on the Map of Science itself, which is made of 554 interconnected sub-disciplines, shown as grey dots here. -A sub-discipline is defined as a cluster of journals. The Map of Science groups over 16,000 journals into 554 sub-disciplines using -similarities in their lists of references and key terms. Sub-disciplines that are especially similar to one another are interconnected, +Circles are overlaid on the Map of Science itself, which is made of 554 interconnected subdisciplines, shown as grey dots here. +A subdiscipline is defined as a cluster of journals. The Map of Science groups over 16,000 journals into 554 subdisciplines using +similarities in their lists of references and key terms. Subdisciplines that are especially similar to one another are interconnected, and will be closer to one another on the map.

For more information on this and other maps of science, see http://mapofscience.com or http://scimaps.org
@@ -143,8 +146,8 @@ concern. <#-- END TOOLTIP TEXT -->
'); + levelOfScienceAreaTH.html('Level of Science Area');*/ + + var scienceAreasTH = $(''); + scienceAreasTH.attr("id", "entity-science-areas-th"); + scienceAreasTH.html('Sub-Disciplines'); + + var activityCountTH = $(''); + activityCountTH.html('# of pubs.'); + + //tr.append(levelOfScienceAreaTH); + tr.append(scienceAreasTH); + tr.append(activityCountTH); + + thead.append(tr); + table.append(thead); + + /* Create tbody and contents */ + var tbody = $('
' + truncateText(SUBDISCIPLINES[index].label, 20) + '' + density.toFixed(1) + '