Skip to content

Commit

Permalink
Merge pull request #2758 from palantir/r1.11.0
Browse files Browse the repository at this point in the history
Release version 1.11.0 (--> master)
  • Loading branch information
jtlan committed Sep 11, 2015
2 parents fa288c7 + 04a8e57 commit 3a457f0
Show file tree
Hide file tree
Showing 20 changed files with 814 additions and 581 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ quicktests/overlaying/list_of_quicktests.json

# Visual Studio Code
.settings/

.vscode/
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 modular charting library built on D3",
"version": "1.10.0",
"version": "1.11.0",
"main": ["plottable.js", "plottable.css"],
"typescript": {
"definition": "plottable.d.ts"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "plottable.js",
"description": "A modular charting library built on D3",
"version": "1.10.0",
"version": "1.11.0",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions plottable.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ svg.plottable {

.plottable .background-fill {
fill: none;
pointer-events: none;
}

.plottable .bounding-box {
Expand Down
13 changes: 12 additions & 1 deletion plottable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,8 @@ declare module Plottable {
*/
function time(specifier: string): Formatter;
/**
* @deprecated As of release v1.3.0, not safe for use with time zones.
*
* Creates a formatter for relative dates.
*
* @param {number} baseValue The start date (as epoch time) used in computing relative dates (default 0)
Expand Down Expand Up @@ -1802,7 +1804,7 @@ declare module Plottable {
*/
formatter(formatter: Formatter): Axis<D>;
/**
* @deprecated As of release 1.3, replaced by innerTickLength()
* @deprecated As of release v1.3.0, replaced by innerTickLength()
*
* Gets the tick mark length in pixels.
*/
Expand Down Expand Up @@ -2732,6 +2734,9 @@ declare module Plottable {
* @returns {Plots.PlotEntity} The nearest PlotEntity, or undefined if no PlotEntity can be found.
*/
entityNearest(queryPoint: Point): Plots.PlotEntity;
/**
* @deprecated As of release v1.1.0, replaced by _entityVisibleOnPlot()
*/
protected _visibleOnPlot(datum: any, pixelPoint: Point, selection: d3.Selection<void>): boolean;
protected _entityVisibleOnPlot(pixelPoint: Point, datum: any, index: number, dataset: Dataset): boolean;
protected _uninstallScaleForKey(scale: Scale<any, any>, key: string): void;
Expand Down Expand Up @@ -3152,6 +3157,9 @@ declare module Plottable {
*/
symbol(symbol: Accessor<SymbolFactory>): Plots.Scatter<X, Y>;
protected _generateDrawSteps(): Drawers.DrawStep[];
/**
* @deprecated As of release v1.1.0, replaced by _entityVisibleOnPlot()
*/
protected _visibleOnPlot(datum: any, pixelPoint: Point, selection: d3.Selection<void>): boolean;
protected _entityVisibleOnPlot(pixelPoint: Point, datum: any, index: number, dataset: Dataset): boolean;
protected _propertyProjectors(): AttributeToProjector;
Expand Down Expand Up @@ -3268,6 +3276,9 @@ declare module Plottable {
* @returns {PlotEntity} The nearest PlotEntity, or undefined if no PlotEntity can be found.
*/
entityNearest(queryPoint: Point): PlotEntity;
/**
* @deprecated As of release v1.1.0, replaced by _entityVisibleOnPlot()
*/
protected _visibleOnPlot(datum: any, pixelPoint: Point, selection: d3.Selection<void>): boolean;
protected _entityVisibleOnPlot(pixelPoint: Point, datum: any, index: number, dataset: Dataset): boolean;
/**
Expand Down
33 changes: 24 additions & 9 deletions plottable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
Plottable 1.10.0 (https://github.com/palantir/plottable)
Plottable 1.11.0 (https://github.com/palantir/plottable)
Copyright 2014-2015 Palantir Technologies
Licensed under MIT (https://github.com/palantir/plottable/blob/master/LICENSE)
*/
Expand Down Expand Up @@ -909,7 +909,7 @@ var Plottable;
///<reference path="../reference.ts" />
var Plottable;
(function (Plottable) {
Plottable.version = "1.10.0";
Plottable.version = "1.11.0";
})(Plottable || (Plottable = {}));

///<reference path="../reference.ts" />
Expand Down Expand Up @@ -1385,6 +1385,8 @@ var Plottable;
}
Formatters.time = time;
/**
* @deprecated As of release v1.3.0, not safe for use with time zones.
*
* Creates a formatter for relative dates.
*
* @param {number} baseValue The start date (as epoch time) used in computing relative dates (default 0)
Expand All @@ -1397,7 +1399,7 @@ var Plottable;
if (baseValue === void 0) { baseValue = 0; }
if (increment === void 0) { increment = Plottable.MILLISECONDS_IN_ONE_DAY; }
if (label === void 0) { label = ""; }
Plottable.Utils.Window.deprecated("relativeDate()", "1.3", "Not safe for use with time zones.");
Plottable.Utils.Window.deprecated("relativeDate()", "v1.3.0", "Not safe for use with time zones.");
return function (d) {
var relativeDate = Math.round((d.valueOf() - baseValue) / increment);
return relativeDate.toString() + label;
Expand Down Expand Up @@ -7117,8 +7119,11 @@ var Plottable;
});
return this._lightweightPlotEntityToPlotEntity(closestPointEntity);
};
/**
* @deprecated As of release v1.1.0, replaced by _entityVisibleOnPlot()
*/
Plot.prototype._visibleOnPlot = function (datum, pixelPoint, selection) {
Plottable.Utils.Window.deprecated("Plot._visibleOnPlot()", "v1.1.0");
Plottable.Utils.Window.deprecated("Plot._visibleOnPlot()", "v1.1.0", "replaced by _entityVisibleOnPlot()");
return !(pixelPoint.x < 0 || pixelPoint.y < 0 ||
pixelPoint.x > this.width() || pixelPoint.y > this.height());
};
Expand Down Expand Up @@ -8192,8 +8197,11 @@ var Plottable;
drawSteps.push({ attrToProjector: this._generateAttrToProjector(), animator: this._getAnimator(Plots.Animator.MAIN) });
return drawSteps;
};
/**
* @deprecated As of release v1.1.0, replaced by _entityVisibleOnPlot()
*/
Scatter.prototype._visibleOnPlot = function (datum, pixelPoint, selection) {
Plottable.Utils.Window.deprecated("Scatter._visibleOnPlot()", "v1.1.0");
Plottable.Utils.Window.deprecated("Scatter._visibleOnPlot()", "v1.1.0", "replaced by _entityVisibleOnPlot()");
var xRange = { min: 0, max: this.width() };
var yRange = { min: 0, max: this.height() };
var translation = d3.transform(selection.attr("transform")).translate;
Expand Down Expand Up @@ -8513,8 +8521,11 @@ var Plottable;
});
return closest;
};
/**
* @deprecated As of release v1.1.0, replaced by _entityVisibleOnPlot()
*/
Bar.prototype._visibleOnPlot = function (datum, pixelPoint, selection) {
Plottable.Utils.Window.deprecated("Bar._visibleOnPlot()", "v1.1.0");
Plottable.Utils.Window.deprecated("Bar._visibleOnPlot()", "v1.1.0", "replaced by _entityVisibleOnPlot()");
var xRange = { min: 0, max: this.width() };
var yRange = { min: 0, max: this.height() };
var barBBox = Plottable.Utils.DOM.elementBBox(selection);
Expand Down Expand Up @@ -8611,10 +8622,13 @@ var Plottable;
return extents;
}
var scale = accScaleBinding.scale;
extents = extents.map(function (extent) { return [
// To account for inverted domains
extents = extents.map(function (extent) { return d3.extent([
scale.invert(scale.scale(extent[0]) - _this._barPixelWidth / 2),
scale.invert(scale.scale(extent[1]) + _this._barPixelWidth / 2),
]; });
scale.invert(scale.scale(extent[0]) + _this._barPixelWidth / 2),
scale.invert(scale.scale(extent[1]) - _this._barPixelWidth / 2),
scale.invert(scale.scale(extent[1]) + _this._barPixelWidth / 2)
]); });
return extents;
};
Bar.prototype._drawLabels = function () {
Expand Down Expand Up @@ -8672,6 +8686,7 @@ var Plottable;
labelPosition.x = x + w / 2 - measurement.width / 2;
}
else {
labelPosition.y = y + h / 2 - measurement.height / 2;
if (!positive) {
labelPosition.x = x + w - measurement.width;
}
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.
2 changes: 1 addition & 1 deletion src/axes/axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ export class Axis<D> extends Component {
}

/**
* @deprecated As of release 1.3, replaced by innerTickLength()
* @deprecated As of release v1.3.0, replaced by innerTickLength()
*
* Gets the tick mark length in pixels.
*/
Expand Down
4 changes: 3 additions & 1 deletion src/core/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ export module Formatters {
}

/**
* @deprecated As of release v1.3.0, not safe for use with time zones.
*
* Creates a formatter for relative dates.
*
* @param {number} baseValue The start date (as epoch time) used in computing relative dates (default 0)
Expand All @@ -253,7 +255,7 @@ export module Formatters {
* @returns {Formatter} A formatter for time/date values.
*/
export function relativeDate(baseValue: number = 0, increment: number = MILLISECONDS_IN_ONE_DAY, label: string = "") {
Plottable.Utils.Window.deprecated("relativeDate()", "1.3", "Not safe for use with time zones.");
Plottable.Utils.Window.deprecated("relativeDate()", "v1.3.0", "Not safe for use with time zones.");
return (d: any) => {
let relativeDate = Math.round((d.valueOf() - baseValue) / increment);
return relativeDate.toString() + label;
Expand Down
16 changes: 11 additions & 5 deletions src/plots/barPlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,11 @@ export module Plots {
return closest;
}

/**
* @deprecated As of release v1.1.0, replaced by _entityVisibleOnPlot()
*/
protected _visibleOnPlot(datum: any, pixelPoint: Point, selection: d3.Selection<void>): boolean {
Utils.Window.deprecated("Bar._visibleOnPlot()", "v1.1.0");
Utils.Window.deprecated("Bar._visibleOnPlot()", "v1.1.0", "replaced by _entityVisibleOnPlot()");
let xRange = { min: 0, max: this.width() };
let yRange = { min: 0, max: this.height() };
let barBBox = Utils.DOM.elementBBox(selection);
Expand Down Expand Up @@ -439,10 +442,13 @@ export module Plots {

let scale = <QuantitativeScale<any>>accScaleBinding.scale;

extents = extents.map((extent) => [
// To account for inverted domains
extents = extents.map((extent) => d3.extent([
scale.invert(scale.scale(extent[0]) - this._barPixelWidth / 2),
scale.invert(scale.scale(extent[1]) + this._barPixelWidth / 2),
]);
scale.invert(scale.scale(extent[0]) + this._barPixelWidth / 2),
scale.invert(scale.scale(extent[1]) - this._barPixelWidth / 2),
scale.invert(scale.scale(extent[1]) + this._barPixelWidth / 2)
]));

return extents;
}
Expand Down Expand Up @@ -489,7 +495,6 @@ export module Plots {
} else {
x += offset;
}

let showLabel = true;
let labelPosition = {
x: x,
Expand All @@ -499,6 +504,7 @@ export module Plots {
if (this._isVertical) {
labelPosition.x = x + w / 2 - measurement.width / 2;
} else {
labelPosition.y = y + h / 2 - measurement.height / 2;
if (!positive) {
labelPosition.x = x + w - measurement.width;
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/plots/plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,11 @@ export class Plot extends Component {
return this._lightweightPlotEntityToPlotEntity(closestPointEntity);
}

/**
* @deprecated As of release v1.1.0, replaced by _entityVisibleOnPlot()
*/
protected _visibleOnPlot(datum: any, pixelPoint: Point, selection: d3.Selection<void>): boolean {
Utils.Window.deprecated("Plot._visibleOnPlot()", "v1.1.0");
Utils.Window.deprecated("Plot._visibleOnPlot()", "v1.1.0", "replaced by _entityVisibleOnPlot()");
return !(pixelPoint.x < 0 || pixelPoint.y < 0 ||
pixelPoint.x > this.width() || pixelPoint.y > this.height());
}
Expand Down
5 changes: 4 additions & 1 deletion src/plots/scatterPlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ export module Plots {
return drawSteps;
}

/**
* @deprecated As of release v1.1.0, replaced by _entityVisibleOnPlot()
*/
protected _visibleOnPlot(datum: any, pixelPoint: Point, selection: d3.Selection<void>): boolean {
Utils.Window.deprecated("Scatter._visibleOnPlot()", "v1.1.0");
Utils.Window.deprecated("Scatter._visibleOnPlot()", "v1.1.0", "replaced by _entityVisibleOnPlot()");
let xRange = { min: 0, max: this.width() };
let yRange = { min: 0, max: this.height() };

Expand Down
8 changes: 8 additions & 0 deletions test/components/componentTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@ describe("Component behavior", () => {
svg.remove();
});

it("background-fill's pointer-event is set to none", () => {
c.renderTo(svg);
let backgroundFill = c.background().select(".background-fill").node();
let pointerEvent = window.getComputedStyle(<Element>backgroundFill).pointerEvents;
assert.strictEqual(pointerEvent, "none", "background-fill's pointer-event is set to none");
svg.remove();
});

it("can't reuse component if it's been destroy()-ed", () => {
let c1 = new Plottable.Component();
c1.renderTo(svg);
Expand Down
Loading

0 comments on commit 3a457f0

Please sign in to comment.