Skip to content

Commit

Permalink
bump version, remove Unitful ext for now
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday committed Oct 2, 2024
1 parent 2157f31 commit 0171bb5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PlotlyLight"
uuid = "ca7969ec-10b3-423e-8d99-40f33abb42bf"
authors = ["joshday <[email protected]>"]
version = "0.9.2"
version = "0.10.0"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand All @@ -14,9 +14,9 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"

[compat]
Artifacts = "1.3"
Aqua = "0.8"
Cobweb = "0.6"
Artifacts = "1.3"
Cobweb = "0.6, 0.7"
Downloads = "1.6"
EasyConfig = "0.1"
JSON3 = "1.14"
Expand Down
9 changes: 5 additions & 4 deletions src/PlotlyLight.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ end
settings::Settings = Settings()

#-----------------------------------------------------------------------------# utils/other
fix_matrix(x::Config) = Config(k => fix_matrix(v) for (k,v) in pairs(x))
fix_matrix(x) = x
fix_matrix(x::AbstractMatrix) = eachrow(x)
# Hack to change behavior of `JSON3.write` for `AbstractMatrix`
_fix(x::Config) = Config(k => _fix(v) for (k,v) in pairs(x))
_fix(x) = x
_fix(x::AbstractMatrix) = eachrow(x)

attributes(t::Symbol) = plotly.schema.traces[t].attributes
check_attribute(trace, attr::Symbol) = haskey(attributes(Symbol(trace)), attr) || @warn("`$trace` does not have attribute `$attr`.")
Expand Down Expand Up @@ -78,7 +79,7 @@ Base.getproperty(::typeof(plot), x::Symbol) = (; kw...) -> plot(x; kw...)

#-----------------------------------------------------------------------------# display/show
function html_div(o::Plot; id=randstring(10))
data = JSON3.write(fix_matrix.(o.data); allow_inf=true)
data = JSON3.write(_fix.(o.data); allow_inf=true)
layout = JSON3.write(merge(settings.layout, o.layout); allow_inf=true)
config = JSON3.write(merge(settings.config, o.config); allow_inf=true)
h.div(class="plotlylight-parent-div",
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ end
@testset "other" begin
@test propertynames(Plot()) isa Vector{Symbol}
@test all(x in propertynames(Plot()) for x in propertynames(plot))
@test PlotlyLight.fix_matrix([1 2; 3 4]) == [[1, 2], [3, 4]]
@test PlotlyLight._fix([1 2; 3 4]) == [[1, 2], [3, 4]]
@test propertynames(JSON3.read(JSON3.write(Plot()))) == [:data, :layout, :config]
end

Expand Down

0 comments on commit 0171bb5

Please sign in to comment.