Skip to content

PGD File Format

JSON Format

PGD allows loading PrestoPlot Graph Description files in JSON format. These files should be encoded using the UTF-8 encoding, which is the default for JSON, if any non ASCII charaters are to be used. The file contents can be checked on-line JSON Validator.

A PGD file is a list of graph configurations to create and configure new graphs and save them as images or PMD/PGR files.

In a nutshell

  • Format: JSON-based chart description file.
  • Purpose: Easily describe graphs.
  • Usage:
    • Integration with third party software
    • Create graph description programmatically (by third party)
    • Simplify automation

Here is an example of a minimalist PGD file :

{
    "version" : 1,
    "graphs"  : [{
        "datasets" : ["DEFICIT","IBAT","MODEBM","VBAT"],
        "settings" : {
            "general" : {
                "axes"        : "spread"
            }
        }
    }]
}

This file will produce a graph with the four datasets DEFICIT, IBAT, MODEBM and VBAT, with spread axes.

Format description

The current format is described below.

{
  "version": 1,            // Version is 1
  "variables": {
   "flight": "VA222",      // Set the variable '$flight' to the value VA222
   "color": "green",       // Set the variable '$color' to the value green
   "datasets": "VBAT IBAT" // Set the list of datasets (no commas for a list in a variable)
  },
  "graphs": [              // List of graphs to create
  {
   "graphname": "MyGraph",     // Name for the graph window
   "exports": [{               // List of image/graph/model exports on finished graph
    "filename": "IMG/img.png", // Name of the file can use sub directories (PNG, GIF, PS, EPS, EMF, PGRB, PGR, PMDB, PMD)
    "size": "1800x450"         // Size of the image file produced (default is maximized or configured size)
   }],
   "datasets": "$datasets",        // List of datasets to add to the graph
   "settings": {                   // List of optional settings
    "general": {                   // General graph settings
     "title": "My flight $flight", // Title for the graph
     "titlefont": "Tahoma 16",     // Font for the title (can add bold,italic,underline,overstrike)
     "titlecolor": "orange",       // Color for the title
     "axes": "spread",             // One of (spread,overlayed)
     "background": "beige",        // Color of the plot area background
     "borderbackground": "$color", // Color of the graph border
     "synchronise": {              // Time axis synchronisation
      "mode": "locked"             // One of (none,this axis,all axes,locked)
      "dataset": "VBAT",           // Master time axis
      "offsets": [{                // Axis offsets (locked ONLY)
        "dataset": "IBAT",         // Dataset time axis
        "offset": "-12:00:00.00",  // Offset "[+-][DD] [HH:MM:SS.mmm]" (minus 12 hours)
       },{
        "dataset": "MODEBM",       // Dataset time axis
        "offset": "1 00:00:01.00", // Offset "[+-][DD] [HH:MM:SS.mmm]" (plus 1 day and one second)
       }]
     },
     "legend": {                   // Configuration of the legend
      "position": "right",         // Side of the graph to position (left,right,top,bottom)
      "anchor": "north",           // Position on the side (north,south,east,west)
      "font": "Tahoma 10 bold",    // Font for the legend text (can add bold,italic,underline,overstrike)
      "color": "black"             // Color of the legend text
     },
     "grid": {                     // Configuration of the grid
      "xdataset": "IBAT",          // Element to use for the X axis grid lines (none for no lines)
      "ydataset": "VBAT",          // Element to use for the Y axis grid lines (none for no lines)
      "linecolor": "#34e22a",      // Color of the grid lines
      "linestyle": "solid",        // One of (solid,dotted,dashed)
      "linewidth": "2"             // Width of the grid lines (1,2,3)
      "minorlinecolor": "#34e22a", // Color of the minor grid lines
      "minorlinestyle": "dotted",  // One of (solid,dotted,dashed)
      "minorlinewidth": "1"        // Width of the minor grid lines (1,2,3)
     }
    },
    "elements": [{             // Configuration of Graph elements
     "dataset": "VBAT",        // Element to configure
     "label": "VBAT (V)",      // Label to display in the legend
     "linestyle": "solid",     // One of (solid,dotted,dashed)
     "linecolor": "green",     // Color of the joining lines
     "linewidth": "2",         // Width of the joining lines (0,1,2,3,4)
     "symbol": "arrow",        // One of (square,circle,diamond,plus,cross,splus,scross,triangle,arrow,none)
     "symbolfill": "#90ee90",  // Color of the symbol interior
     "symboloutline": "green", // Color of the symbol outline
     "symbolsize": "large",    // One of (small(8),medium(12),large(16) or number 4-100)
     "segment": "linear",      // One of (linear,step)
     "fillarea": "lightgreen"  // Fill the area above and/or below the element using the color or none for transparent.
     "fillbase": "top"         // One of (top,bottom,min,minaxis,max,maxaxis or a numerical value)
    }],
    "events": [{                // Configuration of Event markers
     "dataset": "VBAT",         // Element to add markers to
     "position": "top",         // One of (top,bottom)
     "events": "MODEBM",        // Labelled dataset to use for events
     "mode": "all",             // Event mode (transition,all)
     "color": "blue",           // Label and Line color
     "titlecolor": "blue",      // Label color
     "titlefont": "Tahoma 12",  // Label font (can add bold,italic,underline,overstrike)
     "titleorient": "vertical", // Label orientation (horizontal,vertical)
     "titleside": "left",       // Label, side of the line (left,right) only for vertical
     "titledate": "show",       // Display the event date (show,hide)
     "linestyle": "solid",      // One of (solid,dotted,dashed)
     "linecolor": "blue",       // Line color
     "linewidth": "3",          // Width of the event lines (1,2,3,4)
     "linestacking": "above",   // Draw lines relative to the elements (above,below)
     "showonly": ["I LIMIT", "V LIMIT"] // Show ONLY listed events (can contain * and ?)
    }],
    "pens": [{                        // Configuration of graph pens
     "dataset": "VBAT",               // Dataset to add the pen to
     "values": "Q_VBAT",              // Values dataset to be used as weights
     "pen": [{
      "name": "MyPen",                // Name of this pen
      "min": "30",                    // Minimum raw value to apply for pen
      "max": "36",                    // Maximum raw value to apply for pen
      "linestyle": "solid",           // One of (solid,dotted,dashed)
      "linecolor": "#FF0000/#00FF00", // Color for the line, for gradient use from/to colors
      "linewidth": "0",               // Width of the pen lines (0,1,2,3,4)
      "symbol": "circle",             // One of (square,circle,diamond,plus,cross,splus,scross,triangle,arrow,none)
      "symbolfill": "gradient",       // Color of the symbol interior ('gradient' or a color)
      "symboloutline": "#000000",     // Color of the symbol outline ('gradient' or a color)
      "symbolsize": "small/large"     // One of (small(8),medium(12),large(16) or number 4-100), min/max for gradient
     }]
    }],
    "x-axes": [{                          // Configure any X axes
     "dataset": "VBAT",                   // Id of the axis to configure
     "format": "ISO8601",                 // One of the Date formats (see Date Formats, default AUTO)
     "custom": "%B-%d:%I:%M %p:3",        // A custom format description (see Custom date formating)
     "min": "2003/05/28 10:00:00.000000", // Minimum limit of the date axes (see format)
     "max": "2003/05/28 22:00:00.000000", // Maximum limit of the date axes (see format)
     "stepsize": "4",                     // Interval between major ticks
     "subdivisions": "3",                 // Number of minor axis ticks (max 50)
     "axisfont": "Courier 16 bold",       // Font for the tick labels (can add bold,italic,underline,overstrike)
     "axiscolor": "red",                  // Color of the axis and tick marks
     "axisscale": "linear",               // One of (linear,logarithmic)
     "labelfont": "{Script MT} 18",       // Font for the label (can add bold,italic,underline,overstrike)
     "label": "Date",                     // Label text
     "labelcolor": "blue",                // Color of the label
     "tickorient": "horizontal",          // One of (horizontal,vertical)
     "order": "decreasing",               // One of (increasing,decreasing)
     "hidden": "true",                    // Boolean true is hidden
     "zoomlock": "true",                  // Boolean true is zoom locked
     "moveaxis": "closest"                // One of (closest,furthest)
    }],
    "y-axes": [{                    // Configure any Y axes
     "dataset": "MODEBM",           // Id of the axis to configure
     "stepsize": "4",               // Interval between major ticks
     "subdivisions": "3",           // Number of minor axis ticks (max 50)
     "axisfont": "Courier 16 bold", // Font for the tick labels (can add bold,italic,underline,overstrike)
     "axiscolor": "red",            // Color for the axis and tick marks
     "axisscale": "logarithmic",    // One of (linear,logarithmic)
     "labelfont": "{Script MT} 18", // Font for the label (can add bold,italic,underline,overstrike)
     "label": "AMPS",               // Label text
     "labelcolor": "blue",          // Color of the label
     "labelvalues": "numbers",      // One of (labels,numbers) ONLY for LABELS
     "tickorient": "horizontal",    // One of (horizontal,vertical)
     "order": "increasing",         // One of (increasing,decreasing)
     "hidden": "true",              // Boolean true is hidden
     "zoomlock": "true",            // Boolean true is zoom locked
     "moveaxis": "closest",         // One of (closest,furthest)
     "min": "0",                    // Minimum limit of the axis
     "max": "20"                    // Maximum limit of the axis
    }],
    "markers": [{                     // Configuration of graph markers (see Configure Markers)
     "dataset": "VBAT",               // Dataset to add the marker to
     "markers": [{
      "type": "vertical",             // One of (vertical,horizontal,text,point,2point)
      "label": "VBAT (%VX1)",         // Text to display (see Marker Label)
      "graphlock": "none",            // Marker is locked to the graph (none,graph,left,right,top,bottom,topleft,topright,bottomleft,bottomright)
      "labelfont": "Tahoma 8",        // Font for the label (can add bold,italic,underline,overstrike)
      "labelcolor": "blue",           // Color of the label
      "labeljustify": "center",       // One of (center,right,left)
      "hidden": "false",              // Boolean true is hidden
      "datalock": "lock",             // Marker is locked to the data (lock,nolock)
      "value": "2003/05/28 11:00:00", // Position of the marker
      "xlabelposition": "2003/05/28 11:00:00",  // X Position of the marker label or % (0%-100%) from left of the graph (if variable)
      "ylabelposition": "25%",        // Y Position of the marker label or % (0%-100%) from bottom of the graph (if variable)
      "labelside": "right",           // One of (left,right,above,below)
      "labelorient": "vertical",      // One of (vertical,horizontal)
      "precision": "2",               // One of (0,1,2,3,4,5,6,7,8)
      "format": "f",                  // One of (f,e)
      "linestyle": "solid",           // One of (solid,dotted,dashed)
      "linecolor": "#FF0000",         // Color for the line
      "linewidth": "2",               // Width of the line(s) (1,2,3,4)
      "points": [{                    // Pointer information for Point markers
        "index": "11",                  // Index in the dataset to point to
        "value": "2003/05/28 11:00:00", // Closest date to point to
        "linestyle": "solid",           // One of (solid,dotted,dashed)
        "linecolor": "#FF0000",         // Color for the line
        "linewidth": "3",               // Width of the line (1,2,3,4)
        "order": "before",              // One of (before,behind) position to the element line/symbols
      }]
     }]
    }]
   }
  }]
}

