From 70ccf55c44c1130a4e3aaeea5f6495dbd3646f0d Mon Sep 17 00:00:00 2001 From: Bob Monteverde Date: Mon, 18 Jun 2012 02:17:49 -0400 Subject: [PATCH] scatter examples now shows shapes --- examples/scatterChart.html | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/scatterChart.html b/examples/scatterChart.html index 58f7b94..db5393a 100644 --- a/examples/scatterChart.html +++ b/examples/scatterChart.html @@ -62,7 +62,7 @@ nv.addGraph(function() { chart.yAxis.tickFormat(d3.format('.02f')) d3.select('#test1 svg') - .datum(randomData()) + .datum(randomData(4,40)) .transition().duration(500) .call(chart); @@ -72,18 +72,24 @@ nv.addGraph(function() { }); -function randomData() { +function randomData(groups, points) { //# groups,# points per group var data = [], + shapes = ['circle', 'cross', 'triangle-up', 'triangle-down'], random = d3.random.normal(); - for (i = 0; i < 2; i++) { + for (i = 0; i < groups; i++) { data.push({ key: 'Group ' + i, values: [] }); - for (j = 0; j < 100; j++) { - data[i].values.push({x: random(), y: random(), size: Math.random()}); + for (j = 0; j < points; j++) { + data[i].values.push({ + x: random(), + y: random(), + size: Math.random(), + shape: shapes[i] + }); } }