san
Posts: 0
Joined: Sun Jul 05, 2015 2:37 pm

d3.js/SVG run on load in start page vs navigate to page

Hello,

I am using d3.js to create SVG animation. The javascript(below) is setup to run on page load of svg page. If initial app start page is set to the svg page, everything works perfectly. However, if the start page is set to my login screen, and then I navigate to svg page via menu select, the elements are not showing up. I used both load, and page show events.

Below is the code I am trying to run on load of svg page:

$('td[name="mobilegridcell_8"]').append('');
var svgtest=d3.select("#Testsvg")
.append("svg:svg")
.attr("width", 162)
.attr("height", 158);

var rect = svgtest.append("path")
.attr("d", rightRoundedRect(50, 0, 80, 160, 10))
.attr("fill", "#fff");

function rightRoundedRect(x, y, width, height, radius) {
return "M" + x + "," + y
+ "h" + (width - radius)
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius
+ "v" + (height - 2 * radius)
+ "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + radius
+ "h" + (radius - width)
+ "a" + -radius + "," + -radius + " 0 0 1 " + -radius + "," + -radius

  • "v" + -(height - 2 * radius)
    • "a" + -radius + "," + radius + " 0 0 1 " + radius + "," + -radius;
      }
Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

d3.js/SVG run on load in start page vs navigate to page

Hello,

Please use "page show" event instead of "load" event for that

san
Posts: 0
Joined: Sun Jul 05, 2015 2:37 pm

d3.js/SVG run on load in start page vs navigate to page

Thanks for your reply. I tried page show as well, and I am still not seeing any svg elements. If I change the app start page to the svg page, I can see everything.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

d3.js/SVG run on load in start page vs navigate to page

Could you check are there any errors in console? This (http://devcenter.appery.io/documentat...) should help.

Return to “Issues”