globes
A really cool visualization!
- awesome visualization
- moves and updates
- shows values
// this is some sample code
alert("foobar");
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <head> | |
| <style> | |
| .title { | |
| display: inline-block; | |
| font-size: 48px; | |
| line-height: 90px; | |
| text-align: center; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <script src="http://d3js.org/d3.v3.min.js"></script> | |
| <script src="http://d3js.org/topojson.v0.min.js"></script> | |
| <script> | |
| var diameter = 960 / 3, | |
| radius = diameter >> 1, | |
| velocity = .01, | |
| then = Date.now(); | |
| var projection = d3.geo.orthographic() | |
| .scale(radius - 2) | |
| .translate([radius, radius]) | |
| .clipAngle(90) | |
| .precision(0); | |
| d3.select("body").selectAll(".title") | |
| .data(["a", "b", "c"]) | |
| .enter().append("div") | |
| .attr("class", "title") | |
| .style("width", diameter + "px") | |
| .text(function(d) { return d; }); | |
| var canvas = d3.select("body").selectAll("canvas") | |
| .data(d3.range(3)) | |
| .enter().append("canvas") | |
| .attr("width", diameter) | |
| .attr("height", diameter); | |
| var path = d3.geo.path() | |
| .projection(projection); | |
| d3.json("foo.json", function(error, world) { | |
| var land = topojson.object(world, world.objects.land), | |
| globe = {type: "Sphere"}; | |
| d3.timer(function() { | |
| var angle = velocity * (Date.now() - then); | |
| canvas.each(function(i) { | |
| var rotate = [0, 0, 0], context = this.getContext("2d"); | |
| rotate[i] = angle, projection.rotate(rotate); | |
| context.clearRect(0, 0, diameter, diameter); | |
| context.beginPath(), path.context(context)(land), context.fill(); | |
| context.beginPath(), path(globe), context.stroke(); | |
| }); | |
| }); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
| $(document).ready(function() { | |
| chart_id = "chart-" + (new Date).getTime(); | |
| $terminal.print($('<div style="height: 300px; width: 800; border: none;" id="'+chart_id+'"></div>')); | |
| (function basic_bubble(container) { | |
| var | |
| d1 = [], | |
| d2 = [], | |
| point, graph, i; | |
| for (i = 0; i < 10; i++ ){ | |
| point = [i, Math.ceil(Math.random()*10), Math.ceil(Math.random()*10)]; | |
| d1.push(point); | |
| point = [i, Math.ceil(Math.random()*10), Math.ceil(Math.random()*10)]; | |
| d2.push(point); | |
| } | |
| // Draw the graph | |
| graph = Flotr.draw(container, [d1, d2], { | |
| bubbles : { show : true, baseRadius : 5 }, | |
| xaxis : { min : -4, max : 14 }, | |
| yaxis : { min : -4, max : 14 } | |
| }); | |
| })(document.getElementById(chart_id)); | |
| }); |
| name: Globes | |
| author: kordless | |
| description: A set of three globes rotating | |
| command: globes | |
| externals: | |
| - http://d3js.org/d3.v2.js | |
| parameters: | |
| shape: | |
| required: True | |
| color: | |
| required: False | |
| default: "red" | |
| variables: | |
| height: 200 | |
| width: 200 | |
| title: "My Chart" | |
| data: [50,60,80,90,110,110,80,20] |