diff options
Diffstat (limited to 'client/chart')
| -rw-r--r-- | client/chart/countriesByYear.chart.js | 23 |
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> ) } |
