Skip to content

Commit

Permalink
feat: Integrate API into area swiped pie chart
Browse files Browse the repository at this point in the history
  • Loading branch information
bshankar committed Sep 20, 2024
1 parent 74d0888 commit 668b58c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Chart from 'chart.js/auto';
import { CHART_COLOURS } from '../../config';
import messages from './messages';

export const SwipesByProjectType = () => {
export const SwipesByProjectType = ({ areaSwipedByProjectType = [] }) => {
const chartRef = useRef(null);
const chartInstance = useRef(null);

Expand All @@ -21,14 +21,14 @@ export const SwipesByProjectType = () => {
chartInstance.current = new Chart(context, {
type: 'doughnut',
data: {
labels: ['Find', 'Validate'],
labels: ['Find', 'Compare', 'Validate'],
datasets: [
{
data: [75, 25],
data: areaSwipedByProjectType.map(c => c.totalArea),
backgroundColor: [
CHART_COLOURS.orange, // Orange for Find
CHART_COLOURS.green, // Green for Validate
CHART_COLOURS.blue, // Blue for Compare
CHART_COLOURS.green, // Green for Validate
],
borderColor: '#fff',
borderWidth: 2,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/partnersMapswipeStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const PartnersMapswipeStats = () => {
</div>

<div className="mt3 flex items-center justify-between">
<SwipesByProjectType />
<SwipesByProjectType areaSwipedByProjectType={data?.areaSwipedByProjectType} />
<SwipesByOrganisation />
</div>

Expand Down

0 comments on commit 668b58c

Please sign in to comment.