Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions examples/scatterFocusPlusLineChart.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="../build/nv.d3.css" rel="stylesheet" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js" charset="utf-8"></script>
<script src="../build/nv.d3.js"></script>
<style>
text {
font: 12px sans-serif;
}
svg {
display: block;
}
html, body, #test1, svg {
margin: 0px;
padding: 0px;
height: 100%;
width: 100%;
}
</style>
</head>
<body class='with-3d-shadow with-transitions'>

<div id="test1" class="chartWrap">
<svg></svg>
</div>

<script>

var chart;
nv.addGraph(function() {
chart = nv.models.scatterFocusChart()
.showDistX(true)
.showDistY(true)
.duration(300)
.color(d3.scale.category10().range());

chart.dispatch.on('renderEnd', function(){
console.log('render complete');
});

chart.xAxis.tickFormat(d3.format('.02f'));
chart.yAxis.tickFormat(d3.format('.02f'));

d3.select('#test1 svg')
.datum(nv.log(randomData(4,40)))
.call(chart);

nv.utils.windowResize(chart.update);
chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });
return chart;
});


function randomData(groups, points) { //# groups,# points per group
var data = [],
shapes = ['circle'],
random = d3.random.normal();

for (i = 0; i < groups; i++) {
data.push({
key: 'Group ' + i,
values: [],
slope: Math.random() - .01,
intercept: Math.random() - .5
});

for (j = 0; j < points; j++) {
data[i].values.push({
x: random(),
y: random(),
size: Math.random(),
shape: shapes[j % shapes.length]
});
}
}
return data;
}

</script>
</body>
</html>
Loading