UNPKG

cal-heatmap

Version:

Cal-Heatmap is a javascript module to create calendar heatmap to visualize time series data

27 lines (23 loc) 688 B
import type { Template, DomainType } from '../index'; const yearTemplate: Template = (DateHelper) => { const ALLOWED_DOMAIN_TYPE: DomainType[] = []; return { name: 'year', allowedDomainType: ALLOWED_DOMAIN_TYPE, rowsCount: () => 1, columnsCount: () => 1, mapping: (startTimestamp, endTimestamp) => // eslint-disable-next-line implicit-arrow-linebreak DateHelper.intervals( 'year', startTimestamp, DateHelper.date(endTimestamp), ).map((ts, index) => ({ t: ts, x: index, y: 0, })), extractUnit: (ts) => DateHelper.date(ts).startOf('year').valueOf(), }; }; export default yearTemplate;