#33, plus added flatTestData() for testing with flat data to cumulativeLineChart example

master-patched
Tyler Wolf 12 years ago
parent db9778e7d5
commit 5f0700eac9

@ -51,10 +51,12 @@ svg {
// Wrapping in nv.addGraph allows for '0 timeout render', stors rendered charts in nv.graphs, and may do more in the future... it's NOT required
var chart;
nv.addGraph(function() {
chart = nv.models.cumulativeLineChart()
.x(function(d) { return d[0] })
.y(function(d) { return d[1]/100 })
.color(d3.scale.category10().range());
.color(d3.scale.category10().range())
.clipVoronoi(false);
chart.xAxis
.tickFormat(function(d) {
@ -65,6 +67,7 @@ nv.addGraph(function() {
.tickFormat(d3.format(',.1%'));
d3.select('#chart1 svg')
// .datum(cumulativeTestData())
.datum(cumulativeTestData())
//.transition().duration(500)
.call(chart);
@ -80,6 +83,18 @@ nv.addGraph(function() {
});
function flatTestData() {
return [
{
key: "Snakes",
values: [0,1,2,3,4,5,6,7,8,9].map(function(d) {
var currentDate = new Date();
currentDate.setDate(currentDate.getDate() + d);
return [currentDate, 0]
})
}
];
}
function cumulativeTestData() {

10986
nv.d3.js

File diff suppressed because it is too large Load Diff

5
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

@ -187,13 +187,13 @@ nv.models.scatter = function() {
}
if(vertices.length < 3) {
// if(vertices.length < 3) {
// Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work
vertices.push([x.range()[0] - 2000, y.range()[0] - 2000, null, null]);
vertices.push([x.range()[1] + 2000, y.range()[1] + 2000, null, null]);
vertices.push([x.range()[0] - 2000, y.range()[0] + 2000, null, null]);
vertices.push([x.range()[1] + 2000, y.range()[1] - 2000, null, null]);
}
vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]);
vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]);
vertices.push([x.range()[0] - 20, y.range()[0] + 20, null, null]);
vertices.push([x.range()[1] + 20, y.range()[1] - 20, null, null]);
// }
var bounds = d3.geom.polygon([
[-10,-10],

Loading…
Cancel
Save