Skip to content

Commit

Permalink
Merge branch 'master' into pr/PallHaraldsson/328
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff committed Mar 11, 2021
2 parents f8e3bc5 + b138b25 commit 7068dc7
Show file tree
Hide file tree
Showing 25 changed files with 365 additions and 297 deletions.
78 changes: 39 additions & 39 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -1,113 +1,113 @@
[[vegalite_app]]
arch = "i686"
git-tree-sha1 = "f0938a68e4bf6f7269b3fddbe423bf0df8be9412"
git-tree-sha1 = "cc1b2fe24b9b19e61f02b978de6fe04bfe599fa5"
libc = "glibc"
os = "linux"

[[vegalite_app.download]]
sha256 = "3edec93ae7d847dc8b47ff0ace2375bec352fbf5ed156ace5e0c6dab91934754"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-i686-linux-gnu.tar.gz"
sha256 = "89cb4b0893145b62ccf8ffa1b1491c9f43eb636e262a2bef450093542fde1fa7"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-i686-linux-gnu.tar.gz"
[[vegalite_app]]
arch = "x86_64"
git-tree-sha1 = "d4eb87e3d20fd297976fb1bc0bc3a1fe94268bb1"
git-tree-sha1 = "ead9a31a77872dcae4f9a0e110ddb2281812b6b0"
libc = "glibc"
os = "linux"

[[vegalite_app.download]]
sha256 = "103a0e859888770770f315054f77a29c6ecc8d0a1b2f81f15f033a224d76cc75"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-x86_64-linux-gnu.tar.gz"
sha256 = "569c0a6a63132c44093386c0419ba554e1b461a564b9ec3b1867a2de07628a47"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-x86_64-linux-gnu.tar.gz"
[[vegalite_app]]
arch = "aarch64"
git-tree-sha1 = "5bd3bb2e82818e10e32a3dcd456539866d4245d5"
git-tree-sha1 = "748deb0d5a967ec1d6d81fd06b5da6aea6f69248"
libc = "glibc"
os = "linux"

[[vegalite_app.download]]
sha256 = "f0f3156bde5454c1c0949b4ff24833a56c75ab840074ce1e11eb96cff7cf9850"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-aarch64-linux-gnu.tar.gz"
sha256 = "5b503762ccb2ec3111cb739dfc9e88ca3ef222bc1bd7a36a92ece0900b16291c"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-aarch64-linux-gnu.tar.gz"
[[vegalite_app]]
arch = "armv7l"
git-tree-sha1 = "6ed56a7b788fcd733ed1f4e7276c30c9c3d9028e"
git-tree-sha1 = "153425b21b526eb1a68ae978c4c94d8d18e34384"
libc = "glibc"
os = "linux"

[[vegalite_app.download]]
sha256 = "59d0abd927cd288716b2bc4487ce65fc25489848c437559d4fcf463f048d1d8e"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-arm-linux-gnueabihf.tar.gz"
sha256 = "6e866644c4edd79549747d38c65f63d71bcbc5a278f23059e8c916985f38cb27"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-arm-linux-gnueabihf.tar.gz"
[[vegalite_app]]
arch = "powerpc64le"
git-tree-sha1 = "5cdca2f914b761c880abfa54c885e1321d26234e"
git-tree-sha1 = "6c514dd6410ab46df40ec2699f3f9a4d9d4be687"
libc = "glibc"
os = "linux"

[[vegalite_app.download]]
sha256 = "790691d003286bab984211bc5ac33e333488deb659ae4caf113d820283c8ae55"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-powerpc64le-linux-gnu.tar.gz"
sha256 = "f1a1849fd7d5193bc5b6ade9f8cf5dcf6ec5807d748703403cb6b8f21aab693d"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-powerpc64le-linux-gnu.tar.gz"
[[vegalite_app]]
arch = "i686"
git-tree-sha1 = "9bc0eb9b7ebe598f8241e31342329c29ff9722dd"
git-tree-sha1 = "1eacfe9275cfe445370e9f9a5b7a23ba3714ab20"
libc = "musl"
os = "linux"

