-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from dataesr/fundingRankingCharts
add first chart / success - part 2
- Loading branch information
Showing
6 changed files
with
122 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...ects/components/pages/analysis/positioning/charts/funding-ranking/options-succes-rate.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
export default function optionSuccessRate(data) { | ||
if (!data) return null; | ||
|
||
// average ratio | ||
const total = data.reduce((acc, el) => acc + el.ratio, 0); | ||
const average = total / data.length; | ||
|
||
return { | ||
chart: { | ||
type: "bar", | ||
height: 400, | ||
}, | ||
title: { text: "" }, | ||
legend: { enabled: false }, | ||
credits: { enabled: false }, | ||
|
||
xAxis: { | ||
visible: false, | ||
}, | ||
yAxis: { | ||
plotLines: [{ | ||
color: '#D75521', | ||
width: 4, | ||
value: average, | ||
zIndex: 4, | ||
dashStyle: 'dot', | ||
}], | ||
min: 0, | ||
title: { | ||
text: 'Taux de succès %' | ||
}, | ||
}, | ||
tooltip: { | ||
pointFormat: 'Total des subventions : <b>{point.y:.1f} €</b>' | ||
}, | ||
plotOptions: { | ||
series: { dataLabels: { enabled: true } } | ||
}, | ||
series: [ | ||
{ | ||
name: 'Succès sur les montants', | ||
colors: ['#27A658'], | ||
colorByPoint: true, | ||
groupPadding: 0, | ||
data: data.map((item) => ({ | ||
name: item.name, | ||
y: item.ratio, | ||
})), | ||
dataLabels: [{ | ||
align: 'right', | ||
format: '{point.name}' | ||
}], | ||
} | ||
] | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters