Skip to content

Commit

Permalink
update teds
Browse files Browse the repository at this point in the history
  • Loading branch information
HAFSA AALLAT committed Feb 28, 2024
1 parent 677bc73 commit a894433
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions client/src/pages/teds/charts/NbIpccReferencesByCountry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,28 @@ export default function NbIpccReferencesByCountry() {
if (isLoading) {
return <div>Loading...</div>;
}

const series = (data?.group_by?.slice(0, 20) ?? []).map((country) => ({
color: country.key === 'FR' ? '#cc0000' : '#808080',
name: country.key_display_name,
y: country.count,

const data_counts = {};
data.aggregations.by_countries.buckets.forEach((x: { key: string ; doc_count: number; }) => {
data_counts[x.key] = Math.round((x.doc_count * 100) / data.hits.total.value);
});

const categories = Object.keys(data_counts).slice(0, 20);

const series = categories.map((country) => ({
color: country === 'FR' ? '#cc0000' : '#808080',
name: country,
y: data_counts[country],
}));
const categories = series.map((country) => country.name);

const options = {
chart: { type: 'column' },
legend: { enabled: false },
plotOptions: { column: { dataLabels: { enabled: true } } },
series: [{ data: series }],
title: { text: 'Number of IPCC references in which France participated (top 20)' },
xAxis: { categories, title: { text: 'Country' } },
yAxis: { title: { text: 'Number of IPCC references' } }
title: { text: 'Percentage of IPCC references in which France participated' },
xAxis: { categories: categories, title: { text: 'Country' } },
yAxis: { title: { text: 'Percentage of IPCC references' } },
};

return (
Expand Down

0 comments on commit a894433

Please sign in to comment.