[[vegalite_app.download]]
sha256 = "a09c7062bd1bcd2094e4f2d5f83765a57e359650bdb499527a78b3b95cfb48c2"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-i686-linux-musl.tar.gz"
sha256 = "f728524dbcb9c4609ea7353f0b59cd752d8853f21553acf4bd5115a67d3f10d8"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-i686-linux-musl.tar.gz"
[[vegalite_app]]
arch = "x86_64"
git-tree-sha1 = "8376a346e836172a927feaf861966a8c60314064"
git-tree-sha1 = "43d22de95c1b6f86e8ad03d59293ea23497cdade"
libc = "musl"
os = "linux"

[[vegalite_app.download]]
sha256 = "bfd9b27c7138199c7ac594355936242506b75ed986d04c27c3c322116ecf5a9f"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-x86_64-linux-musl.tar.gz"
sha256 = "053aa2c9ae2821d5f8853a3ab6a0fff9537e3812e39ce20f16dca5b7d5993f67"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-x86_64-linux-musl.tar.gz"
[[vegalite_app]]
arch = "aarch64"
git-tree-sha1 = "492343be069aa550d8d29f3a378851389feb9a0e"
git-tree-sha1 = "08654a75e6f24e26a94174bc6a132faf06f2add0"
libc = "musl"
os = "linux"

[[vegalite_app.download]]
sha256 = "ab0f2b40f045766beb4cbc1b04e94ed1e3000735989ed902dd1ee6e5a8a4144b"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-aarch64-linux-musl.tar.gz"
sha256 = "38db53311cb0c5d1e7c4067a3122ad3d3e820bea85c547c68aaa764fb56e2d4f"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-aarch64-linux-musl.tar.gz"
[[vegalite_app]]
arch = "armv7l"
git-tree-sha1 = "7200ac4e39a4586c95660101eb328fb33f99f4a6"
git-tree-sha1 = "48f2e0056c364c55f8097b721518115924816b36"
libc = "musl"
os = "linux"

[[vegalite_app.download]]
sha256 = "915fc59a57f44b0992afe8d6c68ba4e70018a9714b7236ed320a2221cbbe2db7"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-arm-linux-musleabihf.tar.gz"
sha256 = "c155d1b028d26553f113147ac4edaf23061dc77564bc84c7965f0e083b353300"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-arm-linux-musleabihf.tar.gz"
[[vegalite_app]]
arch = "x86_64"
git-tree-sha1 = "83b94e72a3341f67247b0c45f810cd5682ec5e08"
git-tree-sha1 = "2f940e09ca056ec979279f3a2bd1f8991fc6a680"
os = "macos"

[[vegalite_app.download]]
sha256 = "d3fc1d2c8059144340b31bd63831f3188be1de99b72a8a730bc4f58f7a8622ef"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-x86_64-apple-darwin14.tar.gz"
sha256 = "2570eda374182396150b6760f2475eb431c738c46af7d298d157271228039a90"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-x86_64-apple-darwin14.tar.gz"
[[vegalite_app]]
arch = "x86_64"
git-tree-sha1 = "3a74249a6bfc181ffc52303be013e46e9f809597"
git-tree-sha1 = "54832120b3b3cc3b805751d48a6f5b8f3d5380da"
os = "freebsd"

[[vegalite_app.download]]
sha256 = "36d55d7f365d75124d4848068f627b4c756f9463be3bb947adedb75495cfc55c"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-x86_64-unknown-freebsd11.1.tar.gz"
sha256 = "11a487711624fb2f0cc0abd666a9f7383d027803924227e78a7ada9c47245fe3"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-x86_64-unknown-freebsd11.1.tar.gz"
[[vegalite_app]]
arch = "i686"
git-tree-sha1 = "05e2dd49dbb3f0bf3f492fd67f5a8fce3a04d11d"
git-tree-sha1 = "97ba8c2e3b321a3c11b5edfee4d4e8a3bcda2eee"
os = "windows"

