summaryrefslogtreecommitdiff
path: root/client/chart
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-05-28 17:58:21 +0200
committerJules Laplace <julescarbon@gmail.com>2019-05-28 18:02:41 +0200
commit3cffea282d93e0a636ac3c022a4fb3d2cefb85ae (patch)
tree6de748eda032da42c23d0603b73dd6fc2ed0e935 /client/chart
parentab8d6b68a75c69d3db0678bc4507c7bf10b99a6a (diff)
update countries by year chart
Diffstat (limited to 'client/chart')
-rw-r--r--client/chart/countriesByYear.chart.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/client/chart/countriesByYear.chart.js b/client/chart/countriesByYear.chart.js
index df7a4530..4f8cc44e 100644
--- a/client/chart/countriesByYear.chart.js
+++ b/client/chart/countriesByYear.chart.js
@@ -118,7 +118,7 @@ class CountriesByYearChart extends Component {
tick: {
values: ticks,
},
- default: [ 0, maxCitationsInAYear * 286 / 261 ],
+ default: [0, maxCitationsInAYear * 286 / 261],
show: true,
}
}}
@@ -129,7 +129,7 @@ class CountriesByYearChart extends Component {
pattern: colorPattern
}}
tooltip={{
- contents: function (d, defaultTitleFormat, defaultValueFormat, color) {
+ contents: d => {
const countriesByYearLookup = years[yearList[d[0].x]]
let countriesByYear = Object.keys(countriesByYearLookup).map(country => [country, countriesByYearLookup[country]]).sort((a,b) => b[1] - a[1])
let topCountriesForThisYear = countriesByYear.slice(0, topCountryCount)
@@ -139,15 +139,15 @@ class CountriesByYearChart extends Component {
const tableRows = topCountriesForThisYear.filter(pair => !!pair[1]).map(([country, total]) => {
let colorIndex = topCountries.indexOf(country)
if (colorIndex < 0) colorIndex = colorPattern.length - 1
- const color = colorPattern[ colorIndex ]
+ const countryColor = colorPattern[colorIndex]
return [
"<tr>",
"<td>",
- "<span style='background-color:" + color + "' class='swatch'></span>",
- country,
+ "<span style='background-color:" + countryColor + "' class='swatch'></span>",
+ country,
"</td>",
"<td>",
- total,
+ total,
"</td>",
"</tr>",
].join('')
@@ -160,7 +160,16 @@ class CountriesByYearChart extends Component {
}
}}
/>
- <div className='caption'>{paper.name}{' dataset citations per country per year. We verified ' + citations.length + ' papers that used the dataset.'}</div>
+ {paper.vetting &&
+ <div className='caption'>
+ {paper.name}
+ {' dataset citations per country per year. We confirmed use of the dataset in '}
+ {citations.length}
+ {' papers, out of '}
+ {paper.vetting.total}
+ {' citations vetted.'}
+ </div>
+ }
</div>
)
}