plottable 3.12.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/build/src/animators/easingAnimator.d.ts +2 -2
- package/build/src/animators/easingAnimator.js +1 -1
- package/build/src/animators/index.js +2 -2
- package/build/src/axes/axis.d.ts +1 -1
- package/build/src/axes/axis.js +5 -5
- package/build/src/axes/categoryAxis.js +8 -7
- package/build/src/axes/index.js +3 -3
- package/build/src/axes/numericAxis.js +1 -1
- package/build/src/axes/timeAxis.d.ts +5 -5
- package/build/src/axes/timeAxis.js +6 -6
- package/build/src/components/component.d.ts +4 -4
- package/build/src/components/component.js +6 -6
- package/build/src/components/componentContainer.js +1 -1
- package/build/src/components/dragBoxLayer.d.ts +1 -1
- package/build/src/components/dragBoxLayer.js +1 -1
- package/build/src/components/dragLineLayer.js +1 -1
- package/build/src/components/gridlines.js +1 -1
- package/build/src/components/group.js +1 -1
- package/build/src/components/guideLineLayer.js +1 -1
- package/build/src/components/index.js +14 -14
- package/build/src/components/interpolatedColorLegend.js +1 -1
- package/build/src/components/label.d.ts +1 -1
- package/build/src/components/label.js +3 -3
- package/build/src/components/legend.js +7 -7
- package/build/src/components/plotGroup.js +1 -1
- package/build/src/components/selectionBoxLayer.js +2 -2
- package/build/src/components/table.js +1 -1
- package/build/src/components/wrappedLabel.js +1 -1
- package/build/src/components/xDragBoxLayer.js +1 -1
- package/build/src/components/yDragBoxLayer.js +1 -1
- package/build/src/core/dataset.d.ts +1 -1
- package/build/src/core/formatters.d.ts +2 -2
- package/build/src/core/formatters.js +16 -13
- package/build/src/core/interfaces.d.ts +9 -9
- package/build/src/core/renderController.d.ts +1 -1
- package/build/src/core/renderController.js +6 -6
- package/build/src/core/symbolFactories.d.ts +2 -2
- package/build/src/core/symbolFactories.js +15 -15
- package/build/src/core/version.js +1 -1
- package/build/src/dispatchers/index.js +3 -3
- package/build/src/dispatchers/keyDispatcher.d.ts +1 -1
- package/build/src/dispatchers/keyDispatcher.js +1 -1
- package/build/src/dispatchers/mouseDispatcher.d.ts +1 -1
- package/build/src/dispatchers/mouseDispatcher.js +1 -1
- package/build/src/dispatchers/touchDispatcher.d.ts +1 -1
- package/build/src/dispatchers/touchDispatcher.js +1 -1
- package/build/src/drawers/arcDrawer.js +1 -1
- package/build/src/drawers/arcOutlineDrawer.js +1 -1
- package/build/src/drawers/areaDrawer.js +3 -3
- package/build/src/drawers/canvasBuffer.js +2 -2
- package/build/src/drawers/canvasDrawer.d.ts +1 -1
- package/build/src/drawers/canvasDrawer.js +8 -8
- package/build/src/drawers/drawStep.d.ts +2 -2
- package/build/src/drawers/index.js +11 -11
- package/build/src/drawers/lineDrawer.js +3 -3
- package/build/src/drawers/rectangleDrawer.js +2 -2
- package/build/src/drawers/segmentDrawer.js +1 -1
- package/build/src/drawers/symbolDrawer.js +3 -3
- package/build/src/index.js +14 -14
- package/build/src/interactions/clickInteraction.d.ts +1 -1
- package/build/src/interactions/clickInteraction.js +1 -1
- package/build/src/interactions/dragInteraction.d.ts +2 -2
- package/build/src/interactions/dragInteraction.js +1 -1
- package/build/src/interactions/index.js +5 -5
- package/build/src/interactions/keyInteraction.d.ts +1 -1
- package/build/src/interactions/keyInteraction.js +1 -1
- package/build/src/interactions/panZoomConstraints.js +5 -6
- package/build/src/interactions/panZoomInteraction.d.ts +4 -4
- package/build/src/interactions/panZoomInteraction.js +9 -10
- package/build/src/interactions/pointerInteraction.d.ts +1 -1
- package/build/src/interactions/pointerInteraction.js +1 -1
- package/build/src/memoize/index.js +3 -3
- package/build/src/memoize/memThunk.d.ts +1 -1
- package/build/src/memoize/memThunk.js +1 -2
- package/build/src/memoize/memoize.d.ts +1 -1
- package/build/src/memoize/memoize.js +1 -2
- package/build/src/memoize/memoizeProjectors.js +4 -5
- package/build/src/memoize/signature.d.ts +1 -1
- package/build/src/memoize/signature.js +10 -10
- package/build/src/plots/areaPlot.js +4 -3
- package/build/src/plots/barPlot.d.ts +3 -3
- package/build/src/plots/barPlot.js +6 -6
- package/build/src/plots/clusteredBarPlot.js +1 -1
- package/build/src/plots/commons.js +1 -1
- package/build/src/plots/index.js +12 -12
- package/build/src/plots/linePlot.d.ts +2 -3
- package/build/src/plots/linePlot.js +3 -2
- package/build/src/plots/piePlot.js +3 -2
- package/build/src/plots/plot.d.ts +2 -2
- package/build/src/plots/plot.js +9 -9
- package/build/src/plots/rectanglePlot.js +3 -4
- package/build/src/plots/scatterPlot.js +4 -4
- package/build/src/plots/segmentPlot.js +1 -1
- package/build/src/plots/stackedAreaPlot.js +5 -6
- package/build/src/plots/stackedBarPlot.js +4 -4
- package/build/src/plots/waterfallPlot.js +1 -1
- package/build/src/plots/xyPlot.js +3 -3
- package/build/src/scales/categoryScale.js +2 -2
- package/build/src/scales/colorScale.js +24 -5
- package/build/src/scales/index.js +9 -9
- package/build/src/scales/interpolatedColorScale.js +6 -6
- package/build/src/scales/linearScale.js +3 -3
- package/build/src/scales/logScale.js +3 -3
- package/build/src/scales/modifiedLogScale.js +2 -2
- package/build/src/scales/quantitativeScale.js +1 -1
- package/build/src/scales/scale.d.ts +1 -1
- package/build/src/scales/tickGenerators.js +2 -3
- package/build/src/scales/timeScale.js +4 -4
- package/build/src/utils/arrayUtils.js +5 -7
- package/build/src/utils/callbackSet.js +1 -1
- package/build/src/utils/coerceD3.js +1 -2
- package/build/src/utils/colorUtils.js +3 -4
- package/build/src/utils/d3ShapeUtils.d.ts +11 -0
- package/build/src/utils/d3ShapeUtils.js +17 -0
- package/build/src/utils/domUtils.js +20 -20
- package/build/src/utils/index.js +8 -8
- package/build/src/utils/makeEnum.js +1 -2
- package/build/src/utils/mathUtils.d.ts +2 -2
- package/build/src/utils/mathUtils.js +17 -18
- package/build/src/utils/objectUtils.js +1 -2
- package/build/src/utils/rTree.d.ts +1 -1
- package/build/src/utils/rTree.js +4 -4
- package/build/src/utils/rTreeSplitStrategies.d.ts +1 -1
- package/build/src/utils/stackingUtils.d.ts +6 -6
- package/build/src/utils/stackingUtils.js +8 -9
- package/build/src/utils/transformAwareTranslator.js +2 -2
- package/build/src/utils/windowUtils.js +4 -5
- package/package.json +12 -11
- package/plottable.js +19210 -46909
- package/plottable.js.map +1 -1
package/build/src/index.js
CHANGED
|
@@ -34,21 +34,21 @@ var Scales = require("./scales");
|
|
|
34
34
|
exports.Scales = Scales;
|
|
35
35
|
var Utils = require("./utils");
|
|
36
36
|
exports.Utils = Utils;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
tslib_1.__exportStar(require("./animators/animator"), exports);
|
|
38
|
+
tslib_1.__exportStar(require("./axes/axis"), exports);
|
|
39
39
|
var timeAxis_1 = require("./axes/timeAxis");
|
|
40
40
|
Object.defineProperty(exports, "TimeInterval", { enumerable: true, get: function () { return timeAxis_1.TimeInterval; } });
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
tslib_1.__exportStar(require("./components/component"), exports);
|
|
42
|
+
tslib_1.__exportStar(require("./components/componentContainer"), exports);
|
|
43
|
+
tslib_1.__exportStar(require("./core/dataset"), exports);
|
|
44
|
+
tslib_1.__exportStar(require("./core/interfaces"), exports);
|
|
45
45
|
var version_1 = require("./core/version");
|
|
46
46
|
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return version_1.version; } });
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
tslib_1.__exportStar(require("./dispatchers/dispatcher"), exports);
|
|
48
|
+
tslib_1.__exportStar(require("./drawers/drawer"), exports);
|
|
49
|
+
tslib_1.__exportStar(require("./interactions/interaction"), exports);
|
|
50
|
+
tslib_1.__exportStar(require("./interactions/keyInteraction"), exports);
|
|
51
|
+
tslib_1.__exportStar(require("./plots/xyPlot"), exports);
|
|
52
|
+
tslib_1.__exportStar(require("./plots/plot"), exports);
|
|
53
|
+
tslib_1.__exportStar(require("./scales/quantitativeScale"), exports);
|
|
54
|
+
tslib_1.__exportStar(require("./scales/scale"), exports);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Component } from "../components/component";
|
|
6
6
|
import { Point } from "../core/interfaces";
|
|
7
7
|
import { Interaction } from "./interaction";
|
|
8
|
-
export
|
|
8
|
+
export type ClickCallback = (point: Point, event: MouseEvent | TouchEvent) => void;
|
|
9
9
|
export declare class Click extends Interaction {
|
|
10
10
|
private _mouseDispatcher;
|
|
11
11
|
private _touchDispatcher;
|
|
@@ -10,7 +10,7 @@ var Dispatchers = require("../dispatchers");
|
|
|
10
10
|
var Utils = require("../utils");
|
|
11
11
|
var interaction_1 = require("./interaction");
|
|
12
12
|
var Click = /** @class */ (function (_super) {
|
|
13
|
-
|
|
13
|
+
tslib_1.__extends(Click, _super);
|
|
14
14
|
function Click() {
|
|
15
15
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
16
16
|
_this._clickedDown = false;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { Component } from "../components/component";
|
|
6
6
|
import { Point } from "../core/interfaces";
|
|
7
7
|
import { Interaction } from "./interaction";
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export type DragCallback = (start: Point, end: Point) => void;
|
|
9
|
+
export type MouseFilter = (e: MouseEvent) => boolean;
|
|
10
10
|
export declare class Drag extends Interaction {
|
|
11
11
|
private static _DEFAULT_MOUSE_FILTER;
|
|
12
12
|
private _dragging;
|
|
@@ -10,7 +10,7 @@ var Dispatchers = require("../dispatchers");
|
|
|
10
10
|
var Utils = require("../utils");
|
|
11
11
|
var interaction_1 = require("./interaction");
|
|
12
12
|
var Drag = /** @class */ (function (_super) {
|
|
13
|
-
|
|
13
|
+
tslib_1.__extends(Drag, _super);
|
|
14
14
|
function Drag(mouseButton) {
|
|
15
15
|
var _this = _super.call(this) || this;
|
|
16
16
|
_this._dragging = false;
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.zoomOut = void 0;
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
tslib_1.__exportStar(require("./clickInteraction"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./dragInteraction"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./keyInteraction"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./panZoomInteraction"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./pointerInteraction"), exports);
|
|
14
14
|
var panZoomConstraints_1 = require("./panZoomConstraints");
|
|
15
15
|
Object.defineProperty(exports, "zoomOut", { enumerable: true, get: function () { return panZoomConstraints_1.zoomOut; } });
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Component } from "../components/component";
|
|
6
6
|
import { Interaction } from "./interaction";
|
|
7
|
-
export
|
|
7
|
+
export type KeyCallback = (keyCode: number) => void;
|
|
8
8
|
export declare class Key extends Interaction {
|
|
9
9
|
/**
|
|
10
10
|
* A Key Interaction listens to key events that occur while the Component is
|
|
@@ -10,7 +10,7 @@ var Dispatchers = require("../dispatchers");
|
|
|
10
10
|
var Utils = require("../utils");
|
|
11
11
|
var interaction_1 = require("./interaction");
|
|
12
12
|
var Key = /** @class */ (function (_super) {
|
|
13
|
-
|
|
13
|
+
tslib_1.__extends(Key, _super);
|
|
14
14
|
function Key() {
|
|
15
15
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
16
16
|
_this._keyPressCallbacks = {};
|
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.zoomOut = zoomOut;
|
|
8
|
+
exports.constrainedZoom = constrainedZoom;
|
|
9
|
+
exports.constrainZoomExtents = constrainZoomExtents;
|
|
10
|
+
exports.constrainZoomValues = constrainZoomValues;
|
|
11
|
+
exports.constrainedTranslation = constrainedTranslation;
|
|
8
12
|
/**
|
|
9
13
|
* Return `value` if its distance to `center` was scaled by `zoom`.
|
|
10
14
|
*
|
|
@@ -16,7 +20,6 @@ exports.constrainedTranslation = exports.constrainZoomValues = exports.constrain
|
|
|
16
20
|
function zoomOut(value, zoom, center) {
|
|
17
21
|
return center - (center - value) * zoom;
|
|
18
22
|
}
|
|
19
|
-
exports.zoomOut = zoomOut;
|
|
20
23
|
/**
|
|
21
24
|
* This is the zoomOut method algebra-ed to solve for the `center` value
|
|
22
25
|
* given the other three. The "target" is the return value of zoomOut.
|
|
@@ -32,7 +35,6 @@ function constrainedZoom(scale, zoomAmount, centerPoint, minDomainExtent, maxDom
|
|
|
32
35
|
zoomAmount = constrainZoomExtents(scale, zoomAmount, minDomainExtent, maxDomainExtent);
|
|
33
36
|
return constrainZoomValues(scale, zoomAmount, centerPoint, minDomainValue, maxDomainValue);
|
|
34
37
|
}
|
|
35
|
-
exports.constrainedZoom = constrainedZoom;
|
|
36
38
|
function constrainZoomExtents(scale, zoomAmount, minDomainExtent, maxDomainExtent) {
|
|
37
39
|
var extentIncreasing = zoomAmount > 1;
|
|
38
40
|
var boundingDomainExtent = extentIncreasing ? maxDomainExtent : minDomainExtent;
|
|
@@ -44,7 +46,6 @@ function constrainZoomExtents(scale, zoomAmount, minDomainExtent, maxDomainExten
|
|
|
44
46
|
var compareF = extentIncreasing ? Math.min : Math.max;
|
|
45
47
|
return compareF(zoomAmount, boundingDomainExtent / domainExtent);
|
|
46
48
|
}
|
|
47
|
-
exports.constrainZoomExtents = constrainZoomExtents;
|
|
48
49
|
/**
|
|
49
50
|
* Modify zoomAmount and centerPoint such that a panzoom will stay inside
|
|
50
51
|
* the bounds defined by minDomainValue and maxDomainValue.
|
|
@@ -113,7 +114,6 @@ function constrainZoomValues(scale, zoomAmount, centerPoint, minDomainValue, max
|
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
|
-
exports.constrainZoomValues = constrainZoomValues;
|
|
117
117
|
/**
|
|
118
118
|
* Returns a new translation value that respects domain min/max value
|
|
119
119
|
* constraints.
|
|
@@ -139,7 +139,6 @@ function constrainedTranslation(scale, translation, minDomainValue, maxDomainVal
|
|
|
139
139
|
}
|
|
140
140
|
return translation;
|
|
141
141
|
}
|
|
142
|
-
exports.constrainedTranslation = constrainedTranslation;
|
|
143
142
|
/**
|
|
144
143
|
* Returns true iff the scale.range[1] < scale.range[0].
|
|
145
144
|
*/
|
|
@@ -7,10 +7,10 @@ import { Point } from "../core/interfaces";
|
|
|
7
7
|
import { TransformableScale } from "../scales/scale";
|
|
8
8
|
import * as Interactions from "./";
|
|
9
9
|
import { Interaction } from "./interaction";
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
10
|
+
export type PanCallback = () => void;
|
|
11
|
+
export type ZoomCallback = () => void;
|
|
12
|
+
export type PanZoomUpdateCallback = () => void;
|
|
13
|
+
export type WheelFilter = (wheelEvent: WheelEvent) => boolean;
|
|
14
14
|
export declare class PanZoom extends Interaction {
|
|
15
15
|
/**
|
|
16
16
|
* The number of pixels occupied in a line.
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.PanZoom = void 0;
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
|
-
var d3 = require("d3");
|
|
10
9
|
var Dispatchers = require("../dispatchers");
|
|
11
10
|
var Scales = require("../scales");
|
|
12
11
|
var Utils = require("../utils");
|
|
@@ -14,7 +13,7 @@ var Interactions = require("./");
|
|
|
14
13
|
var interaction_1 = require("./interaction");
|
|
15
14
|
var panZoomConstraints_1 = require("./panZoomConstraints");
|
|
16
15
|
var PanZoom = /** @class */ (function (_super) {
|
|
17
|
-
|
|
16
|
+
tslib_1.__extends(PanZoom, _super);
|
|
18
17
|
/**
|
|
19
18
|
* A PanZoom Interaction updates the domains of an x-scale and/or a y-scale
|
|
20
19
|
* in response to the user panning or zooming.
|
|
@@ -38,7 +37,7 @@ var PanZoom = /** @class */ (function (_super) {
|
|
|
38
37
|
_this._yScales = new Utils.Set();
|
|
39
38
|
_this._dragInteraction = new Interactions.Drag();
|
|
40
39
|
_this._setupDragInteraction();
|
|
41
|
-
_this._touchIds =
|
|
40
|
+
_this._touchIds = new Map();
|
|
42
41
|
_this._minDomainExtents = new Utils.Map();
|
|
43
42
|
_this._maxDomainExtents = new Utils.Map();
|
|
44
43
|
_this._minDomainValues = new Utils.Map();
|
|
@@ -152,17 +151,17 @@ var PanZoom = /** @class */ (function (_super) {
|
|
|
152
151
|
this._dragInteraction.detach();
|
|
153
152
|
};
|
|
154
153
|
PanZoom.prototype._handleTouchStart = function (ids, idToPoint, e) {
|
|
155
|
-
for (var i = 0; i < ids.length && this._touchIds.size
|
|
154
|
+
for (var i = 0; i < ids.length && this._touchIds.size < 2; i++) {
|
|
156
155
|
var id = ids[i];
|
|
157
156
|
this._touchIds.set(id.toString(), this._translateToComponentSpace(idToPoint[id]));
|
|
158
157
|
}
|
|
159
158
|
};
|
|
160
159
|
PanZoom.prototype._handlePinch = function (ids, idToPoint, e) {
|
|
161
160
|
var _this = this;
|
|
162
|
-
if (this._touchIds.size
|
|
161
|
+
if (this._touchIds.size < 2) {
|
|
163
162
|
return;
|
|
164
163
|
}
|
|
165
|
-
var oldPoints = this._touchIds.values();
|
|
164
|
+
var oldPoints = Array.from(this._touchIds.values());
|
|
166
165
|
if (!this._isInsideComponent(this._translateToComponentSpace(oldPoints[0])) || !this._isInsideComponent(this._translateToComponentSpace(oldPoints[1]))) {
|
|
167
166
|
return;
|
|
168
167
|
}
|
|
@@ -175,7 +174,7 @@ var PanZoom = /** @class */ (function (_super) {
|
|
|
175
174
|
_this._touchIds.set(id.toString(), _this._translateToComponentSpace(idToPoint[id]));
|
|
176
175
|
}
|
|
177
176
|
});
|
|
178
|
-
var points = this._touchIds.values();
|
|
177
|
+
var points = Array.from(this._touchIds.values());
|
|
179
178
|
var newCornerDistance = PanZoom._pointDistance(points[0], points[1]);
|
|
180
179
|
if (newCornerDistance === 0) {
|
|
181
180
|
return;
|
|
@@ -219,9 +218,9 @@ var PanZoom = /** @class */ (function (_super) {
|
|
|
219
218
|
PanZoom.prototype._handleTouchEnd = function (ids, idToPoint, e) {
|
|
220
219
|
var _this = this;
|
|
221
220
|
ids.forEach(function (id) {
|
|
222
|
-
_this._touchIds.
|
|
221
|
+
_this._touchIds.delete(id.toString());
|
|
223
222
|
});
|
|
224
|
-
if (this._touchIds.size
|
|
223
|
+
if (this._touchIds.size > 0) {
|
|
225
224
|
this._zoomEndCallbacks.callCallbacks();
|
|
226
225
|
}
|
|
227
226
|
};
|
|
@@ -252,7 +251,7 @@ var PanZoom = /** @class */ (function (_super) {
|
|
|
252
251
|
var lastDragPoint;
|
|
253
252
|
this._dragInteraction.onDragStart(function () { return lastDragPoint = null; });
|
|
254
253
|
this._dragInteraction.onDrag(function (startPoint, endPoint) {
|
|
255
|
-
if (_this._touchIds.size
|
|
254
|
+
if (_this._touchIds.size >= 2) {
|
|
256
255
|
return;
|
|
257
256
|
}
|
|
258
257
|
var translateAmount = {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Component } from "../components/component";
|
|
6
6
|
import { Point } from "../core/interfaces";
|
|
7
7
|
import { Interaction } from "./interaction";
|
|
8
|
-
export
|
|
8
|
+
export type PointerCallback = (point: Point) => void;
|
|
9
9
|
export declare class Pointer extends Interaction {
|
|
10
10
|
private _mouseDispatcher;
|
|
11
11
|
private _touchDispatcher;
|
|
@@ -10,7 +10,7 @@ var Dispatchers = require("../dispatchers");
|
|
|
10
10
|
var Utils = require("../utils");
|
|
11
11
|
var interaction_1 = require("./interaction");
|
|
12
12
|
var Pointer = /** @class */ (function (_super) {
|
|
13
|
-
|
|
13
|
+
tslib_1.__extends(Pointer, _super);
|
|
14
14
|
function Pointer() {
|
|
15
15
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
16
16
|
_this._overComponent = false;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.sign = void 0;
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
tslib_1.__exportStar(require("./memoize"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./memoizeProjectors"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./memThunk"), exports);
|
|
12
12
|
var signature_1 = require("./signature");
|
|
13
13
|
Object.defineProperty(exports, "sign", { enumerable: true, get: function () { return signature_1.sign; } });
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* of creating a memoized function that takes its inputs from mutable class properties.
|
|
6
6
|
*/
|
|
7
7
|
import { MemoizedFunction } from "./index";
|
|
8
|
-
export
|
|
8
|
+
export type Thunk<R> = () => R;
|
|
9
9
|
export declare function memThunk<I1, O>(arg1: Thunk<I1>, compute: (this: void, arg1: I1) => O): MemoizedFunction<Thunk<O>>;
|
|
10
10
|
export declare function memThunk<I1, I2, O>(arg1: Thunk<I1>, arg2: Thunk<I2>, compute: (this: void, arg1: I1, arg2: I2) => O): MemoizedFunction<Thunk<O>>;
|
|
11
11
|
export declare function memThunk<I1, I2, I3, O>(arg1: Thunk<I1>, arg2: Thunk<I2>, arg3: Thunk<I3>, compute: (this: void, arg1: I1, arg2: I2, arg3: I3) => O): MemoizedFunction<Thunk<O>>;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* of creating a memoized function that takes its inputs from mutable class properties.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.memThunk =
|
|
9
|
+
exports.memThunk = memThunk;
|
|
10
10
|
var index_1 = require("./index");
|
|
11
11
|
/**
|
|
12
12
|
* First pass argument thunks that will be evaluated whenever the memThunk
|
|
@@ -35,4 +35,3 @@ function memThunk() {
|
|
|
35
35
|
};
|
|
36
36
|
return memoizedThunk;
|
|
37
37
|
}
|
|
38
|
-
exports.memThunk = memThunk;
|
|
@@ -21,7 +21,7 @@ export interface IMemoizedFunctionMethods {
|
|
|
21
21
|
*/
|
|
22
22
|
logPerformance(): this;
|
|
23
23
|
}
|
|
24
|
-
export
|
|
24
|
+
export type MemoizedFunction<F extends Function> = F & IMemoizedFunctionMethods;
|
|
25
25
|
/**
|
|
26
26
|
* Return a memoized version of the input function. The memoized function
|
|
27
27
|
* reduces unnecessary invocations of the input by keeping a cache of the
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @fileoverview Implements a function memoizer using the Signature API.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.memoize =
|
|
8
|
+
exports.memoize = memoize;
|
|
9
9
|
var signature_1 = require("./signature");
|
|
10
10
|
/**
|
|
11
11
|
* Return a memoized version of the input function. The memoized function
|
|
@@ -76,4 +76,3 @@ function memoize(compute) {
|
|
|
76
76
|
};
|
|
77
77
|
return memoizeFn;
|
|
78
78
|
}
|
|
79
|
-
exports.memoize = memoize;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.memoizeProjector = memoizeProjector;
|
|
4
|
+
exports.memoizeProjectors = memoizeProjectors;
|
|
5
|
+
var memoize_1 = require("lodash-es/memoize");
|
|
5
6
|
/**
|
|
6
7
|
* An index that stores values by numeric key.
|
|
7
8
|
*
|
|
@@ -64,15 +65,13 @@ var DatasetIndexCache = /** @class */ (function () {
|
|
|
64
65
|
return DatasetIndexCache;
|
|
65
66
|
}());
|
|
66
67
|
function memoizeProjector(projector) {
|
|
67
|
-
var memo = (0,
|
|
68
|
+
var memo = (0, memoize_1.default)(projector, DatasetIndexCache.resolver);
|
|
68
69
|
memo.cache = new DatasetIndexCache();
|
|
69
70
|
return memo;
|
|
70
71
|
}
|
|
71
|
-
exports.memoizeProjector = memoizeProjector;
|
|
72
72
|
function memoizeProjectors(attrToProjector) {
|
|
73
73
|
Object.keys(attrToProjector).forEach(function (key) {
|
|
74
74
|
attrToProjector[key] = memoizeProjector(attrToProjector[key]);
|
|
75
75
|
});
|
|
76
76
|
return attrToProjector;
|
|
77
77
|
}
|
|
78
|
-
exports.memoizeProjectors = memoizeProjectors;
|
|
@@ -58,7 +58,7 @@ export declare class ReferenceSignature extends Signature {
|
|
|
58
58
|
constructor(ref: any);
|
|
59
59
|
isSignatureDifferent(other: ReferenceSignature): boolean;
|
|
60
60
|
}
|
|
61
|
-
export
|
|
61
|
+
export type ISignatureRecord = Record<string, Signature>;
|
|
62
62
|
/**
|
|
63
63
|
* A signature for a plain js object.
|
|
64
64
|
*/
|
|
@@ -14,7 +14,13 @@
|
|
|
14
14
|
* We must hand-write a signature for each custom class we wish to support.
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ObjectSignature = exports.ReferenceSignature = exports.ArraySignature = exports.Signature =
|
|
17
|
+
exports.ObjectSignature = exports.ReferenceSignature = exports.ArraySignature = exports.Signature = void 0;
|
|
18
|
+
exports.sign = sign;
|
|
19
|
+
exports.signScale = signScale;
|
|
20
|
+
exports.signDataset = signDataset;
|
|
21
|
+
exports.signRef = signRef;
|
|
22
|
+
exports.signArray = signArray;
|
|
23
|
+
exports.signObj = signObj;
|
|
18
24
|
var tslib_1 = require("tslib");
|
|
19
25
|
var isPlainObject = require("is-plain-object");
|
|
20
26
|
var dataset_1 = require("../core/dataset");
|
|
@@ -52,7 +58,6 @@ function sign(a) {
|
|
|
52
58
|
return signRef(a);
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
|
-
exports.sign = sign;
|
|
56
61
|
function signScale(scale) {
|
|
57
62
|
var scaleObj = {
|
|
58
63
|
// required in case the domain has changed without the updateId changing
|
|
@@ -67,7 +72,6 @@ function signScale(scale) {
|
|
|
67
72
|
};
|
|
68
73
|
return signObj(scaleObj);
|
|
69
74
|
}
|
|
70
|
-
exports.signScale = signScale;
|
|
71
75
|
function signDataset(dataset) {
|
|
72
76
|
var datasetObj = {
|
|
73
77
|
ref: signRef(dataset),
|
|
@@ -77,15 +81,12 @@ function signDataset(dataset) {
|
|
|
77
81
|
};
|
|
78
82
|
return signObj(datasetObj);
|
|
79
83
|
}
|
|
80
|
-
exports.signDataset = signDataset;
|
|
81
84
|
function signRef(a) {
|
|
82
85
|
return new ReferenceSignature(a);
|
|
83
86
|
}
|
|
84
|
-
exports.signRef = signRef;
|
|
85
87
|
function signArray(a) {
|
|
86
88
|
return new ArraySignature(a.map(function (element) { return sign(element); }));
|
|
87
89
|
}
|
|
88
|
-
exports.signArray = signArray;
|
|
89
90
|
function signObj(obj) {
|
|
90
91
|
var signatureRecord = {};
|
|
91
92
|
for (var key in obj) {
|
|
@@ -95,7 +96,6 @@ function signObj(obj) {
|
|
|
95
96
|
}
|
|
96
97
|
return new ObjectSignature(signatureRecord);
|
|
97
98
|
}
|
|
98
|
-
exports.signObj = signObj;
|
|
99
99
|
/**
|
|
100
100
|
* Base signature. Subclasses should implement isSignatureDifferent. All classes
|
|
101
101
|
* should be immutable.
|
|
@@ -120,7 +120,7 @@ exports.Signature = Signature;
|
|
|
120
120
|
* A signature for an array.
|
|
121
121
|
*/
|
|
122
122
|
var ArraySignature = /** @class */ (function (_super) {
|
|
123
|
-
|
|
123
|
+
tslib_1.__extends(ArraySignature, _super);
|
|
124
124
|
function ArraySignature(array) {
|
|
125
125
|
var _this = _super.call(this) || this;
|
|
126
126
|
_this.array = array;
|
|
@@ -146,7 +146,7 @@ var ArraySignature = /** @class */ (function (_super) {
|
|
|
146
146
|
}(Signature));
|
|
147
147
|
exports.ArraySignature = ArraySignature;
|
|
148
148
|
var ReferenceSignature = /** @class */ (function (_super) {
|
|
149
|
-
|
|
149
|
+
tslib_1.__extends(ReferenceSignature, _super);
|
|
150
150
|
function ReferenceSignature(ref) {
|
|
151
151
|
var _this = _super.call(this) || this;
|
|
152
152
|
_this.ref = ref;
|
|
@@ -162,7 +162,7 @@ exports.ReferenceSignature = ReferenceSignature;
|
|
|
162
162
|
* A signature for a plain js object.
|
|
163
163
|
*/
|
|
164
164
|
var ObjectSignature = /** @class */ (function (_super) {
|
|
165
|
-
|
|
165
|
+
tslib_1.__extends(ObjectSignature, _super);
|
|
166
166
|
function ObjectSignature(obj) {
|
|
167
167
|
var _this = _super.call(this) || this;
|
|
168
168
|
_this.obj = obj;
|
|
@@ -9,6 +9,7 @@ var tslib_1 = require("tslib");
|
|
|
9
9
|
var d3 = require("d3");
|
|
10
10
|
var Scales = require("../scales");
|
|
11
11
|
var Utils = require("../utils");
|
|
12
|
+
var d3ShapeUtils_1 = require("../utils/d3ShapeUtils");
|
|
12
13
|
var Drawers = require("../drawers");
|
|
13
14
|
var areaDrawer_1 = require("../drawers/areaDrawer");
|
|
14
15
|
var drawer_1 = require("../drawers/drawer");
|
|
@@ -17,7 +18,7 @@ var Plots = require("./");
|
|
|
17
18
|
var linePlot_1 = require("./linePlot");
|
|
18
19
|
var plot_1 = require("./plot");
|
|
19
20
|
var Area = /** @class */ (function (_super) {
|
|
20
|
-
|
|
21
|
+
tslib_1.__extends(Area, _super);
|
|
21
22
|
/**
|
|
22
23
|
* An Area Plot draws a filled region (area) between Y and Y0.
|
|
23
24
|
*
|
|
@@ -210,7 +211,7 @@ var Area = /** @class */ (function (_super) {
|
|
|
210
211
|
Area.prototype._createAreaGenerator = function (xProjector, yProjector, y0Projector, definedProjector, dataset) {
|
|
211
212
|
// just runtime error if user passes curveBundle to area plot
|
|
212
213
|
var curveFactory = this._getCurveFactory();
|
|
213
|
-
var areaGenerator = d3.area()
|
|
214
|
+
var areaGenerator = (0, d3ShapeUtils_1.withFullPrecision)(d3.area())
|
|
214
215
|
.x(function (innerDatum, innerIndex) { return xProjector(innerDatum, innerIndex, dataset); })
|
|
215
216
|
.y1(function (innerDatum, innerIndex) { return yProjector(innerDatum, innerIndex, dataset); })
|
|
216
217
|
.y0(function (innerDatum, innerIndex) { return y0Projector(innerDatum, innerIndex, dataset); })
|
|
@@ -220,7 +221,7 @@ var Area = /** @class */ (function (_super) {
|
|
|
220
221
|
};
|
|
221
222
|
Area.prototype._createTopLineGenerator = function (xProjector, yProjector, definedProjector, dataset) {
|
|
222
223
|
var curveFactory = this._getCurveFactory();
|
|
223
|
-
var areaGenerator = d3.line()
|
|
224
|
+
var areaGenerator = (0, d3ShapeUtils_1.withFullPrecision)(d3.line())
|
|
224
225
|
.x(function (innerDatum, innerIndex) { return xProjector(innerDatum, innerIndex, dataset); })
|
|
225
226
|
.y(function (innerDatum, innerIndex) { return yProjector(innerDatum, innerIndex, dataset); })
|
|
226
227
|
.curve(curveFactory)
|
|
@@ -17,20 +17,20 @@ export declare const BarOrientation: {
|
|
|
17
17
|
vertical: "vertical";
|
|
18
18
|
horizontal: "horizontal";
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type BarOrientation = keyof typeof BarOrientation;
|
|
21
21
|
export declare const LabelsPosition: {
|
|
22
22
|
end: "end";
|
|
23
23
|
start: "start";
|
|
24
24
|
middle: "middle";
|
|
25
25
|
outside: "outside";
|
|
26
26
|
};
|
|
27
|
-
export
|
|
27
|
+
export type LabelsPosition = keyof typeof LabelsPosition;
|
|
28
28
|
export declare const BarAlignment: {
|
|
29
29
|
end: "end";
|
|
30
30
|
start: "start";
|
|
31
31
|
middle: "middle";
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export type BarAlignment = keyof typeof BarAlignment;
|
|
34
34
|
export declare class Bar<X, Y> extends XYPlot<X, Y> {
|
|
35
35
|
static _BAR_THICKNESS_RATIO: number;
|
|
36
36
|
static _BAR_GAPLESS_THRESHOLD_PX: number;
|
|
@@ -26,7 +26,7 @@ exports.BarOrientation = (0, makeEnum_1.makeEnum)(["vertical", "horizontal"]);
|
|
|
26
26
|
exports.LabelsPosition = (0, makeEnum_1.makeEnum)(["start", "middle", "end", "outside"]);
|
|
27
27
|
exports.BarAlignment = (0, makeEnum_1.makeEnum)(["start", "middle", "end"]);
|
|
28
28
|
var Bar = /** @class */ (function (_super) {
|
|
29
|
-
|
|
29
|
+
tslib_1.__extends(Bar, _super);
|
|
30
30
|
/**
|
|
31
31
|
* A Bar Plot draws bars growing out from a baseline to some value
|
|
32
32
|
*
|
|
@@ -226,7 +226,7 @@ var Bar = /** @class */ (function (_super) {
|
|
|
226
226
|
// clearing to remove outdated font-size classes
|
|
227
227
|
labelArea.attr("class", null)
|
|
228
228
|
.classed(Bar._LABEL_AREA_CLASS, true)
|
|
229
|
-
.classed("label-"
|
|
229
|
+
.classed("label-".concat(_this._labelFontSize), true);
|
|
230
230
|
});
|
|
231
231
|
return this.render();
|
|
232
232
|
}
|
|
@@ -235,7 +235,7 @@ var Bar = /** @class */ (function (_super) {
|
|
|
235
235
|
var drawer = _super.prototype._createNodesForDataset.call(this, dataset);
|
|
236
236
|
var labelArea = this._renderArea.append("g")
|
|
237
237
|
.classed(Bar._LABEL_AREA_CLASS, true)
|
|
238
|
-
.classed("label-"
|
|
238
|
+
.classed("label-".concat(this._labelFontSize), true);
|
|
239
239
|
var context = new Typesettable.SvgContext(labelArea.node());
|
|
240
240
|
var measurer = new Typesettable.CacheMeasurer(context);
|
|
241
241
|
var writer = new Typesettable.Writer(measurer, context);
|
|
@@ -525,7 +525,7 @@ var Bar = /** @class */ (function (_super) {
|
|
|
525
525
|
};
|
|
526
526
|
};
|
|
527
527
|
Bar.prototype._createLabelContainer = function (labelArea, labelContainerOrigin, labelOrigin, measurement, showLabelOnBar, color) {
|
|
528
|
-
var labelContainer = labelArea.append("g").attr("transform", "translate("
|
|
528
|
+
var labelContainer = labelArea.append("g").attr("transform", "translate(".concat(labelContainerOrigin.x, ", ").concat(labelContainerOrigin.y, ")"));
|
|
529
529
|
if (showLabelOnBar) {
|
|
530
530
|
labelContainer.classed("on-bar-label", true);
|
|
531
531
|
var dark = Utils.Color.contrast("white", color) * 1.6 < Utils.Color.contrast("black", color);
|
|
@@ -751,11 +751,11 @@ function computeBarPixelThickness(positionBinding, datasets, plotPositionDimensi
|
|
|
751
751
|
}
|
|
752
752
|
else {
|
|
753
753
|
var positionAccessor_1 = positionBinding.accessor;
|
|
754
|
-
var numberBarAccessorData =
|
|
754
|
+
var numberBarAccessorData = Utils.Array.uniq(Utils.Array.flatten(datasets.map(function (dataset) {
|
|
755
755
|
return dataset.data().map(function (d, i) { return positionAccessor_1(d, i, dataset); })
|
|
756
756
|
.filter(function (d) { return d != null; })
|
|
757
757
|
.map(function (d) { return d.valueOf(); });
|
|
758
|
-
}))).
|
|
758
|
+
}))).map(function (value) { return +value; });
|
|
759
759
|
numberBarAccessorData.sort(function (a, b) { return a - b; });
|
|
760
760
|
var scaledData = numberBarAccessorData.map(function (datum) { return positionScale.scale(datum); });
|
|
761
761
|
var barAccessorDataPairs = d3.pairs(scaledData);
|
|
@@ -11,7 +11,7 @@ var Utils = require("../utils");
|
|
|
11
11
|
var barPlot_1 = require("./barPlot");
|
|
12
12
|
var plot_1 = require("./plot");
|
|
13
13
|
var ClusteredBar = /** @class */ (function (_super) {
|
|
14
|
-
|
|
14
|
+
tslib_1.__extends(ClusteredBar, _super);
|
|
15
15
|
/**
|
|
16
16
|
* A ClusteredBar Plot groups bars across Datasets based on the primary value of the bars.
|
|
17
17
|
* On a vertical ClusteredBar Plot, the bars with the same X value are grouped.
|
package/build/src/plots/index.js
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
var tslib_1 = require("tslib");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
tslib_1.__exportStar(require("./areaPlot"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./barPlot"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./commons"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./clusteredBarPlot"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./linePlot"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./piePlot"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./rectanglePlot"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./scatterPlot"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./segmentPlot"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./stackedAreaPlot"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./stackedBarPlot"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./waterfallPlot"), exports);
|