PerspectiveExamples

Thermometer — Data grid with 1 group and 3 columns. 2 columns use bars and 1 column uses gradient conditional highlighting.

Data grid of Profit (-), Profit and Profit (+), grouped by State, with 2 computed expression columns.

Thermometer — Data grid with 1 group and 3 columns. 2 columns use bars and 1 column uses gradient conditional highlighting.: Data grid of Profit (-), Profit and Profit (+), grouped by State, with 2 computed expression columns.

Data

Programmatic variations on the Superstore retail sales dataset, showing the flexibility of Perspective's configuration: the same table re-queried as data grids, pivot tables and charts by changing only the viewer's JSON config.

Loaded from /data/superstore.lz4.arrow as arrow into the perspective-server engine.

Configuration

This example is a saved <perspective-viewer> workspace. Pass this JSON to viewer.restoreWorkspace() to reproduce it over the same table:

{
    "layout": {
        "type": "tab-layout",
        "tabs": [
            "p0"
        ],
        "selected": 0
    },
    "panels": {
        "p0": {
            "table": "",
            "title": "Thermometer",
            "group_by": [
                "State"
            ],
            "columns": [
                "Profit (-)",
                "Profit",
                "Profit (+)"
            ],
            "columns_config": {
                "Profit (-)": {
                    "fg_mode": "bar",
                    "fg_gradient": 10000
                },
                "Profit": {
                    "bg_mode": "gradient",
                    "bg_gradient": 10000
                },
                "Profit (+)": {
                    "fg_mode": "bar",
                    "fg_gradient": 10000
                }
            },
            "expressions": {
                "Profit (-)": "if(\"Profit\"<0){\"Profit\"}else{0}",
                "Profit (+)": "if(\"Profit\">0){\"Profit\"}else{0}"
            },
            "theme": null
        }
    },
    "active": "p0"
}

About Perspective

Perspective is an open-source, WebAssembly-powered data grid, pivot table and charting component for large, real-time and streaming datasets — in the browser, Python, Jupyter, Node.js and Rust.

Documentation