2020-08-23 12:28:21 +09:00
|
|
|
import * as CalHeatMap from 'cal-heatmap';
|
2020-06-06 18:01:56 +09:00
|
|
|
import { subMonths } from 'date-fns';
|
2020-05-24 19:03:15 +09:00
|
|
|
|
|
|
|
if (document.getElementById('cal-heatmap')) {
|
|
|
|
new CalHeatMap().init({
|
|
|
|
itemSelector: '#cal-heatmap',
|
|
|
|
domain: 'month',
|
|
|
|
subDomain: 'day',
|
|
|
|
domainLabelFormat: '%Y/%m',
|
|
|
|
weekStartOnMonday: false,
|
2020-06-06 16:14:11 +09:00
|
|
|
start: subMonths(new Date(), 9),
|
2020-05-24 19:03:15 +09:00
|
|
|
range: 10,
|
2020-06-06 19:12:00 +09:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
2020-06-06 16:14:11 +09:00
|
|
|
data: JSON.parse(document.getElementById('count-by-day')!.textContent as string),
|
2020-06-06 18:01:56 +09:00
|
|
|
legend: [1, 2, 3, 4],
|
2020-05-24 19:03:15 +09:00
|
|
|
});
|
|
|
|
}
|