Skip to content

Properties

Jonathan Simmonds edited this page Jan 20, 2021 · 20 revisions

Fields

JSON is used to define the properties of the graph. When any required properties are absent defaults will be provided. When no properties are defined at all, the graph has a viewport that spans the entire dataset, labels on the y axis without units and all user interaction disabled, which may be preferable for some applications.

Linegraphs and Bargraphs

flags

highlight_enabled (boolean) - when set to true, an information panel and visual indicators are displayed as the user moves the cursor over the graph

hide_horizontal_axis (boolean) - when set to true, the x-axis labels will not be shown

hide_vertical_axes (boolean) - when set to true, the y-axis and u-axis labels will not be shown

x_axis

min (integer) - the start of the x_axis viewport, defaults to zero if not set

max (integer) - the end of the x_axis viewport, defaults to the length of the data minus one

markers (array) - annotations that can be placed at points along the graph

y_axis

base (integer) - the base of the number system used on the y_axis, defaults to 10 if not set

min (integer) - the start of the y_axis, defaults to zero if not set

max (integer) - the end of the y_axis, defaults to a calculated value if not set

label_prefix (string) - text to be placed at the start of each label on the y_axis

label_suffix (array) - text to be placed at the end of each label on the y_axis

u_axis

base (integer) - the base of the number system used on the u_axis, defaults to 10 if not set

label_prefix (string) - text to be placed at the start of each label on the u_axis

label_suffix (array) - text to be placed at the end of each label on the u_axis

decimal_places (integer) - the maximum number of decimal places to display on a u_axis label, defaults to 0 if not set

Linegraphs

root

graph_drawing_method (string) - choose from lines, curves or splines

flags

scroll_enabled (boolean) - when set to true, and only a subset of data is being displayed, the user can scroll the graph horizontally

zoom_enabled (boolean) - when set to true, users can define their own viewport that displays a subset of data

graph_gradient_colour (boolean) - when set to true, the gradient under the graph will fade to another colour, rather than transparent

graph_gradient_horizontal (boolean) - when set to true, the gradient under the graph will go from left to right rather than top to bottom

show_data_points (boolean) - when set to true, each data point will be shown on the graph

Bargraphs

flags

draw_lines_of_best_fit (boolean) - when set to true, a line of best fit will be plotted for each dataset

x_axis

projected_index (integer) - denotes the start of projected data, all data beyond this zero based index will be treated differently

u_axis

offset_index (integer) - a zero based index which denotes where the u_axis data begins in relation to the x_axis

Notes

About markers

Markers are defined as arrays. Each member of the array is in turn another array, consisting of two elements. The first element is an integer defining the zero based index on the x_axis where the marker will be positioned and the second element is a string, the annotation text itself.

About label suffixes

Label suffixes are defined as arrays for flexibility. Each member of the array is in turn another array, consisting of two elements. The first element is an integer that defines the exclusive upper limit that the suffix should be applied to and the second element is a string, the suffix itself.

If the suffix is to be applied indiscriminately to each label then, in the case of things like percentages:

[[0, "%"]

Otherwise, if different suffixes should be applied based on the value of the label on the y_axis, like bytes per second:

[[1000, " B/s"], [1000000, " kB/s"], [1000000000, " mB/s"]

About projected data

Projected data is treated differently to the rest of the data, the colour of the bars will be 50% transparent and the lines of best fit will become dashed.

Examples

Linegraph

{
    "graph_drawing_method": "lines",
    "flags": {
        "highlight_enabled": true,
        "scroll_enabled": true,
        "zoom_enabled": true,
        "graph_gradient_colour": true,
        "graph_gradient_horizontal": true,
        "hide_horizontal_axis": true,
        "hide_vertical_axes": true,
        "show_data_points": true
    },
    "x_axis": {
        "min": 7,
        "max": 14,
        "markers": [[2,"first line of text"],[2,"second line of text"],[4,"insert text here"]]
    },
    "y_axis": {
        "base": 10,
        "min": 10,
        "max": 40,
        "label_prefix": "",
        "label_suffix": [[0, "°C"]]
    },
    "u_axis": {
        "base": 2,
        "label_prefix": "",
        "label_suffix": [[1000, " B/s"], [1000000, " kB/s"], [1000000000, " mB/s"]],
        "decimal_places": 3
    }
}

Bargraph

{
    "flags": {
        "highlight_enabled": true,
        "hide_horizontal_axis": true,
        "hide_vertical_axes": true,
        "draw_lines_of_best_fit": true
    },
    "x_axis": {
        "min": 7,
        "max": 14,
        "markers": [[2,"first line of text"],[2,"second line of text"],[4,"insert text here"]],
        "projected_index": 4
    },
    "y_axis": {
        "base": 10,
        "min": 10,
        "max": 40,
        "label_prefix": "",
        "label_suffix": [[0, "°C"]]
    },
    "u_axis": {
        "base": 2,
        "label_prefix": "",
        "label_suffix": [[1000, " B/s"], [1000000, " kB/s"], [1000000000, " mB/s"]],
        "decimal_places": 3,
        "offset_index": 1
    }
}