plotly hover and scattergl
This commit is contained in:
parent
1140b51e91
commit
3b33b054d3
@ -40,7 +40,7 @@ supported_args(::PlotlyBackend) = [
|
|||||||
|
|
||||||
supported_types(::PlotlyBackend) = [
|
supported_types(::PlotlyBackend) = [
|
||||||
:path, :scatter, :bar, :pie, :heatmap,
|
:path, :scatter, :bar, :pie, :heatmap,
|
||||||
:contour, :surface, :path3d, :scatter3d, :shape
|
:contour, :surface, :path3d, :scatter3d, :shape, :scattergl,
|
||||||
]
|
]
|
||||||
supported_styles(::PlotlyBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
supported_styles(::PlotlyBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||||
supported_markers(::PlotlyBackend) = [
|
supported_markers(::PlotlyBackend) = [
|
||||||
@ -292,6 +292,11 @@ function plotly_layout(plt::Plot)
|
|||||||
d_out
|
d_out
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# turn off hover if nothing's using it
|
||||||
|
if all(series -> series.d[:hover] in (false,:none), plt.series_list)
|
||||||
|
d_out[:hovermode] = "none"
|
||||||
|
end
|
||||||
|
|
||||||
d_out
|
d_out
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -347,14 +352,14 @@ function plotly_series(plt::Plot, series::Series)
|
|||||||
x, y = collect(d[:x]), collect(d[:y])
|
x, y = collect(d[:x]), collect(d[:y])
|
||||||
d_out[:name] = d[:label]
|
d_out[:name] = d[:label]
|
||||||
st = d[:seriestype]
|
st = d[:seriestype]
|
||||||
isscatter = st in (:scatter, :scatter3d)
|
isscatter = st in (:scatter, :scatter3d, :scattergl)
|
||||||
hasmarker = isscatter || d[:markershape] != :none
|
hasmarker = isscatter || d[:markershape] != :none
|
||||||
# hasline = !isscatter
|
# hasline = !isscatter
|
||||||
hasline = st in (:path, :path3d)
|
hasline = st in (:path, :path3d)
|
||||||
|
|
||||||
# set the "type"
|
# set the "type"
|
||||||
if st in (:path, :scatter)
|
if st in (:path, :scatter, :scattergl)
|
||||||
d_out[:type] = "scatter"
|
d_out[:type] = st==:scattergl ? "scattergl" : "scatter"
|
||||||
d_out[:mode] = if hasmarker
|
d_out[:mode] = if hasmarker
|
||||||
hasline ? "lines+markers" : "markers"
|
hasline ? "lines+markers" : "markers"
|
||||||
else
|
else
|
||||||
@ -500,9 +505,12 @@ function plotly_series(plt::Plot, series::Series)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# hover text
|
# hover text
|
||||||
if get(d, :hover, nothing) != nothing
|
hover = d[:hover]
|
||||||
|
if hover in (:none, false)
|
||||||
|
d_out[:hoverinfo] = "none"
|
||||||
|
elseif hover != nothing
|
||||||
d_out[:hoverinfo] = "text"
|
d_out[:hoverinfo] = "text"
|
||||||
d_out[:text] = d[:hover]
|
d_out[:text] = hover
|
||||||
end
|
end
|
||||||
|
|
||||||
d_out
|
d_out
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user