Skip to content

Commit

Permalink
allow NaN/Inf values in JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
Titas22 authored Nov 17, 2023
1 parent 0074483 commit 1ef9b12
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/PlotlyLight.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function download_schema!()
end
function load_schema(force=false)
if force || !isassigned(schema)
schema[] = JSON3.read(open(joinpath(scratch_dir[], "plotly-schema.json"), "r"), Config)
schema[] = JSON3.read(open(joinpath(scratch_dir[], "plotly-schema.json"), "r"), Config; allow_inf=true)
end
return schema[]
end
Expand Down Expand Up @@ -160,7 +160,7 @@ module Preset
export $f
function $f()
file = joinpath(templates_dir[], $(string(t)) * ".json")
SETTINGS.layout.template = open(io -> JSON3.read(io, Config), file)
SETTINGS.layout.template = open(io -> JSON3.read(io, Config; allow_inf=true), file)
return SETTINGS
end
end
Expand Down Expand Up @@ -267,7 +267,7 @@ function Base.show(io::IO, M::MIME"text/html", o::Plot; setting::Settings = SETT
show(io, M, setting.load_plotlyjs())
show(io, M, setting.make_container(id))
print(io, "<script>Plotly.newPlot(", repr(id), ", ")
foreach(x -> (JSON3.write(io, x); print(io, ", ")), (data, layout, config))
foreach(x -> (JSON3.write(io, x; allow_inf=true); print(io, ", ")), (data, layout, config))
print(io, ")</script>")
else
iframe = setting.iframe
Expand Down

0 comments on commit 1ef9b12

Please sign in to comment.