@@ -3,15 +3,12 @@ import Highcharts from "highcharts";
33import HighchartsReact from "highcharts-react-official" ;
44import HighchartsMore from "highcharts/highcharts-more" ;
55import { useIntl } from "react-intl" ;
6+ import { Aggregation } from "../../types/commons" ;
67
78HighchartsMore ( Highcharts ) ;
89
910type CpcChartProps = {
10- data : {
11- label : string ;
12- doc_count : number ;
13- code : string ;
14- } [ ] ;
11+ data : Aggregation [ ] ;
1512} ;
1613
1714const sectionLabels : Record < string , string > = {
@@ -40,11 +37,11 @@ const CpcChart: React.FC<CpcChartProps> = ({ data }) => {
4037 "#AEA397" ,
4138 ] ;
4239 const groupedData = data . reduce ( ( acc , item ) => {
43- const firstLetter = item . code . charAt ( 0 ) . toUpperCase ( ) ;
40+ const firstLetter = item . value . charAt ( 0 ) . toUpperCase ( ) ;
4441 if ( ! acc [ firstLetter ] ) acc [ firstLetter ] = [ ] ;
4542 acc [ firstLetter ] . push ( {
46- name : item . code ,
47- value : item . doc_count ,
43+ name : item . value ,
44+ value : item . count ,
4845 label : item . label ,
4946 } ) ;
5047 return acc ;
@@ -54,9 +51,9 @@ const CpcChart: React.FC<CpcChartProps> = ({ data }) => {
5451 ( [ letter , items ] , index ) => {
5552 const totalCount = items . reduce ( ( sum , item ) => sum + item . value , 0 ) ;
5653 return {
57- name :
58- intl . formatMessage ( { id : sectionLabels [ letter ] } ) ||
59- `Section ${ letter } ` ,
54+ name : sectionLabels [ letter ]
55+ ? intl . formatMessage ( { id : sectionLabels [ letter ] } )
56+ : `Section ${ letter } ` ,
6057 color : colorPalette [ index % colorPalette . length ] ,
6158 data : items . map ( ( item ) => ( {
6259 name : item . name ,
@@ -105,18 +102,19 @@ const CpcChart: React.FC<CpcChartProps> = ({ data }) => {
105102 ) ;
106103 const totalFamiliesText = intl . formatMessage (
107104 {
108- id : "organizations.patents.chart.families" ,
109- defaultMessage : "{count} famille{plural}" ,
105+ id : "organizations.patents.chart.totalFamilies" ,
106+ defaultMessage :
107+ "{count, plural, one {# famille} other {# familles}}" ,
110108 } ,
111109 {
112110 count : totalCount ,
113- plural : totalCount > 1 ? "s" : "" ,
114111 }
115112 ) ;
116113
117- if ( ! pointName && ! pointLabel ) {
118- return `<b>${ sectionName } </b>: ${ totalFamiliesText } ` ;
119- }
114+ if ( ! pointName && ! pointLabel )
115+ if ( ! pointName && ! pointLabel ) {
116+ return `<b>${ sectionName } </b>: ${ totalFamiliesText } ` ;
117+ }
120118
121119 return `${ pointName } ${
122120 pointLabel ? `- ${ pointLabel } ` : ""
@@ -126,11 +124,12 @@ const CpcChart: React.FC<CpcChartProps> = ({ data }) => {
126124
127125 plotOptions : {
128126 packedbubble : {
129- minSize : "45 %" ,
130- maxSize : "120 %" ,
127+ minSize : "30 %" ,
128+ maxSize : "100 %" ,
131129 zMin : zMin ,
132130 zMax : zMax ,
133131 layoutAlgorithm : {
132+ enableSimulation : false ,
134133 gravitationalConstant : 0.05 ,
135134 splitSeries : true ,
136135 seriesInteraction : false ,
0 commit comments