EzDevInfo.com

d3plus

A javascript library that extends D3.js to enable fast and beautiful visualizations.

Displaying properties of edges in d3.js network using d3plus.js

Is there a way to get the properties of the edges displayed in the tooltip by configuring d3plus network? I have tried with the example described here with no success http://d3plus.org/workshops/11_29_2013/network/


Source: (StackOverflow)

How to change tooltip format in d3plus tree maps

How can I get rid of the labels (on the left) in a tooltip so that just the text on the right appears across the entire width of the tooltip?


Source: (StackOverflow)

Advertisements

How to change treemap ordering in D3plus

Is it possible to change ordering of tree map layout in d3plus. As far as I see its size based in default, however I want custom ordering according to name of rectangle elements in tree map. I tried the code below but doesn't work.

.order({'value':['rectname','rectid']})

Here is my fiddle. http://jsfiddle.net/kasimsert/wLvpph35/11/


Source: (StackOverflow)

Add notes to columns bar chart

I'm creating vertical bar chart using html & javascript with d3plus script. I'm trying to add notes to bar chart columns, which will show its name and value, but i have no idea how to do it.

Is it possible? Thank you for your attention and help


Source: (StackOverflow)

How to cuxtmoize d3plus box plot?

How do I use timeline for a string instead of year? How to change the layout of details pane which appears when hovering over a box? I want to add my own set of details.

code:

var visualization = d3plus.viz()
.container("#viz")
.data(data)
.type("box")
.id("name")
.x("year")
.y("value")
.time("year")

screenshot http://postimg.org/image/6bf5oml0r/


Source: (StackOverflow)

How to inject D3 & D3plus together in Angular webapp?

