2

Hi im trying to use deployd-template https://bitbucket.org/leozero/dpd-template/

I have set all up as it says and also install'ed ejs

but when i run dpd.template.post.... i get this console error and deployd crash

  C:\Program Files (x86)\Deployd\node_modules\deployd\node_modules\doh\lib\handler
.js:42
      req.resume(); // fixes pause causing requests to timeout
          ^
TypeError: Object #<Object> has no method 'resume'
    at C:\Program Files (x86)\Deployd\node_modules\deployd\node_modules\doh\lib\
handler.js:42:11
    at Handler.respond (C:\Program Files (x86)\Deployd\node_modules\deployd\node
_modules\doh\lib\respond.js:61:15)
    at Domain.<anonymous> (C:\Program Files (x86)\Deployd\node_modules\deployd\n
ode_modules\doh\lib\handler.js:37:13)
    at Domain.emit (events.js:95:17)
    at process._fatalException (node.js:255:29)

If i run a template file without ejs code eg.

<%= data %>

it out puts the template, but as soon as i add ejs code to templete it craches


d3.js Prevent `rotate` property from parent group

I want to prevent the text from accessing the rotate property from parent node, how can I do that?

here is the demo:

// largely based on http://bl.ocks.org/4063550

// some made-up data
var data = [3,3,3,3,3,3,3,3];

// tree-ify our fake data
var dataTree = {
    children: data.map(function(d) { return { size: d }; })
};

// basic settings
var w = 400,
    m = 20,
    maxRadius = 40,
    padding = 10;


// size scale for data
var radiusScale = d3.scale.sqrt()
    .domain([0, d3.max(data)])
    .range([0, maxRadius]);

// determine the appropriate radius for the circle
var roughCircumference = d3.sum(data.map(radiusScale)) * 2 +
        padding * (data.length - 1),
    radius = roughCircumference / (Math.PI * 2);

// make a radial tree layout
var tree = d3.layout.tree()
    .size([360, radius])
    .separation(function(a, b) {
        return radiusScale(a.size) + radiusScale(b.size);
    });

// make the svg
var svg = d3.select("body").append("svg")
    .attr("width", w + m * 2)
    .attr("height", w + m * 2)
  .append("g")
    .attr("transform", "translate(" + (w / 2 + m) + "," + (w / 2 + m) + ")");

// apply the layout to the data
var nodes = tree.nodes(dataTree);

// create dom elements for the node
var node = svg.selectAll(".node")
      .data(nodes.slice(1)) // cut out the root node, we don't need it
    .enter().append("g")
      .attr("class", "node")
      .attr("transform", function(d) {
          return "rotate(" + (d.x - 90) + ") translate(" + d.y + ")";
      })

node.append("circle")
    .attr("r", function(d) { return radiusScale(d.size); });
node.append("text")
.attr("transform", function(d) {
         return "rotate(" + (2 * d.x) + ")";
      })
.text("testing a word");
circle {
   fill: steelblue;
   stroke: black;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>

4

0 回答 0