scatter examples now shows shapes

master-patched
Bob Monteverde 12 years ago
parent 34850d6c54
commit 70ccf55c44

@ -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]
});
}
}

Loading…
Cancel
Save