protovis

Loading a javascript library in javax.script?

I want to run Protovis javascript from Java and get the evaluated SVG code. I am using javax.script.* to run the Javascript: public static void EvalScript() throws Exception { ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("JavaScript"); Object result = engine.eval("va...

Using javax.script or Rhino to run javascript in Java with browser context (e.g. envjs)?

I am trying to run Protovis javascript from a Java program using javax.script: ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("JavaScript"); engine.eval(new java.io.FileReader("protovis-d3.1.js")); In order to run this, the JavaScript engine needs to have all the context of a web...

Accessing value attribute in Protovis lines

I'm using Protovis Arc layout and I'd like to color links between nodes accoriding to the 'value' property defined in dataset. How can I access it? Dataset is defined like that: Nodes: ... {nodeName:"Books"} ... Links: ... {source:1, target:4, value:20} ... arc.link.add(pv.Line).strokeStyle(function(d) d.value > 10 ? "#cc0000" : "#eee...

protovis unable to display a function

Hello, When I plot a function y=f(x) with pv.Dot, everythings works well whereas when I replace pv.Dot by pv.Line, it doesn't display anything anymore. (when I comment the .bottom function, it draws a straight horizontal line) Where does the error may come from? Thanks for helping me ...

Has anyone got the cars example in protovis download example working?

I tried to deploy and run it. I see only vertical bars but no horizontal lines that I can select as it is http://vis.stanford.edu/protovis/ex/cars.html ...

Trigger resize event on print

I have a div in which I create a chart using protovis. The div has width: 100% and height: 100% and the code to create the chart uses $('#chart').width() and $('#chart').height() to get the size of the div at render time and fill the page with the chart. I capture the resize event on the window and adjust the div and the chart so that ...

Javascript: array.forEach() sometimes not working

Hi, this is my code snippet, where the program doesn't enter the foreach loop: var ct = new Array(); ct["me"]= {"name" : "Jakub"}; ct["you"]= {"name" : "stack"}; ct.forEach(function (c){ document.getElementById("tmp").appendChild(document.createTextNode(c)); }); When I change the array indices from strings ("me", "you") to integer...

Using Protovis with Django

Hi, I am trying to get Protovis working in my Django site. Here is my sample code: <html> <head> <script type="text/javascript" src="protovis-r3.2.js"></script> </head> <body> <script type="text/javascript+protovis"> new pv.Panel().width(150).height(150).anchor("center") .add(pv.Label) ...

Giving non-leaf nodes data/values in protovis

My data looks similar to this: var root = { node1: { node2: 4, node3: 2 }, node4: { node5: 3 } }; Which is similar to how they suggest the data be laid out for tree structures in their examples. My question is this: how would I give values to node1 and node4? Thanks. ...

Handling multiple data objects in Protovis (javascript info visualization)

I am extremely frustrated with trying to prune and hand over to Protovis a set of arrays only containing numbers from a set of data objects that looks something like below to draw up three separate pie charts (pv.Wedge) for each object... myData = [{dept:"Accounting",sal:90000,equ:10000,trvl:267,extra:5000}, {dept:"Sales",...

How do I animate a protovis streamgraph?

I'm having trouble figuring out how to animate a protovis streamgraph. I think the best way is to simply pass an array of i, j indexes to .layers() and have the .x() and .y() functions look up the actual updating values. Is there a simpler way? ...

printing protovis output (programmatically)

Dear all, I'm pondering switching to protovis for visualizations. One thing that keeps me skeptical however - since protovis creates its output as a div in a browser, I wonder if there is any at least semi-automatic way for me to create a bunch of images at once without opening each one and pressing "print" manually. So the question w...

Logarithmic bar chart using Protovis

var vis = new pv.Panel().canvas('grphLangSpeakers').height(langCount*(barWidth+barGap)).width(canvasWidth) .add(pv.Bar) .data(popCountArray) .bottom(0).width(function(d){ return d}) .height(barWidth) .top(function() {return this.index * (barGap+barWidth)}); vis.render(); I'm using above code to generate a Bar Chart...

Adding Zoom & Pan for Protovis Dot Chart with GeoScale

var w = 810, h = 400, mapMargin = 30; geo = pv.Geo.scale().range(w, h); var vis = new pv.Panel() .width(w) .height(h) .top(50) .bottom(30) .def("i", -1); var dot = vis.add(pv.Dot) .data(geoPopList) .left(function(d) {return geo(d.center).x}) .top(function(d) {return geo(d.center).y}) .radiu...