-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.jl
80 lines (66 loc) · 1.88 KB
/
routes.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
module App
using GenieFramework, PlotlyBase, StipplePlotly, CSV, DataFrames, PlotlyJS
@genietools
include(joinpath("src", "traces.jl"))
include(joinpath("src", "onchange.jl"))
include(joinpath("src", "init.jl"))
include(joinpath("src", "ui.jl"))
@app begin
@in data_click = Dict{String, Any}()
@in active = []
@in period = 2023
@in show_relations = false
# @in grouping = "None"
# @in generate_histograms = false
@out traces = traces
@out plotlayout = PlotlyBase.Layout(
showlegend=false,
margin = Dict(
:autoexpand => false,
:b => 0,
:l => 0,
:t => 0,
:r => 0,
:pad => 0
),
width = 800,
height = 400,
)
# @out list_of_groupings = ["None", "All", "Selected", "Continents" , "Graph"]
# @out histogram_traces = []
# @out histogram_layout = PlotlyBase.Layout(
# width = 500,
# height = 300
# )
# @out tab = "map"
@mixin traces::PlotlyEvents
@onchange data_click begin
if haskey(data_click, "points") && haskey(data_click["points"][1], "location")
traces = onchange_data_click(data_click["points"][1]["location"], params)
end
end
@onchange period begin
params.period = period
traces = onchange_period(params)
end
@onchange show_relations begin
params.show_relations = show_relations
traces = onchange_show_relations(params)
end
# @onchange grouping begin
# end
# @onchange generate_histograms begin
# histogram_traces = [
# scatter(; x=1:4, y=[0, 2, 3, 5], fill="tozeroy"),
# scatter(; x=1:4, y=[3, 5, 1, 7], fill="tonexty")
# ]
# end
end
@mounted watchplots()
route("/") do
global model
model = @init
page(model, ui()) |> html
end
Server.isrunning() || Server.up()
end