@@ -104,20 +104,25 @@ end
104104 p.layout.title.text = "My Title!"
105105 p
106106"""
107- Base. @kwdef mutable struct Plot
108- data:: Vector{Config} = Config[]
109- layout:: Config = Defaults. layout[]
110- config:: Config = Defaults. config[]
111- id:: String = randstring (10 ) # id of graphDiv
112- js:: Cobweb.Javascript = Cobweb. Javascript (" console.log('plot created!')" )
113- end
114- function Plot (traces, layout= Defaults. layout[], config= Defaults. config[]; kw... )
115- data = traces isa Config ? [traces] : traces
116- Plot (; kw... , data,
117- layout = merge (layout, Defaults. layout[]),
118- config = merge (config, Defaults. config[])
119- )
107+ mutable struct Plot
108+ data:: Vector{Config}
109+ layout:: Config
110+ config:: Config
111+ id:: String # id of graphDiv
112+ js:: Cobweb.Javascript
113+
114+ function Plot (
115+ data:: Union{Config, Vector{Config}} ,
116+ layout:: Config = Defaults. layout[],
117+ config:: Config = Defaults. config[];
118+ # kw
119+ id:: AbstractString = randstring (10 ),
120+ js:: Cobweb.Javascript = Cobweb. Javascript (" console.log('plot created!')" )
121+ )
122+ new (data isa Config ? [data] : data, layout, config, string (id), js)
123+ end
120124end
125+ Plot (; kw... ) = Plot (Config (kw))
121126(p:: Plot )(; kw... ) = (push! (p. data, Config (kw)); p)
122127
123128StructTypes. StructType (:: Plot ) = StructTypes. Struct ()
0 commit comments