PerspectiveExamples

SF Evictions

Map Density chart of lon, lat and state, grouped by lat and lon, filtered to lon is not null, with 2 computed expression columns.

San Francisco eviction notices, from DataSF.

SF Evictions: Map Density chart of lon, lat and state, grouped by lat and lon, filtered to lon is not null, with 2 computed expression columns.

Data

San Francisco eviction notices from the DataSF open data portal, plotted on tile-based scatter and density maps.

Loaded from /data/evictions.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": "evictions",
            "columns_config": {
                "state": {
                    "gradient": "linear-gradient(to right, #000000 0%, #590d4f 24%, #dd6367 52.6%, #ffe894 70.1%, #ffffff 100%)"
                }
            },
            "plugin": "Map Density",
            "plugin_config": {
                "gradient_radius_px": 15,
                "gradient_intensity": 1
            },
            "group_by": [
                "lat",
                "lon"
            ],
            "filter": [
                [
                    "lon",
                    "is not null",
                    null
                ]
            ],
            "expressions": {
                "lat": "var x[2];\nindexof(\"shape\", ' .+?( )', x);\nvar y := substring(\"shape\", x[0], length(\"shape\") - x[1]);\nfloat(y)",
                "lon": "var x[2];\nindexof(\"shape\", ' .+?( )', x);\nvar y := substring(\"shape\", 7, x[1] - 7);\nfloat(y)"
            },
            "columns": [
                "lon",
                "lat",
                "state",
                null
            ],
            "aggregates": {
                "lat": "any",
                "lon": "any"
            }
        }
    },
    "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