Skip to content

IPresetData

Type interface

Settings for supplying preset data to be used in place of default template data.

Sources

IPresetData is an interface: it describes a shape of data and is not imported on its own.

Properties

data

Type Array <IChartData>

Actual preset data.

Your dataset as an array of name: value objects

templatePropertyMap

Type Map <string, string>

Mapping of the actual preset data to standard template fields.

To use your data the Editor needs to know what fields in your dataset correspond to standard template fields.

For example, in the code below the suppiled dataset has cat and val fields and the typical serial chart template has category and value (or value1, value2, etc.) fields.

So, we supply a map mapping category to cat, and value and value1 to val.

presetData: {
  data: [
    { cat: 'c1', val: 10 },
    { cat: 'c2', val: 20 },
    { cat: 'c3', val: 40 },
    { cat: 'c4', val: 18 }
  ],
  templatePropertyMap: new Map([
    ['category', 'cat'],
    ['value', 'val'],
    ['value1', 'val']
  ])
}