generated from idea2app/Lark-Next-Bootstrap-ts
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCharts.tsx
More file actions
38 lines (32 loc) · 1.43 KB
/
Charts.tsx
File metadata and controls
38 lines (32 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { BarSeries, SVGCharts, Title, Tooltip, XAxis, YAxis } from 'echarts-jsx';
import { observer } from 'mobx-react';
import { FC, useContext } from 'react';
import { AgendaModel } from '../../models/Activity/Agenda';
import { I18nContext } from '../../models/Base/Translation';
type ActivityDataProps = Awaited<ReturnType<AgendaModel['getStatistics']>>;
const ActivityCharts: FC<ActivityDataProps> = observer(
({ keynoteSpeechCounts, mentorOrganizationCounts }) => {
const { t } = useContext(I18nContext);
const keynoteSpeechList = Object.entries(keynoteSpeechCounts).sort((a, b) => b[1] - a[1]),
mentorOrganizationList = Object.entries(mentorOrganizationCounts).sort((a, b) => b[1] - a[1]);
return (
<>
<SVGCharts>
<Title>{t('distribution_of_activity_topics_by_heat')}</Title>
<XAxis type="category" data={keynoteSpeechList.map(([key]) => key)} />
<YAxis type="value" />
<BarSeries data={keynoteSpeechList.map(([{}, value]) => value)} />
<Tooltip />
</SVGCharts>
<SVGCharts>
<Title>{t('distribution_of_mentor_organizations_by_topics')}</Title>
<XAxis type="category" data={mentorOrganizationList.map(([key]) => key)} />
<YAxis type="value" />
<BarSeries data={mentorOrganizationList.map(([{}, value]) => value)} />
<Tooltip />
</SVGCharts>
</>
);
},
);
export default ActivityCharts;