idvxlab / vega-lite-linter

Fixing your visualization design written in Vega-Lite based on the answer set programming

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vega-lite-linter

A smart visual designer for automatic diagnosis and improving your design of visualization charts written in Vega-Lite.

Setup

Step 1: install Clingo

Since vega-lite-linter requires Clingo as the solver of Answer Set Programming, you are required to install it first.

For MacOS

brew install clingo

For Linux

apt-get install -y gringo

Using Conda

conda install -c potassco clingo

For other system, please look up to https://potassco.org/clingo/

Step 2: install vega-lite-linter

pip install vega-lite-linter

More instruction about can be found on vega-lite-linter's project website.

Usage

from vega_lite_linter import Lint 

vega_json = {
    "data": {
        "url": "data/cars.json"
    },
    "mark": "bar",
    "encoding": {
        "x": {
            "field": "Horsepower",
            "type": "quantitative"
        },
        "y": {
            "field": "Miles_per_Gallon",
            "type": "quantitative"
        },
        "size": {
            "field": "Cylinders",
            "type": "ordinal"
        }
    }
}

# initialize 
lint = Lint(vega_json)

# show rules that the input vega-lite json violated
violate_rules = lint.lint()

# show fixing recommendation by vega-lite-linter
fix = lint.fix()

Credits

Vega-lite-linter was invented by the iDVx Lab together with AntV.

Based on our technology, AntV and iDVx Lab also developed ChartLinter in Javascript to support visualization charts beyond Vega-Lite.

License

The software is available under the MIT License.

Contact

If you have any question, feel free to open an issue or contact idvx.lab [at] gmail.com.

About

Fixing your visualization design written in Vega-Lite based on the answer set programming

License:MIT License


Languages

Language:Python 62.3%Language:JavaScript 37.7%