highcharts / highcharts-editor

https://www.highcharts.com/products/highcharts-editor
Other
250 stars 96 forks source link

highed.installTemplate and highed.installMultipleTemplates are undefined #162

Closed mikemccaughan closed 6 years ago

mikemccaughan commented 6 years ago

Expected behaviour

To add a template, I should call highed.installTemplate(type, definition) in the following manner:

highed.installTemplate('custom', {
      title: 'My company template',
      tooltipText: 'Company template: requires no particular data',
      config: {
          'chart--title': 'Company Chart'
      }
});

Similar expectation for highed.installMultipleTemplates().

Actual behaviour

Calling the function like above results in error:

highed.installTemplate is not a function.

Instead, at least according to the code, one should call:

highed.templates.add('custom', {
      title: 'My company template',
      tooltipText: 'Company template: requires no particular data',
      config: {
          'chart--title': 'Company Chart'
      }
});

And this indeed works. For installMultipleTemplates, addMultiple works.

Reproduction steps

Include, for example, highcharts-editor.complete.js in an HTML page.

Call the code shown in the Expected section.

Editor version

v0.2.1-rc2

Affected browser(s)

Tested in Chrome v64.0.3282.186 (Official Build) (64-bit), but I expect it happens in all browsers

cvasseng commented 6 years ago

Hi, thanks for reporting.

The interface was streamlined to be the same as the other collection managers in version 0.2.0-rc1 in December last year.

The change to highed.templates.* was mentioned in the changelog for 0.2.0-rc1, but the docs where not updated accordingly.

The docs have been updated now.