Skip to content

Static Image Export in plotly.js does not work for polar charts #1654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dugagjin opened this issue May 8, 2017 · 1 comment
Closed

Static Image Export in plotly.js does not work for polar charts #1654

dugagjin opened this issue May 8, 2017 · 1 comment
Milestone

Comments

@dugagjin
Copy link

dugagjin commented May 8, 2017

Hi,

The code here

var d3 = Plotly.d3;
var img_jpg= d3.select('#jpg-export');
// Ploting the Graph
var trace={x:[3,9,8,10,4,6,5],y:[5,7,6,7,8,9,8],type:"scatter"};
var trace1={x:[3,4,1,6,8,9,5],y:[4,2,5,2,1,7,3],type:"scatter"};
var data = [trace,trace1];
var layout = {title : "Simple Javascript Graph"};
Plotly.plot(
  'plotly_div',
   data,
   layout)
// static image in jpg format
.then(
    function(gd)
     {
      Plotly.toImage(gd,{height:300,width:300})
         .then(
            function(url)
         {
             img_jpg.attr("src", url);
             return Plotly.toImage(gd,{format:'jpeg',height:400,width:400});
         }
         )
    });

is from Export Javascript plots as jpeg, png,... and it works for line charts.
But if I replace the x with t and y with r (at the trace variables) to make it a polar chart:

var d3 = Plotly.d3;
var img_jpg= d3.select('#jpg-export');
// Ploting the Graph
var trace={t:[3,9,8,10,4,6,5],r:[5,7,6,7,8,9,8],type:"scatter"};
var trace1={t:[3,4,1,6,8,9,5],r:[4,2,5,2,1,7,3],type:"scatter"};
var data = [trace,trace1];
var layout = {title : "Simple Javascript Graph"};
Plotly.plot(
  'plotly_div',
   data,
   layout)
// static image in jpg format
.then(
    function(gd)
     {
      Plotly.toImage(gd,{height:300,width:300})
         .then(
            function(url)
         {
             img_jpg.attr("src", url);
             return Plotly.toImage(gd,{format:'jpeg',height:400,width:400});
         }
         )
    });

then I don't get the exported image but I get the following error:

plotly-latest.min.js:66 Uncaught (in promise) TypeError: Cannot read property 'framework' of undefined
at e.exports (plotly-latest.min.js:66)
at plotly-latest.min.js:58
at Promise ()
at Object.n [as toImage] (plotly-latest.min.js:58)

You can find a jsfiddle here: https://jsfiddle.net/f87k57nt/ just change the x and y to respectively t and r in order to see the issue. You will see the svg of the polar plot but not the png.

@etpinard etpinard added this to the On-par polar milestone May 8, 2017
@etpinard
Copy link
Contributor

fixed in scatterpolar after #2200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants