Skip to content

Commit

Permalink
Merge pull request #303 from palantir/0.8.0-merge-in-master
Browse files Browse the repository at this point in the history
Merge 0.8.0 into master
  • Loading branch information
teamdandelion committed Apr 16, 2014
2 parents 76c64c9 + d3cadb8 commit 4c6ea9c
Show file tree
Hide file tree
Showing 57 changed files with 3,381 additions and 2,361 deletions.
7 changes: 4 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = function(grunt) {
},
"rebuild": {
"tasks": ["dev-compile"],
"files": ["src/*.ts"]
"files": ["src/**/*.ts"]
},
"tests": {
"tasks": ["ts:test", "tslint"],
Expand All @@ -78,9 +78,9 @@ module.exports = function(grunt) {
}
},
blanket_mocha: {
all: ['test/tests.html'],
all: ['test/coverage.html'],
options: {
threshold: 85
threshold: 80
}
},
connect: {
Expand Down Expand Up @@ -147,4 +147,5 @@ module.exports = function(grunt) {

grunt.registerTask("launch", ["connect", "dev-compile", "watch"]);
grunt.registerTask("test", ["dev-compile", "blanket_mocha"]);
grunt.registerTask("bm", ["blanket_mocha"]);
};
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plottable",
"version": "0.7.0",
"version": "0.8.0",
"ignore": [
"**/*",
"!plottable.js",
Expand Down
12 changes: 3 additions & 9 deletions examples/exampleUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function makeRandomData(numPoints, scaleFactor) {
data.sort(function (a, b) {
return a.x - b.x;
});
return { data: data, metadata: { cssClass: "random-data" } };
return data;
}

function makeNormallyDistributedData(n, xMean, xStdDev, yMean, yStdDev) {
Expand Down Expand Up @@ -85,10 +85,7 @@ function makeRandomBucketData(numBuckets, bucketWidth, maxValue) {
y: Math.round(Math.random() * maxValue)
});
}
return {
"data": data,
metadata: { cssClass: "random-buckets" }
};
return data;
}

function generateHeightWeightData(n) {
Expand All @@ -104,8 +101,5 @@ function generateHeightWeightData(n) {
});
}

