Skip to content

Commit

Permalink
Merge pull request #1552 from palantir/release-v0.41.1
Browse files Browse the repository at this point in the history
Release v0.41.1 (--> master)
  • Loading branch information
jtlan committed Jan 24, 2015
2 parents e05b602 + 79668bb commit 3da788d
Show file tree
Hide file tree
Showing 30 changed files with 165 additions and 123 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "plottable",
"description": "A library for creating charts out of D3",
"version": "0.41.0",
"version": "0.41.1",
"main": ["plottable.js", "plottable.css"],
"license": "MIT",
"ignore": [
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "plottable.js",
"description": "A library for creating charts out of D3",
"version": "0.41.0",
"version": "0.41.1",
"repository": {
"type": "git",
"url": "https://github.com/palantir/plottable.git"
Expand All @@ -22,7 +22,7 @@
"grunt-contrib-connect": "~0.6.0",
"grunt-blanket-mocha": "~0.4.0",
"grunt-saucelabs": "8.1.1",
"typescript": "1.3.0",
"typescript": "1.4.1",
"grunt-sed": "~0.1.1",
"grunt-git": "~0.2.6",
"grunt-contrib-clean": "~0.4.0",
Expand Down
24 changes: 12 additions & 12 deletions plottable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ declare module Plottable {
* @returns {[{ [key: string]: any }} coppied map.
*/
function copyMap<T>(oldMap: {
[x: string]: T;
[key: string]: T;
}): {
[x: string]: T;
[key: string]: T;
};
function range(start: number, stop: number, step?: number): number[];
/** Is like setTimeout, but activates synchronously if time=0
Expand All @@ -127,7 +127,7 @@ declare module Plottable {
*/
function setTimeout(f: Function, time: number, ...args: any[]): number;
function colorTest(colorTester: D3.Selection, className: string): string;
function lightenColor(color: string, factor: number, lightenAmount: number): string;
function lightenColor(color: string, factor: number): string;
function darkenColor(color: string, factor: number, darkenAmount: number): string;
}
}
Expand Down Expand Up @@ -493,7 +493,7 @@ declare module Plottable {
*
* The listeners are called synchronously.
*/
class Broadcaster extends PlottableObject {
class Broadcaster extends Core.PlottableObject {
listenable: Listenable;
/**
* Constructs a broadcaster, taking the Listenable that the broadcaster will be attached to.
Expand Down Expand Up @@ -1422,7 +1422,7 @@ declare module Plottable {
module Scale {
module TickGenerators {
interface TickGenerator<D> {
(scale: AbstractQuantitative<D>): D[];
(scale: Plottable.Scale.AbstractQuantitative<D>): D[];
}
/**
* Creates a tick generator using the specified interval.
Expand Down Expand Up @@ -1746,7 +1746,7 @@ declare module Plottable {
* @param {Component} c The component to merge in.
* @returns {ComponentGroup} The relevant ComponentGroup out of the above four cases.
*/
merge(c: AbstractComponent): Group;
merge(c: AbstractComponent): Component.Group;
/**
* Detaches a Component from the DOM. The component can be reused.
*
Expand Down Expand Up @@ -2506,7 +2506,7 @@ declare module Plottable {
protected _datasetKeysInOrder: string[];
protected _renderArea: D3.Selection;
protected _projections: {
[x: string]: _Projection;
[attrToSet: string]: _Projection;
};
protected _animate: boolean;
protected _animateOnNextRender: boolean;
Expand Down Expand Up @@ -2793,7 +2793,7 @@ declare module Plottable {
module Plot {
class Bar<X, Y> extends AbstractXYPlot<X, Y> implements Interaction.Hoverable {
protected static _BarAlignmentToFactor: {
[x: string]: number;
[alignment: string]: number;
};
protected static _DEFAULT_WIDTH: number;
protected _isVertical: boolean;
Expand Down Expand Up @@ -3318,7 +3318,7 @@ declare module Plottable {
class AbstractDispatcher extends Core.PlottableObject {
protected _target: D3.Selection;
protected _event2Callback: {
[x: string]: () => any;
[eventName: string]: () => any;
};
/**
* Constructs a Dispatcher with the specified target.
Expand Down Expand Up @@ -3363,7 +3363,7 @@ declare module Plottable {

declare module Plottable {
module Dispatcher {
class Mouse extends AbstractDispatcher {
class Mouse extends Dispatcher.AbstractDispatcher {
/**
* Constructs a Mouse Dispatcher with the specified target.
*
Expand Down Expand Up @@ -3419,7 +3419,7 @@ declare module Plottable {

declare module Plottable {
module Dispatcher {
class Keypress extends AbstractDispatcher {
class Keypress extends Dispatcher.AbstractDispatcher {
/**
* Constructs a Keypress Dispatcher with the specified target.
*
Expand Down Expand Up @@ -3745,7 +3745,7 @@ declare module Plottable {
*/
_doHover(p: Point): HoverData;
}
class Hover extends AbstractInteraction {
class Hover extends Interaction.AbstractInteraction {
_componentToListenTo: Hoverable;
_anchor(component: Hoverable, hitBox: D3.Selection): void;
/**
Expand Down
69 changes: 32 additions & 37 deletions plottable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
Plottable 0.41.0 (https://github.com/palantir/plottable)
Plottable 0.41.1 (https://github.com/palantir/plottable)
Copyright 2014 Palantir Technologies
Licensed under MIT (https://github.com/palantir/plottable/blob/master/LICENSE)
*/
Expand Down Expand Up @@ -293,21 +293,9 @@ var Plottable;
return hexCode;
}
Methods.colorTest = colorTest;
// Code adapted from https://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color-or-rgb-and-blend-colors
function lightenColor(color, factor, lightenAmount) {
var r = parseInt(color.substring(1, 3), 16);
var g = parseInt(color.substring(3, 5), 16);
var b = parseInt(color.substring(5, 7), 16);
var hsl = _Util.Color.rgbToHsl(r, g, b);
var newL = Math.min(hsl[2] + lightenAmount * factor, 1);
var newRgb = _Util.Color.hslToRgb(hsl[0], hsl[1], newL);
var rHex = newRgb[0].toString(16);
var gHex = newRgb[1].toString(16);
var bHex = newRgb[2].toString(16);
rHex = rHex.length < 2 ? "0" + rHex : rHex;
gHex = gHex.length < 2 ? "0" + gHex : gHex;
bHex = bHex.length < 2 ? "0" + bHex : bHex;
return "#" + rHex + gHex + bHex;
function lightenColor(color, factor) {
var hsl = d3.hsl(color).brighter(factor);
return hsl.rgb().toString();
}
Methods.lightenColor = lightenColor;
// Code adapted from https://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color-or-rgb-and-blend-colors
Expand Down Expand Up @@ -986,7 +974,7 @@ var Plottable;
///<reference path="../reference.ts" />
var Plottable;
(function (Plottable) {
Plottable.version = "0.41.0";
Plottable.version = "0.41.1";
})(Plottable || (Plottable = {}));

///<reference path="../reference.ts" />
Expand Down Expand Up @@ -2391,7 +2379,6 @@ var Plottable;
throw new Error("Unsupported ColorScale type");
}
_super.call(this, scale);
this._lightenAmount = 0.16;
}
// Duplicated from OrdinalScale._getExtent - should be removed in #388
Color.prototype._getExtent = function () {
Expand Down Expand Up @@ -2419,10 +2406,12 @@ var Plottable;
Color.prototype.scale = function (value) {
var color = _super.prototype.scale.call(this, value);
var index = this.domain().indexOf(value);
var modifyFactor = Math.floor(index / this.range().length);
return Plottable._Util.Methods.lightenColor(color, modifyFactor, this._lightenAmount);
var numLooped = Math.floor(index / this.range().length);
var modifyFactor = Math.log(numLooped * Color.LOOP_LIGHTEN_FACTOR + 1);
return Plottable._Util.Methods.lightenColor(color, modifyFactor);
};
Color.HEX_SCALE_FACTOR = 20;
Color.LOOP_LIGHTEN_FACTOR = 1.6;
return Color;
})(Scale.AbstractScale);
Scale.Color = Color;
Expand Down Expand Up @@ -8494,18 +8483,16 @@ var Plottable;
function PanZoom(xScale, yScale) {
var _this = this;
_super.call(this);
if (xScale == null) {
xScale = new Plottable.Scale.Linear();
if (xScale) {
this._xScale = xScale;
// HACKHACK #1388: self-register for resetZoom()
this._xScale.broadcaster.registerListener("pziX" + this.getID(), function () { return _this.resetZoom(); });
}
if (yScale == null) {
yScale = new Plottable.Scale.Linear();
if (yScale) {
this._yScale = yScale;
// HACKHACK #1388: self-register for resetZoom()
this._yScale.broadcaster.registerListener("pziY" + this.getID(), function () { return _this.resetZoom(); });
}
this._xScale = xScale;
this._yScale = yScale;
this._zoom = d3.behavior.zoom();
this._zoom.x(this._xScale._d3Scale);
this._zoom.y(this._yScale._d3Scale);
this._zoom.on("zoom", function () { return _this._rerenderZoomed(); });
}
/**
* Sets the scales back to their original domains.
Expand All @@ -8514,22 +8501,30 @@ var Plottable;
var _this = this;
// HACKHACK #254
this._zoom = d3.behavior.zoom();
this._zoom.x(this._xScale._d3Scale);
this._zoom.y(this._yScale._d3Scale);
if (this._xScale) {
this._zoom.x(this._xScale._d3Scale);
}
if (this._yScale) {
this._zoom.y(this._yScale._d3Scale);
}
this._zoom.on("zoom", function () { return _this._rerenderZoomed(); });
this._zoom(this._hitBox);
};
PanZoom.prototype._anchor = function (component, hitBox) {
_super.prototype._anchor.call(this, component, hitBox);
this._zoom(hitBox);
this.resetZoom();
};
PanZoom.prototype._rerenderZoomed = function () {
// HACKHACK since the d3.zoom.x modifies d3 scales and not our TS scales, and the TS scales have the
// event listener machinery, let's grab the domain out of the d3 scale and pipe it back into the TS scale
var xDomain = this._xScale._d3Scale.domain();
var yDomain = this._yScale._d3Scale.domain();
this._xScale.domain(xDomain);
this._yScale.domain(yDomain);
if (this._xScale) {
var xDomain = this._xScale._d3Scale.domain();
this._xScale.domain(xDomain);
}
if (this._yScale) {
var yDomain = this._yScale._d3Scale.domain();
this._yScale.domain(yDomain);
}
};
return PanZoom;
})(Interaction.AbstractInteraction);
Expand Down
12 changes: 6 additions & 6 deletions plottable.min.js

Large diffs are not rendered by default.

Binary file modified plottable.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function run(svg, data, Plottable) {
var yAxis = new Plottable.Axis.Numeric(yScale, "left");

var dataset = new Plottable.Dataset(data);
var verticalBarPlot = new Plottable.Plot.Bar(xScale, yScale)
var verticalBarPlot = new Plottable.Plot.Bar(xScale, yScale, true)
.addDataset(dataset)
.project("x", "x", xScale)
.project("y", "y", yScale)
Expand Down
4 changes: 2 additions & 2 deletions quicktests/overlaying/tests/basic/basic_allPlots.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function run(svg, data, Plottable) {
var scatterPlot = new Plottable.Plot.Scatter(xScale, yScale).addDataset(data).project("x", "x", xScale).project("y", "y", yScale);
var linePlot = new Plottable.Plot.Line(xScale, yScale).addDataset(data).project("x", "x", xScale).project("y", "y", yScale);
var areaPlot = new Plottable.Plot.Area(xScale, yScale).addDataset(data).project("x", "x", xScale).project("y", "y", yScale);
var vbarPlot = new Plottable.Plot.VerticalBar(xScale, yScale).addDataset(data).project("x", "x", xScale).project("y", "y", yScale);
var hbarPlot = new Plottable.Plot.HorizontalBar(xScale, yScale).addDataset(data).project("x", "x", xScale).project("y", "y", yScale);
var vbarPlot = new Plottable.Plot.Bar(xScale, yScale, true).addDataset(data).project("x", "x", xScale).project("y", "y", yScale);
var hbarPlot = new Plottable.Plot.Bar(xScale, yScale, false).addDataset(data).project("x", "x", xScale).project("y", "y", yScale);

//title + legend

Expand Down
2 changes: 1 addition & 1 deletion quicktests/overlaying/tests/basic/categoryAxis_timeAxis.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function run(svg, data, Plottable) {
var xScale = new Plottable.Scale.Time();
var yScale = new Plottable.Scale.Ordinal();

var hBarPlot = new Plottable.Plot.HorizontalBar(xScale, yScale)
var hBarPlot = new Plottable.Plot.Bar(xScale, yScale, false)
.addDataset(data)
.attr("x", function (d) { return d3.time.format("%x").parse(d.x); }, xScale)
.project("y", "y", yScale);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function run(svg, data, Plottable) {
var xScale = new Plottable.Scale.Linear();
var xAxis = new Plottable.Axis.Numeric(xScale, "bottom");

var barPlot = new Plottable.Plot.HorizontalBar(xScale, yScale)
var barPlot = new Plottable.Plot.Bar(xScale, yScale, false)
.addDataset(ds)
.attr("y", "name", yScale)
.attr("x", "age", xScale)
Expand Down
2 changes: 1 addition & 1 deletion quicktests/overlaying/tests/basic/category_project.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function run(svg, data, Plottable) {
};

//rendering
var renderAreaD1 = new Plottable.Plot.VerticalBar(xScale, yScale)
var renderAreaD1 = new Plottable.Plot.Bar(xScale, yScale, true)
.addDataset(dataseries1)
.attr("width", widthProjector)
.project("x", "x", xScale)
Expand Down
2 changes: 1 addition & 1 deletion quicktests/overlaying/tests/basic/category_verticalBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function run(svg, data, Plottable) {
var yScale = new Plottable.Scale.Linear();
var yAxis = new Plottable.Axis.Numeric(yScale, "left");

var barPlot = new Plottable.Plot.VerticalBar(xScale, yScale)
var barPlot = new Plottable.Plot.Bar(xScale, yScale, true)
.addDataset(ds)
.attr("x", "name", xScale)
.attr("y", "age", yScale)
Expand Down
4 changes: 2 additions & 2 deletions quicktests/overlaying/tests/basic/no_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ function run(svg, data, Plottable) {
var scatterPlot = new Plottable.Plot.Scatter(xScale, yScale).addDataset([]);
var linePlot = new Plottable.Plot.Line(xScale, yScale).addDataset([]);
var areaPlot = new Plottable.Plot.Area(xScale, yScale).addDataset([]);
var vbarPlot = new Plottable.Plot.VerticalBar(xScale, yScale);
var hbarPlot = new Plottable.Plot.HorizontalBar(xScale, yScale);
var vbarPlot = new Plottable.Plot.Bar(xScale, yScale, true);
var hbarPlot = new Plottable.Plot.Bar(xScale, yScale, false);

//title + legend

Expand Down
4 changes: 2 additions & 2 deletions quicktests/overlaying/tests/basic/no_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ function run(svg, data, Plottable) {
.addDataset(data);
var areaPlot = new Plottable.Plot.Area(xScale, yScale)
.addDataset(data);
var vbarPlot = new Plottable.Plot.VerticalBar(xScale, yScale)
var vbarPlot = new Plottable.Plot.Bar(xScale, yScale, true)
.addDataset(data);
var hbarPlot = new Plottable.Plot.HorizontalBar(xScale, yScale)
var hbarPlot = new Plottable.Plot.Bar(xScale, yScale, false)
.addDataset(data);

//title + legend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function run(svg, data, Plottable) {

var xAxis = new Plottable.Axis.Category(xScale, "bottom");
var yAxis = new Plottable.Axis.Numeric(yScale, "left");
var clusteredBarRenderer = new Plottable.Plot.VerticalBar(xScale, yScale)
var clusteredBarRenderer = new Plottable.Plot.Bar(xScale, yScale, true)
.addDataset("d1", data)
.attr("x", "name", xScale)
.attr("y", "y", yScale)
Expand Down
2 changes: 1 addition & 1 deletion quicktests/overlaying/tests/basic/project_width.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function run(svg, data, Plottable) {
return w;
};

var barRenderer = new Plottable.Plot.VerticalBar(xScale, yScale)
var barRenderer = new Plottable.Plot.Bar(xScale, yScale, true)
.addDataset(ds)
.attr("x", "name", xScale)
.attr("y", "age", yScale)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function run(svg, data, Plottable) {
var yAxis = new Plottable.Axis.Numeric(yScale, "left");


var barPlot = new Plottable.Plot.VerticalBar(xScale, yScale)
var barPlot = new Plottable.Plot.Bar(xScale, yScale, true)
.addDataset(dataseries1)
.animate(true)
.project("x", "x", xScale)
Expand Down
2 changes: 1 addition & 1 deletion quicktests/overlaying/tests/interactions/add_time.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function run(svg, data, Plottable) {
var yScale = new Plottable.Scale.Linear();
var ds = new Plottable.Dataset(dates);
var parse = function(d) {return d3.time.format("%x").parse(d.x);};
var plot = new Plottable.Plot.VerticalBar(xScale, yScale)
var plot = new Plottable.Plot.Bar(xScale, yScale, true)
.addDataset(ds)
.attr("x", parse, xScale)
.project("y", "y", yScale);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function run(svg, data, Plottable) {

var ds = new Plottable.Dataset(data, { foo: "!" });

var plot = new Plottable.Plot.VerticalBar(xScale, yScale)
var plot = new Plottable.Plot.Bar(xScale, yScale, true)
.addDataset(ds)
.project("x", function (d, i, u) { return d.name + u.foo; }, xScale)
.project("y", "y", yScale)
Expand Down
2 changes: 1 addition & 1 deletion quicktests/overlaying/tests/interactions/select_bars.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function run(svg, data, Plottable) {
var yScale = new Plottable.Scale.Linear();
var yAxis = new Plottable.Axis.Numeric(yScale, "left");

var barPlot = new Plottable.Plot.VerticalBar(xScale, yScale).addDataset(dataseries);
var barPlot = new Plottable.Plot.Bar(xScale, yScale, true).addDataset(dataseries);
barPlot.project("x", "x", xScale).project("y", "y", yScale);
var gridlines = new Plottable.Component.Gridlines(xScale, yScale);
var renderGroup = gridlines.merge(barPlot);
Expand Down
Loading

0 comments on commit 3da788d

Please sign in to comment.