Skip to content

Commit

Permalink
Merge pull request #432 from queryverse:ppi-png
Browse files Browse the repository at this point in the history
Add support for ppi setting for png export
  • Loading branch information
davidanthoff authored May 2, 2023
2 parents 7268bc4 + 6174395 commit 9149ae9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/rendering/show.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function convert_vl_to_x(v::VLSpec, fileformat)
function convert_vl_to_x(v::VLSpec, fileformat; cmd_args="")
script_path = vegalite_app_path("node_modules", "vega-lite", "bin", "vl2$fileformat")

p = open(Cmd(`$(NodeJS_18_jll.node()) $script_path`, dir=vegalite_app_path()),"r+")
p = open(Cmd(`$(NodeJS_18_jll.node()) $script_path $cmd_args`, dir=vegalite_app_path()),"r+")
writer = @async begin
our_json_print(p, v)
close(p.in)
Expand Down Expand Up @@ -66,7 +66,11 @@ end

function Base.show(io::IO, m::MIME"image/png", v::VLSpec)
if vegaliate_app_includes_canvas[]
print(io, convert_vl_to_x(v, "png"))
if haskey(io, :ppi)
print(io, convert_vl_to_x(v, "png", cmd_args="--ppi=$(io[:ppi])"))
else
print(io, convert_vl_to_x(v, "png"))
end
else
error("Not yet implemented.")
# svgstring = convert_vl_to_svg(v)
Expand Down

0 comments on commit 9149ae9

Please sign in to comment.