Skip to content

Commit

Permalink
plotly-graph: improve readability of the logic setting imgOpts.format
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinerg committed Apr 7, 2020
1 parent 703adf1 commit da5c8f2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/component/plotly-graph/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ function render (info, opts, sendToMain) {
const PRINT_TO_PDF = (format === 'pdf' || format === 'eps')
const PRINT_TO_EMF = (format === 'emf')

let imgOptsFormat
if (PRINT_TO_PDF || PRINT_TO_EMF) {
imgOptsFormat = 'svg'
} else if (format === 'json') {
imgOptsFormat = 'full-json'
} else {
imgOptsFormat = format
}

// stash `paper_bgcolor` here in order to set the pdf window bg color
let bgColor
const pdfBackground = (gd, _bgColor) => {
Expand All @@ -51,7 +60,7 @@ function render (info, opts, sendToMain) {
}

const imgOpts = {
format: (PRINT_TO_PDF || PRINT_TO_EMF) ? 'svg' : (format === 'json' ? 'full-json' : format),
format: imgOptsFormat,
width: info.width,
height: info.height,
// only works as of plotly.js v1.31.0
Expand Down

0 comments on commit da5c8f2

Please sign in to comment.