diff --git a/src/components/Charts/publications/others/retractions/chart-by-publisher.js b/src/components/Charts/publications/others/retractions/chart-by-publisher.js index 25754555..386d220e 100644 --- a/src/components/Charts/publications/others/retractions/chart-by-publisher.js +++ b/src/components/Charts/publications/others/retractions/chart-by-publisher.js @@ -1,4 +1,4 @@ -import { Toggle } from '@dataesr/react-dsfr'; +import { Radio, RadioGroup } from '@dataesr/react-dsfr'; import Highcharts from 'highcharts'; import HCExportingData from 'highcharts/modules/export-data'; import HCExporting from 'highcharts/modules/exporting'; @@ -23,7 +23,7 @@ const Chart = ({ domain, hasComments, hasFooter, id }) => { const chartRef = useRef(); const intl = useIntl(); const [chartComments, setChartComments] = useState(''); - const [isPercent, setPercent] = useState(false); + const [isPercent, setPercent] = useState(true); const { observationSnaps } = useGlobals(); const { data, isError, isLoading } = useGetData( observationSnaps, @@ -55,11 +55,25 @@ const Chart = ({ domain, hasComments, hasFooter, id }) => { isError={isError} isLoading={isLoading || !dataGraph} > - setPercent(!isPercent)} - /> + value={isPercent} + > + + + item.by_retraction.buckets.find((i2) => i2.key === 1)?.doc_count ?? 0; + const percentageOfRetracted = (item) => (numberOfRetracted(item) / item.doc_count) * 100; + const response = await Axios.post(ES_API_URL, query, HEADERS); const buckets = response?.data?.aggregations?.by_publisher?.buckets - ?.sort((a, b) => numberOfRetracted(b) - numberOfRetracted(a)) + ?.sort((a, b) => percentageOfRetracted(b) - percentageOfRetracted(a)) .slice(0, 20); const categories = buckets.map((item) => item.key); const dataGraph = { data: buckets.map((item, catIndex) => ({ - y_tot: item.doc_count ?? 0, + y_tot: item.doc_count, y_abs: numberOfRetracted(item), - y_rel: (numberOfRetracted(item) / item.doc_count) * 10000, - y: isPercent - ? (numberOfRetracted(item) / item.doc_count) * 10000 - : numberOfRetracted(item), + y_rel: percentageOfRetracted(item), + y: isPercent ? percentageOfRetracted(item) : numberOfRetracted(item), x: catIndex, publisher: categories[catIndex], })), diff --git a/src/translations/en.json b/src/translations/en.json index ab251de9..1786e79b 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -871,7 +871,8 @@ "app.health-publi.data.hosted-documents-pmc": "of the publications in the health field from {publicationYear} are hosted on PubMed Central", "app.national-publi.data.documents-by-types-by-oa": "of the journal articles are open access, compared to {oaBooksRate}% of books", "app.national-publi.others.collaborations.international-collaborations.title": "Top 10 of the international collaborations with France", - "app.national-publi.others.retractions.chart-by-publisher.tooltip": "{point.publisher}
• Share of retracted publications :
{point.y_rel:.1f} ‱ ({point.y_abs} / {point.y_tot})", + "app.national-publi.others.retractions.chart-by-publisher.title": "Retracted publications by publisher", + "app.national-publi.others.retractions.chart-by-publisher.tooltip": "{point.publisher}
• Share of retracted publications :
{point.y_rel:.1f}% ({point.y_abs}/{point.y_tot})", "app.national-publi.others.retractions.chart-by-year.title": "Rate of retracted publications by year of publication", "app.national-publi.others.retractions.chart-by-field.title": "Rate of retracted publications by scientific field", "app.navigation.objet-recherche": "Research object navigation", @@ -965,6 +966,8 @@ "app.publi.display": "Display:", "app.publi.display-open-access": "Open access rate (%)", "app.publi.display-staff-open-access": "Number of publications", + "app.publi.display-percent-retracted": "Percentage of retracted publications", + "app.publi.display-number-retracted": "Number of retracted publications", "app.publi.type-apc": "Type of publication fee", "app.publi.type-auteur-rang-utile": "Affiliation of the first and last authors", "app.publi.type-hebergement": "Hosting type", diff --git a/src/translations/fr.json b/src/translations/fr.json index c163311a..f1743d17 100644 --- a/src/translations/fr.json +++ b/src/translations/fr.json @@ -1032,7 +1032,8 @@ "app.health-publi.data.hosted-documents-pmc": "des publications en santé de {publicationYear} sont hébergées sur PubMed Central", "app.national-publi.data.documents-by-types-by-oa": "des articles de revue sont en accès ouvert, contre {oaBooksRate} % des ouvrages", "app.national-publi.others.collaborations.international-collaborations.title": "Top 10 des collaborations internationales avec la France", - "app.national-publi.others.retractions.chart-by-publisher.tooltip": "{point.publisher}
• Part de publications retirées :
{point.y_rel:.1f} ‱ ({point.y_abs} / {point.y_tot})", + "app.national-publi.others.retractions.chart-by-publisher.title": "Publications retirées par éditeur", + "app.national-publi.others.retractions.chart-by-publisher.tooltip": "{point.publisher}
• Pourcentage de publications retirées :
{point.y_rel:.1f}% ({point.y_abs}/{point.y_tot})", "app.national-publi.others.retractions.chart-by-year.title": "Taux de publications retirées par année de publication", "app.national-publi.others.retractions.chart-by-field.title": "Taux de publications retirées par discipline", "app.navigation.objet-recherche": "Navigation par objet de recherche", @@ -1131,6 +1132,8 @@ "app.publi.display": "Afficher :", "app.publi.display-open-access": "Taux d'accès ouvert (%)", "app.publi.display-staff-open-access": "Nombre de publications", + "app.publi.display-percent-retracted": "Pourcentage de publications retirées", + "app.publi.display-number-retracted": "Nombre de publications retirées", "app.publi.type-apc": "Type de frais de publication", "app.publi.type-auteur-rang-utile": "Affiliation des premiers et derniers auteurs", "app.publi.type-hebergement": "Voie d'ouverture", diff --git a/src/utils/chartOptions.js b/src/utils/chartOptions.js index 4729c53b..baec3076 100644 --- a/src/utils/chartOptions.js +++ b/src/utils/chartOptions.js @@ -4198,15 +4198,15 @@ export const chartOptions = { 'publi.others.retractions.chart-by-publisher': { getOptions: (id, intl, categories, graph, isPercent, dataTitle) => { const options = getGraphOptions({ id, intl, dataTitle }); - options.chart.type = 'column'; + options.chart.type = 'bar'; options.xAxis = { title: { text: intl.formatMessage({ id: 'app.publishers' }) }, categories, }; - options.yAxis = getPertenthousandYAxis(false, null, !isPercent); + options.yAxis = getPercentageYAxis(false, null, !isPercent); options.yAxis.title.text = intl.formatMessage({ id: isPercent - ? 'app.publi.pertenthousand-publications-retracted' + ? 'app.publi.percent-publications-retracted' : 'app.publi.nb-publications-retracted', }); options.legend.enabled = false; @@ -4216,7 +4216,7 @@ export const chartOptions = { enabled: true, formatter() { if (isPercent) { - return this.y === 0 ? '' : this.y.toFixed(1).concat(' ‱'); + return this.y === 0 ? '' : this.y.toFixed(3).concat(' %'); } return this.y === 0 ? '' : this.y.toFixed(); },