A smart visual designer for automatic diagnosis and improving your design of visualization charts written in Vega-Lite.
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/
pip install vega-lite-linter
More instruction about can be found on vega-lite-linter's project website.
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()
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.
The software is available under the MIT License.
If you have any question, feel free to open an issue or contact idvx.lab [at] gmail.com.