All elements are optional except the 'datasets' and 'dataset' items.

The INI file option PGD::Config(LogWarnings) can be set to true to activate warning messages in the log file if the PGD does not display the graph as you like.

Custom Date Formatting

Calendar

The x-axes format option for ISO8601, EUR and USA dates can be extended with custom formatting options. The syntax is Date;Time;Precision, all 3 must be present e.g. %B-%d;%I:%M %p;3 where:

Date - AUTO - The default format for this format. - NONE - No value displayed - %Y - Full 4 digit year (2024) - %y - 2 digit year (24) - %m - 2 digit month (11) - %B - Full textual month name (November) - %b - 3 letter month name (Nov) - %d - 2 digit date (21)

Time - AUTO - The default format for this format. - NONE - No value displayed - %H - 2 digit 24 hour (18) - %I - 2 digit 12 hour (06) - %M - 2 digit minute (35) - %S - 2 digit second (24) - %p - AM/PM indicator (PM)

Precision An integer value from 0 to 12 inclusive, for the fractions of seconds.


Seconds

The x-axes format option for SECONDS dates can be extended with custom formatting options. The syntax is Time;Precision, both must be present e.g. TIME;6 where:

Time - AUTO - The default format for this format. - NONE - No value displayed - TIME - [DAYS] HH:MM:SS

Precision An integer value from 0 to 12 inclusive, for the fractions of seconds. e.g.