Skip to content

Commit bd31b5e

Browse files
committed
make Plot::default() behave like Plot::new()
Closes #380 Signed-off-by: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com>
1 parent f68ea92 commit bd31b5e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

plotly/src/plot.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ impl Traces {
156156
/// Ok(())
157157
/// }
158158
/// ```
159-
#[derive(Default, Serialize, Clone)]
159+
#[derive(Serialize, Clone)]
160160
pub struct Plot {
161161
#[serde(rename = "data")]
162162
traces: Traces,
@@ -169,13 +169,21 @@ pub struct Plot {
169169
js_scripts: String,
170170
}
171171

172+
impl Default for Plot {
173+
fn default() -> Self {
174+
Self::new()
175+
}
176+
}
177+
172178
impl Plot {
173179
/// Create a new `Plot`.
174180
pub fn new() -> Plot {
175181
Plot {
176182
traces: Traces::new(),
183+
layout: Layout::default(),
184+
configuration: Configuration::default(),
185+
frames: None,
177186
js_scripts: Self::js_scripts(),
178-
..Default::default()
179187
}
180188
}
181189

0 commit comments

Comments
 (0)