return {
data: data,
metadata: { cssClass: "height-weight-data" }
};
return data;
}
16 changes: 5 additions & 11 deletions examples/exampleUtil.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
function makeRandomData(numPoints, scaleFactor=1): Plottable.IDataset {
function makeRandomData(numPoints, scaleFactor=1): any[] {
var data = [];
for (var i = 0; i < numPoints; i++) {
var x = Math.random();
var r = {x: x, y: (x + x * Math.random()) * scaleFactor}
data.push(r);
}
data.sort((a: any, b: any) => a.x - b.x);
return {data: data, metadata: {cssClass: "random-data"}};
return data;
}

function makeNormallyDistributedData(n=100, xMean?, xStdDev?, yMean?, yStdDev?) {
Expand Down Expand Up @@ -53,7 +53,7 @@ function binByVal(data: any[], accessor: Plottable.IAccessor, range=[0,100], nBi
})
return bins;
}
function makeRandomBucketData(numBuckets: number, bucketWidth: number, maxValue = 10): Plottable.IDataset {
function makeRandomBucketData(numBuckets: number, bucketWidth: number, maxValue = 10): any[] {
var data = [];
for (var i=0; i < numBuckets; i++) {
data.push({
Expand All @@ -62,10 +62,7 @@ function makeRandomBucketData(numBuckets: number, bucketWidth: number, maxValue
y: Math.round(Math.random() * maxValue)
});
}
return {
"data": data,
metadata: {cssClass: "random-buckets"}
};
return data;
}

function generateHeightWeightData(n: number) {
Expand All @@ -81,8 +78,5 @@ function generateHeightWeightData(n: number) {
});
}

return {
data: data,
metadata: {cssClass: "height-weight-data"}
};
return data;
}
42 changes: 20 additions & 22 deletions examples/main-page/commit-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ function commitDashboard(dataManager, svg) {
var scatterDateAxis = new Plottable.XAxis(timeScale, "bottom", dateFormatter);

var rScale = new Plottable.QuantitiveScale(d3.scale.log())
.range([2, 12])
.widenDomainOnData(commits, linesAddedAccessor);
.range([2, 12]);
function radiusAccessor(d) { return rScale.scale(linesAddedAccessor(d)); }

var scatterRenderer = new Plottable.CircleRenderer(commits, timeScale, scatterYScale)
.xAccessor("date")
.yAccessor(hourAccessor)
.rAccessor(radiusAccessor)
.colorAccessor(function(d) { return contributorColorScale.scale(d.name); });
.project("x", "date")
.project("y", hourAccessor)
.project("r", linesAddedAccessor, rScale)
.project("fill", "name", contributorColorScale);
window.scatterRenderer = scatterRenderer;

var scatterGridlines = new Plottable.Gridlines(timeScale, scatterYScale);
var scatterRenderArea = scatterGridlines.merge(scatterRenderer);
Expand All @@ -68,17 +68,14 @@ function commitDashboard(dataManager, svg) {
var tscRenderers = {};
dataManager.directories.forEach(function(dir) {
var timeSeries = directoryTimeSeries[dir];
var directoryDataset = {
data: timeSeries,
metadata: {}
};
var lineRenderer = new Plottable.LineRenderer(directoryDataset, timeScale, tscYScale);
lineRenderer.xAccessor(function(d) { return d[0]; })
.yAccessor(function(d) { return d[1]; })
.colorAccessor(function(d) { return directoryColorScale.scale(dir); });
var lineRenderer = new Plottable.LineRenderer(timeSeries, timeScale, tscYScale);
lineRenderer.project("x", function(d) { return d[0]; })
.project("y", function(d) { return d[1]; })
.project("stroke", function() {return dir}, directoryColorScale);
lineRenderer.classed(dir, true);
tscRenderers[dir] = lineRenderer;
tscRenderArea = tscRenderArea.merge(lineRenderer);
window.lineRenderer = lineRenderer;
});

var loadTSCData = function() {
Expand All @@ -102,17 +99,17 @@ function commitDashboard(dataManager, svg) {
// ----- /Legends -----

// ----- Bar1: Lines changed by contributor -----
var contributorBarYScale = new Plottable.LinearScale();
var contributorBarYAxis = new Plottable.YAxis(contributorBarYScale, "right");
var contributorBarXScale = new Plottable.OrdinalScale().domain(dataManager.contributors);
var contributorBarYScale = new Plottable.LinearScale();
var contributorBarXAxis = new Plottable.XAxis(contributorBarXScale, "bottom", function(d) { return d});
var contributorBarYAxis = new Plottable.YAxis(contributorBarYScale, "right");
contributorBarXAxis.classed("no-tick-labels", true).rowMinimum(5);
var contributorBarRenderer = new Plottable.CategoryBarRenderer(linesByContributor,
contributorBarXScale,
contributorBarYScale);
contributorBarRenderer.widthAccessor(40);
contributorBarRenderer.colorAccessor(function(d) { return contributorColorScale.scale(d.name); });
contributorBarRenderer.xAccessor("name").yAccessor(linesAddedAccessor);
contributorBarRenderer.project("width", 40)
.project("fill", "name", contributorColorScale)
.project("x", "name").project("y", linesAddedAccessor);
var contributorGridlines = new Plottable.Gridlines(null, contributorBarYScale);
var contributorBarChart = new Plottable.Table([
[contributorBarRenderer.merge(contributorGridlines), contributorBarYAxis],
Expand All @@ -129,9 +126,10 @@ function commitDashboard(dataManager, svg) {
var directoryBarRenderer = new Plottable.CategoryBarRenderer(linesByDirectory,
directoryBarXScale,
directoryBarYScale);
directoryBarRenderer.widthAccessor(40);
directoryBarRenderer.colorAccessor(function(d) { return directoryColorScale.scale(d.directory); });
directoryBarRenderer.xAccessor("directory").yAccessor(linesAddedAccessor);
directoryBarRenderer.project("width", 40)
.project("fill", "directory", directoryColorScale)
.project("x", "directory")
.project("y", linesAddedAccessor);
var directoryGridlines = new Plottable.Gridlines(null, directoryBarYScale);
var directoryBarChart = new Plottable.Table([
[directoryBarRenderer.merge(directoryGridlines), directoryBarYAxis],
Expand Down
2 changes: 1 addition & 1 deletion license_header.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
Plottable v0.7.0 (https://github.com/palantir/plottable)
Plottable v0.8.0 (https://github.com/palantir/plottable)
Copyright 2014 Palantir Technologies
Licensed under MIT (https://github.com/palantir/plottable/blob/master/LICENSE)
*/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plottable.js",
"version": "0.7.0",
"version": "0.8.0",
"description": "Build flexible, performant, interactive charts using D3",
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit 4c6ea9c

Please sign in to comment.