Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
/orcaPublic archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/component/plotly-graph/constants.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,14 +6,16 @@ module.exports = {
svg: 'image/svg+xml',
pdf: 'application/pdf',
eps: 'application/postscript',
emf: 'image/emf'
emf: 'image/emf',
json: 'application/json'
},

statusMsg: {
400: 'invalid or malformed request syntax',
406: 'requested format is not acceptable',
525: 'plotly.js error',
526: 'plotly.js version 1.11.0 or up required',
527: 'plotly.js version 1.53.0 or up required for exporting to `json`',
530: 'image conversion error'
},

Expand Down
4 changes: 4 additions & 0 deletions src/component/plotly-graph/convert.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,6 +81,10 @@ function convert (info, opts, reply) {
}

switch (format) {
case 'json':
body = imgData
bodyLength = body.length
return done()
case 'png':
case 'jpeg':
case 'webp':
Expand Down
21 changes: 20 additions & 1 deletion src/component/plotly-graph/render.js
Original file line numberDiff line numberDiff 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,
format: imgOptsFormat,
width: info.width,
height: info.height,
// only works as of plotly.js v1.31.0
Expand All@@ -64,6 +73,16 @@ function render (info, opts, sendToMain) {
: ''
}

if (
// 'full-json' was introduced in plotly.js v1.53.0
// see: https://github.com/plotly/plotly.js/releases/tag/v1.53.0
imgOpts.format === 'full-json' && semver.lt(Plotly.version, '1.53.0')
) {
errorCode = 527
result.error = `plotly.js version: ${Plotly.version}`
return done()
}

let promise

if (semver.gte(Plotly.version, '1.30.0')) {
Expand Down
1 change: 1 addition & 0 deletions test/image/baselines/29.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/image/baselines/basic_heatmap.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
{"data":[{"autocolorscale":false,"colorbar":{"bgcolor":"rgba(0,0,0,0)","bordercolor":"#444","borderwidth":0,"exponentformat":"B","len":1,"lenmode":"fraction","nticks":0,"outlinecolor":"#444","outlinewidth":1,"separatethousands":false,"showexponent":"all","showticklabels":true,"thickness":30,"thicknessmode":"pixels","tickangle":"auto","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","tickmode":"auto","tickprefix":"","ticks":"","ticksuffix":"","title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"side":"top","text":"Click to enter Colorscale title"},"x":1.02,"xanchor":"left","xpad":10,"y":0.5,"yanchor":"middle","ypad":10},"colorscale":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"connectgaps":false,"dx":1,"dy":1,"hoverinfo":"x+y+z+text","hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hoverongaps":true,"hovertemplate":"","index":0,"legendgroup":"","name":"trace 0","opacity":1,"reversescale":false,"showlegend":false,"showscale":true,"transpose":false,"type":"heatmap","uid":"data0","visible":true,"x0":0,"xaxis":"x","xcalendar":"gregorian","xgap":0,"y0":0,"yaxis":"y","ycalendar":"gregorian","ygap":0,"z":[[1,20,30],[20,1,60],[30,60,1]],"zauto":true,"zhoverformat":"","zmax":60,"zmin":1,"zsmooth":false}],"layout":{"annotations":[],"autosize":false,"calendar":"gregorian","clickmode":"event","colorscale":{"diverging":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"sequential":[[0,"rgb(220,220,220)"],[0.2,"rgb(245,195,157)"],[0.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],"sequentialminus":[[0,"rgb(5,10,172)"],[0.35,"rgb(40,60,190)"],[0.5,"rgb(70,100,245)"],[0.6,"rgb(90,120,245)"],[0.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]]},"colorway":["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],"dragmode":"zoom","font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"height":500,"hidesources":false,"hoverdistance":20,"hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hovermode":"x","images":[],"margin":{"autoexpand":true,"b":80,"l":80,"pad":0,"r":80,"t":100},"modebar":{"activecolor":"rgba(68, 68, 68, 0.7)","bgcolor":"rgba(255, 255, 255, 0.5)","color":"rgba(68, 68, 68, 0.3)","orientation":"h"},"paper_bgcolor":"#fff","plot_bgcolor":"#fff","separators":".,","shapes":[],"showlegend":false,"sliders":[],"spikedistance":20,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":17},"pad":{"b":0,"l":0,"r":0,"t":0},"text":"Click to enter Plot title","x":0.5,"xanchor":"auto","xref":"container","y":"auto","yanchor":"auto","yref":"container"},"uniformtext":{"mode":false},"updatemenus":[],"width":700,"xaxis":{"anchor":"y","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"center","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"bottom","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter X axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1},"yaxis":{"anchor":"x","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"middle","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"left","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter Y axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1}},"frames":[],"config":{"autosizable":false,"displayModeBar":false,"displaylogo":true,"doubleClick":false,"doubleClickDelay":300,"editable":false,"edits":{},"fillFrame":false,"frameMargins":0,"globalTransforms":[],"linkText":"Edit chart","locale":"en-US","locales":{},"logging":1,"mapboxAccessToken":null,"modeBarButtons":false,"modeBarButtonsToAdd":[],"modeBarButtonsToRemove":[],"notifyOnLogging":0,"plotGlPixelRatio":2.5,"plotlyServerURL":"","queueLength":0,"responsive":false,"scrollZoom":false,"sendData":true,"setBackground":"_function","showAxisDragHandles":true,"showAxisRangeEntryBoxes":true,"showEditInChartStudio":false,"showLink":false,"showSendToCloud":false,"showSources":false,"showTips":false,"staticPlot":true,"toImageButtonOptions":{},"topojsonURL":"https://cdn.plot.ly/","watermark":false},"version":"1.53.0"}
Binary file modifiedtest/image/baselines/geo_choropleth-usa.emf
Binary file not shown.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
plotly-graph: add support for JSON exports by antoinerg · Pull Request #309 · plotly/orca · GitHub
Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
/orcaPublic archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/component/plotly-graph/constants.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,14 +6,16 @@ module.exports = {
svg: 'image/svg+xml',
pdf: 'application/pdf',
eps: 'application/postscript',
emf: 'image/emf'
emf: 'image/emf',
json: 'application/json'
},

statusMsg: {
400: 'invalid or malformed request syntax',
406: 'requested format is not acceptable',
525: 'plotly.js error',
526: 'plotly.js version 1.11.0 or up required',
527: 'plotly.js version 1.53.0 or up required for exporting to `json`',
530: 'image conversion error'
},

Expand Down
4 changes: 4 additions & 0 deletions src/component/plotly-graph/convert.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,6 +81,10 @@ function convert (info, opts, reply) {
}

switch (format) {
case 'json':
body = imgData
bodyLength = body.length
return done()
case 'png':
case 'jpeg':
case 'webp':
Expand Down
21 changes: 20 additions & 1 deletion src/component/plotly-graph/render.js
Original file line numberDiff line numberDiff 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,
format: imgOptsFormat,
width: info.width,
height: info.height,
// only works as of plotly.js v1.31.0
Expand All@@ -64,6 +73,16 @@ function render (info, opts, sendToMain) {
: ''
}

if (
// 'full-json' was introduced in plotly.js v1.53.0
// see: https://github.com/plotly/plotly.js/releases/tag/v1.53.0
imgOpts.format === 'full-json' && semver.lt(Plotly.version, '1.53.0')
) {
errorCode = 527
result.error = `plotly.js version: ${Plotly.version}`
return done()
}

let promise

if (semver.gte(Plotly.version, '1.30.0')) {
Expand Down
1 change: 1 addition & 0 deletions test/image/baselines/29.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/image/baselines/basic_heatmap.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
{"data":[{"autocolorscale":false,"colorbar":{"bgcolor":"rgba(0,0,0,0)","bordercolor":"#444","borderwidth":0,"exponentformat":"B","len":1,"lenmode":"fraction","nticks":0,"outlinecolor":"#444","outlinewidth":1,"separatethousands":false,"showexponent":"all","showticklabels":true,"thickness":30,"thicknessmode":"pixels","tickangle":"auto","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","tickmode":"auto","tickprefix":"","ticks":"","ticksuffix":"","title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"side":"top","text":"Click to enter Colorscale title"},"x":1.02,"xanchor":"left","xpad":10,"y":0.5,"yanchor":"middle","ypad":10},"colorscale":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"connectgaps":false,"dx":1,"dy":1,"hoverinfo":"x+y+z+text","hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hoverongaps":true,"hovertemplate":"","index":0,"legendgroup":"","name":"trace 0","opacity":1,"reversescale":false,"showlegend":false,"showscale":true,"transpose":false,"type":"heatmap","uid":"data0","visible":true,"x0":0,"xaxis":"x","xcalendar":"gregorian","xgap":0,"y0":0,"yaxis":"y","ycalendar":"gregorian","ygap":0,"z":[[1,20,30],[20,1,60],[30,60,1]],"zauto":true,"zhoverformat":"","zmax":60,"zmin":1,"zsmooth":false}],"layout":{"annotations":[],"autosize":false,"calendar":"gregorian","clickmode":"event","colorscale":{"diverging":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"sequential":[[0,"rgb(220,220,220)"],[0.2,"rgb(245,195,157)"],[0.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],"sequentialminus":[[0,"rgb(5,10,172)"],[0.35,"rgb(40,60,190)"],[0.5,"rgb(70,100,245)"],[0.6,"rgb(90,120,245)"],[0.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]]},"colorway":["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],"dragmode":"zoom","font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"height":500,"hidesources":false,"hoverdistance":20,"hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hovermode":"x","images":[],"margin":{"autoexpand":true,"b":80,"l":80,"pad":0,"r":80,"t":100},"modebar":{"activecolor":"rgba(68, 68, 68, 0.7)","bgcolor":"rgba(255, 255, 255, 0.5)","color":"rgba(68, 68, 68, 0.3)","orientation":"h"},"paper_bgcolor":"#fff","plot_bgcolor":"#fff","separators":".,","shapes":[],"showlegend":false,"sliders":[],"spikedistance":20,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":17},"pad":{"b":0,"l":0,"r":0,"t":0},"text":"Click to enter Plot title","x":0.5,"xanchor":"auto","xref":"container","y":"auto","yanchor":"auto","yref":"container"},"uniformtext":{"mode":false},"updatemenus":[],"width":700,"xaxis":{"anchor":"y","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"center","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"bottom","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter X axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1},"yaxis":{"anchor":"x","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"middle","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"left","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter Y axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1}},"frames":[],"config":{"autosizable":false,"displayModeBar":false,"displaylogo":true,"doubleClick":false,"doubleClickDelay":300,"editable":false,"edits":{},"fillFrame":false,"frameMargins":0,"globalTransforms":[],"linkText":"Edit chart","locale":"en-US","locales":{},"logging":1,"mapboxAccessToken":null,"modeBarButtons":false,"modeBarButtonsToAdd":[],"modeBarButtonsToRemove":[],"notifyOnLogging":0,"plotGlPixelRatio":2.5,"plotlyServerURL":"","queueLength":0,"responsive":false,"scrollZoom":false,"sendData":true,"setBackground":"_function","showAxisDragHandles":true,"showAxisRangeEntryBoxes":true,"showEditInChartStudio":false,"showLink":false,"showSendToCloud":false,"showSources":false,"showTips":false,"staticPlot":true,"toImageButtonOptions":{},"topojsonURL":"https://cdn.plot.ly/","watermark":false},"version":"1.53.0"}
Binary file modifiedtest/image/baselines/geo_choropleth-usa.emf
Binary file not shown.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' plotly-graph: add support for JSON exports by antoinerg · Pull Request #309 · plotly/orca · GitHub
Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
/orcaPublic archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/component/plotly-graph/constants.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,14 +6,16 @@ module.exports = {
svg: 'image/svg+xml',
pdf: 'application/pdf',
eps: 'application/postscript',
emf: 'image/emf'
emf: 'image/emf',
json: 'application/json'
},

statusMsg: {
400: 'invalid or malformed request syntax',
406: 'requested format is not acceptable',
525: 'plotly.js error',
526: 'plotly.js version 1.11.0 or up required',
527: 'plotly.js version 1.53.0 or up required for exporting to `json`',
530: 'image conversion error'
},

Expand Down
4 changes: 4 additions & 0 deletions src/component/plotly-graph/convert.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,6 +81,10 @@ function convert (info, opts, reply) {
}

switch (format) {
case 'json':
body = imgData
bodyLength = body.length
return done()
case 'png':
case 'jpeg':
case 'webp':
Expand Down
21 changes: 20 additions & 1 deletion src/component/plotly-graph/render.js
Original file line numberDiff line numberDiff 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,
format: imgOptsFormat,
width: info.width,
height: info.height,
// only works as of plotly.js v1.31.0
Expand All@@ -64,6 +73,16 @@ function render (info, opts, sendToMain) {
: ''
}

if (
// 'full-json' was introduced in plotly.js v1.53.0
// see: https://github.com/plotly/plotly.js/releases/tag/v1.53.0
imgOpts.format === 'full-json' && semver.lt(Plotly.version, '1.53.0')
) {
errorCode = 527
result.error = `plotly.js version: ${Plotly.version}`
return done()
}

let promise

if (semver.gte(Plotly.version, '1.30.0')) {
Expand Down
1 change: 1 addition & 0 deletions test/image/baselines/29.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/image/baselines/basic_heatmap.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
{"data":[{"autocolorscale":false,"colorbar":{"bgcolor":"rgba(0,0,0,0)","bordercolor":"#444","borderwidth":0,"exponentformat":"B","len":1,"lenmode":"fraction","nticks":0,"outlinecolor":"#444","outlinewidth":1,"separatethousands":false,"showexponent":"all","showticklabels":true,"thickness":30,"thicknessmode":"pixels","tickangle":"auto","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","tickmode":"auto","tickprefix":"","ticks":"","ticksuffix":"","title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"side":"top","text":"Click to enter Colorscale title"},"x":1.02,"xanchor":"left","xpad":10,"y":0.5,"yanchor":"middle","ypad":10},"colorscale":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"connectgaps":false,"dx":1,"dy":1,"hoverinfo":"x+y+z+text","hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hoverongaps":true,"hovertemplate":"","index":0,"legendgroup":"","name":"trace 0","opacity":1,"reversescale":false,"showlegend":false,"showscale":true,"transpose":false,"type":"heatmap","uid":"data0","visible":true,"x0":0,"xaxis":"x","xcalendar":"gregorian","xgap":0,"y0":0,"yaxis":"y","ycalendar":"gregorian","ygap":0,"z":[[1,20,30],[20,1,60],[30,60,1]],"zauto":true,"zhoverformat":"","zmax":60,"zmin":1,"zsmooth":false}],"layout":{"annotations":[],"autosize":false,"calendar":"gregorian","clickmode":"event","colorscale":{"diverging":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"sequential":[[0,"rgb(220,220,220)"],[0.2,"rgb(245,195,157)"],[0.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],"sequentialminus":[[0,"rgb(5,10,172)"],[0.35,"rgb(40,60,190)"],[0.5,"rgb(70,100,245)"],[0.6,"rgb(90,120,245)"],[0.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]]},"colorway":["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],"dragmode":"zoom","font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"height":500,"hidesources":false,"hoverdistance":20,"hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hovermode":"x","images":[],"margin":{"autoexpand":true,"b":80,"l":80,"pad":0,"r":80,"t":100},"modebar":{"activecolor":"rgba(68, 68, 68, 0.7)","bgcolor":"rgba(255, 255, 255, 0.5)","color":"rgba(68, 68, 68, 0.3)","orientation":"h"},"paper_bgcolor":"#fff","plot_bgcolor":"#fff","separators":".,","shapes":[],"showlegend":false,"sliders":[],"spikedistance":20,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":17},"pad":{"b":0,"l":0,"r":0,"t":0},"text":"Click to enter Plot title","x":0.5,"xanchor":"auto","xref":"container","y":"auto","yanchor":"auto","yref":"container"},"uniformtext":{"mode":false},"updatemenus":[],"width":700,"xaxis":{"anchor":"y","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"center","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"bottom","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter X axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1},"yaxis":{"anchor":"x","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"middle","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"left","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter Y axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1}},"frames":[],"config":{"autosizable":false,"displayModeBar":false,"displaylogo":true,"doubleClick":false,"doubleClickDelay":300,"editable":false,"edits":{},"fillFrame":false,"frameMargins":0,"globalTransforms":[],"linkText":"Edit chart","locale":"en-US","locales":{},"logging":1,"mapboxAccessToken":null,"modeBarButtons":false,"modeBarButtonsToAdd":[],"modeBarButtonsToRemove":[],"notifyOnLogging":0,"plotGlPixelRatio":2.5,"plotlyServerURL":"","queueLength":0,"responsive":false,"scrollZoom":false,"sendData":true,"setBackground":"_function","showAxisDragHandles":true,"showAxisRangeEntryBoxes":true,"showEditInChartStudio":false,"showLink":false,"showSendToCloud":false,"showSources":false,"showTips":false,"staticPlot":true,"toImageButtonOptions":{},"topojsonURL":"https://cdn.plot.ly/","watermark":false},"version":"1.53.0"}
Binary file modifiedtest/image/baselines/geo_choropleth-usa.emf
Binary file not shown.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' plotly-graph: add support for JSON exports by antoinerg · Pull Request #309 · plotly/orca · GitHub
Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
/orcaPublic archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/component/plotly-graph/constants.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,14 +6,16 @@ module.exports = {
svg: 'image/svg+xml',
pdf: 'application/pdf',
eps: 'application/postscript',
emf: 'image/emf'
emf: 'image/emf',
json: 'application/json'
},

statusMsg: {
400: 'invalid or malformed request syntax',
406: 'requested format is not acceptable',
525: 'plotly.js error',
526: 'plotly.js version 1.11.0 or up required',
527: 'plotly.js version 1.53.0 or up required for exporting to `json`',
530: 'image conversion error'
},

Expand Down
4 changes: 4 additions & 0 deletions src/component/plotly-graph/convert.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,6 +81,10 @@ function convert (info, opts, reply) {
}

switch (format) {
case 'json':
body = imgData
bodyLength = body.length
return done()
case 'png':
case 'jpeg':
case 'webp':
Expand Down
21 changes: 20 additions & 1 deletion src/component/plotly-graph/render.js
Original file line numberDiff line numberDiff 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,
format: imgOptsFormat,
width: info.width,
height: info.height,
// only works as of plotly.js v1.31.0
Expand All@@ -64,6 +73,16 @@ function render (info, opts, sendToMain) {
: ''
}

if (
// 'full-json' was introduced in plotly.js v1.53.0
// see: https://github.com/plotly/plotly.js/releases/tag/v1.53.0
imgOpts.format === 'full-json' && semver.lt(Plotly.version, '1.53.0')
) {
errorCode = 527
result.error = `plotly.js version: ${Plotly.version}`
return done()
}

let promise

if (semver.gte(Plotly.version, '1.30.0')) {
Expand Down
1 change: 1 addition & 0 deletions test/image/baselines/29.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/image/baselines/basic_heatmap.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
{"data":[{"autocolorscale":false,"colorbar":{"bgcolor":"rgba(0,0,0,0)","bordercolor":"#444","borderwidth":0,"exponentformat":"B","len":1,"lenmode":"fraction","nticks":0,"outlinecolor":"#444","outlinewidth":1,"separatethousands":false,"showexponent":"all","showticklabels":true,"thickness":30,"thicknessmode":"pixels","tickangle":"auto","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","tickmode":"auto","tickprefix":"","ticks":"","ticksuffix":"","title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"side":"top","text":"Click to enter Colorscale title"},"x":1.02,"xanchor":"left","xpad":10,"y":0.5,"yanchor":"middle","ypad":10},"colorscale":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"connectgaps":false,"dx":1,"dy":1,"hoverinfo":"x+y+z+text","hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hoverongaps":true,"hovertemplate":"","index":0,"legendgroup":"","name":"trace 0","opacity":1,"reversescale":false,"showlegend":false,"showscale":true,"transpose":false,"type":"heatmap","uid":"data0","visible":true,"x0":0,"xaxis":"x","xcalendar":"gregorian","xgap":0,"y0":0,"yaxis":"y","ycalendar":"gregorian","ygap":0,"z":[[1,20,30],[20,1,60],[30,60,1]],"zauto":true,"zhoverformat":"","zmax":60,"zmin":1,"zsmooth":false}],"layout":{"annotations":[],"autosize":false,"calendar":"gregorian","clickmode":"event","colorscale":{"diverging":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"sequential":[[0,"rgb(220,220,220)"],[0.2,"rgb(245,195,157)"],[0.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],"sequentialminus":[[0,"rgb(5,10,172)"],[0.35,"rgb(40,60,190)"],[0.5,"rgb(70,100,245)"],[0.6,"rgb(90,120,245)"],[0.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]]},"colorway":["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],"dragmode":"zoom","font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"height":500,"hidesources":false,"hoverdistance":20,"hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hovermode":"x","images":[],"margin":{"autoexpand":true,"b":80,"l":80,"pad":0,"r":80,"t":100},"modebar":{"activecolor":"rgba(68, 68, 68, 0.7)","bgcolor":"rgba(255, 255, 255, 0.5)","color":"rgba(68, 68, 68, 0.3)","orientation":"h"},"paper_bgcolor":"#fff","plot_bgcolor":"#fff","separators":".,","shapes":[],"showlegend":false,"sliders":[],"spikedistance":20,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":17},"pad":{"b":0,"l":0,"r":0,"t":0},"text":"Click to enter Plot title","x":0.5,"xanchor":"auto","xref":"container","y":"auto","yanchor":"auto","yref":"container"},"uniformtext":{"mode":false},"updatemenus":[],"width":700,"xaxis":{"anchor":"y","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"center","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"bottom","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter X axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1},"yaxis":{"anchor":"x","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"middle","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"left","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter Y axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1}},"frames":[],"config":{"autosizable":false,"displayModeBar":false,"displaylogo":true,"doubleClick":false,"doubleClickDelay":300,"editable":false,"edits":{},"fillFrame":false,"frameMargins":0,"globalTransforms":[],"linkText":"Edit chart","locale":"en-US","locales":{},"logging":1,"mapboxAccessToken":null,"modeBarButtons":false,"modeBarButtonsToAdd":[],"modeBarButtonsToRemove":[],"notifyOnLogging":0,"plotGlPixelRatio":2.5,"plotlyServerURL":"","queueLength":0,"responsive":false,"scrollZoom":false,"sendData":true,"setBackground":"_function","showAxisDragHandles":true,"showAxisRangeEntryBoxes":true,"showEditInChartStudio":false,"showLink":false,"showSendToCloud":false,"showSources":false,"showTips":false,"staticPlot":true,"toImageButtonOptions":{},"topojsonURL":"https://cdn.plot.ly/","watermark":false},"version":"1.53.0"}
Binary file modifiedtest/image/baselines/geo_choropleth-usa.emf
Binary file not shown.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' plotly-graph: add support for JSON exports by antoinerg · Pull Request #309 · plotly/orca · GitHub
Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
/orcaPublic archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/component/plotly-graph/constants.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,14 +6,16 @@ module.exports = {
svg: 'image/svg+xml',
pdf: 'application/pdf',
eps: 'application/postscript',
emf: 'image/emf'
emf: 'image/emf',
json: 'application/json'
},

statusMsg: {
400: 'invalid or malformed request syntax',
406: 'requested format is not acceptable',
525: 'plotly.js error',
526: 'plotly.js version 1.11.0 or up required',
527: 'plotly.js version 1.53.0 or up required for exporting to `json`',
530: 'image conversion error'
},

Expand Down
4 changes: 4 additions & 0 deletions src/component/plotly-graph/convert.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,6 +81,10 @@ function convert (info, opts, reply) {
}

switch (format) {
case 'json':
body = imgData
bodyLength = body.length
return done()
case 'png':
case 'jpeg':
case 'webp':
Expand Down
21 changes: 20 additions & 1 deletion src/component/plotly-graph/render.js
Original file line numberDiff line numberDiff 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,
format: imgOptsFormat,
width: info.width,
height: info.height,
// only works as of plotly.js v1.31.0
Expand All@@ -64,6 +73,16 @@ function render (info, opts, sendToMain) {
: ''
}

if (
// 'full-json' was introduced in plotly.js v1.53.0
// see: https://github.com/plotly/plotly.js/releases/tag/v1.53.0
imgOpts.format === 'full-json' && semver.lt(Plotly.version, '1.53.0')
) {
errorCode = 527
result.error = `plotly.js version: ${Plotly.version}`
return done()
}

let promise

if (semver.gte(Plotly.version, '1.30.0')) {
Expand Down
1 change: 1 addition & 0 deletions test/image/baselines/29.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/image/baselines/basic_heatmap.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
{"data":[{"autocolorscale":false,"colorbar":{"bgcolor":"rgba(0,0,0,0)","bordercolor":"#444","borderwidth":0,"exponentformat":"B","len":1,"lenmode":"fraction","nticks":0,"outlinecolor":"#444","outlinewidth":1,"separatethousands":false,"showexponent":"all","showticklabels":true,"thickness":30,"thicknessmode":"pixels","tickangle":"auto","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","tickmode":"auto","tickprefix":"","ticks":"","ticksuffix":"","title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"side":"top","text":"Click to enter Colorscale title"},"x":1.02,"xanchor":"left","xpad":10,"y":0.5,"yanchor":"middle","ypad":10},"colorscale":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"connectgaps":false,"dx":1,"dy":1,"hoverinfo":"x+y+z+text","hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hoverongaps":true,"hovertemplate":"","index":0,"legendgroup":"","name":"trace 0","opacity":1,"reversescale":false,"showlegend":false,"showscale":true,"transpose":false,"type":"heatmap","uid":"data0","visible":true,"x0":0,"xaxis":"x","xcalendar":"gregorian","xgap":0,"y0":0,"yaxis":"y","ycalendar":"gregorian","ygap":0,"z":[[1,20,30],[20,1,60],[30,60,1]],"zauto":true,"zhoverformat":"","zmax":60,"zmin":1,"zsmooth":false}],"layout":{"annotations":[],"autosize":false,"calendar":"gregorian","clickmode":"event","colorscale":{"diverging":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"sequential":[[0,"rgb(220,220,220)"],[0.2,"rgb(245,195,157)"],[0.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],"sequentialminus":[[0,"rgb(5,10,172)"],[0.35,"rgb(40,60,190)"],[0.5,"rgb(70,100,245)"],[0.6,"rgb(90,120,245)"],[0.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]]},"colorway":["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],"dragmode":"zoom","font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"height":500,"hidesources":false,"hoverdistance":20,"hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hovermode":"x","images":[],"margin":{"autoexpand":true,"b":80,"l":80,"pad":0,"r":80,"t":100},"modebar":{"activecolor":"rgba(68, 68, 68, 0.7)","bgcolor":"rgba(255, 255, 255, 0.5)","color":"rgba(68, 68, 68, 0.3)","orientation":"h"},"paper_bgcolor":"#fff","plot_bgcolor":"#fff","separators":".,","shapes":[],"showlegend":false,"sliders":[],"spikedistance":20,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":17},"pad":{"b":0,"l":0,"r":0,"t":0},"text":"Click to enter Plot title","x":0.5,"xanchor":"auto","xref":"container","y":"auto","yanchor":"auto","yref":"container"},"uniformtext":{"mode":false},"updatemenus":[],"width":700,"xaxis":{"anchor":"y","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"center","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"bottom","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter X axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1},"yaxis":{"anchor":"x","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"middle","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"left","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter Y axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1}},"frames":[],"config":{"autosizable":false,"displayModeBar":false,"displaylogo":true,"doubleClick":false,"doubleClickDelay":300,"editable":false,"edits":{},"fillFrame":false,"frameMargins":0,"globalTransforms":[],"linkText":"Edit chart","locale":"en-US","locales":{},"logging":1,"mapboxAccessToken":null,"modeBarButtons":false,"modeBarButtonsToAdd":[],"modeBarButtonsToRemove":[],"notifyOnLogging":0,"plotGlPixelRatio":2.5,"plotlyServerURL":"","queueLength":0,"responsive":false,"scrollZoom":false,"sendData":true,"setBackground":"_function","showAxisDragHandles":true,"showAxisRangeEntryBoxes":true,"showEditInChartStudio":false,"showLink":false,"showSendToCloud":false,"showSources":false,"showTips":false,"staticPlot":true,"toImageButtonOptions":{},"topojsonURL":"https://cdn.plot.ly/","watermark":false},"version":"1.53.0"}
Binary file modifiedtest/image/baselines/geo_choropleth-usa.emf
Binary file not shown.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' plotly-graph: add support for JSON exports by antoinerg · Pull Request #309 · plotly/orca · GitHub
Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
/orcaPublic archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/component/plotly-graph/constants.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,14 +6,16 @@ module.exports = {
svg: 'image/svg+xml',
pdf: 'application/pdf',
eps: 'application/postscript',
emf: 'image/emf'
emf: 'image/emf',
json: 'application/json'
},

statusMsg: {
400: 'invalid or malformed request syntax',
406: 'requested format is not acceptable',
525: 'plotly.js error',
526: 'plotly.js version 1.11.0 or up required',
527: 'plotly.js version 1.53.0 or up required for exporting to `json`',
530: 'image conversion error'
},

Expand Down
4 changes: 4 additions & 0 deletions src/component/plotly-graph/convert.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,6 +81,10 @@ function convert (info, opts, reply) {
}

switch (format) {
case 'json':
body = imgData
bodyLength = body.length
return done()
case 'png':
case 'jpeg':
case 'webp':
Expand Down
21 changes: 20 additions & 1 deletion src/component/plotly-graph/render.js
Original file line numberDiff line numberDiff 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,
format: imgOptsFormat,
width: info.width,
height: info.height,
// only works as of plotly.js v1.31.0
Expand All@@ -64,6 +73,16 @@ function render (info, opts, sendToMain) {
: ''
}

if (
// 'full-json' was introduced in plotly.js v1.53.0
// see: https://github.com/plotly/plotly.js/releases/tag/v1.53.0
imgOpts.format === 'full-json' && semver.lt(Plotly.version, '1.53.0')
) {
errorCode = 527
result.error = `plotly.js version: ${Plotly.version}`
return done()
}

let promise

if (semver.gte(Plotly.version, '1.30.0')) {
Expand Down
1 change: 1 addition & 0 deletions test/image/baselines/29.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/image/baselines/basic_heatmap.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
{"data":[{"autocolorscale":false,"colorbar":{"bgcolor":"rgba(0,0,0,0)","bordercolor":"#444","borderwidth":0,"exponentformat":"B","len":1,"lenmode":"fraction","nticks":0,"outlinecolor":"#444","outlinewidth":1,"separatethousands":false,"showexponent":"all","showticklabels":true,"thickness":30,"thicknessmode":"pixels","tickangle":"auto","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","tickmode":"auto","tickprefix":"","ticks":"","ticksuffix":"","title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"side":"top","text":"Click to enter Colorscale title"},"x":1.02,"xanchor":"left","xpad":10,"y":0.5,"yanchor":"middle","ypad":10},"colorscale":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"connectgaps":false,"dx":1,"dy":1,"hoverinfo":"x+y+z+text","hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hoverongaps":true,"hovertemplate":"","index":0,"legendgroup":"","name":"trace 0","opacity":1,"reversescale":false,"showlegend":false,"showscale":true,"transpose":false,"type":"heatmap","uid":"data0","visible":true,"x0":0,"xaxis":"x","xcalendar":"gregorian","xgap":0,"y0":0,"yaxis":"y","ycalendar":"gregorian","ygap":0,"z":[[1,20,30],[20,1,60],[30,60,1]],"zauto":true,"zhoverformat":"","zmax":60,"zmin":1,"zsmooth":false}],"layout":{"annotations":[],"autosize":false,"calendar":"gregorian","clickmode":"event","colorscale":{"diverging":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"sequential":[[0,"rgb(220,220,220)"],[0.2,"rgb(245,195,157)"],[0.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],"sequentialminus":[[0,"rgb(5,10,172)"],[0.35,"rgb(40,60,190)"],[0.5,"rgb(70,100,245)"],[0.6,"rgb(90,120,245)"],[0.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]]},"colorway":["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],"dragmode":"zoom","font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"height":500,"hidesources":false,"hoverdistance":20,"hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hovermode":"x","images":[],"margin":{"autoexpand":true,"b":80,"l":80,"pad":0,"r":80,"t":100},"modebar":{"activecolor":"rgba(68, 68, 68, 0.7)","bgcolor":"rgba(255, 255, 255, 0.5)","color":"rgba(68, 68, 68, 0.3)","orientation":"h"},"paper_bgcolor":"#fff","plot_bgcolor":"#fff","separators":".,","shapes":[],"showlegend":false,"sliders":[],"spikedistance":20,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":17},"pad":{"b":0,"l":0,"r":0,"t":0},"text":"Click to enter Plot title","x":0.5,"xanchor":"auto","xref":"container","y":"auto","yanchor":"auto","yref":"container"},"uniformtext":{"mode":false},"updatemenus":[],"width":700,"xaxis":{"anchor":"y","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"center","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"bottom","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter X axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1},"yaxis":{"anchor":"x","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"middle","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"left","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter Y axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1}},"frames":[],"config":{"autosizable":false,"displayModeBar":false,"displaylogo":true,"doubleClick":false,"doubleClickDelay":300,"editable":false,"edits":{},"fillFrame":false,"frameMargins":0,"globalTransforms":[],"linkText":"Edit chart","locale":"en-US","locales":{},"logging":1,"mapboxAccessToken":null,"modeBarButtons":false,"modeBarButtonsToAdd":[],"modeBarButtonsToRemove":[],"notifyOnLogging":0,"plotGlPixelRatio":2.5,"plotlyServerURL":"","queueLength":0,"responsive":false,"scrollZoom":false,"sendData":true,"setBackground":"_function","showAxisDragHandles":true,"showAxisRangeEntryBoxes":true,"showEditInChartStudio":false,"showLink":false,"showSendToCloud":false,"showSources":false,"showTips":false,"staticPlot":true,"toImageButtonOptions":{},"topojsonURL":"https://cdn.plot.ly/","watermark":false},"version":"1.53.0"}
Binary file modifiedtest/image/baselines/geo_choropleth-usa.emf
Binary file not shown.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); plotly-graph: add support for JSON exports by antoinerg · Pull Request #309 · plotly/orca · GitHub
Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
/orcaPublic archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/component/plotly-graph/constants.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,14 +6,16 @@ module.exports = {
svg: 'image/svg+xml',
pdf: 'application/pdf',
eps: 'application/postscript',
emf: 'image/emf'
emf: 'image/emf',
json: 'application/json'
},

statusMsg: {
400: 'invalid or malformed request syntax',
406: 'requested format is not acceptable',
525: 'plotly.js error',
526: 'plotly.js version 1.11.0 or up required',
527: 'plotly.js version 1.53.0 or up required for exporting to `json`',
530: 'image conversion error'
},

Expand Down
4 changes: 4 additions & 0 deletions src/component/plotly-graph/convert.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,6 +81,10 @@ function convert (info, opts, reply) {
}

switch (format) {
case 'json':
body = imgData
bodyLength = body.length
return done()
case 'png':
case 'jpeg':
case 'webp':
Expand Down
21 changes: 20 additions & 1 deletion src/component/plotly-graph/render.js
Original file line numberDiff line numberDiff 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,
format: imgOptsFormat,
width: info.width,
height: info.height,
// only works as of plotly.js v1.31.0
Expand All@@ -64,6 +73,16 @@ function render (info, opts, sendToMain) {
: ''
}

if (
// 'full-json' was introduced in plotly.js v1.53.0
// see: https://github.com/plotly/plotly.js/releases/tag/v1.53.0
imgOpts.format === 'full-json' && semver.lt(Plotly.version, '1.53.0')
) {
errorCode = 527
result.error = `plotly.js version: ${Plotly.version}`
return done()
}

let promise

if (semver.gte(Plotly.version, '1.30.0')) {
Expand Down
1 change: 1 addition & 0 deletions test/image/baselines/29.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/image/baselines/basic_heatmap.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
{"data":[{"autocolorscale":false,"colorbar":{"bgcolor":"rgba(0,0,0,0)","bordercolor":"#444","borderwidth":0,"exponentformat":"B","len":1,"lenmode":"fraction","nticks":0,"outlinecolor":"#444","outlinewidth":1,"separatethousands":false,"showexponent":"all","showticklabels":true,"thickness":30,"thicknessmode":"pixels","tickangle":"auto","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","tickmode":"auto","tickprefix":"","ticks":"","ticksuffix":"","title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"side":"top","text":"Click to enter Colorscale title"},"x":1.02,"xanchor":"left","xpad":10,"y":0.5,"yanchor":"middle","ypad":10},"colorscale":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"connectgaps":false,"dx":1,"dy":1,"hoverinfo":"x+y+z+text","hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hoverongaps":true,"hovertemplate":"","index":0,"legendgroup":"","name":"trace 0","opacity":1,"reversescale":false,"showlegend":false,"showscale":true,"transpose":false,"type":"heatmap","uid":"data0","visible":true,"x0":0,"xaxis":"x","xcalendar":"gregorian","xgap":0,"y0":0,"yaxis":"y","ycalendar":"gregorian","ygap":0,"z":[[1,20,30],[20,1,60],[30,60,1]],"zauto":true,"zhoverformat":"","zmax":60,"zmin":1,"zsmooth":false}],"layout":{"annotations":[],"autosize":false,"calendar":"gregorian","clickmode":"event","colorscale":{"diverging":[[0,"rgb(5,10,172)"],[0.35,"rgb(106,137,247)"],[0.5,"rgb(190,190,190)"],[0.6,"rgb(220,170,132)"],[0.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],"sequential":[[0,"rgb(220,220,220)"],[0.2,"rgb(245,195,157)"],[0.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],"sequentialminus":[[0,"rgb(5,10,172)"],[0.35,"rgb(40,60,190)"],[0.5,"rgb(70,100,245)"],[0.6,"rgb(90,120,245)"],[0.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]]},"colorway":["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],"dragmode":"zoom","font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"height":500,"hidesources":false,"hoverdistance":20,"hoverlabel":{"align":"auto","font":{"family":"Arial, sans-serif","size":13},"namelength":15},"hovermode":"x","images":[],"margin":{"autoexpand":true,"b":80,"l":80,"pad":0,"r":80,"t":100},"modebar":{"activecolor":"rgba(68, 68, 68, 0.7)","bgcolor":"rgba(255, 255, 255, 0.5)","color":"rgba(68, 68, 68, 0.3)","orientation":"h"},"paper_bgcolor":"#fff","plot_bgcolor":"#fff","separators":".,","shapes":[],"showlegend":false,"sliders":[],"spikedistance":20,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":17},"pad":{"b":0,"l":0,"r":0,"t":0},"text":"Click to enter Plot title","x":0.5,"xanchor":"auto","xref":"container","y":"auto","yanchor":"auto","yref":"container"},"uniformtext":{"mode":false},"updatemenus":[],"width":700,"xaxis":{"anchor":"y","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"center","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"bottom","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter X axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1},"yaxis":{"anchor":"x","automargin":false,"autorange":true,"color":"#444","constrain":"range","constraintoward":"middle","domain":[0,1],"dtick":0.5,"exponentformat":"B","fixedrange":false,"gridcolor":"rgb(238, 238, 238)","gridwidth":1,"hoverformat":"","layer":"above traces","mirror":false,"nticks":0,"range":[-0.5,2.5],"rangemode":"normal","separatethousands":false,"showexponent":"all","showgrid":true,"showline":false,"showspikes":false,"showticklabels":true,"side":"left","tick0":0,"tickangle":"auto","tickcolor":"#444","tickfont":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":12},"tickformat":"","ticklen":5,"tickmode":"auto","tickprefix":"","ticks":"outside","ticksuffix":"","tickwidth":1,"title":{"font":{"color":"#444","family":"\"Open Sans\", verdana, arial, sans-serif","size":14},"text":"Click to enter Y axis title"},"type":"linear","visible":true,"zeroline":true,"zerolinecolor":"#444","zerolinewidth":1}},"frames":[],"config":{"autosizable":false,"displayModeBar":false,"displaylogo":true,"doubleClick":false,"doubleClickDelay":300,"editable":false,"edits":{},"fillFrame":false,"frameMargins":0,"globalTransforms":[],"linkText":"Edit chart","locale":"en-US","locales":{},"logging":1,"mapboxAccessToken":null,"modeBarButtons":false,"modeBarButtonsToAdd":[],"modeBarButtonsToRemove":[],"notifyOnLogging":0,"plotGlPixelRatio":2.5,"plotlyServerURL":"","queueLength":0,"responsive":false,"scrollZoom":false,"sendData":true,"setBackground":"_function","showAxisDragHandles":true,"showAxisRangeEntryBoxes":true,"showEditInChartStudio":false,"showLink":false,"showSendToCloud":false,"showSources":false,"showTips":false,"staticPlot":true,"toImageButtonOptions":{},"topojsonURL":"https://cdn.plot.ly/","watermark":false},"version":"1.53.0"}
Binary file modifiedtest/image/baselines/geo_choropleth-usa.emf
Binary file not shown.
Loading