Use the template manager for all template related interactions with the API

With JavaScript you can create a function for applying a template. All you need is a template file, insert by the user, and the grid cell where the template should to be applied. Downloading a template file is possible from the save template dialog in trueChart.

example

JavaScript implementation for applying a template

const applyTemplate = async (templateFile, cell) => {
    const dataMap = await trueChartInstance.TemplateManager.generateDataMap(template);
    // if you like to edit the data mapping, here is the place to go
    return trueChartInstance.TemplateManager.applyTemplate(template)
}

Hierarchy

  • ITemplateManager

Index

Methods

applyTemplate

  • applies a template to the given cell

    throws

    {IInvalidParameterError}

    Parameters

    Returns Promise<void>

generateDataMap

  • generates a data map from the template and returns that data map

    Parameters

    Returns Promise<IDataMap>

readFromFile

  • readFromFile(file: File): Promise<TTemplate>
  • reads a template from a file and returns that template

    throws

    FileNotReadableError

    Parameters

    • file: File

    Returns Promise<TTemplate>