Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter pboes

    (@pboes)

    A specific example:
    query Querying “http://localhost/mysite/?json=get_page_index&include=title,type” gives

    {
    “status”: “ok”,
    “pages”: [
    {
    “id”: 42,
    “type”: “page”,
    “title”: “Home”,
    “children”: []
    },
    {
    “id”: 58,
    “type”: “page”,
    “title”: “Edit Post”,
    “children”: []
    },
    {
    “id”: 62,
    “type”: “page”,
    “title”: “Dashboard”,
    “children”: []
    }

    etc…

    The file is supposed to work in this code:

    d3.json(“json-url”, function(error, root) {
    var nodes = tree.nodes(root),
    links = tree.links(nodes);

    var link = svg.selectAll(“.link”)
    .data(links)
    .enter().append(“path”)
    .attr(“class”, “link”)
    .attr(“d”, diagonal);
    ….etc….
    node.append(“text”)
    .attr(“dy”, “.31em”)
    .attr(“text-anchor”, function(d) { return d.x < 180 ? “start” : “end”; })
    .attr(“transform”, function(d) { return d.x < 180 ? “translate(8)” : “rotate(180)translate(-8)”; })
    .text(function(d) { return d.title; });

    etc…
    So I would either have to get the plugin give me an output of the form

    {
    “title”: “foo”,
    “children”: [
    {
    “id”: 42,
    “type”: “page”,
    “title”: “Home”,
    “children”: []
    },
    {
    “id”: 58,
    “type”: “page”,
    “title”: “Edit Post”,
    “children”: []
    },

    or get the d3.json-function to query not from the root…hope this helps

Viewing 1 replies (of 1 total)