Skip to content

SpeedChartIndicator JSON

roosit edited this page Oct 16, 2026 · 1 revision

SpeedChartIndicator JSON

Up | Code | Русский

Purpose

This page describes the persisted format of the speedChart indicator ("Speed Chart") in a project, a Mixel, and templates. For the user guide to hand-written .vttp, see Speed Chart JSON.

Two save modes

The indicator is saved in two modes:

  • toJSON(false) — the real Mixel state: contains the selected source/sensor, the current property values, and the size and position of the layer.
  • toJSON(true) — the template state: contains only the values that can be carried between projects. For Distance, the source and sensor are not written and the object stays empty {}; when the indicator is added from a template, the runtime picks the sensor automatically.

Common indicator wrapper

The layer identifier is built from the plugin uid and the indicator name:

{
  "name": "com.velitask.plagin.official.speedChart",
  "data": {
    "properties": {}
  }
}

Stable parts:

Part Value
plugin uid com.velitask.plagin.official
indicator name speedChart

Real mixel state

In a real Mixel, the runtime stores the layer geometry next to properties: size, position, and the binding to the parent. The exact shape of these State fields depends on the current runtime, so they are shown in abbreviated form.

{
  "name": "com.velitask.plagin.official.speedChart",
  "data": {
    "size": { "...": "layer size state" },
    "positionInParent": { "...": "layer position state" },
    "properties": {
      "Distance": {
        "sourceId": { "value": 1 },
        "sensorId": { "value": 3 }
      },
      "geoZoom": { "value": 14 },
      "SpeedScale": { "value": 1 },
      "line": {
        "lineColor": { "r": 255, "g": 255, "b": 255, "a": 255 },
        "thickness": { "value": 1 },
        "style": { "value": 0 },
        "dashPattern": { "value": "" }
      },
      "fillColorLow": { "r": 0, "g": 200, "b": 0, "a": 60 },
      "fillColorHigh": { "r": 200, "g": 0, "b": 0, "a": 60 },
      "avgColor": { "r": 255, "g": 255, "b": 0, "a": 180 }
    }
  }
}

The values of sourceId and sensorId are identifiers from a specific project.

Template state

A template uses maket, and Distance stays empty. Integer properties whose value has not been changed are written as {}: the state is not set, and when reading, the default value from the code is used (see the table below). This is the real toJSON(true) output of a freshly created indicator.

{
  "name": "com.velitask.plagin.official.speedChart",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "Distance": {},
      "geoZoom": {},
      "SpeedScale": {},
      "line": {
        "lineColor": { "r": 255, "g": 255, "b": 255, "a": 255 },
        "thickness": {},
        "style": { "value": 0 },
        "dashPattern": { "value": "" }
      },
      "fillColorLow": { "r": 0, "g": 200, "b": 0, "a": 60 },
      "fillColorHigh": { "r": 200, "g": 0, "b": 0, "a": 60 },
      "avgColor": { "r": 255, "g": 255, "b": 0, "a": 180 }
    }
  }
}

The indicator declares no figures.

Properties

The row order matches defineProperties().

JSON key Java property SDK type Meaning for the user Default
Distance mDistance DistanceSensorProperty Distance and speed sensor ("Distance"). Empty selection: {} in the template.
geoZoom mGeoZoom GeoZoomProperty Horizontal scale ("Map zoom"). 14, range 8..19.
SpeedScale mSpeedScale IntegerProperty Vertical speed scale ("Speed scale"). 1, range 1..20.
line mLine LineProperty Chart line ("Line"). White, thickness 1 (range 0..50), style 0 (solid).
fillColorLow mFillColorLow ColorProperty Fill at low speed ("Fill (min)"). 0, 200, 0, 60.
fillColorHigh mFillColorHigh ColorProperty Fill at the maximum speed of the window ("Fill (max)"). 200, 0, 0, 60.
avgColor mAvgColor ColorProperty Average speed line ("Average speed color"). 255, 255, 0, 180.

State formats:

  • Color — a flat object r, g, b, a (0..255); here the alpha channel matters for all three colors, and fillColorLow and fillColorHigh are blended including alpha.
  • Integer — { "value": number }.
  • line — a composite property of the child lineColor, thickness, style, dashPattern; style stores the LineStyle index (0 solid … 7 custom). The indicator uses only the color and thickness.
  • The neon skin ("Neon green") sets line.lineColor = 0, 255, 100, line.thickness = 4, fillColorLow = 0, 100, 0, 40, fillColorHigh = 0, 255, 0, 80, avgColor = 0, 200, 200, 150. Distance, geoZoom, and SpeedScale are not part of skins.

Examples

A large scale, a vertically stretched scale, and neon colors:

{
  "name": "com.velitask.plagin.official.speedChart",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "Distance": {},
      "geoZoom": { "value": 13 },
      "SpeedScale": { "value": 2 },
      "line": {
        "lineColor": { "r": 0, "g": 255, "b": 100, "a": 255 },
        "thickness": { "value": 4 },
        "style": { "value": 0 },
        "dashPattern": { "value": "" }
      },
      "fillColorLow": { "r": 0, "g": 100, "b": 0, "a": 40 },
      "fillColorHigh": { "r": 0, "g": 255, "b": 0, "a": 80 },
      "avgColor": { "r": 0, "g": 200, "b": 200, "a": 150 }
    }
  }
}

Compatibility

  • VelitaskPlagin.getUID() (com.velitask.plagin.official) must not be changed without migrating saved projects.
  • Indicator.getName() (speedChart) must not be changed without a migration.
  • Property names (Distance, geoZoom, SpeedScale, line, fillColorLow, fillColorHigh, avgColor) must not be renamed without a migration; case matters (SpeedScale, Distance with a capital letter).
  • The order of properties mostly affects the UI, while loading the persisted state goes by name; renaming is more dangerous than reordering.

Clone this wiki locally