Skip to content

Custom Templates

cvasseng edited this page Mar 7, 2018 · 6 revisions

Custom templates can be added by calling the highed.templates.add(type, definition) function.

The type can be either of the following:

  • line
  • area
  • column
  • bar
  • scatterandbubble
  • pie
  • polar
  • stock
  • more
  • combinations

The definition is an object as such:

{
    title: 'Pretty title',
    urlImg: 'http://example.com/mypreview.png',
    tooltipText: 'Showed on hover in the info panel',
    config: {
        //Set of highcharts properties
        title: {
           text: 'My template'
        }
    }
}

Adding Custom Template Types

Custom chart types can also be added, which will appear in the category list in the template selector UI. This can be done by calling highed.templates.addType(typ, title), where type is a string containing the type id, and title is the title as it should appear in the category list. After adding a template type, a custom template can be added to it by calling highed.templates.add with the new type name as the first argument.

Batch Installing

Multiple templates can be installed at the same time by using the highed.installMultipleTemplates function:

highed.templates.addMultiple([
    {type: 'line', template: {title: 'My Line Template', config: {}}},
    ... 
]);