I am trying to include d3Plus sample code (http://d3plus.org/examples/basic/32517cfde67270c99092/) in my webapp based on angular.

The skeleton code:

angular.module('UI', ['UI.controllers', 'UI.directives']);
angular.module('d3Plus', ['d3']);
angular.module('d3', []);
angular.module('UI.controllers', []);
angular.module('UI.directives', ['d3Plus']);

angular.module('d3').factory('d3',[function(){ 
    var d3;    
    d3=minimized/code/of/d3.js
    return d3;
}]) ;

angular.module('d3Plus').factory('d3Plus',['d3', function(){ 
    var d3Plus;    
    d3Plus=minimized/code/of/d3Plus.js
    return d3Plus;
}]) ;


angular.module('UI.directives').directive('d3Bars', ['d3', function(d3) {....}])
angular.module('UI.directives').directive('d3plusMap', ['d3Plus', function(d3) {....}])

Error: When I try custom-tag (directive created using d3Plus), I get following error in my console: ReferenceError: d3 is not defined in angular.js line: 11496

Any help?

Edit 1: The d3 based tag - d3-bars works fine.


Source: (StackOverflow)

Problems using json recursive in treemap using D3PLUS

I'm using the D3PlUS JS library (http://d3plus.org/) and I need to implement a treemap chart with a json recursive structure. I could just to do a first level treemap chart, but I couldn't do mack my code to be multilevel.

example.json

[
    {
        "id":"First cell",
        "value": 10,
        "child": 
        [ 
            {
                "id":"Child first cel",
                "value": 10,
                "child":[]
            }
        ]
    },

    {
        "id":"Second cell",
        "value": 90,
        "child": 
        [ 
            {
                "id":"Child second cell 1",
                "value": 10,
                "child":[]
            },
            {
                "id":"Child second cell 2",
                "value": 20,
                "child":[]
            },{
                "id":"Child second cell 3",
                "value": 10,
                "child":[]
            }
        ]
    } 
]

<!doctype html>
<meta charset="utf-8">

<link rel='nofollow' href="http://d3plus.org/css/d3plus.css" media="screen" rel="stylesheet" type="text/css" />
<script src="http://d3plus.org/js/d3.js"></script>
<script src="http://d3plus.org/js/d3.geo.tile.js"></script>
<script src="http://d3plus.org/js/topojson.js"></script>
<script src="http://d3plus.org/js/modernizr.js"></script>
<script src="http://d3plus.org/js/d3plus.js"></script>

<!-- create container element for visualization -->
<div id="viz"></div>

<script>

  // instantiate d3plus
  var visualization = d3plus.viz()
    .container("#viz")  // container DIV to hold the visualization
    .data("data/exemple.json")
    .type("tree_map")   // visualization type
    .id("id")         // key for which our data is unique on
    .size("value")      // sizing of blocks
    .draw()             // finally, draw the visualization!

</script>

Anybody can help me?


Source: (StackOverflow)

D3 scale how to put only the minimum and the max number on the scale

Creating the scale:

headers.forEach(function(d) {
            // Coerce values to numbers.
            jsonObj.forEach(function(p) {
                y[d] = d3.scale.linear().domain(
                        d3.extent(jsonObj, function(p) {
                            return +p[d] || 0;
                        })).range([ h, 0 ]);
                y[d].brush = d3.svg.brush().y(y[d]).on("brush", brush);
            });
        }); 



g.append("svg:g").attr("class", "axis").each(function(d) {
            d3.select(this).call(axis.scale(y[d]));

the Scale is comming [0.0,0.1,0.2,...,1.0]

I want something like this [0,1].

It's possible? How can I do this?


Source: (StackOverflow)

D3Plus - How to add labels to bar chart?

I am drawing a simple bar chart using d3Plus. CodePen includes simple example code from the d3Plus webpage. The following code

  var visualization = d3plus.viz()
    .container("#viz")
    .data(data)
    .type("bar")
    .id("name")
    .x("year")
    .y("value")
    .draw()

Yields:

enter image description here

How can labels be added to each bar? I would like each bar to be labeled with its value.

EDIT: Not yet available https://github.com/alexandersimoes/d3plus/issues/354


Source: (StackOverflow)

D3 scale how to remove the text of the scales and preserve the scale and maintain the max and the minimun

Creating the scale:

   headers.forEach(function(d) {
                // Coerce values to numbers.
                jsonObj.forEach(function(p) {
                    y[d] = d3.scale.linear().domain(
                            d3.extent(jsonObj, function(p) {
                                return +p[d] || 0;
                            })).range([ h, 0 ]);
                    y[d].brush = d3.svg.brush().y(y[d]).on("brush", brush);
                });
            }); 



g.append("svg:g").attr("class", "axis").each(function(d) {
            d3.select(this).call(axis.scale(y[d]));

I would like to preserve the - of the scale.

the Scale is comming [0.0,0.1,0.2,...,1.0]

I want something like this [0,-,-,-,-,-,-,-,-,-,1].

It's possible? How can I do this?


Source: (StackOverflow)

D3plus options having no effect on chart

I originally posted this on the D3plus Google group but haven't recieved any response, so seeing if anyone here knows anything.

I've created a Treemap using D3plus and would like to edit the tooltip. I'd like to add a % suffix to one of the values and I'd like to remove the 'share' line altogether. I'd also like to change the global font size.

Here are the variables I've added...

var visualization = d3plus.viz()
.container("#viz")
.data(sample_data)
.type("tree_map")
.id("name")
.size("value")
.font( {"size":10 } )//to change font size
.color("growth")
.format({

  "number": function(number, key) {

    var formatted = d3plus.number.format(number, key)

    if (key === "growth") {
      return formatted + " %"
    }
    else {
      return formatted
    }

  }
}) // to add prefix
.draw()


});

They seem to have no effect whatsoever

Here is a link to my chart... http://thetally.efinancialnews.com/tallyassets/pensions2/index.html Maybe I've made a mistake in the order I call the code or something but I'm really stuck,

Thanks in advance for any ideas


Source: (StackOverflow)

Why it does not showing the year value .in D3plus scatter?

I am using D3plus for data visualization . but in the x axis wrong data is showing instead of what i wrote in .x("year") to show .

http://jsfiddle.net/MituVinci/a77kz0dr/

enter code here

var visualization = d3plus.viz() .container("#viz") // container DIV to hold the visualization .data(sample_data) // data to use with the visualization .type("scatter") // visualization type .id("Reason") // key for which our data is unique on .x("year") // key for x-axis .y("Female") // key for y-axis .draw()

I also want to resize the width and height of this and also want to show it using an external json file how can i do it ?


Source: (StackOverflow)

How to customize d3plus large tooltip

I am making a visualisation with d3plus.here is my fiddle.http://jsfiddle.net/kasimsert/wLvpph35/11/ I want to make some basic custom processing over elements like tooltips, rectangles etc.However I could not find a way to do it with d3 selectors.As far as I see problem is when selector function works this elements are not there. For this I have added onLoad function to html body but no change. My question is when in the code flow I should call such code blocks in order to take effect?

d3.select(".d3plus_tooltip_container")
    .style("background-color", 'red');

Source: (StackOverflow)

How to resize large tooltip in D3Plus

I am using tree maps in d3plus and set its large tooltip property with .html key like below.

            .tooltip({
            "share":false,
            "html" : "Summary information about the Service, and may be some links to the external applications"
        })

However in my case it seems much bigger than necessary, as shown below. Is there a ways to resize it ?

d3plus large tooltip


Source: (StackOverflow)

Change network chart dynamically with d3plus.js

I'm working now on visualization of some networks using D3plus library. What I want to do is to show different networks depending on the key of the object, e.g. year. There is a working example with tree_map chart. But I couldn't implement the same for network.

Here is my code:

<!doctype html>
<meta charset="utf-8">

<script src="http://www.d3plus.org/js/d3.js"></script>
<script src="http://www.d3plus.org/js/d3plus.js"></script>

<div id="viz"></div>

<script>
  var sample_data = [
    {"name": "point1", "year": 1994},
    {"name": "point2", "year": 1994},
    {"name": "point3", "year": 1994},
    {"name": "point4", "year": 1994},
    {"name": "point5", "year": 1994},
    {"name": "point6", "year": 1994},
    {"name": "point7", "year": 1994},
    {"name": "point8", "year": 1994},
    {"name": "point9", "year": 1994},
    {"name": "point10", "year": 1994},
    {"name": "point11", "year": 1994},
    {"name": "point12", "year": 1995}
  ]

  var positions = [
    {"name": "point1", "x": 3, "y": 7},
    {"name": "point2", "x": 2, "y": 6},
    {"name": "point3", "x": 4, "y": 6},
    {"name": "point4", "x": 1, "y": 5.5},
    {"name": "point5", "x": 5, "y": 5.5},
    {"name": "point6", "x": 2, "y": 4},
    {"name": "point7", "x": 4, "y": 4},
    {"name": "point8", "x": 1, "y": 3},
    {"name": "point9", "x": 5, "y": 3},
    {"name": "point10", "x": 2, "y": 1.5},
    {"name": "point11", "x": 4, "y": 1.5},
    {"name": "point12", "x": 2, "y": 7}
  ]

  var connections = []

  var visualization = d3plus.viz()
    .container("#viz")
    .type("network")
    .data(sample_data)   
    .nodes(positions)
    .edges(connections)
    .id("name")
    .time({"value": "year", "solo": 1994})
    .draw()

</script>

I need to show different nodes on click at the timeline, so that by choosing 1995 only "point12" node should be shown.

JSBin example

NOTE: what I have found also is an opened issue, but maybe this functionality was already implemented since that time.


Source: (StackOverflow)