HeatMap.js
926 Bytes
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
39
40
41
import React, { use } from 'react';
import CalendarHeatmap from 'react-calendar-heatmap';
import 'react-calendar-heatmap/dist/styles.css';
/*
TODO: 날짜 범위 지정, 날짜별 검색 추가
*/
/*
solvedBJbyDATE:
solvedBJbyDATE:{
20190304 : [Object]
...
}
*/
const HeatMap = (HMArr) => {
return (
<div>
<CalendarHeatmap
onClick={() => {
console.log(HMArr);
}}
startDate={new Date('2020-01-01')}
endDate={new Date('2020-12-01')}
values={HMArr.HMArr}
classForValue={(value) => {
if (!value) {
return 'color-empty';
}
return `color-github-${value.count}`;
}}
tooltipDataAttrs={(value) => {
return {
'data-tooltip': `${value.date} has count: ${value.count}`,
};
}}
showWeekdayLabels={true}
/>
</div>
);
};
export default HeatMap;