Skip to content

Instantly share code, notes, and snippets.

@domitry
Created August 17, 2014 01:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save domitry/78e2a3300f2f27e18cc8 to your computer and use it in GitHub Desktop.
Example for Nyaplotjs (Bubble chart)
<html lang='en'>
<head>
<title>Nyaplotjs example -- Scatter</title>
<script src='http://d3js.org/d3.v3.min.js'></script>
<script src='https://rawgit.com/domitry/Nyaplotjs/master/release/nyaplot.js'></script>
</head>
<body>
<div id='vis'></div>
<script>
var data1 = [], MAX=50, MIN=0;
for(var i=0;i<50;i++)data1.push({x: Math.random()*MAX, y: Math.random()*MAX, name: 'huga', nya:'nya', hoge: (Math.random()<0.5?'nya':'huga')})
models = {data:{data1: data1},panes: [{type:'rectangular', diagrams:[{type: 'scatter', data: 'data1', options: {x:'x', y:'y', size_by: 'y', fill_by: 'x', color: ["#000", "steelblue"], stroke_width:0, tooltip_contents:['name', 'nya']}}],options:{width:500, height:500, xrange: [MIN-5, MAX+5], yrange: [MIN-5, MAX+5], zoom:true}}]};
window.onload = function(){Nyaplot.core.parse(models, '#vis');};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment