plottable 3.9.0-dev-76-g6a7bb807 → 3.9.0-dev-79-g98c2e10e

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.
@@ -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 = "3.9.0-dev-76-g6a7bb807";
13
+ exports.version = "3.9.0-dev-79-g98c2e10e";
@@ -243,6 +243,11 @@ export declare class Bar<X, Y> extends XYPlot<X, Y> {
243
243
  protected _updateThicknessAttr(): void;
244
244
  private _barPixelThickness;
245
245
  entities(datasets?: Dataset[]): IPlotEntity[];
246
+ /**
247
+ * Undrawn bars stay in `_getDataToDraw` as null placeholders, so the drawer
248
+ * indexes each bar's element by its dataset index
249
+ */
250
+ protected _buildLightweightPlotEntities(datasets: Dataset[]): Plots.ILightweightPlotEntity[];
246
251
  protected _entityBounds(entity: Plots.IPlotEntity | Plots.ILightweightPlotEntity): Pick<DOMRect, "height" | "width" | "x" | "y">;
247
252
  /**
248
253
  * The rectangular bounds of a bar. Note that the x/y coordinates are not the
@@ -631,6 +631,17 @@ var Bar = /** @class */ (function (_super) {
631
631
  var entities = _super.prototype.entities.call(this, datasets);
632
632
  return entities;
633
633
  };
634
+ /**
635
+ * Undrawn bars stay in `_getDataToDraw` as null placeholders, so the drawer
636
+ * indexes each bar's element by its dataset index
637
+ */
638
+ Bar.prototype._buildLightweightPlotEntities = function (datasets) {
639
+ var lightweightPlotEntities = _super.prototype._buildLightweightPlotEntities.call(this, datasets);
640
+ lightweightPlotEntities.forEach(function (lightweightPlotEntity) {
641
+ lightweightPlotEntity.validDatumIndex = lightweightPlotEntity.index;
642
+ });
643
+ return lightweightPlotEntities;
644
+ };
634
645
  Bar.prototype._entityBounds = function (entity) {
635
646
  var datum = entity.datum, index = entity.index, dataset = entity.dataset;
636
647
  return this._pixelBounds(datum, index, dataset);
@@ -101,6 +101,11 @@ export declare class Rectangle<X, Y> extends XYPlot<X, Y> {
101
101
  * @returns {PlotEntity[]} The PlotEntities at the particular point
102
102
  */
103
103
  entitiesAt(point: Point): Plots.IPlotEntity[];
104
+ /**
105
+ * Undrawn rectangles stay in `_getDataToDraw` as null placeholders, so the
106
+ * drawer indexes each rectangle's element by its dataset index
107
+ */
108
+ protected _buildLightweightPlotEntities(datasets: Dataset[]): Plots.ILightweightPlotEntity[];
104
109
  protected _entityBounds(entity: Plots.IPlotEntity | Plots.ILightweightPlotEntity): Pick<DOMRect, "height" | "width" | "x" | "y">;
105
110
  private _entityBBox;
106
111
  /**
@@ -170,6 +170,17 @@ var Rectangle = /** @class */ (function (_super) {
170
170
  return x <= point.x && point.x <= x + width && y <= point.y && point.y <= y + height;
171
171
  });
172
172
  };
173
+ /**
174
+ * Undrawn rectangles stay in `_getDataToDraw` as null placeholders, so the
175
+ * drawer indexes each rectangle's element by its dataset index
176
+ */
177
+ Rectangle.prototype._buildLightweightPlotEntities = function (datasets) {
178
+ var lightweightPlotEntities = _super.prototype._buildLightweightPlotEntities.call(this, datasets);
179
+ lightweightPlotEntities.forEach(function (lightweightPlotEntity) {
180
+ lightweightPlotEntity.validDatumIndex = lightweightPlotEntity.index;
181
+ });
182
+ return lightweightPlotEntities;
183
+ };
173
184
  Rectangle.prototype._entityBounds = function (entity) {
174
185
  var datum = entity.datum, index = entity.index, dataset = entity.dataset;
175
186
  return this._entityBBox(datum, index, dataset, this._getAttrToProjector());
@@ -25,22 +25,22 @@ var scale_1 = require("./scale");
25
25
  var ImplicitSeriesTracker = /** @class */ (function () {
26
26
  function ImplicitSeriesTracker() {
27
27
  this.count = 0;
28
- this.tracker = {};
28
+ this.tracker = new Map();
29
29
  }
30
30
  ImplicitSeriesTracker.prototype.getIndex = function (value) {
31
- if (this.tracker[value] != null) {
32
- return this.tracker[value];
31
+ if (this.tracker.has(value)) {
32
+ return this.tracker.get(value);
33
33
  }
34
34
  else {
35
35
  var idx = this.count;
36
- this.tracker[value] = idx;
36
+ this.tracker.set(value, idx);
37
37
  this.count += 1;
38
38
  return idx;
39
39
  }
40
40
  };
41
41
  ImplicitSeriesTracker.prototype.clear = function () {
42
42
  this.count = 0;
43
- this.tracker = {};
43
+ this.tracker.clear();
44
44
  };
45
45
  return ImplicitSeriesTracker;
46
46
  }());
@@ -129,6 +129,39 @@ function stackedExtent(stackingResult, keyAccessor, filter) {
129
129
  var minStackExtent = Utils.Math.min(extents, 0);
130
130
  return [nativeMath.min(minStackExtent, 0), nativeMath.max(0, maxStackExtent)];
131
131
  }
132
+ /**
133
+ * A lodash `MapCache` backed by a `WeakMap`, so each cached string is
134
+ * released once its key object (such as a `Date`) is garbage collected.
135
+ * Primitive keys are never cached: a `WeakMap` cannot hold them, and
136
+ * `String()` on a primitive costs no more than a cache lookup.
137
+ */
138
+ var WeakKeyCache = /** @class */ (function () {
139
+ function WeakKeyCache() {
140
+ this.map = new WeakMap();
141
+ }
142
+ WeakKeyCache.prototype.get = function (key) {
143
+ return this.isObjectKey(key) ? this.map.get(key) : undefined;
144
+ };
145
+ WeakKeyCache.prototype.has = function (key) {
146
+ return this.isObjectKey(key) && this.map.has(key);
147
+ };
148
+ WeakKeyCache.prototype.set = function (key, value) {
149
+ if (this.isObjectKey(key)) {
150
+ this.map.set(key, value);
151
+ }
152
+ return this;
153
+ };
154
+ WeakKeyCache.prototype.delete = function (key) {
155
+ return this.isObjectKey(key) && this.map.delete(key);
156
+ };
157
+ WeakKeyCache.prototype.clear = function () {
158
+ this.map = new WeakMap();
159
+ };
160
+ WeakKeyCache.prototype.isObjectKey = function (key) {
161
+ return typeof key === "object" && key !== null;
162
+ };
163
+ return WeakKeyCache;
164
+ }());
132
165
  /**
133
166
  * Normalizes a key used for stacking
134
167
  *
@@ -138,3 +171,4 @@ function stackedExtent(stackingResult, keyAccessor, filter) {
138
171
  exports.normalizeKey = (0, memoize_1.default)(function (key) {
139
172
  return String(key);
140
173
  });
174
+ exports.normalizeKey.cache = new WeakKeyCache();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "plottable",
3
3
  "description": "A modular charting library built on D3",
4
- "version": "3.9.0-dev-76-g6a7bb807",
4
+ "version": "3.9.0-dev-79-g98c2e10e",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
package/plottable.js CHANGED
@@ -5315,6 +5315,17 @@ var Bar = /** @class */ (function (_super) {
5315
5315
  var entities = _super.prototype.entities.call(this, datasets);
5316
5316
  return entities;
5317
5317
  };
5318
+ /**
5319
+ * Undrawn bars stay in `_getDataToDraw` as null placeholders, so the drawer
5320
+ * indexes each bar's element by its dataset index
5321
+ */
5322
+ Bar.prototype._buildLightweightPlotEntities = function (datasets) {
5323
+ var lightweightPlotEntities = _super.prototype._buildLightweightPlotEntities.call(this, datasets);
5324
+ lightweightPlotEntities.forEach(function (lightweightPlotEntity) {
5325
+ lightweightPlotEntity.validDatumIndex = lightweightPlotEntity.index;
5326
+ });
5327
+ return lightweightPlotEntities;
5328
+ };
5318
5329
  Bar.prototype._entityBounds = function (entity) {
5319
5330
  var datum = entity.datum, index = entity.index, dataset = entity.dataset;
5320
5331
  return this._pixelBounds(datum, index, dataset);
@@ -16705,6 +16716,17 @@ var Rectangle = /** @class */ (function (_super) {
16705
16716
  return x <= point.x && point.x <= x + width && y <= point.y && point.y <= y + height;
16706
16717
  });
16707
16718
  };
16719
+ /**
16720
+ * Undrawn rectangles stay in `_getDataToDraw` as null placeholders, so the
16721
+ * drawer indexes each rectangle's element by its dataset index
16722
+ */
16723
+ Rectangle.prototype._buildLightweightPlotEntities = function (datasets) {
16724
+ var lightweightPlotEntities = _super.prototype._buildLightweightPlotEntities.call(this, datasets);
16725
+ lightweightPlotEntities.forEach(function (lightweightPlotEntity) {
16726
+ lightweightPlotEntity.validDatumIndex = lightweightPlotEntity.index;
16727
+ });
16728
+ return lightweightPlotEntities;
16729
+ };
16708
16730
  Rectangle.prototype._entityBounds = function (entity) {
16709
16731
  var datum = entity.datum, index = entity.index, dataset = entity.dataset;
16710
16732
  return this._entityBBox(datum, index, dataset, this._getAttrToProjector());
@@ -18066,22 +18088,22 @@ var scale_1 = __webpack_require__(18);
18066
18088
  var ImplicitSeriesTracker = /** @class */ (function () {
18067
18089
  function ImplicitSeriesTracker() {
18068
18090
  this.count = 0;
18069
- this.tracker = {};
18091
+ this.tracker = new Map();
18070
18092
  }
18071
18093
  ImplicitSeriesTracker.prototype.getIndex = function (value) {
18072
- if (this.tracker[value] != null) {
18073
- return this.tracker[value];
18094
+ if (this.tracker.has(value)) {
18095
+ return this.tracker.get(value);
18074
18096
  }
18075
18097
  else {
18076
18098
  var idx = this.count;
18077
- this.tracker[value] = idx;
18099
+ this.tracker.set(value, idx);
18078
18100
  this.count += 1;
18079
18101
  return idx;
18080
18102
  }
18081
18103
  };
18082
18104
  ImplicitSeriesTracker.prototype.clear = function () {
18083
18105
  this.count = 0;
18084
- this.tracker = {};
18106
+ this.tracker.clear();
18085
18107
  };
18086
18108
  return ImplicitSeriesTracker;
18087
18109
  }());
@@ -19679,6 +19701,39 @@ function stackedExtent(stackingResult, keyAccessor, filter) {
19679
19701
  var minStackExtent = Utils.Math.min(extents, 0);
19680
19702
  return [nativeMath.min(minStackExtent, 0), nativeMath.max(0, maxStackExtent)];
19681
19703
  }
19704
+ /**
19705
+ * A lodash `MapCache` backed by a `WeakMap`, so each cached string is
19706
+ * released once its key object (such as a `Date`) is garbage collected.
19707
+ * Primitive keys are never cached: a `WeakMap` cannot hold them, and
19708
+ * `String()` on a primitive costs no more than a cache lookup.
19709
+ */
19710
+ var WeakKeyCache = /** @class */ (function () {
19711
+ function WeakKeyCache() {
19712
+ this.map = new WeakMap();
19713
+ }
19714
+ WeakKeyCache.prototype.get = function (key) {
19715
+ return this.isObjectKey(key) ? this.map.get(key) : undefined;
19716
+ };
19717
+ WeakKeyCache.prototype.has = function (key) {
19718
+ return this.isObjectKey(key) && this.map.has(key);
19719
+ };
19720
+ WeakKeyCache.prototype.set = function (key, value) {
19721
+ if (this.isObjectKey(key)) {
19722
+ this.map.set(key, value);
19723
+ }
19724
+ return this;
19725
+ };
19726
+ WeakKeyCache.prototype.delete = function (key) {
19727
+ return this.isObjectKey(key) && this.map.delete(key);
19728
+ };
19729
+ WeakKeyCache.prototype.clear = function () {
19730
+ this.map = new WeakMap();
19731
+ };
19732
+ WeakKeyCache.prototype.isObjectKey = function (key) {
19733
+ return typeof key === "object" && key !== null;
19734
+ };
19735
+ return WeakKeyCache;
19736
+ }());
19682
19737
  /**
19683
19738
  * Normalizes a key used for stacking
19684
19739
  *
@@ -19688,6 +19743,7 @@ function stackedExtent(stackingResult, keyAccessor, filter) {
19688
19743
  exports.normalizeKey = (0, memoize_1.default)(function (key) {
19689
19744
  return String(key);
19690
19745
  });
19746
+ exports.normalizeKey.cache = new WeakKeyCache();
19691
19747
 
19692
19748
 
19693
19749
  /***/ }),