summaryrefslogtreecommitdiff
path: root/client/chart/chart.container.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/chart/chart.container.js')
-rw-r--r--client/chart/chart.container.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/client/chart/chart.container.js b/client/chart/chart.container.js
index ea86f998..aa80100e 100644
--- a/client/chart/chart.container.js
+++ b/client/chart/chart.container.js
@@ -107,17 +107,17 @@ class ChartContainer extends Component {
)
)
- const maxCitationsInAYear = citationCountsByYear
- .slice(1)
- .reduce((a,b) => (
- Math.max(
- a,
- b.slice(1).reduce((a2, b2) => (
- a2 + b2
- ),
- 0)
- )
- ), 0)
+ let maxCitationsInAYear = 0
+ let currentSum = 0
+ // for each year...
+ for (let j = 1; j < citationCountsByYear[0].length; j++) {
+ // for each country
+ currentSum = 0
+ for (let i = 1; i < citationCountsByYear.length; i++) {
+ currentSum += citationCountsByYear[i][j]
+ }
+ maxCitationsInAYear = Math.max(currentSum, maxCitationsInAYear)
+ }
let ticks = []
for (let i = 0; i < maxCitationsInAYear; i += 50) {
@@ -149,7 +149,7 @@ class ChartContainer extends Component {
tick: {
values: ticks,
},
- default: [ 0, maxCitationsInAYear ],
+ default: [ 0, maxCitationsInAYear * 286 / 261 ],
show: true,
}
}}
@@ -165,7 +165,7 @@ class ChartContainer extends Component {
let countriesByYear = Object.keys(countriesByYearLookup).map(country => [country, countriesByYearLookup[country]]).sort((a,b) => b[1] - a[1])
let topCountriesForThisYear = countriesByYear.slice(0, topCountryCount)
let bottomTotal = countriesByYear.slice(topCountryCount).reduce((a,b) => (a + b[1]), 0)
- console.log(topCountriesForThisYear)
+ // console.log(topCountriesForThisYear)
topCountriesForThisYear.push([otherCountriesLabel, bottomTotal])
const tableRows = topCountriesForThisYear.filter(pair => !!pair[1]).map(([country, total]) => {
let colorIndex = topCountries.indexOf(country)