Skip to main content Link Menu Expand (external link) Document Search Copy Copied

addTemplates()

Add a new subDomain template

addTemplates(Template[] | Template): void;

This method have to be called before you call paint().

See the SubDomain Templates for more informations about the Template.


Usage

Example

Injecting a custom quarter subDomain template.

// Create a quarter Template
// Content skipped here, see the Templates section for full template example
const quarterTemplate = () => {};

const cal = new CalHeatmap();
// Add the template
cal.addTemplates(quarterTemplate);

cal.paint({
  range: 2,
  domain: { type: 'year', gutter: 10, label: { textAlign: 'start' } },
  subDomain: {
    type: 'quarter',
    width: 60,
    height: 15,
    label: '[Quarter] Q',
    radius: 3,
  },
});