Closed mdsa3d closed 2 years ago
looks like you need to pass a matrix as z param. Instead of vector
using Genie, Genie.Renderer.Html, Stipple, StipplePlotly
t = collect(1:1:10)
# pd1 = PlotData(
# x = cos.(t),
# y = sin.(t),
# z = t,
# plot = StipplePlotly.Charts.PLOT_TYPE_SCATTER3D, # for 3D plots,
# name = "test",
# )
# plot_data = [pd1]
@reactive mutable struct Model <: ReactiveModel
# data::R{Vector{PlotData}} = plot_data, READONLY
data::R{PlotData} = PlotData(
x = cos.(t),
y = sin.(t),
z = t[:,:],
plot = StipplePlotly.Charts.PLOT_TYPE_SCATTER3D, # for 3D plots,
name = "test")
layout::R{PlotLayout} = PlotLayout(
plot_bgcolor = "#999",
showlegend = false,
title = PlotLayoutTitle(text = "Random numbers", font = Font(24)),
)
config::R{PlotConfig} = PlotConfig()
end
function ui(model)
page(model, class = "container", [plot(:data, layout = :layout, config = :config)])
end
route("/") do
Stipple.init(Model) |> ui |> html
end
up()
feel free to close the issue if you think the output is as expected @mdsa3d
Thanks @AbhimanyuAryan for the help, highly appreciate it !! Indeed this is what I was looking for, will close this issue for now. 😄
@mdsa3d is it ok if you/I can contribute this example to StippleDemos/StipplePlotly/3DPlots? So others can also benefits from it?
A little update: You can use vector with z
now(just like PlotlyJS). I will push and tag new version. So you original code below should work just fine
using Genie, Genie.Renderer.Html, Stipple, StipplePlotly
t = collect(1:1:10)
pd1 = PlotData(
x = cos.(t),
y = sin.(t),
z = t,
plot = StipplePlotly.Charts.PLOT_TYPE_SCATTER3D, # for 3D plots,
name = "test",
)
plot_data = [pd1]
@reactive! mutable struct Model <: ReactiveModel
data::R{Vector{PlotData}} = plot_data, READONLY
layout::R{PlotLayout} = PlotLayout(
plot_bgcolor = "#999",
showlegend = false,
title = PlotLayoutTitle(text = "Random numbers", font = Font(24)),
)
config::R{PlotConfig} = PlotConfig()
end
function ui(model)
page(model, class = "container", [plot(:data, layout = :layout, config = :config)])
end
route("/") do
model = Model |> init |> ui |> html
end
up()
Thanks for the updated suggestion @AbhimanyuAryan Highly appreciate it ! Yes, indeed please do upload it is a great idea !! Hope others can benefit from this !
@mdsa3d you wanna do it? It will show as your contribution to OSS :)
@AbhimanyuAryan yeah sure if that is ok ? 😄
@AbhimanyuAryan yeah sure if that is ok ? 😄
It is "more than" OK 😉 thanks
Hi, I would like to ask how to plot 3d charts using
StipplePlotly.jl
? I have a basic 3d plot :This a working 3d plot with plotly() as backend renderer. I tried to integrate this with Stipple web app:
I am following one of the StipplePlotly.jl tutorials: https://github.com/GenieFramework/StippleDemos/tree/master/StipplePlotly However, my app returns the following error:
May I ask, what could be causing this error ? Though, 2D chart implementation works perfectly fine. I would like to seek help in making 3d charts accessible through apps. Thanks, look forward to the suggestions.