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/README.md
CHANGED
|
@@ -11,6 +11,13 @@ Plottable is used and developed at [Palantir Technologies](http://palantir.com/)
|
|
|
11
11
|
|
|
12
12
|
## Quick Start
|
|
13
13
|
|
|
14
|
+
Plottable requires D3 7 (`d3@^7.9.0`) and a browser with ES2015 support.
|
|
15
|
+
When loading D3 with a script tag or RequireJS, use `d3/dist/d3.min.js`.
|
|
16
|
+
CommonJS consumers need Node.js 22.12 or later to load D3's ES modules;
|
|
17
|
+
browser applications can use a bundler with ES module support.
|
|
18
|
+
TypeScript consumers need TypeScript 5 or later for the D3 type definitions.
|
|
19
|
+
The `Category20`, `Category20b`, and `Category20c` color scales retain their original palettes.
|
|
20
|
+
|
|
14
21
|
- Get Plottable:
|
|
15
22
|
- npm: `npm install --save plottable`
|
|
16
23
|
- yarn: `yarn add plottable`
|
|
@@ -38,8 +45,8 @@ If you run into any problems using Plottable, please let us know. We want Plotta
|
|
|
38
45
|
## Development
|
|
39
46
|
|
|
40
47
|
- Clone the repo
|
|
41
|
-
-
|
|
42
|
-
- Run `yarn
|
|
48
|
+
- Use the Node.js version in `.nvmrc`, then run `yarn install` and `yarn build`
|
|
49
|
+
- Run `yarn playwright install chromium` to install the browser used by `yarn test`
|
|
43
50
|
- Run `yarn start` and it will spin up a server (pointed at http://localhost:9999) and begin compiling the typescript code
|
|
44
51
|
- Navigate to `http://localhost:9999/quicktests/` and choose a directory to view visual tests
|
|
45
52
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as d3 from "d3";
|
|
6
6
|
import { AttributeToAppliedProjector, SimpleSelection } from "../core/interfaces";
|
|
7
7
|
import { IAnimator } from "./animator";
|
|
8
|
-
export
|
|
8
|
+
export type EaseFn = (normalizedTime: number) => number;
|
|
9
9
|
export declare const EaseName: {
|
|
10
10
|
linear: "linear";
|
|
11
11
|
circle: "circle";
|
|
@@ -48,7 +48,7 @@ export declare const EaseName: {
|
|
|
48
48
|
/**
|
|
49
49
|
* Known ease types that animator's .ease() methods understand
|
|
50
50
|
*/
|
|
51
|
-
export
|
|
51
|
+
export type EaseName = keyof typeof EaseName;
|
|
52
52
|
/**
|
|
53
53
|
* An Animator with easing and configurable durations and delays.
|
|
54
54
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.Easing = exports.EaseName = void 0;
|
|
8
|
-
var d3Ease = require("d3
|
|
8
|
+
var d3Ease = require("d3");
|
|
9
9
|
var coerceD3_1 = require("../utils/coerceD3");
|
|
10
10
|
var makeEnum_1 = require("../utils/makeEnum");
|
|
11
11
|
var EASE_NAME_MAPPING = {
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
var tslib_1 = require("tslib");
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
tslib_1.__exportStar(require("./easingAnimator"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./nullAnimator"), exports);
|
package/build/src/axes/axis.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const AxisOrientation: {
|
|
|
13
13
|
bottom: "bottom";
|
|
14
14
|
right: "right";
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type AxisOrientation = keyof typeof AxisOrientation;
|
|
17
17
|
export declare class Axis<D> extends Component {
|
|
18
18
|
/**
|
|
19
19
|
* The css class applied to each end tick mark (the line on the end tick).
|
package/build/src/axes/axis.js
CHANGED
|
@@ -15,7 +15,7 @@ var Utils = require("../utils");
|
|
|
15
15
|
var makeEnum_1 = require("../utils/makeEnum");
|
|
16
16
|
exports.AxisOrientation = (0, makeEnum_1.makeEnum)(["bottom", "left", "right", "top"]);
|
|
17
17
|
var Axis = /** @class */ (function (_super) {
|
|
18
|
-
|
|
18
|
+
tslib_1.__extends(Axis, _super);
|
|
19
19
|
/**
|
|
20
20
|
* Constructs an Axis.
|
|
21
21
|
* An Axis is a visual representation of a Scale.
|
|
@@ -184,8 +184,8 @@ var Axis = /** @class */ (function (_super) {
|
|
|
184
184
|
}
|
|
185
185
|
// clearing to remove outdated font-size classes
|
|
186
186
|
this._tickLabelContainer.attr("class", null)
|
|
187
|
-
.classed(Axis.TICK_LABEL_CLASS
|
|
188
|
-
.classed("label-"
|
|
187
|
+
.classed("".concat(Axis.TICK_LABEL_CLASS, "-container"), true)
|
|
188
|
+
.classed("label-".concat(this._tickLabelFontSize), true);
|
|
189
189
|
};
|
|
190
190
|
/*
|
|
191
191
|
* Function for generating tick values in data-space (as opposed to pixel values).
|
|
@@ -281,7 +281,7 @@ var Axis = /** @class */ (function (_super) {
|
|
|
281
281
|
}
|
|
282
282
|
});
|
|
283
283
|
var bindElements = function (selection, elementName, className) {
|
|
284
|
-
var elementsUpdate = selection.selectAll("."
|
|
284
|
+
var elementsUpdate = selection.selectAll(".".concat(className)).data(annotatedTicks);
|
|
285
285
|
var elements = elementsUpdate
|
|
286
286
|
.enter()
|
|
287
287
|
.append(elementName)
|
|
@@ -356,7 +356,7 @@ var Axis = /** @class */ (function (_super) {
|
|
|
356
356
|
transform: function (d) {
|
|
357
357
|
var xTranslate = isHorizontal ? positionF(d) : rectangleOffsetF(d);
|
|
358
358
|
var yTranslate = isHorizontal ? rectangleOffsetF(d) : positionF(d);
|
|
359
|
-
return "translate("
|
|
359
|
+
return "translate(".concat(xTranslate, ",").concat(yTranslate, ")");
|
|
360
360
|
},
|
|
361
361
|
visibility: visibilityF,
|
|
362
362
|
})
|
|
@@ -13,7 +13,7 @@ var label_1 = require("../components/label");
|
|
|
13
13
|
var Utils = require("../utils");
|
|
14
14
|
var axis_1 = require("./axis");
|
|
15
15
|
var Category = /** @class */ (function (_super) {
|
|
16
|
-
|
|
16
|
+
tslib_1.__extends(Category, _super);
|
|
17
17
|
/**
|
|
18
18
|
* Constructs a Category Axis.
|
|
19
19
|
*
|
|
@@ -227,7 +227,7 @@ var Category = /** @class */ (function (_super) {
|
|
|
227
227
|
// aligned with the side of the ticks
|
|
228
228
|
if (self.orientation() === "left" && width > self._tickLabelMaxWidth) {
|
|
229
229
|
var cutOffWidth = width - self._tickLabelMaxWidth;
|
|
230
|
-
var newTransform = container.attr("transform")
|
|
230
|
+
var newTransform = "".concat(container.attr("transform"), " translate(").concat(cutOffWidth, ", 0)");
|
|
231
231
|
container.attr("transform", newTransform);
|
|
232
232
|
}
|
|
233
233
|
width = Math.min(width, self._tickLabelMaxWidth);
|
|
@@ -288,10 +288,11 @@ var Category = /** @class */ (function (_super) {
|
|
|
288
288
|
return _this._wrapper.wrap(_this.formatter()(s), _this._measurer, width, height);
|
|
289
289
|
});
|
|
290
290
|
// HACKHACK: https://github.com/palantir/svg-typewriter/issues/25
|
|
291
|
-
var
|
|
292
|
-
var
|
|
293
|
-
var
|
|
294
|
-
var
|
|
291
|
+
var widths = wrappingResults.map(function (result) { return _this._measurer.measure(result.wrappedText).width; });
|
|
292
|
+
var heights = wrappingResults.map(function (result) { return _this._measurer.measure(result.wrappedText).height; });
|
|
293
|
+
var horizontal = this.isHorizontal() && this._tickLabelAngle === 0;
|
|
294
|
+
var usedWidth = horizontal ? d3.sum(widths) : Utils.Math.max(widths, 0);
|
|
295
|
+
var usedHeight = horizontal ? Utils.Math.max(heights, 0) : d3.sum(heights);
|
|
295
296
|
// If the tick labels are rotated, reverse usedWidth and usedHeight
|
|
296
297
|
// HACKHACK: https://github.com/palantir/svg-typewriter/issues/25
|
|
297
298
|
if (this._tickLabelAngle !== 0) {
|
|
@@ -333,7 +334,7 @@ var Category = /** @class */ (function (_super) {
|
|
|
333
334
|
this._drawTicks(stepWidth, tickLabels);
|
|
334
335
|
var xTranslate = this.orientation() === "right" ? this._tickSpaceRequired() : 0;
|
|
335
336
|
var yTranslate = this.orientation() === "bottom" ? this._tickSpaceRequired() : 0;
|
|
336
|
-
this._tickLabelContainer.attr("transform", "translate("
|
|
337
|
+
this._tickLabelContainer.attr("transform", "translate(".concat(xTranslate, ",").concat(yTranslate, ")"));
|
|
337
338
|
// hide ticks and labels that overflow the axis
|
|
338
339
|
this._showAllTickMarks();
|
|
339
340
|
this._showAllTickLabels();
|
package/build/src/axes/index.js
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
var tslib_1 = require("tslib");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
tslib_1.__exportStar(require("./categoryAxis"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./numericAxis"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./timeAxis"), exports);
|
|
@@ -12,7 +12,7 @@ var Formatters = require("../core/formatters");
|
|
|
12
12
|
var Utils = require("../utils");
|
|
13
13
|
var axis_1 = require("./axis");
|
|
14
14
|
var Numeric = /** @class */ (function (_super) {
|
|
15
|
-
|
|
15
|
+
tslib_1.__extends(Numeric, _super);
|
|
16
16
|
/**
|
|
17
17
|
* Constructs a Numeric Axis.
|
|
18
18
|
*
|
|
@@ -15,12 +15,12 @@ export declare const TimeInterval: {
|
|
|
15
15
|
month: "month";
|
|
16
16
|
year: "year";
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type TimeInterval = keyof typeof TimeInterval;
|
|
19
19
|
/**
|
|
20
20
|
* Defines a configuration for a Time Axis tier.
|
|
21
21
|
* For details on how ticks are generated see: https://github.com/mbostock/d3/wiki/Time-Scales#ticks
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export type TimeAxisTierConfiguration = {
|
|
24
24
|
/**
|
|
25
25
|
* The time unit associated with this configuration (seconds, minutes, hours, etc).
|
|
26
26
|
*/
|
|
@@ -40,7 +40,7 @@ export declare type TimeAxisTierConfiguration = {
|
|
|
40
40
|
* Each configuration will be shown on a different tier.
|
|
41
41
|
* Currently, up to two tiers are supported.
|
|
42
42
|
*/
|
|
43
|
-
export
|
|
43
|
+
export type TimeAxisConfiguration = TimeAxisTierConfiguration[];
|
|
44
44
|
/**
|
|
45
45
|
* Possible orientations for a Time Axis.
|
|
46
46
|
*/
|
|
@@ -48,12 +48,12 @@ export declare const TimeAxisOrientation: {
|
|
|
48
48
|
top: "top";
|
|
49
49
|
bottom: "bottom";
|
|
50
50
|
};
|
|
51
|
-
export
|
|
51
|
+
export type TimeAxisOrientation = keyof typeof TimeAxisOrientation;
|
|
52
52
|
export declare const TierLabelPosition: {
|
|
53
53
|
center: "center";
|
|
54
54
|
between: "between";
|
|
55
55
|
};
|
|
56
|
-
export
|
|
56
|
+
export type TierLabelPosition = keyof typeof TierLabelPosition;
|
|
57
57
|
export declare class Time extends Axis<Date> {
|
|
58
58
|
/**
|
|
59
59
|
* The CSS class applied to each Time Axis tier
|
|
@@ -29,7 +29,7 @@ exports.TimeInterval = (0, makeEnum_1.makeEnum)([
|
|
|
29
29
|
exports.TimeAxisOrientation = (0, makeEnum_1.makeEnum)(["top", "bottom"]);
|
|
30
30
|
exports.TierLabelPosition = (0, makeEnum_1.makeEnum)(["between", "center"]);
|
|
31
31
|
var Time = /** @class */ (function (_super) {
|
|
32
|
-
|
|
32
|
+
tslib_1.__extends(Time, _super);
|
|
33
33
|
/**
|
|
34
34
|
* Constructs a Time Axis.
|
|
35
35
|
*
|
|
@@ -63,8 +63,8 @@ var Time = /** @class */ (function (_super) {
|
|
|
63
63
|
this._tierLabelContainers.forEach(function (container) {
|
|
64
64
|
// clearing to remove outdated font-size classes
|
|
65
65
|
container.attr("class", null)
|
|
66
|
-
.classed(axis_1.Axis.TICK_LABEL_CLASS
|
|
67
|
-
.classed("label-"
|
|
66
|
+
.classed("".concat(axis_1.Axis.TICK_LABEL_CLASS, "-container"), true)
|
|
67
|
+
.classed("label-".concat(_this._tickLabelFontSize), true);
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
return _super.prototype.tickLabelFontSize.call(this, fontSize);
|
|
@@ -214,8 +214,8 @@ var Time = /** @class */ (function (_super) {
|
|
|
214
214
|
for (var i = 0; i < this._numTiers; ++i) {
|
|
215
215
|
var tierContainer = this.content().append("g").classed(Time.TIME_AXIS_TIER_CLASS, true);
|
|
216
216
|
this._tierLabelContainers.push(tierContainer.append("g")
|
|
217
|
-
.classed(axis_1.Axis.TICK_LABEL_CLASS
|
|
218
|
-
.classed("label-"
|
|
217
|
+
.classed("".concat(axis_1.Axis.TICK_LABEL_CLASS, "-container"), true)
|
|
218
|
+
.classed("label-".concat(this._tickLabelFontSize), true));
|
|
219
219
|
this._tierMarkContainers.push(tierContainer.append("g").classed(axis_1.Axis.TICK_MARK_CLASS + "-container", true));
|
|
220
220
|
this._tierBaselines.push(tierContainer.append("line").classed("baseline", true));
|
|
221
221
|
}
|
|
@@ -286,7 +286,7 @@ var Time = /** @class */ (function (_super) {
|
|
|
286
286
|
var tickLabels = tickLabelsUpdate.merge(tickLabelsEnter);
|
|
287
287
|
var textSelection = tickLabels.selectAll("text");
|
|
288
288
|
if (textSelection.size() > 0) {
|
|
289
|
-
textSelection.attr("transform", "translate("
|
|
289
|
+
textSelection.attr("transform", "translate(".concat(xTranslate, ",").concat(yTranslate, ")"));
|
|
290
290
|
}
|
|
291
291
|
tickLabelsUpdate.exit().remove();
|
|
292
292
|
tickLabels.attr("transform", function (d) { return "translate(" + _this._scale.scale(d) + ",0)"; });
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import * as d3 from "d3";
|
|
6
6
|
import { Bounds, Point, SimpleSelection, SpaceRequest } from "../core/interfaces";
|
|
7
7
|
import { ComponentContainer } from "./componentContainer";
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export type ComponentCallback = (component: Component) => void;
|
|
9
|
+
export type IResizeHandler = (size: {
|
|
10
10
|
height: number;
|
|
11
11
|
width: number;
|
|
12
12
|
}) => void;
|
|
@@ -15,13 +15,13 @@ export declare const XAlignment: {
|
|
|
15
15
|
left: "left";
|
|
16
16
|
right: "right";
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type XAlignment = keyof typeof XAlignment;
|
|
19
19
|
export declare const YAlignment: {
|
|
20
20
|
center: "center";
|
|
21
21
|
top: "top";
|
|
22
22
|
bottom: "bottom";
|
|
23
23
|
};
|
|
24
|
-
export
|
|
24
|
+
export type YAlignment = keyof typeof YAlignment;
|
|
25
25
|
/**
|
|
26
26
|
* Components are the core logical units that build Plottable visualizations.
|
|
27
27
|
*
|
|
@@ -8,7 +8,7 @@ exports.Component = exports.YAlignment = exports.XAlignment = void 0;
|
|
|
8
8
|
var d3 = require("d3");
|
|
9
9
|
var RenderController = require("../core/renderController");
|
|
10
10
|
var Utils = require("../utils");
|
|
11
|
-
var
|
|
11
|
+
var isElement_1 = require("lodash-es/isElement");
|
|
12
12
|
var coerceD3_1 = require("../utils/coerceD3");
|
|
13
13
|
var makeEnum_1 = require("../utils/makeEnum");
|
|
14
14
|
exports.XAlignment = (0, makeEnum_1.makeEnum)(["left", "center", "right"]);
|
|
@@ -195,10 +195,10 @@ var Component = /** @class */ (function () {
|
|
|
195
195
|
};
|
|
196
196
|
if (this._element != null) {
|
|
197
197
|
this._element.styles({
|
|
198
|
-
left: originX
|
|
199
|
-
height: height
|
|
200
|
-
top: originY
|
|
201
|
-
width: width
|
|
198
|
+
left: "".concat(originX, "px"),
|
|
199
|
+
height: "".concat(height, "px"),
|
|
200
|
+
top: "".concat(originY, "px"),
|
|
201
|
+
width: "".concat(width, "px"),
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
204
|
if (this._resizeHandler != null) {
|
|
@@ -288,7 +288,7 @@ var Component = /** @class */ (function () {
|
|
|
288
288
|
if (typeof (element) === "string") {
|
|
289
289
|
selection = d3.select(element);
|
|
290
290
|
}
|
|
291
|
-
else if ((0,
|
|
291
|
+
else if ((0, isElement_1.default)(element)) {
|
|
292
292
|
selection = d3.select(element);
|
|
293
293
|
}
|
|
294
294
|
else {
|
|
@@ -13,7 +13,7 @@ var component_1 = require("./component");
|
|
|
13
13
|
* It will not do anything if instantiated directly.
|
|
14
14
|
*/
|
|
15
15
|
var ComponentContainer = /** @class */ (function (_super) {
|
|
16
|
-
|
|
16
|
+
tslib_1.__extends(ComponentContainer, _super);
|
|
17
17
|
function ComponentContainer() {
|
|
18
18
|
var _this = _super.call(this) || this;
|
|
19
19
|
_this._detachCallback = function (component) { return _this.remove(component); };
|
|
@@ -6,7 +6,7 @@ import * as d3 from "d3";
|
|
|
6
6
|
import { Bounds } from "../core/interfaces";
|
|
7
7
|
import * as Interactions from "../interactions";
|
|
8
8
|
import { SelectionBoxLayer } from "./selectionBoxLayer";
|
|
9
|
-
export
|
|
9
|
+
export type DragBoxCallback = (bounds: Bounds) => void;
|
|
10
10
|
export declare class DragBoxLayer extends SelectionBoxLayer {
|
|
11
11
|
private _dragInteraction;
|
|
12
12
|
private _detectionEdgeT;
|
|
@@ -12,7 +12,7 @@ var coerceD3_1 = require("../utils/coerceD3");
|
|
|
12
12
|
var _1 = require("./");
|
|
13
13
|
var selectionBoxLayer_1 = require("./selectionBoxLayer");
|
|
14
14
|
var DragBoxLayer = /** @class */ (function (_super) {
|
|
15
|
-
|
|
15
|
+
tslib_1.__extends(DragBoxLayer, _super);
|
|
16
16
|
/**
|
|
17
17
|
* Constructs a DragBoxLayer.
|
|
18
18
|
*
|
|
@@ -10,7 +10,7 @@ var guideLineLayer_1 = require("../components/guideLineLayer");
|
|
|
10
10
|
var Interactions = require("../interactions");
|
|
11
11
|
var Utils = require("../utils");
|
|
12
12
|
var DragLineLayer = /** @class */ (function (_super) {
|
|
13
|
-
|
|
13
|
+
tslib_1.__extends(DragLineLayer, _super);
|
|
14
14
|
function DragLineLayer(orientation) {
|
|
15
15
|
var _this = _super.call(this, orientation) || this;
|
|
16
16
|
_this._detectionRadius = 3;
|
|
@@ -39,7 +39,7 @@ function gridPositionFactory(scale, between, orderedTicks) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
var Gridlines = /** @class */ (function (_super) {
|
|
42
|
-
|
|
42
|
+
tslib_1.__extends(Gridlines, _super);
|
|
43
43
|
/**
|
|
44
44
|
* @constructor
|
|
45
45
|
* @param {Scale} xScale The scale to base the x gridlines on. Pass null if no gridlines are desired.
|
|
@@ -9,7 +9,7 @@ var tslib_1 = require("tslib");
|
|
|
9
9
|
var Utils = require("../utils");
|
|
10
10
|
var componentContainer_1 = require("./componentContainer");
|
|
11
11
|
var Group = /** @class */ (function (_super) {
|
|
12
|
-
|
|
12
|
+
tslib_1.__extends(Group, _super);
|
|
13
13
|
/**
|
|
14
14
|
* Constructs a Group.
|
|
15
15
|
*
|
|
@@ -14,7 +14,7 @@ var PropertyMode;
|
|
|
14
14
|
PropertyMode[PropertyMode["PIXEL"] = 1] = "PIXEL";
|
|
15
15
|
})(PropertyMode || (PropertyMode = {}));
|
|
16
16
|
var GuideLineLayer = /** @class */ (function (_super) {
|
|
17
|
-
|
|
17
|
+
tslib_1.__extends(GuideLineLayer, _super);
|
|
18
18
|
function GuideLineLayer(orientation) {
|
|
19
19
|
var _this = _super.call(this) || this;
|
|
20
20
|
_this._mode = PropertyMode.VALUE;
|
|
@@ -5,17 +5,17 @@
|
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
tslib_1.__exportStar(require("./dragBoxLayer"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./dragLineLayer"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./gridlines"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./group"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./guideLineLayer"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./interpolatedColorLegend"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./label"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./legend"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./plotGroup"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./selectionBoxLayer"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./table"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./wrappedLabel"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./xDragBoxLayer"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./yDragBoxLayer"), exports);
|
|
@@ -12,7 +12,7 @@ var Formatters = require("../core/formatters");
|
|
|
12
12
|
var Utils = require("../utils");
|
|
13
13
|
var component_1 = require("./component");
|
|
14
14
|
var InterpolatedColorLegend = /** @class */ (function (_super) {
|
|
15
|
-
|
|
15
|
+
tslib_1.__extends(InterpolatedColorLegend, _super);
|
|
16
16
|
/**
|
|
17
17
|
* Creates an InterpolatedColorLegend.
|
|
18
18
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Typesettable from "typesettable";
|
|
6
6
|
import { SimpleSelection, SpaceRequest } from "../core/interfaces";
|
|
7
7
|
import { Component } from "./component";
|
|
8
|
-
export
|
|
8
|
+
export type LabelFontSizePx = 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24;
|
|
9
9
|
export declare class Label extends Component {
|
|
10
10
|
static _MIN_FONT_SIZE_PX: LabelFontSizePx;
|
|
11
11
|
static _MAX_FONT_SIZE_PX: LabelFontSizePx;
|
|
@@ -9,7 +9,7 @@ var tslib_1 = require("tslib");
|
|
|
9
9
|
var Typesettable = require("typesettable");
|
|
10
10
|
var component_1 = require("./component");
|
|
11
11
|
var Label = /** @class */ (function (_super) {
|
|
12
|
-
|
|
12
|
+
tslib_1.__extends(Label, _super);
|
|
13
13
|
/**
|
|
14
14
|
* A Label is a Component that displays a single line of text.
|
|
15
15
|
*
|
|
@@ -130,7 +130,7 @@ var Label = /** @class */ (function (_super) {
|
|
|
130
130
|
}(component_1.Component));
|
|
131
131
|
exports.Label = Label;
|
|
132
132
|
var TitleLabel = /** @class */ (function (_super) {
|
|
133
|
-
|
|
133
|
+
tslib_1.__extends(TitleLabel, _super);
|
|
134
134
|
/**
|
|
135
135
|
* @constructor
|
|
136
136
|
* @param {string} [text]
|
|
@@ -146,7 +146,7 @@ var TitleLabel = /** @class */ (function (_super) {
|
|
|
146
146
|
}(Label));
|
|
147
147
|
exports.TitleLabel = TitleLabel;
|
|
148
148
|
var AxisLabel = /** @class */ (function (_super) {
|
|
149
|
-
|
|
149
|
+
tslib_1.__extends(AxisLabel, _super);
|
|
150
150
|
/**
|
|
151
151
|
* @constructor
|
|
152
152
|
* @param {string} [text]
|
|
@@ -180,7 +180,7 @@ var LegendTable = /** @class */ (function () {
|
|
|
180
180
|
return LegendTable;
|
|
181
181
|
}());
|
|
182
182
|
var Legend = /** @class */ (function (_super) {
|
|
183
|
-
|
|
183
|
+
tslib_1.__extends(Legend, _super);
|
|
184
184
|
/**
|
|
185
185
|
* The Legend consists of a series of entries, each with a color and label taken from the Color Scale.
|
|
186
186
|
*
|
|
@@ -366,12 +366,12 @@ var Legend = /** @class */ (function (_super) {
|
|
|
366
366
|
var columnBounds = table.getColumnBounds(rowIndex, columnIndex);
|
|
367
367
|
var withinColumn = Utils.Math.within(p, columnBounds);
|
|
368
368
|
if (withinColumn) {
|
|
369
|
-
var rowElement = _this.content().selectAll("."
|
|
369
|
+
var rowElement = _this.content().selectAll(".".concat(Legend.LEGEND_ROW_CLASS)).nodes()[rowIndex];
|
|
370
370
|
// HACKHACK The 2.x API chooses the symbol element as the "selection" to return, regardless of what
|
|
371
371
|
// was actually selected
|
|
372
372
|
var entryElement = d3.select(rowElement)
|
|
373
|
-
.selectAll("."
|
|
374
|
-
var symbolElement = d3.select(entryElement).select("."
|
|
373
|
+
.selectAll(".".concat(Legend.LEGEND_ENTRY_CLASS)).nodes()[Math.floor(columnIndex / 2)];
|
|
374
|
+
var symbolElement = d3.select(entryElement).select(".".concat(Legend.LEGEND_SYMBOL_CLASS));
|
|
375
375
|
// HACKHACK The 2.x API returns the center {x, y} of the symbol as the position.
|
|
376
376
|
var rowTranslate = Utils.DOM.getTranslateValues(d3.select(rowElement));
|
|
377
377
|
var symbolTranslate = Utils.DOM.getTranslateValues(symbolElement);
|
|
@@ -404,7 +404,7 @@ var Legend = /** @class */ (function (_super) {
|
|
|
404
404
|
rowsUpdate.exit().remove();
|
|
405
405
|
rows.attr("transform", function (row, rowIndex) {
|
|
406
406
|
var rowBounds = table.getRowBounds(rowIndex);
|
|
407
|
-
return "translate("
|
|
407
|
+
return "translate(".concat(rowBounds.topLeft.x, ", ").concat(rowBounds.topLeft.y, ")");
|
|
408
408
|
});
|
|
409
409
|
var self = this;
|
|
410
410
|
rows.each(function (row, rowIndex) {
|
|
@@ -412,7 +412,7 @@ var Legend = /** @class */ (function (_super) {
|
|
|
412
412
|
for (var i = 0; i < row.columns.length; i += 2) {
|
|
413
413
|
symbolEntryPairs.push([row.columns[i], row.columns[i + 1]]);
|
|
414
414
|
}
|
|
415
|
-
var entriesUpdate = d3.select(this).selectAll("g."
|
|
415
|
+
var entriesUpdate = d3.select(this).selectAll("g.".concat(Legend.LEGEND_ENTRY_CLASS)).data(symbolEntryPairs);
|
|
416
416
|
var entriesEnter = entriesUpdate
|
|
417
417
|
.enter()
|
|
418
418
|
.append("g")
|
|
@@ -427,7 +427,7 @@ var Legend = /** @class */ (function (_super) {
|
|
|
427
427
|
var symbol = symbolEntryPair[0];
|
|
428
428
|
var columnIndex = table.rows[rowIndex].columns.indexOf(symbol);
|
|
429
429
|
var columnBounds = table.getColumnBounds(rowIndex, columnIndex);
|
|
430
|
-
return "translate("
|
|
430
|
+
return "translate(".concat(columnBounds.topLeft.x + symbol.width / 2, ", ").concat(symbol.height / 2, ")");
|
|
431
431
|
})
|
|
432
432
|
.attr("fill", function (symbolEntryPair) { return self._colorScale.scale(symbolEntryPair[0].data.name); })
|
|
433
433
|
.attr("opacity", function (symbolEntryPair, _columnIndex) {
|
|
@@ -10,7 +10,7 @@ var plot_1 = require("../plots/plot");
|
|
|
10
10
|
var Utils = require("../utils");
|
|
11
11
|
var group_1 = require("./group");
|
|
12
12
|
var PlotGroup = /** @class */ (function (_super) {
|
|
13
|
-
|
|
13
|
+
tslib_1.__extends(PlotGroup, _super);
|
|
14
14
|
function PlotGroup() {
|
|
15
15
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
16
16
|
}
|
|
@@ -12,9 +12,9 @@ var PropertyMode;
|
|
|
12
12
|
(function (PropertyMode) {
|
|
13
13
|
PropertyMode[PropertyMode["VALUE"] = 0] = "VALUE";
|
|
14
14
|
PropertyMode[PropertyMode["PIXEL"] = 1] = "PIXEL";
|
|
15
|
-
})(PropertyMode
|
|
15
|
+
})(PropertyMode || (exports.PropertyMode = PropertyMode = {}));
|
|
16
16
|
var SelectionBoxLayer = /** @class */ (function (_super) {
|
|
17
|
-
|
|
17
|
+
tslib_1.__extends(SelectionBoxLayer, _super);
|
|
18
18
|
function SelectionBoxLayer() {
|
|
19
19
|
var _this = _super.call(this) || this;
|
|
20
20
|
_this._boxVisible = false;
|
|
@@ -10,7 +10,7 @@ var d3 = require("d3");
|
|
|
10
10
|
var Utils = require("../utils");
|
|
11
11
|
var componentContainer_1 = require("./componentContainer");
|
|
12
12
|
var Table = /** @class */ (function (_super) {
|
|
13
|
-
|
|
13
|
+
tslib_1.__extends(Table, _super);
|
|
14
14
|
/**
|
|
15
15
|
* A Table combines Components in the form of a grid. A
|
|
16
16
|
* common case is combining a y-axis, x-axis, and the plotted data via
|
|
@@ -9,7 +9,7 @@ var tslib_1 = require("tslib");
|
|
|
9
9
|
var label_1 = require("./label");
|
|
10
10
|
var DEFAULT_MAX_LINES = 2;
|
|
11
11
|
var WrappedLabel = /** @class */ (function (_super) {
|
|
12
|
-
|
|
12
|
+
tslib_1.__extends(WrappedLabel, _super);
|
|
13
13
|
function WrappedLabel() {
|
|
14
14
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
15
15
|
_this._maxLines = DEFAULT_MAX_LINES;
|
|
@@ -8,7 +8,7 @@ exports.XDragBoxLayer = void 0;
|
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
9
|
var dragBoxLayer_1 = require("./dragBoxLayer");
|
|
10
10
|
var XDragBoxLayer = /** @class */ (function (_super) {
|
|
11
|
-
|
|
11
|
+
tslib_1.__extends(XDragBoxLayer, _super);
|
|
12
12
|
/**
|
|
13
13
|
* An XDragBoxLayer is a DragBoxLayer whose size can only be set in the X-direction.
|
|
14
14
|
* The y-values of the bounds() are always set to 0 and the height() of the XDragBoxLayer.
|
|
@@ -8,7 +8,7 @@ exports.YDragBoxLayer = void 0;
|
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
9
|
var dragBoxLayer_1 = require("./dragBoxLayer");
|
|
10
10
|
var YDragBoxLayer = /** @class */ (function (_super) {
|
|
11
|
-
|
|
11
|
+
tslib_1.__extends(YDragBoxLayer, _super);
|
|
12
12
|
/**
|
|
13
13
|
* A YDragBoxLayer is a DragBoxLayer whose size can only be set in the Y-direction.
|
|
14
14
|
* The x-values of the bounds() are always set to 0 and the width() of the YDragBoxLayer.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright 2014-present Palantir Technologies
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type DatasetCallback = (dataset: Dataset) => void;
|
|
6
6
|
export declare class Dataset {
|
|
7
7
|
private _data;
|
|
8
8
|
private _metadata;
|
|
@@ -10,7 +10,7 @@ import { Dataset } from "./dataset";
|
|
|
10
10
|
* The value will be different for each use of the formatter - check the documentation of individual
|
|
11
11
|
* methods to see what will be passed into the formatter.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type Formatter = (value: any) => string;
|
|
14
14
|
/**
|
|
15
15
|
* A formatter function that will be passed the value to format as well as the underlying datum, index, and
|
|
16
16
|
* dataset that the value came from. Datum-backed visual elements that display labels, such as Bar Plot bars
|
|
@@ -19,7 +19,7 @@ export declare type Formatter = (value: any) => string;
|
|
|
19
19
|
* The value will be different for each use of the formatter - check the documentation of individual
|
|
20
20
|
* methods to see what will be passed into the formatter.
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export type DatumFormatter = (value: any, datum: any, index: number, dataset: Dataset) => string;
|
|
23
23
|
/**
|
|
24
24
|
* Creates a formatter for currency values.
|
|
25
25
|
*
|