[[vegalite_app.download]]
sha256 = "943d2a4745436d723ca84e57f951e90aafa3aff25985da152f34374e3e5bc6d6"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-i686-w64-mingw32.tar.gz"
sha256 = "d6c3e5c19419b13bb5a36f5bb64988ff215768437362dbf484180744748ab9cb"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-i686-w64-mingw32.tar.gz"
[[vegalite_app]]
arch = "x86_64"
git-tree-sha1 = "b80366d79f4eb178efd93d258a6fbf021cd0ee9f"
git-tree-sha1 = "a473943ecf51217f67b7cf30ddd3c4069e39aa7a"
os = "windows"

[[vegalite_app.download]]
sha256 = "07d75a1e330a51dd92859e065e86235bf110c80025ac69530f08766704d3fe51"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.5.1/vegaliteassets-2.5.1-x86_64-w64-mingw32.tar.gz"
sha256 = "c4385b5eb33223123fb47f25f063918596f275218dd67058be09b82a72b128d6"
url = "https://github.com/queryverse/VegaLiteBuilder/releases/download/v2.6.0/vegaliteassets-2.6.0-x86_64-w64-mingw32.tar.gz"
11 changes: 4 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "VegaLite"
uuid = "112f6efa-9a02-5b7d-90c0-432ed331239a"
version = "2.3.1-DEV"
version = "2.3.2-DEV"

