1. Refactored freemarker templates & the directory structure.
2. Made chanegs to sparkline-related ftls to use the new geenric vis code geenrator. 3. Refactored vis code geenrators to be more geenric.
This commit is contained in:
parent
7dc4628302
commit
a3aa585a03
20 changed files with 506 additions and 350 deletions
|
@ -1,241 +0,0 @@
|
||||||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
|
||||||
|
|
||||||
<#assign visImageContextPath = "${urls.images}/visualization/" >
|
|
||||||
<#assign loadingImageLink = "${visImageContextPath}ajax-loader.gif">
|
|
||||||
|
|
||||||
<#assign egoVivoProfileURL = "${urls.base}/individual?uri=${egoURI}">
|
|
||||||
|
|
||||||
<#assign egoSparklineDataURL = '${urls.base}${dataVisualizationURLRoot}?vis=person_pub_count&uri=${egoURI}&labelField=label'>
|
|
||||||
<#assign coAuthorshipDownloadFile = '${urls.base}${dataVisualizationURLRoot}?vis=person_level&uri=${egoURI}&labelField=label'>
|
|
||||||
|
|
||||||
<div id="body">
|
|
||||||
|
|
||||||
|
|
||||||
<#--
|
|
||||||
|
|
||||||
Support for this has ended. Only created for the VIVO Conf Demo.
|
|
||||||
|
|
||||||
<style type="text/css">
|
|
||||||
|
|
||||||
#profileImage img{
|
|
||||||
width: 90px;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#body h1 {
|
|
||||||
margin:0.0em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sparkline_wrapper_table {
|
|
||||||
display: inline;
|
|
||||||
vertical-align: bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
.author_name {
|
|
||||||
color: #13968c;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.neutral_author_name {
|
|
||||||
color: black;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.author_moniker {
|
|
||||||
color: #9C9C9C;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sub_headings {
|
|
||||||
color: #121b3c;
|
|
||||||
padding-top: 10px;
|
|
||||||
margin-bottom: 0.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sub_headings a {
|
|
||||||
font-size:0.7em;
|
|
||||||
font-weight:normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.sparkline_wrapper_table td, th {
|
|
||||||
vertical-align: bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inline_href {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ego_profile {
|
|
||||||
padding-left:10px;
|
|
||||||
padding-top:10px;
|
|
||||||
min-height: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ego_label {
|
|
||||||
font-size:1.1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ego_profile_image {
|
|
||||||
float:left;
|
|
||||||
padding-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ego_profile_image img{
|
|
||||||
width: 90px;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ego_sparkline {
|
|
||||||
cursor:pointer;
|
|
||||||
height:36px;
|
|
||||||
width:471px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#coauthorships_table th {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<!--[if IE]>
|
|
||||||
<style type="text/css">
|
|
||||||
|
|
||||||
#${egoPubSparklineContainerID},
|
|
||||||
#${uniqueCoauthorsSparklineVisContainerID} {
|
|
||||||
padding-bottom:15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ego_label {
|
|
||||||
margin-left:-3px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<![endif]-->
|
|
||||||
|
|
||||||
<div id="ego_profile">
|
|
||||||
|
|
||||||
|
|
||||||
<%-- Image --%>
|
|
||||||
<div id="ego_profile_image" class="thumbnail"></div>
|
|
||||||
|
|
||||||
<%-- Label --%>
|
|
||||||
<a href="${egoVivoProfileURL}"><h1><span id="ego_label" class="author_name"></span></h1></a>
|
|
||||||
|
|
||||||
<%-- Moniker--%>
|
|
||||||
<span id="ego_moniker" class="author_moniker"></span>
|
|
||||||
|
|
||||||
|
|
||||||
<div style="clear:both;"></div>
|
|
||||||
|
|
||||||
<c:choose>
|
|
||||||
<c:when test='${numOfAuthors > 0}'>
|
|
||||||
|
|
||||||
<div id="incomplete-data">This information is based solely on publications which have been loaded into the VIVO system.
|
|
||||||
This may only be a small sample of the person's total work. </div>
|
|
||||||
|
|
||||||
<h2 class="sub_headings">Co-Author Network
|
|
||||||
<c:choose>
|
|
||||||
<c:when test="${numOfCoAuthorShips > 0 || numOfAuthors > 0}">
|
|
||||||
<a href="${coAuthorshipDownloadFile}">(GraphML File)</a></h2>
|
|
||||||
</c:when>
|
|
||||||
<c:otherwise>
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<c:if test='${numOfAuthors > 0}'>
|
|
||||||
<c:set var='authorsText' value='multi-author' />
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
<span id="no_coauthorships">Currently there are no ${authorsText} papers for
|
|
||||||
<a href="${egoVivoProfileURL}"><span id="no_coauthorships_person" class="author_name">this author</span></a> in the VIVO database.</span>
|
|
||||||
</c:otherwise>
|
|
||||||
</c:choose>
|
|
||||||
|
|
||||||
</c:when>
|
|
||||||
<c:otherwise>
|
|
||||||
<span id="no_coauthorships">Currently there are no papers for <a href="${egoVivoProfileURL}"><span id="no_coauthorships_person" class="author_name">
|
|
||||||
this author</span></a> in the VIVO database.</span>
|
|
||||||
</c:otherwise>
|
|
||||||
</c:choose>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<c:if test='${numOfCoAuthorShips > 0 || numOfAuthors > 0}'>
|
|
||||||
|
|
||||||
<div id="bodyPannel">
|
|
||||||
|
|
||||||
|
|
||||||
<div id="visPanel" style="float: left; width: 600px;">
|
|
||||||
<script language="JavaScript" type="text/javascript">
|
|
||||||
<!--
|
|
||||||
renderCoAuthorshipVisualization();
|
|
||||||
//-->
|
|
||||||
</script>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="dataPanel">
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<div id="profileImage" class="thumbnail"></div>
|
|
||||||
|
|
||||||
<div class="bold"><strong><span id="authorName" class="neutral_author_name"> </span></strong></div>
|
|
||||||
|
|
||||||
<div class="italicize"><span id="profileMoniker" class="author_moniker"></span></div>
|
|
||||||
<div><a href="#" id="profileUrl">VIVO profile</a> | <a href="#" id="coAuthorshipVisUrl">Co-author network</a></div>
|
|
||||||
<br />
|
|
||||||
<div class="author_stats" id="num_works"><span class="numbers" style="width: 40px;" id="works"></span> <span class="author_stats_text">Publication(s)</span></div>
|
|
||||||
<div class="author_stats" id="num_authors"><span class="numbers" style="width: 40px;" id="coAuthors"></span> <span class="author_stats_text">Co-author(s)</span></div>
|
|
||||||
|
|
||||||
<div class="author_stats" id="fPub" style="visibility:hidden"><span class="numbers" style="width:40px;" id="firstPublication"></span> <span>First Publication</span></div>
|
|
||||||
<div class="author_stats" id="lPub" style="visibility:hidden"><span class="numbers" style="width:40px;" id="lastPublication"></span> <span>Last Publication</span></div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
<c:if test='${numOfCoAuthorShips > 0}'>
|
|
||||||
|
|
||||||
<div class="vis_stats">
|
|
||||||
|
|
||||||
<h2 class="sub_headings">Table</h2>
|
|
||||||
|
|
||||||
<c:if test='${numOfCoAuthorShips > 0}'>
|
|
||||||
|
|
||||||
<div class="vis-tables">
|
|
||||||
<p id="coauth_table_container" class="datatable"></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
<div style="clear:both;"></div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script language="JavaScript" type="text/javascript">
|
|
||||||
$(document).ready(function(){
|
|
||||||
|
|
||||||
<c:if test='${numOfCoAuthorShips > 0}'>
|
|
||||||
$("#coauth_table_container").empty().html('<img id="loadingData" with="auto" src="${loadingImageLink}" />');
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
processProfileInformation("ego_label",
|
|
||||||
"ego_moniker",
|
|
||||||
"ego_profile_image",
|
|
||||||
jQuery.parseJSON(getWellFormedURLs("${requestScope.egoURIParam}", "profile_info")));
|
|
||||||
|
|
||||||
<c:if test='${empty numOfCoAuthorShips || empty numOfAuthors}'>
|
|
||||||
|
|
||||||
if ($('#ego_label').text().length > 0) {
|
|
||||||
setProfileName('no_coauthorships_person', $('#ego_label').text());
|
|
||||||
}
|
|
||||||
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
-->
|
|
|
@ -1,5 +1,5 @@
|
||||||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
<#if shouldVIVOrenderVis>
|
<#if shouldVIVOrenderVis>
|
||||||
<#include "/visualization/publicationSparklineContent.ftl">
|
<#include "/visualization/coauthorship/coAuthorshipSparklineContent.ftl">
|
||||||
</#if>
|
</#if>
|
|
@ -0,0 +1,197 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
<#assign visContainerID = '${sparklineVO.visContainerDivID}'>
|
||||||
|
|
||||||
|
<#if sparklineVO.shortVisMode>
|
||||||
|
<#assign sparklineContainerID = 'unique_coauthors_short_sparkline_vis'>
|
||||||
|
<#else>
|
||||||
|
<#assign sparklineContainerID = 'unique_coauthors_full_sparkline_vis'>
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
<#-- This is used to prevent collision between sparkline & visualization conatiner div ids. -->
|
||||||
|
<#if visContainerID?upper_case == sparklineContainerID?upper_case>
|
||||||
|
<#assign sparklineContainerID = visContainerID + "_spark">
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
<div class="staticPageBackground">
|
||||||
|
<div id="${visContainerID}">
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function drawCoauthorsSparklineVisualization(providedSparklineImgTD) {
|
||||||
|
|
||||||
|
var data = new google.visualization.DataTable();
|
||||||
|
data.addColumn('string', 'Year');
|
||||||
|
data.addColumn('number', 'Unique co-authors');
|
||||||
|
data.addRows(${sparklineVO.numOfYearsToBeRendered});
|
||||||
|
|
||||||
|
<#list sparklineVO.yearToEntityCountDataTable as yearToUniqueCoauthorsDataElement>
|
||||||
|
data.setValue(${yearToUniqueCoauthorsDataElement.yearToEntityCounter}, 0, '${yearToUniqueCoauthorsDataElement.year}');
|
||||||
|
data.setValue(${yearToUniqueCoauthorsDataElement.yearToEntityCounter}, 1, ${yearToUniqueCoauthorsDataElement.currentEntitiesCount});
|
||||||
|
</#list>
|
||||||
|
|
||||||
|
<#-- Create a view of the data containing only the column pertaining to coauthors count. -->
|
||||||
|
var sparklineDataView = new google.visualization.DataView(data);
|
||||||
|
sparklineDataView.setColumns([1]);
|
||||||
|
|
||||||
|
<#if sparklineVO.shortVisMode>
|
||||||
|
|
||||||
|
<#-- For the short view we only want the last 10 year's view of coauthors count, hence we filter
|
||||||
|
the data we actually want to use for render. -->
|
||||||
|
|
||||||
|
sparklineDataView.setRows(data.getFilteredRows([{
|
||||||
|
column: 0,
|
||||||
|
minValue: '${sparklineVO.earliestRenderedPublicationYear?c}',
|
||||||
|
maxValue: '${sparklineVO.latestRenderedPublicationYear?c}'
|
||||||
|
}]));
|
||||||
|
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
|
||||||
|
<#-- Create the vis object and draw it in the div pertaining to sparkline. -->
|
||||||
|
var sparkline = new google.visualization.ImageSparkLine(providedSparklineImgTD[0]);
|
||||||
|
sparkline.draw(sparklineDataView, {
|
||||||
|
width: 65,
|
||||||
|
height: 30,
|
||||||
|
showAxisLines: false,
|
||||||
|
showValueLabels: false,
|
||||||
|
labelPosition: 'none'
|
||||||
|
});
|
||||||
|
|
||||||
|
<#if sparklineVO.shortVisMode>
|
||||||
|
|
||||||
|
<#-- We want to display how many coauthors were considered, so this is used to calculate this. -->
|
||||||
|
|
||||||
|
var shortSparkRows = sparklineDataView.getViewRows();
|
||||||
|
var renderedShortSparks = 0;
|
||||||
|
$.each(shortSparkRows, function(index, value) {
|
||||||
|
renderedShortSparks += data.getValue(value, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#${sparklineContainerID} td.sparkline_number').text(parseInt(renderedShortSparks) + parseInt(${sparklineVO.unknownYearPublications}));
|
||||||
|
|
||||||
|
var sparksText = ' co-author(s) within the last 10 years <span class="incomplete-data-holder" title="This information'
|
||||||
|
+ ' is based solely on publications which have been loaded into the VIVO system. This may only be a small'
|
||||||
|
+ ' sample of the person\'s total work.">incomplete list</span>';
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sparks that will be rendered will always be the one's which has
|
||||||
|
* any year associated with it. Hence.
|
||||||
|
* */
|
||||||
|
var renderedSparks = ${sparklineVO.renderedSparks};
|
||||||
|
$('#${sparklineContainerID} td.sparkline_number').text(parseInt(renderedSparks) + parseInt(${sparklineVO.unknownYearPublications}));
|
||||||
|
|
||||||
|
var sparksText = ' co-author(s) from <span class="sparkline_range">${sparklineVO.earliestYearConsidered?c}'
|
||||||
|
+ ' to ${sparklineVO.latestRenderedPublicationYear?c}</span> '
|
||||||
|
+ ' <a href="${sparklineVO.downloadDataLink}" class="inline_href">(.CSV File)</a> ';
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
$('#${sparklineContainerID} td.sparkline_text').html(sparksText);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This will activate the visualization. It takes care of creating
|
||||||
|
* div elements to hold the actual sparkline image and then calling the
|
||||||
|
* drawCoauthorsSparklineVisualization function.
|
||||||
|
* */
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
var sparklineImgTD;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a nuclear option (creating the container in which everything goes)
|
||||||
|
* the only reason this will be ever used is the API user never submitted a
|
||||||
|
* container ID in which everything goes. The alternative was to let the
|
||||||
|
* vis not appear in the calling page at all. So now atleast vis appears but
|
||||||
|
* appended at the bottom of the body.
|
||||||
|
* */
|
||||||
|
|
||||||
|
if ($('#${visContainerID}').length === 0) {
|
||||||
|
$('<div/>', {
|
||||||
|
'id': '${visContainerID}'
|
||||||
|
}).appendTo('body');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($('#${sparklineContainerID}').length === 0) {
|
||||||
|
|
||||||
|
$('<div/>', {
|
||||||
|
'id': '${sparklineContainerID}',
|
||||||
|
'class': 'sparkline_style'
|
||||||
|
}).prependTo('#${visContainerID}');
|
||||||
|
|
||||||
|
var table = $('<table>');
|
||||||
|
table.attr('class', 'sparkline_wrapper_table');
|
||||||
|
var row = $('<tr>');
|
||||||
|
sparklineImgTD = $('<td>');
|
||||||
|
sparklineImgTD.attr('id', '${sparklineContainerID}_img');
|
||||||
|
sparklineImgTD.attr('width', '65');
|
||||||
|
sparklineImgTD.attr('align', 'right');
|
||||||
|
sparklineImgTD.attr('class', 'sparkline_style');
|
||||||
|
|
||||||
|
row.append(sparklineImgTD);
|
||||||
|
|
||||||
|
var sparklineNumberTD = $('<td>');
|
||||||
|
sparklineNumberTD.attr('width', '30');
|
||||||
|
sparklineNumberTD.attr('align', 'right');
|
||||||
|
sparklineNumberTD.attr('class', 'sparkline_number');
|
||||||
|
row.append(sparklineNumberTD);
|
||||||
|
var sparklineTextTD = $('<td>');
|
||||||
|
sparklineTextTD.attr('width', '450');
|
||||||
|
sparklineTextTD.attr('class', 'sparkline_text');
|
||||||
|
row.append(sparklineTextTD);
|
||||||
|
table.append(row);
|
||||||
|
table.prependTo('#${sparklineContainerID}');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
drawCoauthorsSparklineVisualization(sparklineImgTD);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</div><!-- Sparkline Viz -->
|
||||||
|
|
||||||
|
<#if sparklineVO.shortVisMode>
|
||||||
|
<#--<span class="vis_link">-->
|
||||||
|
<p><a class="all-vivo-publications" href="${sparklineVO.fullTimelineNetworkLink}">View full timeline and co-author network.</a></p>
|
||||||
|
<#--</span>-->
|
||||||
|
<#else>
|
||||||
|
<!-- For Full Sparkline - Print the Table of Couauthor Counts per Year -->
|
||||||
|
<p>
|
||||||
|
<table id='sparkline_data_table'>
|
||||||
|
<caption>
|
||||||
|
Unique Co-Authors per year <a href="${sparklineVO.downloadDataLink}">(.CSV File)</a>
|
||||||
|
</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Year
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Count
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<#list sparklineVO.yearToActivityCount?keys as year>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
${year}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
${sparklineVO.yearToActivityCount[year]}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</#list>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
Download data as <a href="${sparklineVO.downloadDataLink}">.csv</a> file.
|
||||||
|
<br />
|
||||||
|
</p>
|
||||||
|
</#if>
|
||||||
|
</div>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<#assign googleJSAPI = 'http://www.google.com/jsapi?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C%22packages%22%3A%5B%22areachart%22%2C%22imagesparkline%22%5D%7D%5D%7D'>
|
||||||
|
|
||||||
|
${headScripts.add(googleJSAPI)}
|
||||||
|
|
||||||
|
<#include "/visualization/coauthorship/coAuthorshipSparklineContent.ftl">
|
|
@ -58,9 +58,9 @@
|
||||||
data.addColumn('number', 'Grants');
|
data.addColumn('number', 'Grants');
|
||||||
data.addRows(${sparklineVO.numOfYearsToBeRendered});
|
data.addRows(${sparklineVO.numOfYearsToBeRendered});
|
||||||
|
|
||||||
<#list sparklineVO.yearToGrantCountDataTable as yearToGrantCountDataElement>
|
<#list sparklineVO.yearToEntityCountDataTable as yearToGrantCountDataElement>
|
||||||
data.setValue(${yearToGrantCountDataElement.grantCounter}, 0, '${yearToGrantCountDataElement.investigatedYear}');
|
data.setValue(${yearToGrantCountDataElement.yearToEntityCounter}, 0, '${yearToGrantCountDataElement.year}');
|
||||||
data.setValue(${yearToGrantCountDataElement.grantCounter}, 1, ${yearToGrantCountDataElement.currentGrants});
|
data.setValue(${yearToGrantCountDataElement.yearToEntityCounter}, 1, ${yearToGrantCountDataElement.currentEntitiesCount});
|
||||||
</#list>
|
</#list>
|
||||||
|
|
||||||
<#-- Create a view of the data containing only the column pertaining to grant count. -->
|
<#-- Create a view of the data containing only the column pertaining to grant count. -->
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<#if shouldVIVOrenderVis>
|
||||||
|
<#include "/visualization/publication/personPublicationSparklineContent.ftl">
|
||||||
|
</#if>
|
|
@ -4,4 +4,4 @@
|
||||||
|
|
||||||
${headScripts.add(googleJSAPI)}
|
${headScripts.add(googleJSAPI)}
|
||||||
|
|
||||||
<#include "/visualization/publicationSparklineContent.ftl">
|
<#include "/visualization/personPublicationSparklineContent.ftl">
|
|
@ -23,9 +23,9 @@
|
||||||
data.addColumn('number', 'Publications');
|
data.addColumn('number', 'Publications');
|
||||||
data.addRows(${sparklineVO.numOfYearsToBeRendered});
|
data.addRows(${sparklineVO.numOfYearsToBeRendered});
|
||||||
|
|
||||||
<#list sparklineVO.yearToPublicationCountDataTable as yearToPublicationCountDataElement>
|
<#list sparklineVO.yearToEntityCountDataTable as yearToPublicationCountDataElement>
|
||||||
data.setValue(${yearToPublicationCountDataElement.publicationCounter}, 0, '${yearToPublicationCountDataElement.publishedYear}');
|
data.setValue(${yearToPublicationCountDataElement.yearToEntityCounter}, 0, '${yearToPublicationCountDataElement.year}');
|
||||||
data.setValue(${yearToPublicationCountDataElement.publicationCounter}, 1, ${yearToPublicationCountDataElement.currentPublications});
|
data.setValue(${yearToPublicationCountDataElement.yearToEntityCounter}, 1, ${yearToPublicationCountDataElement.currentEntitiesCount});
|
||||||
</#list>
|
</#list>
|
||||||
|
|
||||||
<#-- Create a view of the data containing only the column pertaining to publication count. -->
|
<#-- Create a view of the data containing only the column pertaining to publication count. -->
|
|
@ -0,0 +1,5 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<#if shouldVIVOrenderVis>
|
||||||
|
<#include "/visualization/publication/personPublicationSparklineContent.ftl">
|
||||||
|
</#if>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<#assign googleJSAPI = 'http://www.google.com/jsapi?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C%22packages%22%3A%5B%22areachart%22%2C%22imagesparkline%22%5D%7D%5D%7D'>
|
||||||
|
|
||||||
|
${headScripts.add(googleJSAPI)}
|
||||||
|
|
||||||
|
<#include "/visualization/publication/personPublicationSparklineContent.ftl">
|
|
@ -0,0 +1,199 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
<#assign visContainerID = '${sparklineVO.visContainerDivID}'>
|
||||||
|
|
||||||
|
<#if sparklineVO.shortVisMode>
|
||||||
|
<#assign sparklineContainerID = 'pub_count_short_sparkline_vis'>
|
||||||
|
<#else>
|
||||||
|
<#assign sparklineContainerID = 'pub_count_full_sparkline_vis'>
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
<#-- This is used to prevent collision between sparkline & visualization conatiner div ids. -->
|
||||||
|
<#if visContainerID?upper_case == sparklineContainerID?upper_case>
|
||||||
|
<#assign sparklineContainerID = visContainerID + "_spark">
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
<div class="staticPageBackground">
|
||||||
|
<div id="${visContainerID}">
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function drawPubCountVisualization(providedSparklineImgTD) {
|
||||||
|
|
||||||
|
var data = new google.visualization.DataTable();
|
||||||
|
data.addColumn('string', 'Year');
|
||||||
|
data.addColumn('number', 'Publications');
|
||||||
|
data.addRows(${sparklineVO.numOfYearsToBeRendered});
|
||||||
|
|
||||||
|
<#list sparklineVO.yearToEntityCountDataTable as yearToPublicationCountDataElement>
|
||||||
|
data.setValue(${yearToPublicationCountDataElement.yearToEntityCounter}, 0, '${yearToPublicationCountDataElement.year}');
|
||||||
|
data.setValue(${yearToPublicationCountDataElement.yearToEntityCounter}, 1, ${yearToPublicationCountDataElement.currentEntitiesCount});
|
||||||
|
</#list>
|
||||||
|
|
||||||
|
<#-- Create a view of the data containing only the column pertaining to publication count. -->
|
||||||
|
var sparklineDataView = new google.visualization.DataView(data);
|
||||||
|
sparklineDataView.setColumns([1]);
|
||||||
|
|
||||||
|
<#if sparklineVO.shortVisMode>
|
||||||
|
|
||||||
|
<#-- For the short view we only want the last 10 year's view of publication count, hence we filter
|
||||||
|
the data we actually want to use for render. -->
|
||||||
|
|
||||||
|
sparklineDataView.setRows(data.getFilteredRows([{
|
||||||
|
column: 0,
|
||||||
|
minValue: '${sparklineVO.earliestRenderedPublicationYear?c}',
|
||||||
|
maxValue: '${sparklineVO.latestRenderedPublicationYear?c}'
|
||||||
|
/*minValue: '2001',
|
||||||
|
maxValue: '2011'*/
|
||||||
|
}]));
|
||||||
|
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
|
||||||
|
<#-- Create the vis object and draw it in the div pertaining to sparkline. -->
|
||||||
|
var sparkline = new google.visualization.ImageSparkLine(providedSparklineImgTD[0]);
|
||||||
|
sparkline.draw(sparklineDataView, {
|
||||||
|
width: 65,
|
||||||
|
height: 30,
|
||||||
|
showAxisLines: false,
|
||||||
|
showValueLabels: false,
|
||||||
|
labelPosition: 'none'
|
||||||
|
});
|
||||||
|
|
||||||
|
<#if sparklineVO.shortVisMode>
|
||||||
|
|
||||||
|
<#-- We want to display how many publication counts were considered, so this is used to calculate this. -->
|
||||||
|
|
||||||
|
var shortSparkRows = sparklineDataView.getViewRows();
|
||||||
|
var renderedShortSparks = 0;
|
||||||
|
$.each(shortSparkRows, function(index, value) {
|
||||||
|
renderedShortSparks += data.getValue(value, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#${sparklineContainerID} td.sparkline_number').text(parseInt(renderedShortSparks) + parseInt(${sparklineVO.unknownYearPublications}));
|
||||||
|
|
||||||
|
var sparksText = ' publication(s) within the last 10 years <span class="incomplete-data-holder" title="This information'
|
||||||
|
+ ' is based solely on publications which have been loaded into the VIVO system. This may only be a small'
|
||||||
|
+ ' sample of the person\'s total work.">incomplete list</span>';
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sparks that will be rendered will always be the one's which has
|
||||||
|
* any year associated with it. Hence.
|
||||||
|
* */
|
||||||
|
var renderedSparks = ${sparklineVO.renderedSparks};
|
||||||
|
$('#${sparklineContainerID} td.sparkline_number').text(parseInt(renderedSparks) + parseInt(${sparklineVO.unknownYearPublications}));
|
||||||
|
|
||||||
|
var sparksText = ' publication(s) from <span class="sparkline_range">${sparklineVO.earliestYearConsidered?c}'
|
||||||
|
+ ' to ${sparklineVO.latestRenderedPublicationYear?c}</span> '
|
||||||
|
+ ' <a href="${sparklineVO.downloadDataLink}" class="inline_href">(.CSV File)</a> ';
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
$('#${sparklineContainerID} td.sparkline_text').html(sparksText);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This will activate the visualization. It takes care of creating
|
||||||
|
* div elements to hold the actual sparkline image and then calling the
|
||||||
|
* drawPubCountVisualization function.
|
||||||
|
* */
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
var sparklineImgTD;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a nuclear option (creating the container in which everything goes)
|
||||||
|
* the only reason this will be ever used is the API user never submitted a
|
||||||
|
* container ID in which everything goes. The alternative was to let the
|
||||||
|
* vis not appear in the calling page at all. So now atleast vis appears but
|
||||||
|
* appended at the bottom of the body.
|
||||||
|
* */
|
||||||
|
|
||||||
|
if ($('#${visContainerID}').length === 0) {
|
||||||
|
$('<div/>', {
|
||||||
|
'id': '${visContainerID}'
|
||||||
|
}).appendTo('body');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($('#${sparklineContainerID}').length === 0) {
|
||||||
|
|
||||||
|
$('<div/>', {
|
||||||
|
'id': '${sparklineContainerID}',
|
||||||
|
'class': 'sparkline_style'
|
||||||
|
}).prependTo('#${visContainerID}');
|
||||||
|
|
||||||
|
var table = $('<table>');
|
||||||
|
table.attr('class', 'sparkline_wrapper_table');
|
||||||
|
var row = $('<tr>');
|
||||||
|
sparklineImgTD = $('<td>');
|
||||||
|
sparklineImgTD.attr('id', '${sparklineContainerID}_img');
|
||||||
|
sparklineImgTD.attr('width', '65');
|
||||||
|
sparklineImgTD.attr('align', 'right');
|
||||||
|
sparklineImgTD.attr('class', 'sparkline_style');
|
||||||
|
|
||||||
|
row.append(sparklineImgTD);
|
||||||
|
|
||||||
|
var sparklineNumberTD = $('<td>');
|
||||||
|
sparklineNumberTD.attr('width', '30');
|
||||||
|
sparklineNumberTD.attr('align', 'right');
|
||||||
|
sparklineNumberTD.attr('class', 'sparkline_number');
|
||||||
|
row.append(sparklineNumberTD);
|
||||||
|
var sparklineTextTD = $('<td>');
|
||||||
|
sparklineTextTD.attr('width', '450');
|
||||||
|
sparklineTextTD.attr('class', 'sparkline_text');
|
||||||
|
row.append(sparklineTextTD);
|
||||||
|
table.append(row);
|
||||||
|
table.prependTo('#${sparklineContainerID}');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
drawPubCountVisualization(sparklineImgTD);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</div><!-- Sparkline Viz -->
|
||||||
|
|
||||||
|
<#if sparklineVO.shortVisMode>
|
||||||
|
<#--<span class="vis_link">-->
|
||||||
|
<p><a class="all-vivo-publications" href="${sparklineVO.fullTimelineNetworkLink}">View all VIVO publications and corresponding co-author network.</a></p>
|
||||||
|
<#--</span>-->
|
||||||
|
<#else>
|
||||||
|
<!-- For Full Sparkline - Print the Table of Publication Counts per Year -->
|
||||||
|
<p>
|
||||||
|
<table id='sparkline_data_table'>
|
||||||
|
<caption>
|
||||||
|
Publications per year <a href="${sparklineVO.downloadDataLink}">(.CSV File)</a>
|
||||||
|
</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Year
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Publications
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<#list sparklineVO.yearToActivityCount?keys as year>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
${year}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
${sparklineVO.yearToActivityCount[year]}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</#list>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
Download data as <a href="${sparklineVO.downloadDataLink}">.csv</a> file.
|
||||||
|
<br />
|
||||||
|
</p>
|
||||||
|
</#if>
|
||||||
|
</div>
|
|
@ -2,10 +2,12 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.visualization.freemarker.coauthorship;
|
package edu.cornell.mannlib.vitro.webapp.visualization.freemarker.coauthorship;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -18,8 +20,9 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMa
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.visualization.VisualizationFrameworkConstants;
|
import edu.cornell.mannlib.vitro.webapp.controller.visualization.VisualizationFrameworkConstants;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VOConstants;
|
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VOConstants;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VisConstants;
|
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VisConstants;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Node;
|
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Node;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.SparklineData;
|
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.SparklineData;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.YearToEntityCountDataElement;
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
|
@ -172,6 +175,7 @@ public class CoAuthorshipVisCodeGenerator {
|
||||||
int uniqueCoAuthorCounter = 0;
|
int uniqueCoAuthorCounter = 0;
|
||||||
int renderedFullSparks = 0;
|
int renderedFullSparks = 0;
|
||||||
Set<Node> allCoAuthorsWithKnownAuthorshipYears = new HashSet<Node>();
|
Set<Node> allCoAuthorsWithKnownAuthorshipYears = new HashSet<Node>();
|
||||||
|
List<YearToEntityCountDataElement> yearToUniqueCoauthorsCountDataTable = new ArrayList<YearToEntityCountDataElement>();
|
||||||
|
|
||||||
for (int publicationYear = minPubYearConsidered;
|
for (int publicationYear = minPubYearConsidered;
|
||||||
publicationYear <= currentYear;
|
publicationYear <= currentYear;
|
||||||
|
@ -200,6 +204,11 @@ public class CoAuthorshipVisCodeGenerator {
|
||||||
+ ", 1, "
|
+ ", 1, "
|
||||||
+ currentUniqueCoAuthors
|
+ currentUniqueCoAuthors
|
||||||
+ ");\n");
|
+ ");\n");
|
||||||
|
|
||||||
|
yearToUniqueCoauthorsCountDataTable.add(new YearToEntityCountDataElement(uniqueCoAuthorCounter,
|
||||||
|
publicationYearAsString,
|
||||||
|
currentUniqueCoAuthors));
|
||||||
|
|
||||||
uniqueCoAuthorCounter++;
|
uniqueCoAuthorCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,6 +219,10 @@ public class CoAuthorshipVisCodeGenerator {
|
||||||
* associated with it. Hence.
|
* associated with it. Hence.
|
||||||
* */
|
* */
|
||||||
renderedFullSparks = allCoAuthorsWithKnownAuthorshipYears.size();
|
renderedFullSparks = allCoAuthorsWithKnownAuthorshipYears.size();
|
||||||
|
|
||||||
|
sparklineData.setRenderedSparks(renderedFullSparks);
|
||||||
|
|
||||||
|
sparklineData.setYearToEntityCountDataTable(yearToUniqueCoauthorsCountDataTable);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Total publications will also consider publications that have no year associated with
|
* Total publications will also consider publications that have no year associated with
|
||||||
|
@ -221,6 +234,7 @@ public class CoAuthorshipVisCodeGenerator {
|
||||||
.get(VOConstants.DEFAULT_PUBLICATION_YEAR).size();
|
.get(VOConstants.DEFAULT_PUBLICATION_YEAR).size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sparklineData.setUnknownYearPublications(unknownYearCoauthors);
|
||||||
|
|
||||||
String sparklineDisplayOptions = "{width: 65, height: 30, showAxisLines: false, "
|
String sparklineDisplayOptions = "{width: 65, height: 30, showAxisLines: false, "
|
||||||
+ "showValueLabels: false, labelPosition: 'none'}";
|
+ "showValueLabels: false, labelPosition: 'none'}";
|
||||||
|
@ -230,12 +244,15 @@ public class CoAuthorshipVisCodeGenerator {
|
||||||
} else {
|
} else {
|
||||||
visContainerID = DEFAULT_VISCONTAINER_DIV_ID;
|
visContainerID = DEFAULT_VISCONTAINER_DIV_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sparklineData.setVisContainerDivID(visContainerID);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* By default these represents the range of the rendered sparks. Only in case of
|
* By default these represents the range of the rendered sparks. Only in case of
|
||||||
* "short" sparkline mode we will set the Earliest RenderedPublication year to
|
* "short" sparkline mode we will set the Earliest RenderedPublication year to
|
||||||
* "currentYear - 10".
|
* "currentYear - 10".
|
||||||
* */
|
* */
|
||||||
|
sparklineData.setEarliestYearConsidered(minPubYearConsidered);
|
||||||
sparklineData.setEarliestRenderedPublicationYear(minPublishedYear);
|
sparklineData.setEarliestRenderedPublicationYear(minPublishedYear);
|
||||||
sparklineData.setLatestRenderedPublicationYear(currentYear);
|
sparklineData.setLatestRenderedPublicationYear(currentYear);
|
||||||
|
|
||||||
|
@ -253,6 +270,9 @@ public class CoAuthorshipVisCodeGenerator {
|
||||||
if (VisualizationFrameworkConstants.SHORT_SPARKLINE_VIS_MODE.equalsIgnoreCase(visMode)) {
|
if (VisualizationFrameworkConstants.SHORT_SPARKLINE_VIS_MODE.equalsIgnoreCase(visMode)) {
|
||||||
|
|
||||||
sparklineData.setEarliestRenderedPublicationYear(shortSparkMinYear);
|
sparklineData.setEarliestRenderedPublicationYear(shortSparkMinYear);
|
||||||
|
|
||||||
|
sparklineData.setShortVisMode(true);
|
||||||
|
|
||||||
generateShortSparklineVisualizationContent(currentYear,
|
generateShortSparklineVisualizationContent(currentYear,
|
||||||
shortSparkMinYear,
|
shortSparkMinYear,
|
||||||
visContainerID,
|
visContainerID,
|
||||||
|
@ -260,6 +280,8 @@ public class CoAuthorshipVisCodeGenerator {
|
||||||
unknownYearCoauthors,
|
unknownYearCoauthors,
|
||||||
sparklineDisplayOptions);
|
sparklineDisplayOptions);
|
||||||
} else {
|
} else {
|
||||||
|
sparklineData.setShortVisMode(false);
|
||||||
|
|
||||||
generateFullSparklineVisualizationContent(currentYear,
|
generateFullSparklineVisualizationContent(currentYear,
|
||||||
minPubYearConsidered,
|
minPubYearConsidered,
|
||||||
visContainerID,
|
visContainerID,
|
||||||
|
|
|
@ -34,8 +34,7 @@ public class CoPIGrantCountRequestHandler implements VisualizationRequestHandler
|
||||||
@Override
|
@Override
|
||||||
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log,
|
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log,
|
||||||
DataSource dataSource) throws MalformedQueryParametersException {
|
DataSource dataSource) throws MalformedQueryParametersException {
|
||||||
// TODO Auto-generated method stub
|
throw new UnsupportedOperationException("Co-PI Grant Count does not provide Ajax Response.");
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,7 +22,7 @@ import edu.cornell.mannlib.vitro.webapp.visualization.constants.VOConstants;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VisConstants;
|
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VisConstants;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Grant;
|
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Grant;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.SparklineData;
|
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.SparklineData;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.YearGrantCountDataElement;
|
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.YearToEntityCountDataElement;
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
|
@ -190,7 +190,7 @@ public class PersonGrantCountVisCodeGenerator {
|
||||||
*/
|
*/
|
||||||
int renderedFullSparks = 0;
|
int renderedFullSparks = 0;
|
||||||
|
|
||||||
List<YearGrantCountDataElement> yearToGrantCountDataTable = new ArrayList<YearGrantCountDataElement>();
|
List<YearToEntityCountDataElement> yearToGrantCountDataTable = new ArrayList<YearToEntityCountDataElement>();
|
||||||
|
|
||||||
for (int grantYear = minGrantYearConsidered; grantYear <= currentYear; grantYear++) {
|
for (int grantYear = minGrantYearConsidered; grantYear <= currentYear; grantYear++) {
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ public class PersonGrantCountVisCodeGenerator {
|
||||||
+ ", 1, " + currentGrants + ");\n");
|
+ ", 1, " + currentGrants + ");\n");
|
||||||
|
|
||||||
yearToGrantCountDataTable
|
yearToGrantCountDataTable
|
||||||
.add(new YearGrantCountDataElement(
|
.add(new YearToEntityCountDataElement(
|
||||||
grantCounter, stringInvestigatedYear,
|
grantCounter, stringInvestigatedYear,
|
||||||
currentGrants));
|
currentGrants));
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ public class PersonGrantCountVisCodeGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
sparklineData
|
sparklineData
|
||||||
.setYearToGrantCountDataTable(yearToGrantCountDataTable);
|
.setYearToEntityCountDataTable(yearToGrantCountDataTable);
|
||||||
|
|
||||||
sparklineData.setRenderedSparks(renderedFullSparks);
|
sparklineData.setRenderedSparks(renderedFullSparks);
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,8 @@ VisualizationRequestHandler {
|
||||||
|
|
||||||
Portal portal = vreq.getPortal();
|
Portal portal = vreq.getPortal();
|
||||||
|
|
||||||
String standaloneTemplate = "/visualization/publicationCount.ftl";
|
// String standaloneTemplate = "/visualization/publication/personPublicationCountStandaloneActivator.ftl";
|
||||||
|
String standaloneTemplate = "/visualization/personPublicationCountStandaloneActivator.ftl";
|
||||||
|
|
||||||
Map<String, Object> body = new HashMap<String, Object>();
|
Map<String, Object> body = new HashMap<String, Object>();
|
||||||
body.put("portalBean", portal);
|
body.put("portalBean", portal);
|
||||||
|
@ -284,7 +285,8 @@ VisualizationRequestHandler {
|
||||||
|
|
||||||
Portal portal = vreq.getPortal();
|
Portal portal = vreq.getPortal();
|
||||||
|
|
||||||
String dynamicTemplate = "/visualization/sparklineAjaxVisContent.ftl";
|
// String dynamicTemplate = "/visualization/publication/personPublicationCountDynamicActivator.ftl";
|
||||||
|
String dynamicTemplate = "/visualization/personPublicationCountDynamicActivator.ftl";
|
||||||
|
|
||||||
Map<String, Object> body = new HashMap<String, Object>();
|
Map<String, Object> body = new HashMap<String, Object>();
|
||||||
body.put("portalBean", portal);
|
body.put("portalBean", portal);
|
||||||
|
|
|
@ -22,7 +22,7 @@ import edu.cornell.mannlib.vitro.webapp.visualization.constants.VOConstants;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VisConstants;
|
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VisConstants;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.BiboDocument;
|
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.BiboDocument;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.SparklineData;
|
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.SparklineData;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.YearPublicationCountDataElement;
|
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.YearToEntityCountDataElement;
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
|
@ -200,7 +200,7 @@ public class PersonPublicationCountVisCodeGenerator {
|
||||||
* */
|
* */
|
||||||
int renderedFullSparks = 0;
|
int renderedFullSparks = 0;
|
||||||
|
|
||||||
List<YearPublicationCountDataElement> yearToPublicationCountDataTable = new ArrayList<YearPublicationCountDataElement>();
|
List<YearToEntityCountDataElement> yearToPublicationCountDataTable = new ArrayList<YearToEntityCountDataElement>();
|
||||||
|
|
||||||
for (int publicationYear = minPubYearConsidered;
|
for (int publicationYear = minPubYearConsidered;
|
||||||
publicationYear <= currentYear;
|
publicationYear <= currentYear;
|
||||||
|
@ -225,7 +225,7 @@ public class PersonPublicationCountVisCodeGenerator {
|
||||||
+ currentPublications
|
+ currentPublications
|
||||||
+ ");\n");
|
+ ");\n");
|
||||||
|
|
||||||
yearToPublicationCountDataTable.add(new YearPublicationCountDataElement(publicationCounter, stringPublishedYear, currentPublications));
|
yearToPublicationCountDataTable.add(new YearToEntityCountDataElement(publicationCounter, stringPublishedYear, currentPublications));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sparks that will be rendered will always be the one's which has
|
* Sparks that will be rendered will always be the one's which has
|
||||||
|
@ -236,7 +236,7 @@ public class PersonPublicationCountVisCodeGenerator {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sparklineData.setYearToPublicationCountDataTable(yearToPublicationCountDataTable);
|
sparklineData.setYearToEntityCountDataTable(yearToPublicationCountDataTable);
|
||||||
|
|
||||||
|
|
||||||
sparklineData.setRenderedSparks(renderedFullSparks);
|
sparklineData.setRenderedSparks(renderedFullSparks);
|
||||||
|
|
|
@ -39,8 +39,7 @@ public class SparklineData {
|
||||||
|
|
||||||
private boolean isShortVisMode = true;
|
private boolean isShortVisMode = true;
|
||||||
|
|
||||||
private List<YearPublicationCountDataElement> yearToPublicationCountDataTable;
|
private List<YearToEntityCountDataElement> yearToEntityCountDataTable;
|
||||||
private List<YearGrantCountDataElement> yearToGrantCountDataTable;
|
|
||||||
|
|
||||||
private int numOfYearsToBeRendered;
|
private int numOfYearsToBeRendered;
|
||||||
|
|
||||||
|
@ -85,15 +84,6 @@ public class SparklineData {
|
||||||
this.unknownYearGrants = unknownYearGrants;
|
this.unknownYearGrants = unknownYearGrants;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<YearGrantCountDataElement> getYearToGrantCountDataTable() {
|
|
||||||
return yearToGrantCountDataTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setYearToGrantCountDataTable(
|
|
||||||
List<YearGrantCountDataElement> yearToGrantCountDataTable) {
|
|
||||||
this.yearToGrantCountDataTable = yearToGrantCountDataTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumOfYearsToBeRendered(int numOfYearsToBeRendered) {
|
public void setNumOfYearsToBeRendered(int numOfYearsToBeRendered) {
|
||||||
this.numOfYearsToBeRendered = numOfYearsToBeRendered;
|
this.numOfYearsToBeRendered = numOfYearsToBeRendered;
|
||||||
}
|
}
|
||||||
|
@ -102,13 +92,13 @@ public class SparklineData {
|
||||||
return numOfYearsToBeRendered;
|
return numOfYearsToBeRendered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setYearToPublicationCountDataTable(
|
public void setYearToEntityCountDataTable(
|
||||||
List<YearPublicationCountDataElement> yearToPublicationCountDataTable) {
|
List<YearToEntityCountDataElement> yearToEntityCountDataTable) {
|
||||||
this.yearToPublicationCountDataTable = yearToPublicationCountDataTable;
|
this.yearToEntityCountDataTable = yearToEntityCountDataTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<YearPublicationCountDataElement> getYearToPublicationCountDataTable() {
|
public List<YearToEntityCountDataElement> getYearToEntityCountDataTable() {
|
||||||
return yearToPublicationCountDataTable;
|
return yearToEntityCountDataTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setYearToActivityCount(Map<String, Integer> yearToActivityCount) {
|
public void setYearToActivityCount(Map<String, Integer> yearToActivityCount) {
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This object is used to store information about the yearToGrantCount Map in the format
|
|
||||||
* easily expressed to Google Visualization's DataTableAPI.
|
|
||||||
* @author bkoniden
|
|
||||||
* Deepak Konidena
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class YearGrantCountDataElement {
|
|
||||||
|
|
||||||
private int grantCounter;
|
|
||||||
private String investigatedYear;
|
|
||||||
private int currentGrants;
|
|
||||||
|
|
||||||
public YearGrantCountDataElement(int grantCounter,
|
|
||||||
String investigatedYear, int currentGrants) {
|
|
||||||
this.grantCounter = grantCounter;
|
|
||||||
this.investigatedYear = investigatedYear;
|
|
||||||
this.currentGrants = currentGrants;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getGrantCounter() {
|
|
||||||
return grantCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInvestigatedYear() {
|
|
||||||
return investigatedYear;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCurrentGrants() {
|
|
||||||
return currentGrants;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This object is used to store information about the yearToPublicationCount Map in the format
|
|
||||||
* easily expressed to Google Visualization's DataTableAPI.
|
|
||||||
* @author cdtank
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class YearPublicationCountDataElement {
|
|
||||||
|
|
||||||
private int publicationCounter;
|
|
||||||
private String publishedYear;
|
|
||||||
private int currentPublications;
|
|
||||||
|
|
||||||
public YearPublicationCountDataElement(int publicationCounter,
|
|
||||||
String publishedYear, int currentPublications) {
|
|
||||||
this.publicationCounter = publicationCounter;
|
|
||||||
this.publishedYear = publishedYear;
|
|
||||||
this.currentPublications = currentPublications;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPublicationCounter() {
|
|
||||||
return publicationCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPublishedYear() {
|
|
||||||
return publishedYear;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCurrentPublications() {
|
|
||||||
return currentPublications;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This object is used to store information about the yearToEntityCount Map in the format
|
||||||
|
* easily expressed to Google Visualization's DataTableAPI.
|
||||||
|
* @author cdtank
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class YearToEntityCountDataElement {
|
||||||
|
|
||||||
|
private int yearToEntityCounter;
|
||||||
|
private String year;
|
||||||
|
private int currentEntitiesCount;
|
||||||
|
|
||||||
|
public YearToEntityCountDataElement(int yearToEntityCounter,
|
||||||
|
String year, int currentEntitiesCount) {
|
||||||
|
this.yearToEntityCounter = yearToEntityCounter;
|
||||||
|
this.year = year;
|
||||||
|
this.currentEntitiesCount = currentEntitiesCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getYearToEntityCounter() {
|
||||||
|
return yearToEntityCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYear() {
|
||||||
|
return year;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentEntitiesCount() {
|
||||||
|
return currentEntitiesCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue