plottable 3.9.0-dev-74-g48541e02 → 3.9.0-dev-77-g85e05cc1

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.
@@ -211,12 +211,20 @@ var Legend = /** @class */ (function (_super) {
211
211
  return _this;
212
212
  }
213
213
  Legend.prototype._setup = function () {
214
+ var _this = this;
214
215
  _super.prototype._setup.call(this);
215
- var fakeLegendRow = this.content().append("g").classed(Legend.LEGEND_ROW_CLASS, true);
216
+ // Keep the row out of content() except while measuring, since renderImmediately() clears content()
217
+ var fakeLegendRow = d3.create("svg:g").classed(Legend.LEGEND_ROW_CLASS, true);
216
218
  var fakeLegendEntry = fakeLegendRow.append("g").classed(Legend.LEGEND_ENTRY_CLASS, true);
217
219
  fakeLegendEntry.append("text");
218
220
  var context = new Typesettable.SvgContext(fakeLegendRow.node(), null, Configs.ADD_TITLE_ELEMENTS);
219
- this._measurer = new Typesettable.CacheMeasurer(context);
221
+ var ruler = context.createRuler();
222
+ this._measurer = new Typesettable.CacheMeasurer(function (text) {
223
+ _this.content().append(function () { return fakeLegendRow.node(); });
224
+ var dimensions = ruler(text);
225
+ fakeLegendRow.remove();
226
+ return dimensions;
227
+ });
220
228
  this._wrapper = new Typesettable.Wrapper().maxLines(this.maxLinesPerEntry());
221
229
  this._writer = new Typesettable.Writer(this._measurer, context, this._wrapper);
222
230
  };
@@ -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-74-g48541e02";
13
+ exports.version = "3.9.0-dev-77-g85e05cc1";
@@ -55,6 +55,7 @@ var Pie = /** @class */ (function (_super) {
55
55
  if (this.outerRadius().scale != null) {
56
56
  this.outerRadius().scale.range([0, radiusLimit]);
57
57
  }
58
+ this._updateExtents();
58
59
  return this;
59
60
  };
60
61
  Pie.prototype.addDataset = function (dataset) {
@@ -120,7 +120,7 @@ var Plot = /** @class */ (function (_super) {
120
120
  };
121
121
  Plot.prototype.setBounds = function (width, height, originX, originY) {
122
122
  _super.prototype.setBounds.call(this, width, height, originX, originY);
123
- this._updateExtents();
123
+ this._resetEntityStore();
124
124
  if (this._canvas != null) {
125
125
  if (this._bufferCanvas && !this._bufferCanvasValid) {
126
126
  // copy current canvas to buffer 1:1
@@ -196,6 +196,7 @@ var XYPlot = /** @class */ (function (_super) {
196
196
  yScale.range([this.height(), 0]);
197
197
  }
198
198
  }
199
+ this._updateExtents();
199
200
  return this;
200
201
  };
201
202
  XYPlot.prototype._updateXExtentsAndAutodomain = function () {
@@ -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
  }());
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-74-g48541e02",
4
+ "version": "3.9.0-dev-77-g85e05cc1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
package/plottable.js CHANGED
@@ -522,7 +522,7 @@ var Plot = /** @class */ (function (_super) {
522
522
  };
523
523
  Plot.prototype.setBounds = function (width, height, originX, originY) {
524
524
  _super.prototype.setBounds.call(this, width, height, originX, originY);
525
- this._updateExtents();
525
+ this._resetEntityStore();
526
526
  if (this._canvas != null) {
527
527
  if (this._bufferCanvas && !this._bufferCanvasValid) {
528
528
  // copy current canvas to buffer 1:1
@@ -3030,6 +3030,7 @@ var XYPlot = /** @class */ (function (_super) {
3030
3030
  yScale.range([this.height(), 0]);
3031
3031
  }
3032
3032
  }
3033
+ this._updateExtents();
3033
3034
  return this;
3034
3035
  };
3035
3036
  XYPlot.prototype._updateXExtentsAndAutodomain = function () {
@@ -13250,12 +13251,20 @@ var Legend = /** @class */ (function (_super) {
13250
13251
  return _this;
13251
13252
  }
13252
13253
  Legend.prototype._setup = function () {
13254
+ var _this = this;
13253
13255
  _super.prototype._setup.call(this);
13254
- var fakeLegendRow = this.content().append("g").classed(Legend.LEGEND_ROW_CLASS, true);
13256
+ // Keep the row out of content() except while measuring, since renderImmediately() clears content()
13257
+ var fakeLegendRow = d3.create("svg:g").classed(Legend.LEGEND_ROW_CLASS, true);
13255
13258
  var fakeLegendEntry = fakeLegendRow.append("g").classed(Legend.LEGEND_ENTRY_CLASS, true);
13256
13259
  fakeLegendEntry.append("text");
13257
13260
  var context = new Typesettable.SvgContext(fakeLegendRow.node(), null, Configs.ADD_TITLE_ELEMENTS);
13258
- this._measurer = new Typesettable.CacheMeasurer(context);
13261
+ var ruler = context.createRuler();
13262
+ this._measurer = new Typesettable.CacheMeasurer(function (text) {
13263
+ _this.content().append(function () { return fakeLegendRow.node(); });
13264
+ var dimensions = ruler(text);
13265
+ fakeLegendRow.remove();
13266
+ return dimensions;
13267
+ });
13259
13268
  this._wrapper = new Typesettable.Wrapper().maxLines(this.maxLinesPerEntry());
13260
13269
  this._writer = new Typesettable.Writer(this._measurer, context, this._wrapper);
13261
13270
  };
@@ -16071,6 +16080,7 @@ var Pie = /** @class */ (function (_super) {
16071
16080
  if (this.outerRadius().scale != null) {
16072
16081
  this.outerRadius().scale.range([0, radiusLimit]);
16073
16082
  }
16083
+ this._updateExtents();
16074
16084
  return this;
16075
16085
  };
16076
16086
  Pie.prototype.addDataset = function (dataset) {
@@ -18056,22 +18066,22 @@ var scale_1 = __webpack_require__(18);
18056
18066
  var ImplicitSeriesTracker = /** @class */ (function () {
18057
18067
  function ImplicitSeriesTracker() {
18058
18068
  this.count = 0;
18059
- this.tracker = {};
18069
+ this.tracker = new Map();
18060
18070
  }
18061
18071
  ImplicitSeriesTracker.prototype.getIndex = function (value) {
18062
- if (this.tracker[value] != null) {
18063
- return this.tracker[value];
18072
+ if (this.tracker.has(value)) {
18073
+ return this.tracker.get(value);
18064
18074
  }
18065
18075
  else {
18066
18076
  var idx = this.count;
18067
- this.tracker[value] = idx;
18077
+ this.tracker.set(value, idx);
18068
18078
  this.count += 1;
18069
18079
  return idx;
18070
18080
  }
18071
18081
  };
18072
18082
  ImplicitSeriesTracker.prototype.clear = function () {
18073
18083
  this.count = 0;
18074
- this.tracker = {};
18084
+ this.tracker.clear();
18075
18085
  };
18076
18086
  return ImplicitSeriesTracker;
18077
18087
  }());