Skip to content

Commit 29736fe

Browse files
authored
Make i, j, k optional in Mesh3d::new() (#260)
* Make i, j, k optional * Update example to work with optional i,j,k
1 parent ca4560f commit 29736fe

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

examples/3d_charts/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ fn mesh_3d_plot(show: bool) -> Plot {
172172
vec![0, 1, 2, 0],
173173
vec![0, 0, 1, 2],
174174
vec![0, 2, 0, 1],
175-
vec![0, 0, 0, 1],
176-
vec![1, 2, 3, 2],
177-
vec![2, 3, 1, 3],
175+
Some(vec![0, 0, 0, 1]),
176+
Some(vec![1, 2, 3, 2]),
177+
Some(vec![2, 3, 1, 3]),
178178
)
179179
.intensity(vec![0.0, 0.33, 0.66, 1.0])
180180
.color_scale(ColorScale::Palette(ColorScalePalette::Rainbow));

plotly/src/traces/mesh3d.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,17 +389,17 @@ where
389389
x: Vec<X>,
390390
y: Vec<Y>,
391391
z: Vec<Z>,
392-
i: Vec<usize>,
393-
j: Vec<usize>,
394-
k: Vec<usize>,
392+
i: Option<Vec<usize>>,
393+
j: Option<Vec<usize>>,
394+
k: Option<Vec<usize>>,
395395
) -> Box<Self> {
396396
Box::new(Self {
397397
x: Some(x),
398398
y: Some(y),
399399
z: Some(z),
400-
i: Some(i),
401-
j: Some(j),
402-
k: Some(k),
400+
i,
401+
j,
402+
k,
403403
..Default::default()
404404
})
405405
}
@@ -484,9 +484,9 @@ mod tests {
484484
vec![0.0, 1.0, 2.0],
485485
vec![3.0, 4.0, 5.0],
486486
vec![6.0, 7.0, 8.0],
487-
vec![0],
488-
vec![1],
489-
vec![2],
487+
Some(vec![0]),
488+
Some(vec![1]),
489+
Some(vec![2]),
490490
)
491491
.name("trace_name")
492492
.visible(Visible::True)

0 commit comments

Comments
 (0)