Merge branch 'pr_fix_plotly_file_name' into pr_requirejs_plotlyjs

Const variable for filename of plotly.js
This commit is contained in:
Jks Liu 2021-01-18 21:03:09 +08:00
commit 672b3a6038
3 changed files with 7 additions and 3 deletions

View File

@ -187,6 +187,10 @@ import RecipesPipeline: SliceIt,
datetimeformatter,
timeformatter
# Use fixed version of Plotly instead of the latest one for stable dependency
# Ref: https://github.com/JuliaPlots/Plots.jl/pull/2779
const _plotly_min_js_filename = "plotly-1.57.1.min.js"
include("types.jl")
include("utils.jl")
include("axes.jl")

View File

@ -887,7 +887,7 @@ const ijulia_initialized = Ref(false)
function plotly_html_head(plt::Plot)
plotly =
use_local_dependencies[] ? ("file:///" * plotly_local_file_path[]) : "https://cdn.plot.ly/plotly-1.57.1.min.js"
use_local_dependencies[] ? ("file:///" * plotly_local_file_path[]) : "https://cdn.plot.ly/$(_plotly_min_js_filename)"
include_mathjax = get(plt[:extra_plot_kwargs], :include_mathjax, "")
mathjax_file = include_mathjax != "cdn" ? ("file://" * include_mathjax) : "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"

View File

@ -79,9 +79,9 @@ function __init__()
end
if get(ENV, "PLOTS_HOST_DEPENDENCY_LOCAL", "false") == "true"
global plotly_local_file_path[] = joinpath(@get_scratch!("plotly"), "plotly-1.54.2.min.js")
global plotly_local_file_path[] = joinpath(@get_scratch!("plotly"), _plotly_min_js_filename)
if !isfile(plotly_local_file_path[])
download("https://cdn.plot.ly/plotly-1.57.1.min.js", plotly_local_file_path[])
download("https://cdn.plot.ly/$(_plotly_min_js_filename)", plotly_local_file_path[])
end
use_local_plotlyjs[] = true