bergloman / TsDashboard

Light-weight javascript library for creating time-series dashboards.
MIT License
1 stars 3 forks source link

WARNING: This repository is archived and not actively maintained!

TsDashboard

Light-weight javascript library for creating time-series dashboards. Geared primarily towards wide-screens, works also on tablets, but not specially optimized for phones.

Dependencies:

Basic idea

Create a client-side library that:

Dashboard structure

Dashboard consists of the following hierarchy of objects:

Required interface for driver object

The driver object must provide the following methods:

registerView(view_object)

Optional method.

This way the view injects itself into driver - driver can call certain methodsinto view to set values or force refresh.

onParamChange(name)

Optional method.

This method is called, when the value of any of the parameters change.

preParamChange(name)

Optional method.

This method is called, when the input control (textbox, dropdown) for given parameter receives focus.

getViewDefinition(callback)

Parameter callback must accept single parameter - an object that describes the view. For details see special section below.

getParamValues(name, search, callback)

This method is used to populate dropdowns (parameters type enum) and dynamic search results (parameters type filter). Given parameter name and current search string (valid only for dynamic search) the callback receives the list of matches or allowed values.

getDrawData(options, callback)

This method fetches required data to draw. The options parameter must contain the following fields:

Callback receives err and optionaly result object. Result should conform to the following schema:

{
    "timeseries" : [
        {
            "name" : "some name",
            "values: [
                { "epoch": ..., "val": ... },
                ...
            ]
        },
        ....
    ],
    "dataseries" : [
        {
            "name" : "some name",
            "values: [
                { "name": ..., "val": ... },
                ...
            ]
        },
        ....
    ],
    "scatterseries" : [
        {
            "name" : "some name",
            "values: [
                { "x": ..., "y": ..., "c": "..." },
                ...
            ]
        },
        ....
    ]
}

Configuration structure

Configuration is given in javascript object, which looks like the following JSON:

{
    "title": "......",
    "hide_sidebar": false,
    "sidebar_width": 250,
    "parameters": [
        {
            "name: "......",
            "title": "......",
            "type" "......",
            "default: "......",
            "optional": true/false,
            "min_len_search": 3
        },
        ....
    ],
    "blocks": [
        {
            "title": ".........",
            "panels": [
                {
                    "title": ".........",
                    "widgets": [
                        {
                            "title": ".........",
                            "type": "timeseries",
                            "help": ".........",
                            "timeseries": ["...", ....],
                            "dataseries": ["...", ....],
                            "timepoints": ["...", ....],
                            "options": {
                                "height": 100,
                                ..
                                ..
                            }
                        },
                        ....
                    ]
                },
                .....
                .....
            ]
        }
    ]
}

Parameter options

Widget options

All widget options are optional.

Parameter types

Time-series chart options

Histogram chart options

Scatter-plot chart options

Table options

Temporal graph options

View interface

This section describes view interface that can be called from the driver. A reference to the view instance is passed via registerView method.

getParamValue(name)

Gets the value of the parameter named name.

setParamValue(name, value)

Sets the value of parameter named name to value.