API Documentation
Template

Template

In grafiki, a Template is a pre-designed layout that helps you create dashboards quickly and efficiently. It consists of a collection of items, each with its own configuration and layout.

Structure of a Template

To create a Template in grafiki, you'll need to provide the following attributes. Please refer to the table below for a detailed breakdown:

AttributeTypeRequiredDescription
uuidstringRequiredA universally unique identifier for the Template
itemsItem[]RequiredAn array of Item objects that make up the Template
tagsstring[]OptionalAn array of strings used to categorize or filter the Template
namestringRequiredA human-readable name for the Template
temporarybooleanOptionalA boolean indicating whether the Template is temporary

Item Attributes

Each Item object should contain the following:

AttributeTypeRequiredDescription
uuidstringRequiredA universally unique identifier for the Item
namestringRequiredA human-readable name for the Item
typeItemTypeRequiredThe type of the Item
layoutPlotly.LayoutOptionalLayout configuration for the Item
configPlotly.ConfigOptionalConfig configuration for the Item
tracesTraceAttributesOptionalTraces configuration for the Item, referencing attributes from a Dataset
groupsItemGroupsOptionalGroups configuration for the Item
filterFilterInfoOptionalFilter configuration for the Item
transformsTransformsOptionalTransforms configuration for the Item
hnumberRequiredHeight of the Item
wnumberRequiredWidth of the Item
xnumberRequiredX-coordinate of the Item
ynumberOptionalY-coordinate of the Item

Trace Attributes

Each Trace object should contain the following:

AttributeTypeRequiredDescription
valuestringRequiredThe name of the attribute from a Dataset
role"data"RequiredThe role of the attribute in the Item

Example Template

Here's a simple example of a Template in JSON format:

{
  "uuid": "template-uuid",
  "items": [
    {
      "name": "New box item",
      "type": "box",
      "h": 14,
      "w": 6,
      "x": 0,
      "y": 0,
      "traces": {
        "x": {
          "value": "alive",
          "role": "data"
        },
        "y": {
          "value": "age",
          "role": "data"
        }
      },
      "layout": {
        "xaxis": {
          "type": "-"
        }
      }
    },
    {
      "name": "New scatter item",
      "type": "scatter",
      "h": 14,
      "w": 6,
      "x": 6,
      "y": 0,
      "traces": {
        "x": {
          "value": "age",
          "role": "data"
        },
        "y": {
          "value": "fare",
          "role": "data"
        }
      }
    }
  ],
  "tags": ["example", "demo"],
  "name": "My First Template"
}

This example Template has a unique uuid, an array of two items and optional tags and name attributes. Each Item has its own configuration, including layout and traces settings.