update plotly(js)
This commit is contained in:
parent
60d20ea998
commit
7ec54b9c2e
@ -51,8 +51,8 @@ _series_updated(plt::Plot, series::Series) = nothing
|
|||||||
|
|
||||||
_before_layout_calcs(plt::Plot) = nothing
|
_before_layout_calcs(plt::Plot) = nothing
|
||||||
|
|
||||||
title_padding(sp::Subplot) = sp[:title] == "" ? 0mm : sp[:titlefont].pointsize * pt
|
title_padding(sp::Subplot) = sp[:title] == "" ? 0mm : sp[:titlefontsize] * pt
|
||||||
guide_padding(axis::Axis) = axis[:guide] == "" ? 0mm : axis[:guidefont].pointsize * pt
|
guide_padding(axis::Axis) = axis[:guide] == "" ? 0mm : axis[:guidefontsize] * pt
|
||||||
|
|
||||||
"Returns the (width,height) of a text label."
|
"Returns the (width,height) of a text label."
|
||||||
function text_size(lablen::Int, sz::Number, rot::Number = 0)
|
function text_size(lablen::Int, sz::Number, rot::Number = 0)
|
||||||
@ -93,7 +93,7 @@ function tick_padding(axis::Axis)
|
|||||||
# hgt
|
# hgt
|
||||||
|
|
||||||
# get the height of the rotated label
|
# get the height of the rotated label
|
||||||
text_size(longest_label, axis[:tickfont].pointsize, rot)[2]
|
text_size(longest_label, axis[:tickfontsize], rot)[2]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# https://plot.ly/javascript/getting-started
|
# https://plot.ly/javascript/getting-started
|
||||||
|
|
||||||
@require Revise begin
|
@require Revise begin
|
||||||
Revise.track(Plots, joinpath(Pkg.dir("Plots"), "src", "backends", "plotly.jl"))
|
Revise.track(Plots, joinpath(Pkg.dir("Plots"), "src", "backends", "plotly.jl"))
|
||||||
end
|
end
|
||||||
|
|
||||||
const _plotly_attr = merge_with_base_supported([
|
const _plotly_attr = merge_with_base_supported([
|
||||||
@ -19,7 +19,12 @@ const _plotly_attr = merge_with_base_supported([
|
|||||||
:markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle,
|
:markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle,
|
||||||
:fillrange, :fillcolor, :fillalpha,
|
:fillrange, :fillcolor, :fillalpha,
|
||||||
:bins,
|
:bins,
|
||||||
:title, :title_location, :titlefont,
|
:title, :title_location,
|
||||||
|
:titlefontfamily, :titlefontsize, :titlefonthalign, :titlefontvalign,
|
||||||
|
:titlefontcolor,
|
||||||
|
:legendfontfamily, :legendfontsize, :legendfontcolor,
|
||||||
|
:tickfontfamily, :tickfontsize, :tickfontcolor,
|
||||||
|
:guidefontfamily, :guidefontsize, :guidefontcolor,
|
||||||
:window_title,
|
:window_title,
|
||||||
:guide, :lims, :ticks, :scale, :flip, :rotation,
|
:guide, :lims, :ticks, :scale, :flip, :rotation,
|
||||||
:tickfont, :guidefont, :legendfont,
|
:tickfont, :guidefont, :legendfont,
|
||||||
@ -254,9 +259,9 @@ function plotly_axis(axis::Axis, sp::Subplot)
|
|||||||
ax[:tickangle] = -axis[:rotation]
|
ax[:tickangle] = -axis[:rotation]
|
||||||
|
|
||||||
if !(axis[:ticks] in (nothing, :none))
|
if !(axis[:ticks] in (nothing, :none))
|
||||||
ax[:titlefont] = plotly_font(axis[:guidefont], axis[:foreground_color_guide])
|
ax[:titlefont] = plotly_font(guidefont(axis))
|
||||||
ax[:type] = plotly_scale(axis[:scale])
|
ax[:type] = plotly_scale(axis[:scale])
|
||||||
ax[:tickfont] = plotly_font(axis[:tickfont], axis[:foreground_color_text])
|
ax[:tickfont] = plotly_font(tickfont(axis))
|
||||||
ax[:tickcolor] = framestyle in (:zerolines, :grid) || !axis[:showaxis] ? rgba_string(invisible()) : rgb_string(axis[:foreground_color_axis])
|
ax[:tickcolor] = framestyle in (:zerolines, :grid) || !axis[:showaxis] ? rgba_string(invisible()) : rgb_string(axis[:foreground_color_axis])
|
||||||
ax[:linecolor] = rgba_string(axis[:foreground_color_axis])
|
ax[:linecolor] = rgba_string(axis[:foreground_color_axis])
|
||||||
|
|
||||||
@ -334,8 +339,8 @@ function plotly_layout(plt::Plot)
|
|||||||
0.5 * (left(bb) + right(bb))
|
0.5 * (left(bb) + right(bb))
|
||||||
end
|
end
|
||||||
titlex, titley = xy_mm_to_pcts(xmm, top(bbox(sp)), w*px, h*px)
|
titlex, titley = xy_mm_to_pcts(xmm, top(bbox(sp)), w*px, h*px)
|
||||||
titlefont = font(sp[:titlefont], :top, sp[:foreground_color_title])
|
title_font = font(titlefont(sp), :top)
|
||||||
push!(d_out[:annotations], plotly_annotation_dict(titlex, titley, text(sp[:title], titlefont)))
|
push!(d_out[:annotations], plotly_annotation_dict(titlex, titley, text(sp[:title], title_font)))
|
||||||
end
|
end
|
||||||
|
|
||||||
d_out[:plot_bgcolor] = rgba_string(sp[:background_color_inside])
|
d_out[:plot_bgcolor] = rgba_string(sp[:background_color_inside])
|
||||||
@ -376,7 +381,7 @@ function plotly_layout(plt::Plot)
|
|||||||
d_out[:legend] = KW(
|
d_out[:legend] = KW(
|
||||||
:bgcolor => rgba_string(sp[:background_color_legend]),
|
:bgcolor => rgba_string(sp[:background_color_legend]),
|
||||||
:bordercolor => rgba_string(sp[:foreground_color_legend]),
|
:bordercolor => rgba_string(sp[:foreground_color_legend]),
|
||||||
:font => plotly_font(sp[:legendfont], sp[:foreground_color_legend]),
|
:font => plotly_font(legendfont(sp)),
|
||||||
:x => xpos,
|
:x => xpos,
|
||||||
:y => ypos
|
:y => ypos
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user