javascript - Problems while displaying nvd3 pieChart in a pop up window? -


i opening nvd3 piechart in popup window. create popup window this:

function openpopup(html,pos,style) {     var newwindow = window.open('');     newwindow.document.write(html);     return newwindow; }  function openchartpopup(chartid,charttitle) {     divid = "div" + chartid;     html = "<p>"+charttitle+"</p><div  id= \""+divid+"\"><svg id=\""+chartid+"\"></svg></div>";     newwindow = openpopup(html,"_blank","");     return d3.select(newwindow.document.getelementbyid(chartid)); } 

then create piechart using following code:

de_select = openchartpopup("test_chart","test chart");     var chart = nv.models.piechart()       .x(function(d) { return d.label })       .y(function(d) { return d.value })       .showlabels(true)       .growonhover(true);     de_select.datum(exampledata());     de_select.style({"width":"400px", "height":"500px"});     de_select.transition().duration(350);     de_select.call(chart);     nv.addgraph(chart); 

i execute above code on button click opens chart in pop doesn't appear correctly , looks this: enter image description here

when switch tabs , focus on pop window again appears correctly as: enter image description here

however, chart properties still doesn't work fine, example "growonhover" same code works fine when display chart in normal html page instead of popup, guess has popup window, problem nvd3,? can point out issue ?

try this:

nv.utils.windowresize(chart.update); 

this update chart when window resized. may happen in case of popup window.

i not sure how open popup window. use

newwindow = window.open("",title, "width=400,height=500"); newwindow.document.write(html); 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -