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
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.currency = currency;
|
|
8
|
+
exports.fixed = fixed;
|
|
9
|
+
exports.general = general;
|
|
10
|
+
exports.identity = identity;
|
|
11
|
+
exports.percentage = percentage;
|
|
12
|
+
exports.siSuffix = siSuffix;
|
|
13
|
+
exports.shortScale = shortScale;
|
|
14
|
+
exports.multiTime = multiTime;
|
|
15
|
+
exports.time = time;
|
|
8
16
|
var d3 = require("d3");
|
|
9
17
|
// Do not use utc by default
|
|
10
18
|
var DEFAULT_USE_UTC = false;
|
|
@@ -38,7 +46,6 @@ function currency(precision, symbol, prefix) {
|
|
|
38
46
|
return formattedValue;
|
|
39
47
|
};
|
|
40
48
|
}
|
|
41
|
-
exports.currency = currency;
|
|
42
49
|
/**
|
|
43
50
|
* Creates a formatter that displays exactly [precision] decimal places.
|
|
44
51
|
*
|
|
@@ -51,7 +58,6 @@ function fixed(precision) {
|
|
|
51
58
|
verifyPrecision(precision);
|
|
52
59
|
return function (d) { return d.toFixed(precision); };
|
|
53
60
|
}
|
|
54
|
-
exports.fixed = fixed;
|
|
55
61
|
/**
|
|
56
62
|
* Creates a formatter that formats numbers to show no more than
|
|
57
63
|
* [maxNumberOfDecimalPlaces] decimal places. All other values are stringified.
|
|
@@ -73,7 +79,6 @@ function general(maxNumberOfDecimalPlaces) {
|
|
|
73
79
|
}
|
|
74
80
|
};
|
|
75
81
|
}
|
|
76
|
-
exports.general = general;
|
|
77
82
|
/**
|
|
78
83
|
* Creates a formatter that stringifies its input.
|
|
79
84
|
*
|
|
@@ -82,7 +87,6 @@ exports.general = general;
|
|
|
82
87
|
function identity() {
|
|
83
88
|
return function (d) { return String(d); };
|
|
84
89
|
}
|
|
85
|
-
exports.identity = identity;
|
|
86
90
|
/**
|
|
87
91
|
* Creates a formatter for percentage values.
|
|
88
92
|
* Multiplies the input by 100 and appends "%".
|
|
@@ -103,7 +107,6 @@ function percentage(precision) {
|
|
|
103
107
|
return fixedFormatter(valToFormat) + "%";
|
|
104
108
|
};
|
|
105
109
|
}
|
|
106
|
-
exports.percentage = percentage;
|
|
107
110
|
/**
|
|
108
111
|
* Creates a formatter for values that displays [numberOfSignificantFigures] significant figures
|
|
109
112
|
* and puts SI notation.
|
|
@@ -115,9 +118,8 @@ exports.percentage = percentage;
|
|
|
115
118
|
function siSuffix(numberOfSignificantFigures) {
|
|
116
119
|
if (numberOfSignificantFigures === void 0) { numberOfSignificantFigures = 3; }
|
|
117
120
|
verifyPrecision(numberOfSignificantFigures);
|
|
118
|
-
return function (d) { return d3.format("." + numberOfSignificantFigures + "s")(d); };
|
|
121
|
+
return function (d) { return d3.format("." + numberOfSignificantFigures + "s")(d).replace(/\u2212/g, "-"); };
|
|
119
122
|
}
|
|
120
|
-
exports.siSuffix = siSuffix;
|
|
121
123
|
/**
|
|
122
124
|
* Creates a formatter for values that displays abbreviated values
|
|
123
125
|
* and uses standard short scale suffixes
|
|
@@ -137,8 +139,12 @@ function shortScale(precision) {
|
|
|
137
139
|
if (precision === void 0) { precision = 3; }
|
|
138
140
|
verifyPrecision(precision);
|
|
139
141
|
var suffixes = "KMBTQ";
|
|
140
|
-
var
|
|
141
|
-
var
|
|
142
|
+
var formatExponent = d3.format("." + precision + "e");
|
|
143
|
+
var formatFixed = d3.format("." + precision + "f");
|
|
144
|
+
// D3 6 (d3-format 2.0.0) changed the default minus sign from ASCII "-" to Unicode "−" (U+2212).
|
|
145
|
+
// Convert it back to preserve Plottable's output without changing D3's global locale.
|
|
146
|
+
var exponentFormatter = function (value) { return formatExponent(value).replace(/\u2212/g, "-"); };
|
|
147
|
+
var fixedFormatter = function (value) { return formatFixed(value).replace(/\u2212/g, "-"); };
|
|
142
148
|
var max = Math.pow(10, (3 * (suffixes.length + 1)));
|
|
143
149
|
var min = Math.pow(10, -precision);
|
|
144
150
|
return function (num) {
|
|
@@ -170,7 +176,6 @@ function shortScale(precision) {
|
|
|
170
176
|
return output;
|
|
171
177
|
};
|
|
172
178
|
}
|
|
173
|
-
exports.shortScale = shortScale;
|
|
174
179
|
/**
|
|
175
180
|
* Creates a multi time formatter that displays dates.
|
|
176
181
|
*
|
|
@@ -217,7 +222,6 @@ function multiTime() {
|
|
|
217
222
|
return d3.timeFormat(specifier)(d);
|
|
218
223
|
};
|
|
219
224
|
}
|
|
220
|
-
exports.multiTime = multiTime;
|
|
221
225
|
/**
|
|
222
226
|
* Creates a time formatter that displays time/date using given specifier.
|
|
223
227
|
*
|
|
@@ -235,7 +239,6 @@ function time(specifier, useUTC) {
|
|
|
235
239
|
}
|
|
236
240
|
return d3.timeFormat(specifier);
|
|
237
241
|
}
|
|
238
|
-
exports.time = time;
|
|
239
242
|
function verifyPrecision(precision) {
|
|
240
243
|
if (precision < 0 || precision > 20) {
|
|
241
244
|
throw new RangeError("Formatter precision must be between 0 and 20");
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as d3 from "d3";
|
|
6
6
|
import { Component } from "../components/component";
|
|
7
7
|
import { Dataset } from "./dataset";
|
|
8
|
-
export
|
|
8
|
+
export type SimpleSelection<Datum> = d3.Selection<d3.BaseType, Datum | {}, any, any>;
|
|
9
9
|
/**
|
|
10
10
|
* Accesses a specific datum property. Users supply Accessors to their
|
|
11
11
|
* plots' .x, .y, .attr, etc. functions.
|
|
@@ -28,23 +28,23 @@ export interface IRangeProjector<T> {
|
|
|
28
28
|
* Essentially passes the result of an Accessor through a Scale.
|
|
29
29
|
* Projectors are exclusively built from Plot._scaledAccessor.
|
|
30
30
|
*/
|
|
31
|
-
export
|
|
31
|
+
export type Projector = (datum: any, index: number, dataset: Dataset) => any;
|
|
32
32
|
/**
|
|
33
33
|
* A mapping from attributes ("x", "fill", etc.) to the functions that get
|
|
34
34
|
* that information out of the data.
|
|
35
35
|
*/
|
|
36
|
-
export
|
|
36
|
+
export type AttributeToProjector = {
|
|
37
37
|
[attr: string]: Projector;
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
40
|
* A function that generates attribute values from the datum and index.
|
|
41
41
|
* Essentially a Projector with a particular Dataset rolled in.
|
|
42
42
|
*/
|
|
43
|
-
export
|
|
43
|
+
export type AppliedProjector = (datum: any, index: number) => any;
|
|
44
44
|
/**
|
|
45
45
|
* A mapping from attributes to the AppliedProjectors used to generate them.
|
|
46
46
|
*/
|
|
47
|
-
export
|
|
47
|
+
export type AttributeToAppliedProjector = {
|
|
48
48
|
[attr: string]: AppliedProjector;
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
@@ -53,28 +53,28 @@ export declare type AttributeToAppliedProjector = {
|
|
|
53
53
|
* @member {number} minWidth The minimum acceptable width given the offered space.
|
|
54
54
|
* @member {number} minHeight the minimum acceptable height given the offered space.
|
|
55
55
|
*/
|
|
56
|
-
export
|
|
56
|
+
export type SpaceRequest = {
|
|
57
57
|
minWidth: number;
|
|
58
58
|
minHeight: number;
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
61
61
|
* Min and max values for a particular property.
|
|
62
62
|
*/
|
|
63
|
-
export
|
|
63
|
+
export type Range = {
|
|
64
64
|
min: number;
|
|
65
65
|
max: number;
|
|
66
66
|
};
|
|
67
67
|
/**
|
|
68
68
|
* A location in pixel-space.
|
|
69
69
|
*/
|
|
70
|
-
export
|
|
70
|
+
export type Point = {
|
|
71
71
|
x: number;
|
|
72
72
|
y: number;
|
|
73
73
|
};
|
|
74
74
|
/**
|
|
75
75
|
* The corners of a box.
|
|
76
76
|
*/
|
|
77
|
-
export
|
|
77
|
+
export type Bounds = {
|
|
78
78
|
topLeft: Point;
|
|
79
79
|
bottomRight: Point;
|
|
80
80
|
};
|
|
@@ -9,7 +9,7 @@ export declare const Policy: {
|
|
|
9
9
|
immediate: "immediate";
|
|
10
10
|
animationFrame: "animationFrame";
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type Policy = keyof typeof Policy;
|
|
13
13
|
export declare function renderPolicy(): RenderPolicies.IRenderPolicy;
|
|
14
14
|
export declare function renderPolicy(renderPolicy: Policy): void;
|
|
15
15
|
/**
|
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.Policy = void 0;
|
|
8
|
+
exports.renderPolicy = renderPolicy;
|
|
9
|
+
exports.registerToRender = registerToRender;
|
|
10
|
+
exports.registerToComputeLayoutAndRender = registerToComputeLayoutAndRender;
|
|
11
|
+
exports.registerToComputeLayout = registerToComputeLayout;
|
|
12
|
+
exports.flush = flush;
|
|
8
13
|
var Utils = require("../utils");
|
|
9
14
|
var makeEnum_1 = require("../utils/makeEnum");
|
|
10
15
|
var RenderPolicies = require("./renderPolicy");
|
|
@@ -48,7 +53,6 @@ function renderPolicy(renderPolicy) {
|
|
|
48
53
|
Utils.Window.warn("Unrecognized renderPolicy: " + renderPolicy);
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
|
-
exports.renderPolicy = renderPolicy;
|
|
52
56
|
/**
|
|
53
57
|
* Enqueues the Component for rendering.
|
|
54
58
|
*
|
|
@@ -61,7 +65,6 @@ function registerToRender(component) {
|
|
|
61
65
|
_componentsNeedingRender.add(component);
|
|
62
66
|
requestRender();
|
|
63
67
|
}
|
|
64
|
-
exports.registerToRender = registerToRender;
|
|
65
68
|
/**
|
|
66
69
|
* Enqueues the Component for layout and rendering.
|
|
67
70
|
*
|
|
@@ -72,7 +75,6 @@ function registerToComputeLayoutAndRender(component) {
|
|
|
72
75
|
_componentsNeedingRender.add(component);
|
|
73
76
|
requestRender();
|
|
74
77
|
}
|
|
75
|
-
exports.registerToComputeLayoutAndRender = registerToComputeLayoutAndRender;
|
|
76
78
|
/**
|
|
77
79
|
* Enqueues the Component for layout and rendering.
|
|
78
80
|
*
|
|
@@ -82,7 +84,6 @@ exports.registerToComputeLayoutAndRender = registerToComputeLayoutAndRender;
|
|
|
82
84
|
function registerToComputeLayout(component) {
|
|
83
85
|
registerToComputeLayoutAndRender(component);
|
|
84
86
|
}
|
|
85
|
-
exports.registerToComputeLayout = registerToComputeLayout;
|
|
86
87
|
function requestRender() {
|
|
87
88
|
// Only run or enqueue flush on first request.
|
|
88
89
|
if (!_animationRequested) {
|
|
@@ -122,4 +123,3 @@ function flush() {
|
|
|
122
123
|
_isCurrentlyFlushing = false;
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
|
-
exports.flush = flush;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Copyright 2014-present Palantir Technologies
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
|
-
import * as
|
|
5
|
+
import * as d3 from "d3";
|
|
6
6
|
/**
|
|
7
7
|
* A SymbolFactory is a function that takes in a symbolSize which is the edge length of the render area
|
|
8
8
|
* and returns a d3 symbol generator.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type SymbolFactory = (symbolSize: number) => d3.Symbol<any, any>;
|
|
11
11
|
export declare function circle(): SymbolFactory;
|
|
12
12
|
export declare function square(): SymbolFactory;
|
|
13
13
|
export declare function cross(): SymbolFactory;
|
|
@@ -4,51 +4,51 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.circle = circle;
|
|
8
|
+
exports.square = square;
|
|
9
|
+
exports.cross = cross;
|
|
10
|
+
exports.diamond = diamond;
|
|
11
|
+
exports.triangle = triangle;
|
|
12
|
+
exports.star = star;
|
|
13
|
+
exports.wye = wye;
|
|
8
14
|
var d3 = require("d3");
|
|
15
|
+
var d3ShapeUtils_1 = require("../utils/d3ShapeUtils");
|
|
9
16
|
function circle() {
|
|
10
17
|
return function (symbolSize) {
|
|
11
|
-
return d3.symbol().type(d3.symbolCircle).size(Math.PI * Math.pow(symbolSize / 2, 2));
|
|
18
|
+
return (0, d3ShapeUtils_1.withFullPrecision)(d3.symbol()).type(d3.symbolCircle).size(Math.PI * Math.pow(symbolSize / 2, 2));
|
|
12
19
|
};
|
|
13
20
|
}
|
|
14
|
-
exports.circle = circle;
|
|
15
21
|
function square() {
|
|
16
22
|
return function (symbolSize) {
|
|
17
|
-
return d3.symbol().type(d3.symbolSquare).size(Math.pow(symbolSize, 2));
|
|
23
|
+
return (0, d3ShapeUtils_1.withFullPrecision)(d3.symbol()).type(d3.symbolSquare).size(Math.pow(symbolSize, 2));
|
|
18
24
|
};
|
|
19
25
|
}
|
|
20
|
-
exports.square = square;
|
|
21
26
|
function cross() {
|
|
22
27
|
return function (symbolSize) {
|
|
23
|
-
return d3.symbol().type(d3.symbolCross).size((5 / 9) * Math.pow(symbolSize, 2));
|
|
28
|
+
return (0, d3ShapeUtils_1.withFullPrecision)(d3.symbol()).type(d3.symbolCross).size((5 / 9) * Math.pow(symbolSize, 2));
|
|
24
29
|
};
|
|
25
30
|
}
|
|
26
|
-
exports.cross = cross;
|
|
27
31
|
function diamond() {
|
|
28
32
|
return function (symbolSize) {
|
|
29
|
-
return d3.symbol().type(d3.symbolDiamond).size(Math.tan(Math.PI / 6) * Math.pow(symbolSize, 2) / 2);
|
|
33
|
+
return (0, d3ShapeUtils_1.withFullPrecision)(d3.symbol()).type(d3.symbolDiamond).size(Math.tan(Math.PI / 6) * Math.pow(symbolSize, 2) / 2);
|
|
30
34
|
};
|
|
31
35
|
}
|
|
32
|
-
exports.diamond = diamond;
|
|
33
36
|
function triangle() {
|
|
34
37
|
return function (symbolSize) {
|
|
35
|
-
return d3.symbol().type(d3.symbolTriangle).size(Math.sqrt(3) * Math.pow(symbolSize / 2, 2));
|
|
38
|
+
return (0, d3ShapeUtils_1.withFullPrecision)(d3.symbol()).type(d3.symbolTriangle).size(Math.sqrt(3) * Math.pow(symbolSize / 2, 2));
|
|
36
39
|
};
|
|
37
40
|
}
|
|
38
|
-
exports.triangle = triangle;
|
|
39
41
|
// copied from https://github.com/d3/d3-shape/blob/e2e57722004acba754ed9edff020282682450c5c/src/symbol/star.js#L3
|
|
40
42
|
var ka = 0.89081309152928522810;
|
|
41
43
|
function star() {
|
|
42
44
|
return function (symbolSize) {
|
|
43
|
-
return d3.symbol().type(d3.symbolStar).size(ka * Math.pow(symbolSize / 2, 2));
|
|
45
|
+
return (0, d3ShapeUtils_1.withFullPrecision)(d3.symbol()).type(d3.symbolStar).size(ka * Math.pow(symbolSize / 2, 2));
|
|
44
46
|
};
|
|
45
47
|
}
|
|
46
|
-
exports.star = star;
|
|
47
48
|
// copied from https://github.com/d3/d3-shape/blob/c35b2303eb4836aba3171642f01c2653e4228b9c/src/symbol/wye.js#L2
|
|
48
49
|
var a = ((1 / Math.sqrt(12)) / 2 + 1) * 3;
|
|
49
50
|
function wye() {
|
|
50
51
|
return function (symbolSize) {
|
|
51
|
-
return d3.symbol().type(d3.symbolWye).size(a * Math.pow(symbolSize / 2.4, 2));
|
|
52
|
+
return (0, d3ShapeUtils_1.withFullPrecision)(d3.symbol()).type(d3.symbolWye).size(a * Math.pow(symbolSize / 2.4, 2));
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
|
-
exports.wye = wye;
|
|
@@ -10,4 +10,4 @@ exports.version = void 0;
|
|
|
10
10
|
* real version number during the dist phase for for npm module publishing. Modifying this line should
|
|
11
11
|
* be accompanied by modifying the "sed-version" task in package.json accordingly.
|
|
12
12
|
*/
|
|
13
|
-
exports.version = "
|
|
13
|
+
exports.version = "4.0.0";
|
|
@@ -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("./keyDispatcher"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./mouseDispatcher"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./touchDispatcher"), exports);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as Dispatchers from "./";
|
|
6
6
|
import { Dispatcher } from "./dispatcher";
|
|
7
|
-
export
|
|
7
|
+
export type KeyCallback = (keyCode: number, event: KeyboardEvent) => void;
|
|
8
8
|
export declare class Key extends Dispatcher {
|
|
9
9
|
private static _DISPATCHER_KEY;
|
|
10
10
|
private static _KEYDOWN_EVENT_NAME;
|
|
@@ -8,7 +8,7 @@ exports.Key = void 0;
|
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
9
|
var dispatcher_1 = require("./dispatcher");
|
|
10
10
|
var Key = /** @class */ (function (_super) {
|
|
11
|
-
|
|
11
|
+
tslib_1.__extends(Key, _super);
|
|
12
12
|
/**
|
|
13
13
|
* This constructor should not be invoked directly.
|
|
14
14
|
*
|
|
@@ -6,7 +6,7 @@ import { Point } from "../core/interfaces";
|
|
|
6
6
|
import { Component } from "../components/component";
|
|
7
7
|
import * as Dispatchers from "./";
|
|
8
8
|
import { Dispatcher } from "./dispatcher";
|
|
9
|
-
export
|
|
9
|
+
export type MouseCallback = (p: Point, event: MouseEvent) => void;
|
|
10
10
|
export declare class Mouse extends Dispatcher {
|
|
11
11
|
private static _DISPATCHER_KEY;
|
|
12
12
|
private _lastMousePosition;
|
|
@@ -9,7 +9,7 @@ var tslib_1 = require("tslib");
|
|
|
9
9
|
var Utils = require("../utils");
|
|
10
10
|
var dispatcher_1 = require("./dispatcher");
|
|
11
11
|
var Mouse = /** @class */ (function (_super) {
|
|
12
|
-
|
|
12
|
+
tslib_1.__extends(Mouse, _super);
|
|
13
13
|
/**
|
|
14
14
|
* This constructor not be invoked directly.
|
|
15
15
|
*
|
|
@@ -6,7 +6,7 @@ import { Point } from "../core/interfaces";
|
|
|
6
6
|
import { Component } from "../components/component";
|
|
7
7
|
import * as Dispatchers from "./";
|
|
8
8
|
import { Dispatcher } from "./dispatcher";
|
|
9
|
-
export
|
|
9
|
+
export type TouchCallback = (ids: number[], idToPoint: {
|
|
10
10
|
[id: number]: Point;
|
|
11
11
|
}, event: TouchEvent) => void;
|
|
12
12
|
export declare class Touch extends Dispatcher {
|
|
@@ -9,7 +9,7 @@ var tslib_1 = require("tslib");
|
|
|
9
9
|
var Utils = require("../utils");
|
|
10
10
|
var dispatcher_1 = require("./dispatcher");
|
|
11
11
|
var Touch = /** @class */ (function (_super) {
|
|
12
|
-
|
|
12
|
+
tslib_1.__extends(Touch, _super);
|
|
13
13
|
/**
|
|
14
14
|
* This constructor should not be invoked directly.
|
|
15
15
|
*
|
|
@@ -8,7 +8,7 @@ exports.ArcSVGDrawer = void 0;
|
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
9
|
var svgDrawer_1 = require("./svgDrawer");
|
|
10
10
|
var ArcSVGDrawer = /** @class */ (function (_super) {
|
|
11
|
-
|
|
11
|
+
tslib_1.__extends(ArcSVGDrawer, _super);
|
|
12
12
|
function ArcSVGDrawer() {
|
|
13
13
|
return _super.call(this, "path", "arc fill") || this;
|
|
14
14
|
}
|
|
@@ -8,7 +8,7 @@ exports.ArcOutlineSVGDrawer = void 0;
|
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
9
|
var svgDrawer_1 = require("./svgDrawer");
|
|
10
10
|
var ArcOutlineSVGDrawer = /** @class */ (function (_super) {
|
|
11
|
-
|
|
11
|
+
tslib_1.__extends(ArcOutlineSVGDrawer, _super);
|
|
12
12
|
function ArcOutlineSVGDrawer() {
|
|
13
13
|
return _super.call(this, "path", "arc outline") || this;
|
|
14
14
|
}
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.AreaSVGDrawer = void 0;
|
|
8
|
+
exports.makeAreaCanvasDrawStep = makeAreaCanvasDrawStep;
|
|
8
9
|
var tslib_1 = require("tslib");
|
|
9
10
|
var canvasDrawer_1 = require("./canvasDrawer");
|
|
10
11
|
var svgDrawer_1 = require("./svgDrawer");
|
|
11
12
|
var AreaSVGDrawer = /** @class */ (function (_super) {
|
|
12
|
-
|
|
13
|
+
tslib_1.__extends(AreaSVGDrawer, _super);
|
|
13
14
|
function AreaSVGDrawer() {
|
|
14
15
|
return _super.call(this, "path", "area") || this;
|
|
15
16
|
}
|
|
@@ -34,4 +35,3 @@ function makeAreaCanvasDrawStep(d3AreaFactory, d3LineFactory) {
|
|
|
34
35
|
(0, canvasDrawer_1.renderLine)(context, d3LineFactory(), data[0], strokeAttrs);
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
|
-
exports.makeAreaCanvasDrawStep = makeAreaCanvasDrawStep;
|
|
@@ -24,8 +24,8 @@ var CanvasBuffer = /** @class */ (function () {
|
|
|
24
24
|
var canvas = ctx.canvas;
|
|
25
25
|
canvas.width = screenWidth * devicePixelRatio;
|
|
26
26
|
canvas.height = screenHeight * devicePixelRatio;
|
|
27
|
-
canvas.style.width = screenWidth
|
|
28
|
-
canvas.style.height = screenHeight
|
|
27
|
+
canvas.style.width = "".concat(screenWidth, "px");
|
|
28
|
+
canvas.style.height = "".concat(screenHeight, "px");
|
|
29
29
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
30
30
|
ctx.scale(devicePixelRatio, devicePixelRatio);
|
|
31
31
|
};
|
|
@@ -6,7 +6,7 @@ import * as d3 from "d3";
|
|
|
6
6
|
import { AttributeToAppliedProjector } from "../core/interfaces";
|
|
7
7
|
import { IDrawer } from "./drawer";
|
|
8
8
|
import { AppliedDrawStep } from "./drawStep";
|
|
9
|
-
export
|
|
9
|
+
export type CanvasDrawStep = (context: CanvasRenderingContext2D, data: any[], attrToAppliedProjector: AttributeToAppliedProjector) => void;
|
|
10
10
|
/**
|
|
11
11
|
* A CanvasDrawer draws data onto a supplied Canvas Context.
|
|
12
12
|
*
|
|
@@ -4,7 +4,14 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.ContextStyleAttrs = exports.CanvasDrawer = void 0;
|
|
8
|
+
exports.resolveAttributesSubsetWithStyles = resolveAttributesSubsetWithStyles;
|
|
9
|
+
exports.resolveAttributes = resolveAttributes;
|
|
10
|
+
exports.getStrokeWidth = getStrokeWidth;
|
|
11
|
+
exports.getStrokeDashArray = getStrokeDashArray;
|
|
12
|
+
exports.renderArea = renderArea;
|
|
13
|
+
exports.renderLine = renderLine;
|
|
14
|
+
exports.renderPathWithStyle = renderPathWithStyle;
|
|
8
15
|
var d3 = require("d3");
|
|
9
16
|
/**
|
|
10
17
|
* A CanvasDrawer draws data onto a supplied Canvas Context.
|
|
@@ -60,7 +67,6 @@ function resolveAttributesSubsetWithStyles(projector, extraKeys, datum, index) {
|
|
|
60
67
|
var attrKeys = exports.ContextStyleAttrs.concat(extraKeys);
|
|
61
68
|
return resolveAttributes(projector, attrKeys, datum, index);
|
|
62
69
|
}
|
|
63
|
-
exports.resolveAttributesSubsetWithStyles = resolveAttributesSubsetWithStyles;
|
|
64
70
|
function resolveAttributes(projector, attrKeys, datum, index) {
|
|
65
71
|
var attrs = {};
|
|
66
72
|
for (var _i = 0, attrKeys_1 = attrKeys; _i < attrKeys_1.length; _i++) {
|
|
@@ -71,7 +77,6 @@ function resolveAttributes(projector, attrKeys, datum, index) {
|
|
|
71
77
|
}
|
|
72
78
|
return attrs;
|
|
73
79
|
}
|
|
74
|
-
exports.resolveAttributes = resolveAttributes;
|
|
75
80
|
function getStrokeOpacity(style) {
|
|
76
81
|
var baseOpacity = style["opacity"] != null ? parseFloat(style["opacity"]) : 1;
|
|
77
82
|
var strokeOpacity = style["stroke-opacity"] != null ? parseFloat(style["stroke-opacity"]) : 1;
|
|
@@ -85,7 +90,6 @@ function getFillOpacity(style) {
|
|
|
85
90
|
function getStrokeWidth(style) {
|
|
86
91
|
return style["stroke-width"] != null ? parseFloat(style["stroke-width"]) : 1;
|
|
87
92
|
}
|
|
88
|
-
exports.getStrokeWidth = getStrokeWidth;
|
|
89
93
|
function getStrokeDashArray(style) {
|
|
90
94
|
var rawValue = style["stroke-dasharray"];
|
|
91
95
|
if (rawValue != null) {
|
|
@@ -99,7 +103,6 @@ function getStrokeDashArray(style) {
|
|
|
99
103
|
}
|
|
100
104
|
return [];
|
|
101
105
|
}
|
|
102
|
-
exports.getStrokeDashArray = getStrokeDashArray;
|
|
103
106
|
function renderArea(context, d3Area, data, style) {
|
|
104
107
|
context.save();
|
|
105
108
|
context.beginPath();
|
|
@@ -109,7 +112,6 @@ function renderArea(context, d3Area, data, style) {
|
|
|
109
112
|
renderPathWithStyle(context, style);
|
|
110
113
|
context.restore();
|
|
111
114
|
}
|
|
112
|
-
exports.renderArea = renderArea;
|
|
113
115
|
function renderLine(context, d3Line, data, style) {
|
|
114
116
|
context.save();
|
|
115
117
|
context.beginPath();
|
|
@@ -119,7 +121,6 @@ function renderLine(context, d3Line, data, style) {
|
|
|
119
121
|
renderPathWithStyle(context, style);
|
|
120
122
|
context.restore();
|
|
121
123
|
}
|
|
122
|
-
exports.renderLine = renderLine;
|
|
123
124
|
function renderPathWithStyle(context, style) {
|
|
124
125
|
if (style["stroke"]) {
|
|
125
126
|
context.lineWidth = getStrokeWidth(style);
|
|
@@ -137,4 +138,3 @@ function renderPathWithStyle(context, style) {
|
|
|
137
138
|
context.fill();
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
|
-
exports.renderPathWithStyle = renderPathWithStyle;
|
|
@@ -9,14 +9,14 @@ import { AttributeToAppliedProjector, AttributeToProjector } from "../core/inter
|
|
|
9
9
|
*
|
|
10
10
|
* Specifies how AttributeToProjector needs to be animated.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type DrawStep = {
|
|
13
13
|
attrToProjector: AttributeToProjector;
|
|
14
14
|
animator: IAnimator;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* A DrawStep that carries an AttributeToAppliedProjector map.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export type AppliedDrawStep = {
|
|
20
20
|
attrToAppliedProjector: AttributeToAppliedProjector;
|
|
21
21
|
animator: IAnimator;
|
|
22
22
|
};
|
|
@@ -5,14 +5,14 @@
|
|
|
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
|
-
|
|
8
|
+
tslib_1.__exportStar(require("./arcDrawer"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./arcOutlineDrawer"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./areaDrawer"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./canvasDrawer"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./drawer"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./drawStep"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./lineDrawer"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./rectangleDrawer"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./segmentDrawer"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./svgDrawer"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./symbolDrawer"), exports);
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.LineSVGDrawer = void 0;
|
|
8
|
+
exports.makeLineCanvasDrawStep = makeLineCanvasDrawStep;
|
|
8
9
|
var tslib_1 = require("tslib");
|
|
9
10
|
var canvasDrawer_1 = require("./canvasDrawer");
|
|
10
11
|
var svgDrawer_1 = require("./svgDrawer");
|
|
11
12
|
var LineSVGDrawer = /** @class */ (function (_super) {
|
|
12
|
-
|
|
13
|
+
tslib_1.__extends(LineSVGDrawer, _super);
|
|
13
14
|
function LineSVGDrawer() {
|
|
14
15
|
return _super.call(this, "path", "line") || this;
|
|
15
16
|
}
|
|
@@ -41,4 +42,3 @@ function makeLineCanvasDrawStep(d3LineFactory) {
|
|
|
41
42
|
(0, canvasDrawer_1.renderLine)(context, d3LineFactory(), data[0], lineStyle);
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
|
-
exports.makeLineCanvasDrawStep = makeLineCanvasDrawStep;
|
|
@@ -9,7 +9,7 @@ var tslib_1 = require("tslib");
|
|
|
9
9
|
var canvasDrawer_1 = require("./canvasDrawer");
|
|
10
10
|
var svgDrawer_1 = require("./svgDrawer");
|
|
11
11
|
var RectangleSVGDrawer = /** @class */ (function (_super) {
|
|
12
|
-
|
|
12
|
+
tslib_1.__extends(RectangleSVGDrawer, _super);
|
|
13
13
|
function RectangleSVGDrawer(_rootClassName) {
|
|
14
14
|
if (_rootClassName === void 0) { _rootClassName = ""; }
|
|
15
15
|
var _this = _super.call(this, "rect", "") || this;
|
|
@@ -38,7 +38,7 @@ var RectangleCanvasDrawStep = function (context, data, projector) {
|
|
|
38
38
|
};
|
|
39
39
|
exports.RectangleCanvasDrawStep = RectangleCanvasDrawStep;
|
|
40
40
|
var RectangleCanvasDrawer = /** @class */ (function (_super) {
|
|
41
|
-
|
|
41
|
+
tslib_1.__extends(RectangleCanvasDrawer, _super);
|
|
42
42
|
function RectangleCanvasDrawer(ctx) {
|
|
43
43
|
return _super.call(this, ctx, exports.RectangleCanvasDrawStep) || this;
|
|
44
44
|
}
|
|
@@ -8,7 +8,7 @@ exports.SegmentSVGDrawer = void 0;
|
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
9
|
var svgDrawer_1 = require("./svgDrawer");
|
|
10
10
|
var SegmentSVGDrawer = /** @class */ (function (_super) {
|
|
11
|
-
|
|
11
|
+
tslib_1.__extends(SegmentSVGDrawer, _super);
|
|
12
12
|
function SegmentSVGDrawer() {
|
|
13
13
|
return _super.call(this, "line", "") || this;
|
|
14
14
|
}
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.SymbolSVGDrawer = void 0;
|
|
8
|
+
exports.makeSymbolCanvasDrawStep = makeSymbolCanvasDrawStep;
|
|
8
9
|
var tslib_1 = require("tslib");
|
|
9
10
|
var canvasDrawer_1 = require("./canvasDrawer");
|
|
10
11
|
var canvasBuffer_1 = require("./canvasBuffer");
|
|
11
12
|
var svgDrawer_1 = require("./svgDrawer");
|
|
12
13
|
var SymbolSVGDrawer = /** @class */ (function (_super) {
|
|
13
|
-
|
|
14
|
+
tslib_1.__extends(SymbolSVGDrawer, _super);
|
|
14
15
|
function SymbolSVGDrawer() {
|
|
15
16
|
return _super.call(this, "path", "symbol") || this;
|
|
16
17
|
}
|
|
@@ -69,7 +70,6 @@ function makeSymbolCanvasDrawStep(dataset, symbolProjector, sizeProjector, stepB
|
|
|
69
70
|
}
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
|
-
exports.makeSymbolCanvasDrawStep = makeSymbolCanvasDrawStep;
|
|
73
73
|
function squareOverlapsBounds(width, height, x, y, size) {
|
|
74
74
|
return (x + size >= 0 && x - size <= width &&
|
|
75
75
|
y + size >= 0 && y - size <= height);
|