Skip to content

Commit

Permalink
Merge pull request #270 from datacite/fair-visualizations-release-2
Browse files Browse the repository at this point in the history
Fair visualizations release 2
  • Loading branch information
jrhoads authored Jul 27, 2023
2 parents 1150d52 + c7dbb74 commit 7e4277f
Show file tree
Hide file tree
Showing 20 changed files with 1,365 additions and 277 deletions.
2 changes: 1 addition & 1 deletion cypress/integration/searchWork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Search Works', () => {
.get('.panel.facets.add')
.should(($facet) => {
expect($facet).to.have.length.at.least(4)
expect($facet.eq(0)).to.contain('Authors')
expect($facet.eq(0)).to.contain('Creators')
expect($facet.eq(1)).to.contain('Publication Year')
expect($facet.eq(2)).to.contain('Work Type')
expect($facet.eq(3)).to.contain('License')
Expand Down
11 changes: 8 additions & 3 deletions src/components/AuthorsFacet/AuthorsFacet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ const AuthorsFacet: React.FunctionComponent<Props> = ({
}
}

function removeNullAuthors(author) {
if (author.title)
return author
}

return (
<React.Fragment>
{authors && authors.length > 0 && (
Expand All @@ -80,17 +85,17 @@ const AuthorsFacet: React.FunctionComponent<Props> = ({
placement="top"
overlay={
<Tooltip id="tooltipAuthors">
This list includes only {title} with ORCID ids.
This list includes only {title} with ORCID iDs in DOI metadata.
</Tooltip>
}>
<h4>{title} <FontAwesomeIcon icon={faQuestionCircle} /></h4>
</OverlayTrigger>
<ul id="authors-facets">
{authors.filter(checkAuthorForPerson).map((facet) => (
{authors.filter(removeNullAuthors).filter(checkAuthorForPerson).map((facet) => (
<li key={facet.id}>
{facetLink(
'filterQuery',
'creators.nameIdentifiers.nameIdentifier:"' +
'creators_and_contributors.nameIdentifiers.nameIdentifier:"' +
facet.id +
'"',
'co-authors-facet-' + facet.id
Expand Down
11 changes: 6 additions & 5 deletions src/components/DonutChart/DonutChart.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import React from 'react'
import { mount } from '@cypress/react'
import DonutChart, { typesRange, typesDomain } from './DonutChart'
import DonutChart from './DonutChart'
import { resourceTypeDomain, resourceTypeRange } from 'src/data/color_palettes'

describe('DonutChart Component', () => {
let data
Expand All @@ -19,8 +20,8 @@ describe('DonutChart Component', () => {
count={173}
legend={true}
title="Work Type"
range={typesRange}
domain={typesDomain}
range={resourceTypeRange}
domain={resourceTypeDomain}
/>
)
cy.get('.mark-arc > path').should('be.visible')
Expand All @@ -37,8 +38,8 @@ describe('DonutChart Component', () => {
count={1730}
legend={false}
title="Work Type"
range={typesRange}
domain={typesDomain}
range={resourceTypeRange}
domain={resourceTypeDomain}
/>
)
cy.get('.mark-arc > path').should('be.visible').should('have.length', 6)
Expand Down
236 changes: 0 additions & 236 deletions src/components/DonutChart/DonutChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,242 +27,6 @@ const actions = {
editor: false
}

// Source: https://r-charts.com/color-palettes/#discrete
// paletteer_d("ggsci::category20_d3") + some from original set
export const typesRange = [
'#1F77B4FF',
'#FF7F0EFF',
'#2CA02CFF',
'#D62728FF',
'#9467BDFF',
'#8C564BFF',
'#E377C2FF',
'#7F7F7FFF',
'#BCBD22FF',
'#17BECFFF',
'#AEC7E8FF',
'#FFBB78FF',
'#98DF8AFF',
'#FF9896FF',
'#C5B0D5FF',
'#C49C94FF',
'#F7B6D2FF',
'#C7C7C7FF',
'#DBDB8DFF',
'#9EDAE5FF',
'#fccde5',
'#fdb462',
'#fb8072',
'#b3de69',
'#bc80bd',
'#fccde5',
'#8dd3c7',
'#ffed6f',
]
// Source: https://schema.datacite.org/meta/kernel-4/include/datacite-resourceType-v4.xsd
export const typesDomain = [
'Audiovisual',
'Book',
'Book Chapter',
'Collection',
'Computational Notebook',
'Conference Paper',
'Conference Proceeding',
'Data Paper',
'Dataset',
'Dissertation',
'Event',
'Image',
'Interactive Resource',
'Journal',
'Journal Article',
'Model',
'Output Management Plan',
'Peer Review',
'Physical Object',
'Preprint',
'Report',
'Service',
'Software',
'Sound',
'Standard',
'Text',
'Workflow',
'Other'
]

export const licenseRange = [
'#d9d9d9',
'#ffffb3',
'#ccebc5',
'#8dd3c7',
'#8dd3c7',
'#8dd3c7',
'#8dd3c7',
'#8dd3c7',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#8dd3c7',
'#80b1d3',
'#b3de69',
'#fdb462',
'#fccde5',
'#ccebc5',
'#ccebc5',
'#ffed6f'
]

export const licenseDomain = [
'No License',
'AFL-1.1',
'Apache-2.0',
'CC-BY-1.0',
'CC-BY-2.0',
'CC-BY-2.5',
'CC-BY-3.0',
'CC-BY-4.0',
'CC-BY-NC-2.0',
'CC-BY-NC-2.5',
'CC-BY-NC-3.0',
'CC-BY-NC-4.0',
'CC-BY-NC-ND-3.0',
'CC-BY-NC-ND-4.0',
'CC-BY-NC-SA-3.0',
'CC-BY-NC-SA-4.0',
'CC-BY-SA-4.0',
'CC-PDDC',
'CC0-1.0',
'GPL-3.0',
'ISC',
'MIT',
'MPL-2.0',
'OGL-Canada-2.0'
]

export const fieldOfScienceRange = [
'#d9d9d9',
'#ffffb3',
'#ccebc5',
'#8dd3c7',
'#8dd3c7',
'#8dd3c7',
'#8dd3c7',
'#8dd3c7',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#8dd3c7',
'#80b1d3',
'#b3de69',
'#fdb462',
'#fccde5',
'#ccebc5',
'#ccebc5',
'#ffed6f'
]

export const fieldOfScienceDomain = [
'No Field of Science',
'Natural sciences',
'Mathematics',
'Computer and information sciences',
'Physical sciences',
'Chemical sciences',
'Earth and related environmental sciences',
'Biological sciences',
'Other natural sciences',
'Engineering and technology',
'Civil engineering',
'Electrical engineering, electronic engineering, information engineering',
'Mechanical engineering',
'Chemical engineering',
'Materials engineering',
'Medical engineering',
'Environmental engineering',
'Environmental biotechnology',
'Industrial biotechnology',
'Nano-technology',
'Other engineering and technologies',
'Medical and health sciences',
'Basic medicine',
'Clinical medicine',
'Health sciences',
'Medical biotechnology',
'Other medical sciences',
'Agricultural sciences',
'Agriculture, forestry, and fisheries',
'Animal and dairy science',
'Veterinary science',
'Agricultural biotechnology',
'Other agricultural sciences',
'Social sciences',
'Psychology',
'Economics and business',
'Educational sciences',
'Sociology',
'Law',
'Political science',
'Social and economic geography',
'Media and communications',
'Other social sciences',
'Humanities',
'History and archaeology',
'Languages and literature',
'Philosophy, ethics and religion',
'Arts (arts, history of arts, performing arts, music)',
'Other humanities'
]

export const registrationAgencyRange = [
'#d9d9d9',
'#ffffb3',
'#ccebc5',
'#E81A31',
'#159DEA',
'#8dd3c7',
'#8dd3c7',
'#8dd3c7',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#80b1d3',
'#8dd3c7',
'#80b1d3',
'#b3de69',
'#fdb462',
'#fccde5',
'#ccebc5',
'#ccebc5',
'#ffed6f'
]

export const registrationAgencyDomain = [
'No Registration Agency',
'Airiti',
'CNKI',
'Crossref',
'DataCite',
'ISTIC',
'JaLC',
'KISTI',
'mEDRA',
'OP'
]

const DonutChart: React.FunctionComponent<Props> = ({
data,
Expand Down
Loading

0 comments on commit 7e4277f

Please sign in to comment.