Skip to content

Commit

Permalink
Merge pull request #88 from davidanthoff/tweak-func-api
Browse files Browse the repository at this point in the history
Tweak func api
  • Loading branch information
davidanthoff committed Jun 4, 2018
2 parents 6f743a6 + c302510 commit 4a2e822
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/VegaLite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export load, save

export mk, enc

export vlplot, vldata

export config, selection, resolve, projection, facet, spec, rep
export transform, hconcat, vconcat, layer

######################## settings functions ############################

# Switch for plotting in SVGs or canvas
Expand Down
11 changes: 2 additions & 9 deletions src/dsl_helper_func/dsl_helper_func.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ end
# vls
# end

plot(args...; kwargs...) = mkSpec(:plot, args...; kwargs...)

export plot
vlplot(args...; kwargs...) = mkSpec(:plot, args...; kwargs...)

#### 1st level aliases

Expand All @@ -86,17 +84,14 @@ hconcat(args...) = mkSpec(:vlhconcat, args...)
vconcat(args...) = mkSpec(:vlvconcat, args...)
layer(args...) = mkSpec(:vllayer, args...)

export config, selection, resolve, projection, facet, spec, rep
export transform, hconcat, vconcat, layer

### data
# dat is a special case, we want to interpret correctly cases where an
# iterable table is passed as an argument

getrealvalue(v::DataValues.DataValue) = isnull(v) ? nothing : get(v)
getrealvalue(v) = v

function data(args...; kwargs...)
function vldata(args...; kwargs...)
if (length(args) == 1) && TableTraits.isiterabletable(args[1])
it = IteratorInterfaceExtensions.getiterator(args[1])
recs = [Dict(c[1] => getrealvalue(c[2]) for c in zip(keys(r), values(r))) for r in it]
Expand All @@ -106,5 +101,3 @@ function data(args...; kwargs...)
mkSpec(:vldata, args...; kwargs...)
end
end

export data

0 comments on commit 4a2e822

Please sign in to comment.