Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sasiparupudi1
Master III
Master III

object doesn't support method or property datum error while trying to view d3js treemap in webview

I am trying to implement a treemap objectextension in qlikview but keep on getting the error

object doesn't support method or property datum. Has anyone encountered this error before? if yes how may I get around with it?

The sample is code is taken from d3js.org website. In qlikview ,I am using a hirerachy load and converting the table data into a json string to pass it into the following script(not shown here).

var treemap = d3.layout.treemap()

    .size([width, height])

    .sticky(true)

    .value(function(d) { return d.size; });

   

   

    var div = d3.select("#"+_this.ExtSettings.UniqueId).append("div")

    .style("position", "relative")

    .style("width", (width + margin.left + margin.right) + "px")

    .style("height", (height + margin.top + margin.bottom) + "px")

    .style("left", margin.left + "px")

    .style("top", margin.top + "px");

    

    alert(jsontree);

    

   

   // .value(function(d) { return d.size; });

    //alert(data);

d3.json("flare.json", function(error, root) {

  if (error) throw error;

   

    var node = div.datum(root).selectAll(".node")

      .data(treemap.nodes)

    .enter().append("div")

      .attr("class", "node")

      .call(position)

      .style("background", function(d) { return d.children ? color(d.name) : null; })

      .text(function(d) { return d.children ? null : d.name; });

  d3.selectAll("input").on("change", function change() {

    var value = this.value === "count"

        ? function() { return 1; }

        : function(d) { return d.size; };

    node

        .data(treemap.value(value).nodes)

      .transition()

        .duration(1500)

        .call(position);

  });

  });

        });

function position() {

   

  this.style("left", function(d) { return d.x + "px"; })

      .style("top", function(d) { return d.y + "px"; })

      .style("width", function(d) { return Math.max(0, d.dx - 1) + "px"; })

      .style("height", function(d) { return Math.max(0, d.dy - 1) + "px"; });

};

1 Reply
sasiparupudi1
Master III
Master III
Author

Hi Guys

Any update for me please?

Thanks

Sasi