Skip to content

Commit

Permalink
Merge aad3cec into 815537b
Browse files Browse the repository at this point in the history
  • Loading branch information
thostetler committed Aug 30, 2022
2 parents 815537b + aad3cec commit 3838a8c
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 17 deletions.
33 changes: 28 additions & 5 deletions src/js/widgets/facet/graph-facet/templates/graph.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
<div class="pull-right s-view-metrics-button-container"></div>
{{#if statsCount}}
<div style="width:80%">
{{statsDescription}} : <b>{{statsCount}}</b>
</div>
<hr/>

<!-- citations section -->
{{#compare section "citations"}}
<div style="display: flex;">
<div style="flex: 1; padding-right: 10px">
<p style="font-size: 1.3rem;">{{totalCount}} top cited records with <strong>{{subTotal}}</strong> total citations</p>
</div>
<div class="s-view-metrics-button-container" style="width:40px"></div>
</div>
{{#if showTotalMessage}}
<p style="font-size: 1.3rem;">(<strong>{{statsCount}}</strong> total citations for full set)</p>
{{/if}}
{{/compare}}

<!-- reads section -->
{{#compare section "reads"}}
<div style="display: flex;">
<div style="flex: 1; padding-right: 10px">
<p style="font-size: 1.3rem;">{{totalCount}} top read records with <strong>{{subTotal}}</strong> total recent reads </p>
</div>
<div class="s-view-metrics-button-container" style="width:40px"></div>
</div>
{{#if showTotalMessage}}
<p style="font-size: 1.3rem;">(<strong>{{statsCount}}</strong> total recent reads for full set)</p>
{{/if}}
{{/compare}}
{{/if}}
{{#if statsCount}}<hr/>{{/if}}

<div class="graph-legend" {{#unless statsCount}} style="width:80%" {{/unless}}></div>
{{#unless graphData}}
{{#if error}}
Expand Down
20 changes: 16 additions & 4 deletions src/js/wraps/graph_tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ define([
// if the year exists, then grab it, otherwise fill with an empty (x,y)
if (yearMap.has(year)) {
const { refereed, notrefereed } = yearMap.get(year);

return {
x: year,
y: refereed + notrefereed,
Expand All @@ -90,6 +91,7 @@ define([
if (finalData.length <= 1) {
return noData();
}

this.model.set({ graphData: finalData });

// update widget state
Expand Down Expand Up @@ -131,13 +133,15 @@ define([
// map counts into coordinates for graph
const finalData = [];
let xCounter = 0;
let yCounter = 0;
counts.some((item) => {
xCounter += item.count;
// one dot per paper (this way we'll only plot the top ranked X - fraction of results)
while (
xCounter > finalData.length &&
finalData.length < maxDataPoints
) {
yCounter += item.val;
finalData.push({ y: item.val, x: finalData.length + 1 });
}
if (finalData.length > maxDataPoints) {
Expand All @@ -157,9 +161,12 @@ define([
}

this.model.set({
section: 'citations',
graphData: finalData,
statsCount: statsCount,
statsDescription: `${finalData.length} top ranked citations of`,
statsCount: statsCount.toLocaleString(),
totalCount: finalData.length.toLocaleString(),
subTotal: yCounter.toLocaleString(),
showTotalMessage: finalData.length === maxDataPoints,
});
},
});
Expand Down Expand Up @@ -197,6 +204,7 @@ define([

// map counts into coordinates for graph
const finalData = [];
let yCounter = 0;
let xCounter = 0;
counts.some((item) => {
xCounter += item.count;
Expand All @@ -205,6 +213,7 @@ define([
xCounter > finalData.length &&
finalData.length < maxDataPoints
) {
yCounter += item.val;
finalData.push({ y: item.val, x: finalData.length + 1 });
}
if (finalData.length > maxDataPoints) {
Expand All @@ -224,9 +233,12 @@ define([
}

this.model.set({
section: 'reads',
graphData: finalData,
statsCount: statsCount,
statsDescription: `${finalData.length} top ranked reads of`,
statsCount: statsCount.toLocaleString(),
totalCount: finalData.length.toLocaleString(),
subTotal: yCounter.toLocaleString(),
showTotalMessage: finalData.length === maxDataPoints,
});
},
});
Expand Down
7 changes: 2 additions & 5 deletions src/styles/sass/ads-sass/results-page-widgets.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
padding: 10px 0;
.btn {
font-size: 16px;
margin:2px;
margin: 2px;
@media screen and (max-width: $screen-xs) {
font-size: 0.8em;
}
Expand Down Expand Up @@ -132,14 +132,13 @@
}
}


.s-create-notification-title__title {
display: flex;
justify-content: space-between;
color: #5d5d5d;
font-size: 1.25em;
}

.create-notification-title {
&:hover,
&:focus {
Expand Down Expand Up @@ -179,11 +178,9 @@
transform: translate(-100%);
}
}

}

#search-results-actions {
border-bottom: 1px solid darken($gray-lighter, 10%);
padding: 5px 0 15px 0;

&.sticky {
Expand Down
4 changes: 1 addition & 3 deletions src/styles/sass/ads-sass/visualizations.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ Year, Citation and Reference Graphs
*/

.s-view-metrics-button-container {
@extend .pull-right;
margin-right: 10px;
width: 30px;
}

.change-scale {
Expand Down Expand Up @@ -673,7 +672,6 @@ rect.selection {
}

.s-bubble-chart {

.s-controls {
font-size: 14px;
background-color: $gray-lighter;
Expand Down

0 comments on commit 3838a8c

Please sign in to comment.