<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic what would be the  wrapper code for Circle Packing D3 chart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242622#M72166</link>
    <description>&lt;P&gt;The data would be passed from splunk enterprise search. &lt;BR /&gt;
I am following this tutorial &lt;BR /&gt;
&lt;A href="http://dev.splunk.com/view/SP-CAAAE2X#UIandvisualization+"&gt;http://dev.splunk.com/view/SP-CAAAE2X#UIandvisualization&lt;/A&gt; &lt;BR /&gt;
but still Formatdata function is unclear to me with respect to the circle packing chart. Please tell me how can i embed the code given here &lt;BR /&gt;
 &lt;A href="http://bl.ocks.org/mbostock/4063530+"&gt;http://bl.ocks.org/mbostock/4063530&lt;/A&gt; &lt;BR /&gt;
in the formatdata function in wrapper code &lt;A href="http://dev.splunk.com/view/SP-CAAAE2X#UIandvisualizations:whattheappslooklike-Thewrappercode"&gt;here&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;The xml code for the main dashboard is :-&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="autodiscover.js" &amp;gt;

  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
            &amp;lt;h2&amp;gt;Vulnerability Chart&amp;lt;/h2&amp;gt;
            &amp;lt;div id="circle_search" class="splunk-manager" data-require="splunkjs/mvc/searchmanager" 
        data-options='{"search":"| tstats summariesonly=true count from datamodel=Vulnerabilities where Vulnerabilities.dest="10.0.1.4" by Vulnerabilities.signature,Vulnerabilities.severity,Vulnerabilities.vendor_product | join max=0 Vulnerabilities.signature [| tstats summariesonly=true count from datamodel=Vulnerabilities where earliest=-4h@m latest=+0s by Vulnerabilities.signature,Vulnerabilities.dest ] | search Vulnerabilities.severity ="high"  |stats  count(Vulnerabilities.dest) as count  by Vulnerabilities.signature,Vulnerabilities.dest "
    ,
                     "preview": true,
                     "earliest_time": "-1d@d",
                     "latest_time": "@d"
}'&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div id="circle_chart" class="splunk-view" data-require="app/acalvio_app/components/circle_packing/circle_packing" 
        data-options='{
    "managerid": "circle_search",
    "root_label": "Vulnerability"
}'&amp;gt;&amp;lt;/div&amp;gt;

        &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;circle_packing.js code :-&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;define(function(require, exports, module) {
    var _ = require("underscore");
    var d3 = require("../d3/d3");
    var SimpleSplunkView = require("splunkjs/mvc/simplesplunkview");
    require("css!./circle_packing.css");
    var Circle_chart = SimpleSplunkView.extend({
        //className: "splunk-toolkit-chord-chart",
        options: {
            "managerid": null,
            "data": "preview"
        },
        output_mode: "json",
        initialize: function() {
            SimpleSplunkView.prototype.initialize.apply(this, arguments);
        },
        createView: function() {
            this.$el.html('');
         var svg=d3.select(this.el).append("svg")
                                .attr("width", diameter)
                               .attr("height", diameter)
         return { container: this.$el, svg: svg};           
 //return true;
        },
        // Making the data look how we want it to for updateView to do its job
        formatData: function(data) {


var newData = { name :"root", children : [] },
    levels = ["Vulnerabilities.signature"];

// For each data row, loop through the expected levels traversing the output tree
data.forEach(function(d){
    // Keep this as a reference to the current level
    var depthCursor = newData.children;
    // Go down one level at a time
    levels.forEach(function( property, depth ){

        // Look to see if a branch has already been created
        var index;
        depthCursor.forEach(function(child,i){
            if ( d[property] == child.name ) index = i;
        });
        // Add a branch if it isn't there
        if ( isNaN(index) ) {
            depthCursor.push({ name : d[property], children : []});
            index = depthCursor.length - 1;
        }
        // Now reference the new child array as we go deeper into the tree
        depthCursor = depthCursor[index].children;
        // This is a leaf, so add the last element to the specified branch
        if ( depth === levels.length - 1 ) depthCursor.push({ name : d.Vulnerabilities.dest, size : d.count });
    });
});
    return {
        "name": this.settings.get("root_label"),
        "children": data
    };

            //return formatted_data; // this is passed into updateView as 'data'
        },
        updateView: function(viz, data) {

    this.$el.html("");

    var diameter  = 960,
        format = d3.format(",d");


    var pack = d3.layout.pack()
    .size([diameter - 4, diameter - 4])
    .value(function(d) { return d.size; });

var vis = d3.select(this.el).append("svg:svg")
    .attr("width", diameter)
    .attr("height", diameter)
  .append("svg:g")
  .attr("transform", "translate(2,2)");

        }
    });
    return Circle_chart;
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;circle_packing.css&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;circle {
  fill: rgb(31, 119, 180);
  fill-opacity: .25;
  stroke: rgb(31, 119, 180);
  stroke-width: 1px;
}

.leaf circle {
  fill: #ff7f0e;
  fill-opacity: 1;
}

text {
  font: 10px sans-serif;
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;autodiscover.js&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require.config({
    paths: {
        "app": "../app"
    }
});
require(["splunkjs/mvc",'splunkjs/mvc/simplexml/ready!'], function(mvc){
    require(['splunkjs/ready!'], function(){
        // The splunkjs/ready loader script will automatically instantiate all elements
        // declared in the dashboard's HTML.


    });
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have no idea  whether search query result data is incompatible to the flare.json or there's some error in my files . but when i open the dashboard it says "No search set" and no chart appears. Please help me figure this out.&lt;BR /&gt;
Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jan 2016 04:50:28 GMT</pubDate>
    <dc:creator>gitanjali</dc:creator>
    <dc:date>2016-01-25T04:50:28Z</dc:date>
    <item>
      <title>what would be the  wrapper code for Circle Packing D3 chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242622#M72166</link>
      <description>&lt;P&gt;The data would be passed from splunk enterprise search. &lt;BR /&gt;
I am following this tutorial &lt;BR /&gt;
&lt;A href="http://dev.splunk.com/view/SP-CAAAE2X#UIandvisualization+"&gt;http://dev.splunk.com/view/SP-CAAAE2X#UIandvisualization&lt;/A&gt; &lt;BR /&gt;
but still Formatdata function is unclear to me with respect to the circle packing chart. Please tell me how can i embed the code given here &lt;BR /&gt;
 &lt;A href="http://bl.ocks.org/mbostock/4063530+"&gt;http://bl.ocks.org/mbostock/4063530&lt;/A&gt; &lt;BR /&gt;
in the formatdata function in wrapper code &lt;A href="http://dev.splunk.com/view/SP-CAAAE2X#UIandvisualizations:whattheappslooklike-Thewrappercode"&gt;here&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;The xml code for the main dashboard is :-&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="autodiscover.js" &amp;gt;

  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
            &amp;lt;h2&amp;gt;Vulnerability Chart&amp;lt;/h2&amp;gt;
            &amp;lt;div id="circle_search" class="splunk-manager" data-require="splunkjs/mvc/searchmanager" 
        data-options='{"search":"| tstats summariesonly=true count from datamodel=Vulnerabilities where Vulnerabilities.dest="10.0.1.4" by Vulnerabilities.signature,Vulnerabilities.severity,Vulnerabilities.vendor_product | join max=0 Vulnerabilities.signature [| tstats summariesonly=true count from datamodel=Vulnerabilities where earliest=-4h@m latest=+0s by Vulnerabilities.signature,Vulnerabilities.dest ] | search Vulnerabilities.severity ="high"  |stats  count(Vulnerabilities.dest) as count  by Vulnerabilities.signature,Vulnerabilities.dest "
    ,
                     "preview": true,
                     "earliest_time": "-1d@d",
                     "latest_time": "@d"
}'&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div id="circle_chart" class="splunk-view" data-require="app/acalvio_app/components/circle_packing/circle_packing" 
        data-options='{
    "managerid": "circle_search",
    "root_label": "Vulnerability"
}'&amp;gt;&amp;lt;/div&amp;gt;

        &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;circle_packing.js code :-&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;define(function(require, exports, module) {
    var _ = require("underscore");
    var d3 = require("../d3/d3");
    var SimpleSplunkView = require("splunkjs/mvc/simplesplunkview");
    require("css!./circle_packing.css");
    var Circle_chart = SimpleSplunkView.extend({
        //className: "splunk-toolkit-chord-chart",
        options: {
            "managerid": null,
            "data": "preview"
        },
        output_mode: "json",
        initialize: function() {
            SimpleSplunkView.prototype.initialize.apply(this, arguments);
        },
        createView: function() {
            this.$el.html('');
         var svg=d3.select(this.el).append("svg")
                                .attr("width", diameter)
                               .attr("height", diameter)
         return { container: this.$el, svg: svg};           
 //return true;
        },
        // Making the data look how we want it to for updateView to do its job
        formatData: function(data) {


var newData = { name :"root", children : [] },
    levels = ["Vulnerabilities.signature"];

// For each data row, loop through the expected levels traversing the output tree
data.forEach(function(d){
    // Keep this as a reference to the current level
    var depthCursor = newData.children;
    // Go down one level at a time
    levels.forEach(function( property, depth ){

        // Look to see if a branch has already been created
        var index;
        depthCursor.forEach(function(child,i){
            if ( d[property] == child.name ) index = i;
        });
        // Add a branch if it isn't there
        if ( isNaN(index) ) {
            depthCursor.push({ name : d[property], children : []});
            index = depthCursor.length - 1;
        }
        // Now reference the new child array as we go deeper into the tree
        depthCursor = depthCursor[index].children;
        // This is a leaf, so add the last element to the specified branch
        if ( depth === levels.length - 1 ) depthCursor.push({ name : d.Vulnerabilities.dest, size : d.count });
    });
});
    return {
        "name": this.settings.get("root_label"),
        "children": data
    };

            //return formatted_data; // this is passed into updateView as 'data'
        },
        updateView: function(viz, data) {

    this.$el.html("");

    var diameter  = 960,
        format = d3.format(",d");


    var pack = d3.layout.pack()
    .size([diameter - 4, diameter - 4])
    .value(function(d) { return d.size; });

var vis = d3.select(this.el).append("svg:svg")
    .attr("width", diameter)
    .attr("height", diameter)
  .append("svg:g")
  .attr("transform", "translate(2,2)");

        }
    });
    return Circle_chart;
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;circle_packing.css&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;circle {
  fill: rgb(31, 119, 180);
  fill-opacity: .25;
  stroke: rgb(31, 119, 180);
  stroke-width: 1px;
}

.leaf circle {
  fill: #ff7f0e;
  fill-opacity: 1;
}

text {
  font: 10px sans-serif;
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;autodiscover.js&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require.config({
    paths: {
        "app": "../app"
    }
});
require(["splunkjs/mvc",'splunkjs/mvc/simplexml/ready!'], function(mvc){
    require(['splunkjs/ready!'], function(){
        // The splunkjs/ready loader script will automatically instantiate all elements
        // declared in the dashboard's HTML.


    });
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have no idea  whether search query result data is incompatible to the flare.json or there's some error in my files . but when i open the dashboard it says "No search set" and no chart appears. Please help me figure this out.&lt;BR /&gt;
Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 04:50:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242622#M72166</guid>
      <dc:creator>gitanjali</dc:creator>
      <dc:date>2016-01-25T04:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: what would be the  wrapper code for Circle Packing D3 chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242623#M72167</link>
      <description>&lt;P&gt;,&lt;STRONG&gt;Create dashboard xml file&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;label&amp;gt;Circle chart&amp;lt;/label&amp;gt;
&amp;lt;row&amp;gt;
    &amp;lt;html&amp;gt;

        &amp;lt;div align="center" valign="middle" id="custom"
             class="splunk-view"
      data-require="app/&amp;lt;Your_app&amp;gt;/components/circlechart/circlechart"
           '&amp;gt;
        &amp;lt;/div&amp;gt;
     &amp;lt;/html&amp;gt;
&amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then next create app//components/circlechart/circlechart.js file and paste the code given below.&lt;/P&gt;

&lt;P&gt;/*&lt;BR /&gt;
 * Simple TagCloud visualization&lt;BR /&gt;
 * This view is an example for a simple visualization based on search results&lt;BR /&gt;
 */&lt;BR /&gt;
define(function(require, module) {&lt;BR /&gt;
    var _ = require('underscore'), $ = require('jquery');&lt;BR /&gt;
    var d3 = require("../d3.v3.min.js"); // create //d3js.org/d3.v3.min.js inside components folder&lt;BR /&gt;
        var SimpleSplunkView = require('splunkjs/mvc/simplesplunkview');&lt;BR /&gt;
    var Drilldown = require('splunkjs/mvc/drilldown');&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var Circle= SimpleSplunkView.extend({
    moduleId: module.id,
          output_mode: 'json',

          /* Create svg inside the create view*/
     createView: function() {
         this.$el.html('');
        var svg=d3.select(this.el).append("svg")
                               .attr("width", diameter)
                              .attr("height", diameter)
        return { container: this.$el, svg: svg};
    },
    /* result svg append to g tag inside the update view*/
    updateView: function(viz, data) {
        var diameter = 960,
format = d3.format(",d");
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;var pack = d3.layout.pack()&lt;BR /&gt;
    .size([diameter - 4, diameter - 4])&lt;BR /&gt;
    .value(function(d) { return d.size; });&lt;BR /&gt;
viz.svg.&lt;BR /&gt;
  .append("g")&lt;BR /&gt;
    .attr("transform", "translate(2,2)");&lt;/P&gt;

&lt;P&gt;d3.json("./flare.json", function(error, root) {&lt;BR /&gt;
  if (error) throw error;&lt;/P&gt;

&lt;P&gt;var node = svg.datum(root).selectAll(".node")&lt;BR /&gt;
      .data(pack.nodes)&lt;BR /&gt;
    .enter().append("g")&lt;BR /&gt;
      .attr("class", function(d) { return d.children ? "node" : "leaf node"; })&lt;BR /&gt;
      .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });&lt;/P&gt;

&lt;P&gt;node.append("title")&lt;BR /&gt;
      .text(function(d) { return d.name + (d.children ? "" : ": " + format(d.size)); });&lt;/P&gt;

&lt;P&gt;node.append("circle")&lt;BR /&gt;
      .attr("r", function(d) { return d.r; });&lt;/P&gt;

&lt;P&gt;node.filter(function(d) { return !d.children; }).append("text")&lt;BR /&gt;
      .attr("dy", ".3em")&lt;BR /&gt;
      .style("text-anchor", "middle")&lt;BR /&gt;
      .text(function(d) { return d.name.substring(0, d.r / 3); });&lt;BR /&gt;
});&lt;/P&gt;

&lt;P&gt;d3.select(self.frameElement).style("height", diameter + "px");&lt;BR /&gt;
        }&lt;BR /&gt;
    });&lt;BR /&gt;
    return Circle;&lt;BR /&gt;
});&lt;/P&gt;

&lt;P&gt;at last return Circle will display the Circle chart&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 06:54:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242623#M72167</guid>
      <dc:creator>raghu_vedic</dc:creator>
      <dc:date>2016-01-25T06:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: what would be the  wrapper code for Circle Packing D3 chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242624#M72168</link>
      <description>&lt;P&gt;Hi raghu,&lt;BR /&gt;
I've uploaded all the files that I am using for the dashboard. I am still not getting the circle packing chart displayed on the dashboard. Please see the code and help me out with this.&lt;BR /&gt;
Thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 19:08:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242624#M72168</guid>
      <dc:creator>gitanjali</dc:creator>
      <dc:date>2016-01-25T19:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: what would be the  wrapper code for Circle Packing D3 chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242625#M72169</link>
      <description>&lt;P&gt;HI Gitanjali,&lt;/P&gt;

&lt;P&gt;Please try this &lt;STRONG&gt;&lt;A href="http://d3js.org/d3.v3.min.js"&gt;http://d3js.org/d3.v3.min.js&lt;/A&gt;&lt;/STRONG&gt; plugin  download and replace with  d3.js file in the below code. &lt;BR /&gt;
...&lt;BR /&gt;
...&lt;BR /&gt;
 define(function(require, exports, module) {&lt;BR /&gt;
     var _ = require("underscore");&lt;BR /&gt;
     &lt;STRONG&gt;var d3 = require("../d3/d3");&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;This will work. or else please forward data in csv or json through gmail &lt;A href="mailto:raghu.venkat260@gmail.com"&gt;raghu.venkat260@gmail.com&lt;/A&gt; I will try out from myside.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2016 04:39:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242625#M72169</guid>
      <dc:creator>raghuyarramsett</dc:creator>
      <dc:date>2016-01-27T04:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: what would be the  wrapper code for Circle Packing D3 chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242626#M72170</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;/*Chart-cloud visualization
 * This view is an example for a simple visualization based on search results
 */
define(function(require, module) {
    var _ = require('underscore'), $ = require('jquery');
    var d3 = require("../d3/d3.v3.min");
    var SimpleSplunkView = require('splunkjs/mvc/simplesplunkview');
    var Drilldown = require('splunkjs/mvc/drilldown');
  require("css!./circle_packing.css");
    var CircleChart = SimpleSplunkView.extend({
        moduleId: module.id,
        className: 'circlechart-viz',
        options: {

             data: 'preview'
        },
        output_mode: 'json',


       createView: function() {
             this.$el.html('');
           return true;
        },
        formatData: function(data) {
            console.log(data);
                            var newData = { name :"root", children : [] },
                    levels = ["Vulnerabilities.signature","name"];

                // For each data row, loop through the expected levels traversing the output tree
                data.forEach(function(d){
                    // Keep this as a reference to the current level
                    var depthCursor = newData.children;
                    // Go down one level at a time
                    levels.forEach(function( property, depth ){

                        // Look to see if a branch has already been created
                        var index;
                        depthCursor.forEach(function(child,i){

                            if ( d[property] == child.name ) index = i;
                        });

                        // Add a branch if it isn't there
                        if ( isNaN(index)) {
                            depthCursor.push({ name : d[property], children : []});
                            index = depthCursor.length - 1;
                        }
                        // Now reference the new child array as we go deeper into the tree
                        depthCursor = depthCursor[index].children;
                        // This is a leaf, so add the last element to the specified branch
                        if ( depth === levels.length - 1 ) depthCursor.push({ name : d.Vulnerabilities.dest, size : d.count });

                    });
                });

            console.log(newData);
            return newData;
        },
        updateView: function(viz, data) {
                    console.log(data); //please provide the json data  getting from the search query or else convert this ouptut to below data1 json format in formatData propety

var diameter = 500,
    format = d3.format(",d");

var pack = d3.layout.pack()
    .size([diameter - 4, diameter - 4])
    .value(function(d) { return d.size; });

var svg = d3.select(this.el).append("svg")
    .attr("width", diameter)
    .attr("height", diameter)
  .append("g")
    .attr("transform", "translate(2,2)");



  //if (error) throw error;

  var node = svg.datum(data).selectAll(".node")
      .data(pack.nodes)
    .enter().append("g")
      .attr("class", function(d) { return d.children ? "node" : "leaf node"; })
      .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });

  node.append("title")
      .text(function(d) { return d.name + (d.children ? "" : ": " + format(d.size)); });

  node.append("circle")
      .attr("r", function(d) { return d.r; });

  node.filter(function(d) { return !d.children; }).append("text")
      .attr("dy", ".3em")
      .style("text-anchor", "middle")
      .text(function(d) { return d.name.substring(0, d.r / 3); });


d3.select(self.frameElement).style("height", diameter + "px");
    }   
    });
    return CircleChart;
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jan 2016 05:35:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242626#M72170</guid>
      <dc:creator>raghuyarramsett</dc:creator>
      <dc:date>2016-01-28T05:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: what would be the  wrapper code for Circle Packing D3 chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242627#M72171</link>
      <description>&lt;P&gt;So, the error was in circle_packing.js file with formatdata function i.e. the data was not in the proper flare format which is required for circle packing chart. Also there was a little change in the query syntax.&lt;BR /&gt;
Here are the updated files which worked for me.&lt;BR /&gt;
Dashboard Xml file -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form script="autodiscover.js"&amp;gt;
    &amp;lt;row&amp;gt;
       &amp;lt;html&amp;gt;


            &amp;lt;div id="customsearch1"
                 class="splunk-manager"
                 data-require="splunkjs/mvc/searchmanager"
                 data-options='{
                        "search": { "type": "token_safe", "value": "| tstats summariesonly=true count from 
datamodel=Vulnerabilities where Vulnerabilities.dest=\"192.168.1.84\" by Vulnerabilities.signature,Vulnerabilities.severity| join max=0 Vulnerabilities.signature [| tstats summariesonly=true count from datamodel=Vulnerabilities where earliest=-4h@m latest=+0s by Vulnerabilities.signature,Vulnerabilities.dest ] | search Vulnerabilities.severity =\"high\"  |stats  count(Vulnerabilities.dest) as count  by Vulnerabilities.signature,Vulnerabilities.dest 
| rename Vulnerabilities.signature as signature | rename Vulnerabilities.dest as dest" }

                        }'&amp;gt;


            &amp;lt;/div&amp;gt;

            &amp;lt;div align="center" valign="middle" id="custom"
                 class="splunk-view"
          data-require="app/acalvio_app2/components/circle_packing/circle_packing"
                 data-options='{
                        "managerid": "customsearch1"
                    }'&amp;gt;
            &amp;lt;/div&amp;gt;


        &amp;lt;/html&amp;gt;
    &amp;lt;/row&amp;gt;

&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;circle_packing.js -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/*Chart-cloud visualization
 * This view is an example for a simple visualization based on search results
 */
define(function(require, module) {
    var _ = require('underscore');
    var d3 = require("../d3/d3");
    var SimpleSplunkView = require('splunkjs/mvc/simplesplunkview');
    var Drilldown = require('splunkjs/mvc/drilldown');
  require("css!./circle_packing.css");
    var CircleChart = SimpleSplunkView.extend({
        moduleId: module.id,
        className: 'circlechart-viz',
        options: {

             data: 'preview'
        },
        output_mode: 'json',


       createView: function() {
             this.$el.html('');
           return true;
        },
        formatData: function(data) {
            console.log(data);
                            var newData = { name :"", children : [] };


                var map = [];


                for( i in data){

                    var sign = data[i].signature;
                    if(!map[sign]) map[sign] = [];
                     map[sign].push({"dest":data[i].dest,"count":data[i].count});

                }

                for(j in map){
                    var hosts = [];

                    for(k in map[j]){
                        if(map[j][k].count){
                            hosts.push({"name":map[j][k].dest,"size":map[j][k].count});

                        }
                    }
                    if(hosts.length &amp;gt; 0)
                        newData.children.push({"name":j,"children":hosts});

                }



            console.log(newData);
            return newData;
        },
        updateView: function(viz, data) {
                    console.log(data);

var diameter = 500,
    format = d3.format(",d");

var pack = d3.layout.pack()
    .size([diameter - 4, diameter - 4])
    .value(function(d) { return d.size; });

var svg = d3.select(this.el).append("svg")
    .attr("width", diameter)
    .attr("height", diameter)
  .append("g");



  //if (error) throw error;

  var node = svg.datum(data).selectAll(".node")
      .data(pack.nodes)
    .enter().append("g")
      .attr("class", function(d) { return d.children ? "node" : "leaf node"; })
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });

  node.append("title")
      .text(function(d) { return d.name + (d.children ? "" : ": " + format(d.size)); });

  node.append("circle").attr("r", function(d) { return d.r; });

  node.filter(function(d) { return d.depth&amp;gt;0; }).append("text")
      .attr("dy", function(d){
        if(!d.name)
            return "-7em";
    }
)
.attr("dx",function(d){
    if(!d.name) return "3em";
})
      .style("text-anchor", function(d){
        if(!d.name) return "end";
        if(d.depth === 2) return "middle";

        return "start";
    }
)
      .text(function(d) {
        if(d &amp;amp;&amp;amp; d.depth === 2 &amp;amp;&amp;amp; d.name) 
            return "*." + d.name.substring(d.r / 3); 

        if(d.parent)
            return d.parent.name.substring(0,15);


        return d.name;
    });


d3.select(self.frameElement).style("height", diameter + "px");
    }   
    });
    return CircleChart;
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Feb 2016 06:21:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-would-be-the-wrapper-code-for-Circle-Packing-D3-chart/m-p/242627#M72171</guid>
      <dc:creator>gitanjali</dc:creator>
      <dc:date>2016-02-02T06:21:32Z</dc:date>
    </item>
  </channel>
</rss>

