Skip to content

Commit

Permalink
Merge d649a71 into 2d7cc13
Browse files Browse the repository at this point in the history
  • Loading branch information
fredo-dedup committed Mar 2, 2018
2 parents 2d7cc13 + d649a71 commit 2a69bc9
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 5,886 deletions.
5,864 changes: 0 additions & 5,864 deletions assets/vega-lite-schema.json

This file was deleted.

14 changes: 7 additions & 7 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# download javascript files
# download spec schema, javascript files, and installs nodes js packages

using BinDeps
@BinDeps.setup

# uschema = "https://vega.github.io/schema/vega-lite/v2.json"

uvega = "https://cdnjs.cloudflare.com/ajax/libs/vega/3.0.8/vega.min.js"
uvegalite = "https://cdnjs.cloudflare.com/ajax/libs/vega-lite/2.0.3/vega-lite.min.js"
uembed = "https://cdnjs.cloudflare.com/ajax/libs/vega-embed/3.0.0-rc7/vega-embed.min.js"
uschema = "https://vega.github.io/schema/vega-lite/v2.1.3.json"
uvega = "https://cdnjs.cloudflare.com/ajax/libs/vega/3.1.0/vega.min.js"
uvegalite = "https://cdnjs.cloudflare.com/ajax/libs/vega-lite/2.1.3/vega-lite.min.js"
uembed = "https://cdnjs.cloudflare.com/ajax/libs/vega-embed/3.0.0/vega-embed.min.js"

destdir = joinpath(@__DIR__, "lib")

run(@build_steps begin
CreateDirectory(destdir, true)
# FileDownloader(uschema, joinpath(destdir, basename(uschema)))
FileDownloader(uschema, joinpath(destdir, "vega-lite-schema.json"))
FileDownloader(uvega, joinpath(destdir, basename(uvega)))
FileDownloader(uvegalite, joinpath(destdir, basename(uvegalite)))
FileDownloader(uembed, joinpath(destdir, basename(uembed)))
Expand All @@ -24,3 +23,4 @@ using NodeJS
using Compat

run(Cmd(`$(npm_cmd()) install --production --no-bin-links --no-package-lock --no-optional`, dir=@__DIR__))

5 changes: 2 additions & 3 deletions deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"version": "1.0.1",
"dependencies": {
"rw": "^1.3.3",
"vega": "^3.0.8",
"vega-lite": "^2.0.3",
"vega-embed": "^3.0.0-rc7",
"vega": "^3.1.0",
"vega-lite": "^2.1.3",
"xmlhttprequest": "^1.8.0"
}
}
6 changes: 3 additions & 3 deletions src/render.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ function writehtml_partial(io::IO, spec::String; title="VegaLite plot")
requirejs.config({
paths: {
vg: "https://cdnjs.cloudflare.com/ajax/libs/vega/3.0.8/vega.min.js?noext",
vl: "https://cdnjs.cloudflare.com/ajax/libs/vega-lite/2.0.3/vega-lite.min.js?noext",
vg_embed: "https://cdnjs.cloudflare.com/ajax/libs/vega-embed/3.0.0-rc7/vega-embed.min.js?noext"
vg: "https://cdnjs.cloudflare.com/ajax/libs/vega/3.1.0/vega.min.js?noext",
vl: "https://cdnjs.cloudflare.com/ajax/libs/vega-lite/2.1.3/vega-lite.min.js?noext",
vg_embed: "https://cdnjs.cloudflare.com/ajax/libs/vega-embed/3.0.0/vega-embed.min.js?noext"
},
shim: {
vg_embed: {deps: ["vg.global", "vl.global"]},
Expand Down
4 changes: 1 addition & 3 deletions src/schema_parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function toDef(spec::Dict)
end
end

fn = joinpath(@__DIR__, "../assets/", "vega-lite-schema.json")
fn = joinpath(@__DIR__, "../deps/lib/", "vega-lite-schema.json")
schema = JSON.parsefile(fn)
# showall(keys(schema["definitions"]))
# schema["definitions"]["TopLevelProperties"]
Expand All @@ -157,8 +157,6 @@ schema = JSON.parsefile(fn)
refs = Dict{String, SpecDef}()
rootSpec = toDef(schema["definitions"]["TopLevelExtendedSpec"])



# length(refs) # 124
# dl = rootSpec.items[2].props["layer"]
# dl2 = dl.items.items[1]
Expand Down
10 changes: 8 additions & 2 deletions src/spec_validation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,14 @@ end
function conforms(d, ps::String, spec::ObjDef)
isa(d, Dict) || throw("expected object got '$d' in $ps")
for (k,v) in d
haskey(spec.props, k) || throw("unexpected param '$k' in $ps")
conforms(v, "$ps.$k", spec.props[k])
if haskey(spec.props, k)
conforms(v, "$ps.$k", spec.props[k])
elseif ! isa(spec.addprops, VoidDef) # if additional properties
conforms(v, "$ps.$k", spec.addprops)
elseif length(spec.props) == 0 # if empty object, accept
else
throw("unexpected param '$k' in $ps")
end
end
for k in spec.required
haskey(d, k) || throw("required param '$k' missing in $ps")
Expand Down
4 changes: 2 additions & 2 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ... x(typ=:quantitative, .. )) => xquantitative()
for chan in keys(refs["EncodingWithFacet"].props)
for typ in refs["Type"].enum
for typ in union(refs["BasicType"].enum, refs["GeoType"].enum)
sfn = Symbol(chan * typ)

# function declaration and export
Expand Down Expand Up @@ -64,7 +64,7 @@ for chan in keys(refs["EncodingWithFacet"].props)
end

encoding(($schan)(args...;nkw...))
end)
end)

eval( Expr(:export, sfn))
end
Expand Down
4 changes: 2 additions & 2 deletions test/test_base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ using RDatasets
mpg = dataset("ggplot2", "mpg")

@test isa(VegaLite.data(mpg), VegaLite.VLSpec{:data})
@test equiv(VegaLite.data(mpg) |> config(vlcell(width=200)),
mpg |> config(vlcell(width=200)))
@test equiv(VegaLite.data(mpg) |> plot(width=200),
mpg |> plot(width=200))

end

0 comments on commit 2a69bc9

Please sign in to comment.