Skip to content

Commit a6fd29b

Browse files
kobutriTristan Kobuschandrei-ng
authored
add scalenchor (#161)
* add scalenchor * fix kaleido crash on windows by taking ownership of stdin/stdout --------- Signed-off-by: Andrei Gherghescu <[email protected]> Co-authored-by: Tristan Kobusch <[email protected]> Co-authored-by: Andrei Gherghescu <[email protected]>
1 parent c642253 commit a6fd29b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

plotly/src/layout/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,9 @@ pub struct Axis {
441441
#[serde(rename = "nticks")]
442442
n_ticks: Option<usize>,
443443

444+
#[serde(rename = "scaleanchor")]
445+
scale_anchor: Option<String>,
446+
444447
tick0: Option<f64>,
445448
dtick: Option<f64>,
446449

plotly_kaleido/src/lib.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,15 @@ impl Kaleido {
138138
let p = p.to_str().unwrap();
139139
let p = String::from(p);
140140

141-
let process = Command::new(p.as_str())
141+
let mut process = Command::new(p.as_str())
142142
.current_dir(self.cmd_path.parent().unwrap())
143143
.args([
144144
"plotly",
145145
"--disable-gpu",
146146
"--allow-file-access-from-files",
147147
"--disable-breakpad",
148148
"--disable-dev-shm-usage",
149+
"--disable-software-rasterizer",
149150
"--single-process",
150151
])
151152
.stdin(Stdio::piped())
@@ -156,14 +157,14 @@ impl Kaleido {
156157

157158
{
158159
let plot_data = PlotData::new(plotly_data, format, width, height, scale).to_json();
159-
let mut process_stdin = process.stdin.unwrap();
160+
let mut process_stdin = process.stdin.take().unwrap();
160161
process_stdin
161162
.write_all(plot_data.as_bytes())
162163
.expect("couldn't write to Kaleido stdin");
163164
process_stdin.flush()?;
164165
}
165166

166-
let output_lines = BufReader::new(process.stdout.unwrap()).lines();
167+
let output_lines = BufReader::new(process.stdout.take().unwrap()).lines();
167168
for line in output_lines.map_while(Result::ok) {
168169
let res = KaleidoResult::from(line.as_str());
169170
if let Some(image_data) = res.result {

0 commit comments

Comments
 (0)