1

I am using D3 with a json dataset to render a force directed diagram. The images on the diagram do not save when I save the SVG as a PNG. the images are rendered using a URL passed in the json data. I believe I saw the graphics will not be saved unless they are local. I need to save the graphic files to local storage and then modify my json to point to the correct local url.

I would like to accomplish with jquery and make it part of a function I have in place to strip the time stamp out of the json data. I have tried saving the graphics locally but they are still using the URL from a separate server.

my code so far is below.

//loop thru the json data and remove the time stamp from the DOB
$.each(json.nodes, function (i, item) {
    var myNewDate = new Date(item.DOB);
    item.DOB = (myNewDate.getMonth() + 1) + "/" + (myNewDate.getDate() + 1) + "/" + myNewDate.getFullYear();
    //alert(item.ImageURL);  next lines place the images in a div 
    img.src = item.ImageURL;
    img.setAttribute("name", item.SubjectId)
    img.setAttribute("alt", item.SubjectId);
    document.getElementById("img-container").appendChild(img);
});

new to the jquery language so any help would be great

Pery

Perry
  • 1,057
  • 2
  • 13
  • 32
  • This might help point you in the right direction: http://stackoverflow.com/a/19159094/698454 -- Unless by "local storage" you mean your server? – Subtlebot Aug 13 '15 at 17:43
  • Yes I meant to save them to a folder on the server so I could then change the URL in the json data to reflect the local files. I like the example in the link you provided but I don't think I can write to a folder using jquery. is my assumption correct? – Perry Aug 13 '15 at 17:55

0 Answers0