[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Expand All @@ -12,39 +12,36 @@ JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Vega = "239c3e63-733f-47ad-beb7-a12fde22c578"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
NodeJS = "2bd173c7-0d6d-553b-b6af-13a54713934c"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
TableTraitsUtils = "382cd787-c1b6-5bf2-a167-d5b971a19bda"
DataValues = "e7dc6d0d-1eca-5fa6-8ad6-5aecde8b7ea5"
FilePaths = "8fc22ac5-c921-52a6-82fd-178b2807b824"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
URIParser = "30578b45-9adc-5946-b283-645ec420af67"

[extras]
VegaDatasets = "0ae4a718-28b7-58ec-9efb-cded64d6d5b4"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"

[compat]
TableTraits = "0.3.1, 0.4, 1"
IteratorInterfaceExtensions = "0.1.1, 1"
JSON = "0.19, 0.20, 0.21"
Vega = "0.1, 1, 2"
DataStructures = "0.17"
JSONSchema = "0.1, 0.2"
DataStructures = "0.17, 0.18"
NodeJS = "0.5.1, 0.6, 1"
MacroTools = "0.4.4, 0.5"
FileIO = "1.0.1"
TableTraitsUtils = "1"
julia = "1.3"
DataValues = "0.4.4"
FilePaths = "0.7, 0.8"
Setfield = "0.4, 0.5, 0.6"
URIParser = "0.4"

[targets]
test = ["VegaDatasets", "Dates", "Test", "DataFrames"]
test = ["VegaDatasets", "Dates", "Test", "DataFrames", "Setfield"]
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ To install [VegaLite.jl](https://github.com/queryverse/VegaLite.jl), run the fol
## Documentation

The current documentation can be found [here](https://queryverse.github.io/VegaLite.jl/stable).

## Developer Notes

Jupyterlab support depends on Juperlab's built-in renderer; before updating to a new major version of vega-lite, check the [jupyterlab project](https://github.com/jupyterlab/jupyterlab/blob/master/packages/vega5-extension/package.json#L42) for the latest supported version of vega-lite.
8 changes: 4 additions & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Documenter, VegaLite, UUIDs

function Base.show(io::IO, m::MIME"text/html", v::VegaLite.VLSpec)
divid = string("vl", replace(string(uuid4()), "-"=>""))
divid = string("vl", replace(string(uuid4()), "-" => ""))
print(io, "<div id='$divid' style=\"width:100%;height:100%;\"></div>")
print(io, "<script type='text/javascript'>requirejs.config({paths:{'vg-embed': 'https://cdn.jsdelivr.net/npm/vega-embed@6?noext','vega-lib': 'https://cdn.jsdelivr.net/npm/vega-lib?noext','vega-lite': 'https://cdn.jsdelivr.net/npm/vega-lite@4?noext','vega': 'https://cdn.jsdelivr.net/npm/vega@5?noext'}}); require(['vg-embed'],function(vegaEmbed){vegaEmbed('#$divid',")
VegaLite.our_json_print(io, v)
Expand All @@ -10,8 +10,8 @@ end

makedocs(
modules=[VegaLite],
sitename = "VegaLite.jl",
pages = [
sitename="VegaLite.jl",
pages=[
"Home" => "index.md",
"Getting Started" => Any[
"Installation" => "gettingstarted/installation.md",
Expand Down Expand Up @@ -50,5 +50,5 @@ makedocs(
)

deploydocs(
repo = "github.com/queryverse/VegaLite.jl.git",
repo="github.com/queryverse/VegaLite.jl.git",
)
6 changes: 2 additions & 4 deletions docs/src/examples/examples_line_charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,9 @@ data |>
## Carbon Dioxide in the Atmosphere

```@example
using VegaLite, VegaDatasets, DataFrames
data=readtable(string(dataset("co2-concentration").path))
using VegaLite, VegaDatasets
data |> @vlplot(
dataset("co2-concentration") |> @vlplot(
width=800,
height=500,
transform=[
Expand Down
59 changes: 59 additions & 0 deletions docs/src/gettingstarted/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,62 @@ save("myplot.pdf")
## Next steps

There are two main sources of information if you want to learn more about plotting with [VegaLite.jl](https://github.com/queryverse/VegaLite.jl). The first is the excellent [Vega-Lite documentation](https://vega.github.io/vega-lite/). The documentation describes the JSON original Vega-Lite version, but it should be fairly easy to understand how those examples translate into the Julia equivalent. The second source are the remaining sections in this documentation of [VegaLite.jl](https://github.com/queryverse/VegaLite.jl). The section about the `@vlplot` macro should be especially useful for understanding how the JSON Vega-Lite syntax can be translated into the equivalent Julia version.

### Moving from Vega-Lite Examples to Julia

Vega-Lite has a rich [gallery of examples](https://vega.github.io/vega-lite/examples/) that often make a great starting point for developing visualizations. However, editing JSON and integrating it with Julia is not the simplest workflow. To translate a JSON specification to `@vlplot` syntax, do the following.

```julia
using VegaLite, Vega

spec = vl"""{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"description": "A simple bar chart with embedded data.",
"data": {
"values": [
{"a": "A", "b": 28}, {"a": "B", "b": 55}, {"a": "C", "b": 43},
{"a": "D", "b": 91}, {"a": "E", "b": 81}, {"a": "F", "b": 53},
{"a": "G", "b": 19}, {"a": "H", "b": 87}, {"a": "I", "b": 52}
]
},
"mark": "bar",
"encoding": {
"x": {"field": "a", "type": "nominal", "axis": {"labelAngle": 0}},
"y": {"field": "b", "type": "quantitative"}
}
}""";

# outputs the code as a string so then be copied/pasted and edited
code_str = sprint(Vega.printrepr, spec)

#=
code_str now contains:
"@vlplot(\$schema=\"https://vega.github.io/schema/vega-lite/v4.json\",encoding={x={axis={labelAngle=0},field=\"a\",type=\"nominal\"},y={field=\"b\",type=\"quantitative\"}},mark=\"bar\",description=\"A simple bar chart with embedded data.\")"
=#

# prints the code to stdout more prettily and without the data so then can be copied/pasted
# and edited and new data piped in from a table
Vega.printrepr(stdout, spec, indent=true, include_data=false)

#=
Result
@vlplot(
$schema="https://vega.github.io/schema/vega-lite/v4.json",
encoding={
x={
axis={
labelAngle=0
},
field="a",
type="nominal"
},
y={
field="b",
type="quantitative"
}
},
mark="bar",
description="A simple bar chart with embedded data."
)
=#
```
2 changes: 1 addition & 1 deletion docs/src/userguide/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Inline data

Any Julia data structure data supports the iterable tables interface from the [TableTraits.jl](https://github.com/queryverse/TableTraits.jl) package can be used as an inline data source with [VegaLite.jl](https://github.com/queryverse/VegaLite.jl). In practice that covers most tabular data structures in the Julia ecosystem: [DataFrames.jl](https://github.com/JuliaData/DataFrames.jl), [JuliaDB.jl](https://github.com/JuliaComputing/JuliaDB.jl), [IndexedTables.jl](https://github.com/JuliaComputing/IndexedTables.jl), various file IO packages ([CSVFiles.jl](https://github.com/queryverse/CSVFiles.jl), [FeatherFiles.jl](https://github.com/queryverse/FeatherFiles.jl), [ExcelFiles.jl](https://github.com/queryverse/ExcelFiles.jl), [StatFiles.jl](https://github.com/queryverse/StatFiles.jl), [ParquetFiles.jl](https://github.com/queryverse/ParquetFiles.jl)) and any [Query.jl](https://github.com/queryverse/Query.jl) result that has a tabular form.
Any Julia data structure that supports the iterable tables interface from the [TableTraits.jl](https://github.com/queryverse/TableTraits.jl) package can be used as an inline data source with [VegaLite.jl](https://github.com/queryverse/VegaLite.jl). In practice that covers most tabular data structures in the Julia ecosystem: [DataFrames.jl](https://github.com/JuliaData/DataFrames.jl), [JuliaDB.jl](https://github.com/JuliaComputing/JuliaDB.jl), [IndexedTables.jl](https://github.com/JuliaComputing/IndexedTables.jl), various file IO packages ([CSVFiles.jl](https://github.com/queryverse/CSVFiles.jl), [FeatherFiles.jl](https://github.com/queryverse/FeatherFiles.jl), [ExcelFiles.jl](https://github.com/queryverse/ExcelFiles.jl), [StatFiles.jl](https://github.com/queryverse/StatFiles.jl), [ParquetFiles.jl](https://github.com/queryverse/ParquetFiles.jl)) and any [Query.jl](https://github.com/queryverse/Query.jl) result that has a tabular form.

There are two ways to add an inline data source to a Vega-Lite plot: 1) by piping the data source into a plot, or 2) by using the `data` keyword from within a `@vlplot` call.

Expand Down
2 changes: 2 additions & 0 deletions docs/src/userguide/vlspec.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ The resulting `VLSpec` object is indistinguishable from one that is created via

The main benefit of this approach is that one can directly leverage JSON vega-lite examples and code.

**NOTE:** A JSON spec can be shown in the `@vlplot` style using `Vega.printrepr` - see "Next Steps" in the tutorial for an example.

## Manipulating `VLSpec` object directly

Vega-Lite properties can be directly accessed as properties of the `VLSpec` object.
Expand Down
6 changes: 3 additions & 3 deletions src/VegaLite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ using URIParser
using FilePaths
using REPL, Dates
using Random
import JSONSchema
using Setfield: Setfield, PropertyLens, @lens, @set
# import Cairo, Rsvg
using Pkg.Artifacts
using DataStructures
Expand All @@ -32,7 +30,9 @@ export deletedata, deletedata!
const vegaliate_app_path = artifact"vegalite_app"
const vegaliate_app_includes_canvas = ispath(joinpath(vegaliate_app_path, "node_modules", "canvas"))

global vlschema = JSONSchema.Schema(JSON.parsefile(joinpath(vegaliate_app_path, "schemas", "vega-lite-schema.json")))
const vlschema = JSON.parsefile(
joinpath(vegaliate_app_path, "schemas", "vega-lite-schema.json")
)

include("vlspec.jl")

Expand Down
Loading

0 comments on commit 7068dc7

Please sign in to comment.