Page 1 of 1

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

Posted: Sat Oct 10, 2015 2:56 pm
by san

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;
      }

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

Posted: Sat Oct 10, 2015 3:28 pm
by Serhii Kulibaba

Hello,

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


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

Posted: Sat Oct 10, 2015 8:48 pm
by san

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.


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

Posted: Sun Oct 11, 2015 6:00 pm
by Serhii Kulibaba

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