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.
Files changed (131) hide show
  1. package/README.md +9 -2
  2. package/build/src/animators/easingAnimator.d.ts +2 -2
  3. package/build/src/animators/easingAnimator.js +1 -1
  4. package/build/src/animators/index.js +2 -2
  5. package/build/src/axes/axis.d.ts +1 -1
  6. package/build/src/axes/axis.js +5 -5
  7. package/build/src/axes/categoryAxis.js +8 -7
  8. package/build/src/axes/index.js +3 -3
  9. package/build/src/axes/numericAxis.js +1 -1
  10. package/build/src/axes/timeAxis.d.ts +5 -5
  11. package/build/src/axes/timeAxis.js +6 -6
  12. package/build/src/components/component.d.ts +4 -4
  13. package/build/src/components/component.js +6 -6
  14. package/build/src/components/componentContainer.js +1 -1
  15. package/build/src/components/dragBoxLayer.d.ts +1 -1
  16. package/build/src/components/dragBoxLayer.js +1 -1
  17. package/build/src/components/dragLineLayer.js +1 -1
  18. package/build/src/components/gridlines.js +1 -1
  19. package/build/src/components/group.js +1 -1
  20. package/build/src/components/guideLineLayer.js +1 -1
  21. package/build/src/components/index.js +14 -14
  22. package/build/src/components/interpolatedColorLegend.js +1 -1
  23. package/build/src/components/label.d.ts +1 -1
  24. package/build/src/components/label.js +3 -3
  25. package/build/src/components/legend.js +7 -7
  26. package/build/src/components/plotGroup.js +1 -1
  27. package/build/src/components/selectionBoxLayer.js +2 -2
  28. package/build/src/components/table.js +1 -1
  29. package/build/src/components/wrappedLabel.js +1 -1
  30. package/build/src/components/xDragBoxLayer.js +1 -1
  31. package/build/src/components/yDragBoxLayer.js +1 -1
  32. package/build/src/core/dataset.d.ts +1 -1
  33. package/build/src/core/formatters.d.ts +2 -2
  34. package/build/src/core/formatters.js +16 -13
  35. package/build/src/core/interfaces.d.ts +9 -9
  36. package/build/src/core/renderController.d.ts +1 -1
  37. package/build/src/core/renderController.js +6 -6
  38. package/build/src/core/symbolFactories.d.ts +2 -2
  39. package/build/src/core/symbolFactories.js +15 -15
  40. package/build/src/core/version.js +1 -1
  41. package/build/src/dispatchers/index.js +3 -3
  42. package/build/src/dispatchers/keyDispatcher.d.ts +1 -1
  43. package/build/src/dispatchers/keyDispatcher.js +1 -1
  44. package/build/src/dispatchers/mouseDispatcher.d.ts +1 -1
  45. package/build/src/dispatchers/mouseDispatcher.js +1 -1
  46. package/build/src/dispatchers/touchDispatcher.d.ts +1 -1
  47. package/build/src/dispatchers/touchDispatcher.js +1 -1
  48. package/build/src/drawers/arcDrawer.js +1 -1
  49. package/build/src/drawers/arcOutlineDrawer.js +1 -1
  50. package/build/src/drawers/areaDrawer.js +3 -3
  51. package/build/src/drawers/canvasBuffer.js +2 -2
  52. package/build/src/drawers/canvasDrawer.d.ts +1 -1
  53. package/build/src/drawers/canvasDrawer.js +8 -8
  54. package/build/src/drawers/drawStep.d.ts +2 -2
  55. package/build/src/drawers/index.js +11 -11
  56. package/build/src/drawers/lineDrawer.js +3 -3
  57. package/build/src/drawers/rectangleDrawer.js +2 -2
  58. package/build/src/drawers/segmentDrawer.js +1 -1
  59. package/build/src/drawers/symbolDrawer.js +3 -3
  60. package/build/src/index.js +14 -14
  61. package/build/src/interactions/clickInteraction.d.ts +1 -1
  62. package/build/src/interactions/clickInteraction.js +1 -1
  63. package/build/src/interactions/dragInteraction.d.ts +2 -2
  64. package/build/src/interactions/dragInteraction.js +1 -1
  65. package/build/src/interactions/index.js +5 -5
  66. package/build/src/interactions/keyInteraction.d.ts +1 -1
  67. package/build/src/interactions/keyInteraction.js +1 -1
  68. package/build/src/interactions/panZoomConstraints.js +5 -6
  69. package/build/src/interactions/panZoomInteraction.d.ts +4 -4
  70. package/build/src/interactions/panZoomInteraction.js +9 -10
  71. package/build/src/interactions/pointerInteraction.d.ts +1 -1
  72. package/build/src/interactions/pointerInteraction.js +1 -1
  73. package/build/src/memoize/index.js +3 -3
  74. package/build/src/memoize/memThunk.d.ts +1 -1
  75. package/build/src/memoize/memThunk.js +1 -2
  76. package/build/src/memoize/memoize.d.ts +1 -1
  77. package/build/src/memoize/memoize.js +1 -2
  78. package/build/src/memoize/memoizeProjectors.js +4 -5
  79. package/build/src/memoize/signature.d.ts +1 -1
  80. package/build/src/memoize/signature.js +10 -10
  81. package/build/src/plots/areaPlot.js +4 -3
  82. package/build/src/plots/barPlot.d.ts +3 -3
  83. package/build/src/plots/barPlot.js +6 -6
  84. package/build/src/plots/clusteredBarPlot.js +1 -1
  85. package/build/src/plots/commons.js +1 -1
  86. package/build/src/plots/index.js +12 -12
  87. package/build/src/plots/linePlot.d.ts +2 -3
  88. package/build/src/plots/linePlot.js +3 -2
  89. package/build/src/plots/piePlot.js +3 -2
  90. package/build/src/plots/plot.d.ts +2 -2
  91. package/build/src/plots/plot.js +9 -9
  92. package/build/src/plots/rectanglePlot.js +3 -4
  93. package/build/src/plots/scatterPlot.js +4 -4
  94. package/build/src/plots/segmentPlot.js +1 -1
  95. package/build/src/plots/stackedAreaPlot.js +5 -6
  96. package/build/src/plots/stackedBarPlot.js +4 -4
  97. package/build/src/plots/waterfallPlot.js +1 -1
  98. package/build/src/plots/xyPlot.js +3 -3
  99. package/build/src/scales/categoryScale.js +2 -2
  100. package/build/src/scales/colorScale.js +24 -5
  101. package/build/src/scales/index.js +9 -9
  102. package/build/src/scales/interpolatedColorScale.js +6 -6
  103. package/build/src/scales/linearScale.js +3 -3
  104. package/build/src/scales/logScale.js +3 -3
  105. package/build/src/scales/modifiedLogScale.js +2 -2
  106. package/build/src/scales/quantitativeScale.js +1 -1
  107. package/build/src/scales/scale.d.ts +1 -1
  108. package/build/src/scales/tickGenerators.js +2 -3
  109. package/build/src/scales/timeScale.js +4 -4
  110. package/build/src/utils/arrayUtils.js +5 -7
  111. package/build/src/utils/callbackSet.js +1 -1
  112. package/build/src/utils/coerceD3.js +1 -2
  113. package/build/src/utils/colorUtils.js +3 -4
  114. package/build/src/utils/d3ShapeUtils.d.ts +11 -0
  115. package/build/src/utils/d3ShapeUtils.js +17 -0
  116. package/build/src/utils/domUtils.js +20 -20
  117. package/build/src/utils/index.js +8 -8
  118. package/build/src/utils/makeEnum.js +1 -2
  119. package/build/src/utils/mathUtils.d.ts +2 -2
  120. package/build/src/utils/mathUtils.js +17 -18
  121. package/build/src/utils/objectUtils.js +1 -2
  122. package/build/src/utils/rTree.d.ts +1 -1
  123. package/build/src/utils/rTree.js +4 -4
  124. package/build/src/utils/rTreeSplitStrategies.d.ts +1 -1
  125. package/build/src/utils/stackingUtils.d.ts +6 -6
  126. package/build/src/utils/stackingUtils.js +8 -9
  127. package/build/src/utils/transformAwareTranslator.js +2 -2
  128. package/build/src/utils/windowUtils.js +4 -5
  129. package/package.json +12 -11
  130. package/plottable.js +19210 -46909
  131. package/plottable.js.map +1 -1
@@ -3,7 +3,6 @@
3
3
  * @license MIT
4
4
  */
5
5
  import * as d3 from "d3";
6
- import * as d3Shape from "d3-shape";
7
6
  import { Dataset } from "../core/dataset";
8
7
  import { AttributeToProjector, IAccessor, IRangeProjector, Point, Projector } from "../core/interfaces";
9
8
  import * as Drawers from "../drawers";
@@ -30,7 +29,7 @@ export declare const CurveName: {
30
29
  cardinalClosed: "cardinalClosed";
31
30
  monotone: "monotone";
32
31
  };
33
- export declare type CurveName = keyof typeof CurveName;
32
+ export type CurveName = keyof typeof CurveName;
34
33
  export declare class Line<X> extends XYPlot<X, number> {
35
34
  private _curve;
36
35
  private _autorangeSmooth;
@@ -141,7 +140,7 @@ export declare class Line<X> extends XYPlot<X, number> {
141
140
  * @returns {Line<[number,number]>}
142
141
  * @private
143
142
  */
144
- protected _d3LineFactory(dataset: Dataset, xProjector?: IAccessor<any>, yProjector?: IAccessor<any>): d3Shape.Line<any>;
143
+ protected _d3LineFactory(dataset: Dataset, xProjector?: IAccessor<any>, yProjector?: IAccessor<any>): d3.Line<any>;
145
144
  protected _getCurveFactory(): d3.CurveFactory | d3.CurveFactoryLineOnly;
146
145
  /**
147
146
  * Line plots represent each dataset with a single <path> element, so we wrap the dataset data in a single element array.
@@ -14,6 +14,7 @@ var lineDrawer_1 = require("../drawers/lineDrawer");
14
14
  var Scales = require("../scales");
15
15
  var quantitativeScale_1 = require("../scales/quantitativeScale");
16
16
  var Utils = require("../utils");
17
+ var d3ShapeUtils_1 = require("../utils/d3ShapeUtils");
17
18
  var makeEnum_1 = require("../utils/makeEnum");
18
19
  var Plots = require("./");
19
20
  var plot_1 = require("./plot");
@@ -52,7 +53,7 @@ exports.CurveName = (0, makeEnum_1.makeEnum)([
52
53
  "monotone",
53
54
  ]);
54
55
  var Line = /** @class */ (function (_super) {
55
- (0, tslib_1.__extends)(Line, _super);
56
+ tslib_1.__extends(Line, _super);
56
57
  /**
57
58
  * A Line Plot draws line segments starting from the first data point to the next.
58
59
  *
@@ -356,7 +357,7 @@ var Line = /** @class */ (function (_super) {
356
357
  var positionY = yProjector(d, i, dataset);
357
358
  return Utils.Math.isValidNumber(positionX) && Utils.Math.isValidNumber(positionY);
358
359
  };
359
- return d3.line()
360
+ return (0, d3ShapeUtils_1.withFullPrecision)(d3.line())
360
361
  .x(function (innerDatum, innerIndex) { return xProjector(innerDatum, innerIndex, dataset); })
361
362
  .y(function (innerDatum, innerIndex) { return yProjector(innerDatum, innerIndex, dataset); })
362
363
  .curve(this._getCurveFactory())
@@ -15,10 +15,11 @@ var Utils = require("../utils");
15
15
  var arcDrawer_1 = require("../drawers/arcDrawer");
16
16
  var arcOutlineDrawer_1 = require("../drawers/arcOutlineDrawer");
17
17
  var drawer_1 = require("../drawers/drawer");
18
+ var d3ShapeUtils_1 = require("../utils/d3ShapeUtils");
18
19
  var windowUtils_1 = require("../utils/windowUtils");
19
20
  var plot_1 = require("./plot");
20
21
  var Pie = /** @class */ (function (_super) {
21
- (0, tslib_1.__extends)(Pie, _super);
22
+ tslib_1.__extends(Pie, _super);
22
23
  /**
23
24
  * @constructor
24
25
  */
@@ -211,7 +212,7 @@ var Pie = /** @class */ (function (_super) {
211
212
  var innerRadiusAccessor = plot_1.Plot._scaledAccessor(this.innerRadius());
212
213
  var outerRadiusAccessor = plot_1.Plot._scaledAccessor(this.outerRadius());
213
214
  attrToProjector["d"] = function (datum, index, ds) {
214
- return d3.arc().innerRadius(innerRadiusAccessor(datum, index, ds))
215
+ return (0, d3ShapeUtils_1.withFullPrecision)(d3.arc()).innerRadius(innerRadiusAccessor(datum, index, ds))
215
216
  .outerRadius(outerRadiusAccessor(datum, index, ds))
216
217
  .startAngle(_this._startAngles[index])
217
218
  .endAngle(_this._endAngles[index])(datum, index);
@@ -17,7 +17,7 @@ export declare const Renderer: {
17
17
  canvas: "canvas";
18
18
  svg: "svg";
19
19
  };
20
- export declare type Renderer = keyof typeof Renderer;
20
+ export type Renderer = keyof typeof Renderer;
21
21
  export declare class Plot extends Component {
22
22
  static OPTIMIZE_MEMOIZE_PROJECTORS: boolean;
23
23
  static getTotalDrawTime(data: any[], drawSteps: Drawers.DrawStep[]): number;
@@ -93,7 +93,7 @@ export declare class Plot extends Component {
93
93
  * registered by the user. By default, only attrs are passed to the
94
94
  * _generateDrawStep's attrToProjector; properties are not.
95
95
  */
96
- protected _propertyBindings: d3.Map<Plots.IAccessorScaleBinding<any, any>>;
96
+ protected _propertyBindings: Map<string, Plots.IAccessorScaleBinding<any, any>>;
97
97
  /**
98
98
  * Mapping from property names to the extents ([min, max]) values that that
99
99
  * property takes on.
@@ -20,7 +20,7 @@ var makeEnum_1 = require("../utils/makeEnum");
20
20
  var deferredRenderer_1 = require("./deferredRenderer");
21
21
  exports.Renderer = (0, makeEnum_1.makeEnum)(["svg", "canvas"]);
22
22
  var Plot = /** @class */ (function (_super) {
23
- (0, tslib_1.__extends)(Plot, _super);
23
+ tslib_1.__extends(Plot, _super);
24
24
  /**
25
25
  * A Plot draws some visualization of the inputted Datasets.
26
26
  *
@@ -60,13 +60,13 @@ var Plot = /** @class */ (function (_super) {
60
60
  _this._overflowHidden = true;
61
61
  _this.addClass("plot");
62
62
  _this._datasetToDrawer = new Utils.Map();
63
- _this._attrBindings = d3.map();
63
+ _this._attrBindings = new Map();
64
64
  _this._includedValuesProvider = function (scale, ignoreAnchorState) {
65
65
  return _this._includedValuesForScale(scale, ignoreAnchorState);
66
66
  };
67
67
  _this._renderCallback = function () { return _this.render(); };
68
68
  _this._onDatasetUpdateCallback = function () { return _this._onDatasetUpdate(); };
69
- _this._propertyBindings = d3.map();
69
+ _this._propertyBindings = new Map();
70
70
  var mainAnimator = new Animators.Easing().maxTotalDuration(Plot._ANIMATION_MAX_DURATION);
71
71
  _this.animator(Plots.Animator.MAIN, mainAnimator);
72
72
  _this.animator(Plots.Animator.RESET, new Animators.Null());
@@ -274,7 +274,7 @@ var Plot = /** @class */ (function (_super) {
274
274
  };
275
275
  Plot.prototype._generateAttrToProjector = function () {
276
276
  var h = {};
277
- this._attrBindings.each(function (binding, attr) {
277
+ this._attrBindings.forEach(function (binding, attr) {
278
278
  h[attr] = Plot._scaledAccessor(binding);
279
279
  });
280
280
  var propertyProjectors = this._propertyProjectors();
@@ -315,13 +315,13 @@ var Plot = /** @class */ (function (_super) {
315
315
  */
316
316
  Plot.prototype._scales = function () {
317
317
  var scales = [];
318
- this._attrBindings.each(function (binding, attr) {
318
+ this._attrBindings.forEach(function (binding, attr) {
319
319
  var scale = binding.scale;
320
320
  if (scale != null && scales.indexOf(scale) === -1) {
321
321
  scales.push(scale);
322
322
  }
323
323
  });
324
- this._propertyBindings.each(function (binding, property) {
324
+ this._propertyBindings.forEach(function (binding, property) {
325
325
  var scale = binding.scale;
326
326
  if (scale != null && scales.indexOf(scale) === -1) {
327
327
  scales.push(scale);
@@ -375,7 +375,7 @@ var Plot = /** @class */ (function (_super) {
375
375
  return [];
376
376
  }
377
377
  var includedValues = [];
378
- this._attrBindings.each(function (binding, attr) {
378
+ this._attrBindings.forEach(function (binding, attr) {
379
379
  if (binding.scale === scale) {
380
380
  var extents = _this.getExtentsForAttr(attr);
381
381
  if (extents != null) {
@@ -383,7 +383,7 @@ var Plot = /** @class */ (function (_super) {
383
383
  }
384
384
  }
385
385
  });
386
- this._propertyBindings.each(function (binding, property) {
386
+ this._propertyBindings.forEach(function (binding, property) {
387
387
  if (binding.scale === scale) {
388
388
  var extents = _this.getExtentsForProperty(property);
389
389
  if (extents != null) {
@@ -511,7 +511,7 @@ var Plot = /** @class */ (function (_super) {
511
511
  var _loop_1 = function (datumIndex) {
512
512
  var datum = data[datumIndex];
513
513
  var position = _this._pixelPoint(datum, datumIndex, dataset);
514
- if (Utils.Math.isNaN(position.x) || Utils.Math.isNaN(position.y)) {
514
+ if (!Utils.Math.isValidNumber(position.x) || !Utils.Math.isValidNumber(position.y)) {
515
515
  return "continue";
516
516
  }
517
517
  var plot = _this;
@@ -6,7 +6,6 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.Rectangle = void 0;
8
8
  var tslib_1 = require("tslib");
9
- var d3 = require("d3");
10
9
  var Typesettable = require("typesettable");
11
10
  var Animators = require("../animators");
12
11
  var Drawers = require("../drawers");
@@ -17,7 +16,7 @@ var Utils = require("../utils");
17
16
  var plot_1 = require("./plot");
18
17
  var xyPlot_1 = require("./xyPlot");
19
18
  var Rectangle = /** @class */ (function (_super) {
20
- (0, tslib_1.__extends)(Rectangle, _super);
19
+ tslib_1.__extends(Rectangle, _super);
21
20
  /**
22
21
  * A Rectangle Plot displays rectangles based on the data.
23
22
  * The left and right edges of each rectangle can be set with x() and x2().
@@ -227,9 +226,9 @@ var Rectangle = /** @class */ (function (_super) {
227
226
  }
228
227
  else {
229
228
  var accessor_1 = scale === this.x().scale ? this.x().accessor : this.y().accessor;
230
- var accessorData = d3.set(Utils.Array.flatten(this.datasets().map(function (dataset) {
229
+ var accessorData = Utils.Array.uniq(Utils.Array.flatten(this.datasets().map(function (dataset) {
231
230
  return dataset.data().map(function (d, i) { return accessor_1(d, i, dataset).valueOf(); });
232
- }))).values().map(function (value) { return +value; });
231
+ }))).map(function (value) { return +value; });
233
232
  // Get the absolute difference between min and max
234
233
  var min = Utils.Math.min(accessorData, 0);
235
234
  var max = Utils.Math.max(accessorData, 0);
@@ -20,7 +20,7 @@ var Plots = require("./");
20
20
  var plot_1 = require("./plot");
21
21
  var xyPlot_1 = require("./xyPlot");
22
22
  var Scatter = /** @class */ (function (_super) {
23
- (0, tslib_1.__extends)(Scatter, _super);
23
+ tslib_1.__extends(Scatter, _super);
24
24
  /**
25
25
  * A Scatter Plot draws a symbol at each data point.
26
26
  *
@@ -166,7 +166,7 @@ var Scatter = /** @class */ (function (_super) {
166
166
  var labelArea = _a.labelArea;
167
167
  labelArea.attr("class", null)
168
168
  .classed(Scatter._LABEL_AREA_CLASS, true)
169
- .classed("label-" + _this._labelFontSize, true);
169
+ .classed("label-".concat(_this._labelFontSize), true);
170
170
  });
171
171
  return this.render();
172
172
  }
@@ -185,7 +185,7 @@ var Scatter = /** @class */ (function (_super) {
185
185
  var drawer = _super.prototype._createNodesForDataset.call(this, dataset);
186
186
  var labelArea = this._renderArea.append("g")
187
187
  .classed(Scatter._LABEL_AREA_CLASS, true)
188
- .classed("label-" + this._labelFontSize, true);
188
+ .classed("label-".concat(this._labelFontSize), true);
189
189
  var context = new Typesettable.SvgContext(labelArea.node());
190
190
  var measurer = new Typesettable.CacheMeasurer(context);
191
191
  var writer = new Typesettable.Writer(measurer, context);
@@ -262,7 +262,7 @@ var Scatter = /** @class */ (function (_super) {
262
262
  };
263
263
  Scatter.prototype._createLabelContainer = function (labelArea, labelContainerOrigin, labelOrigin, measurement) {
264
264
  var labelContainer = labelArea.append("g")
265
- .attr("transform", "translate(" + labelContainerOrigin.x + ", " + labelContainerOrigin.y + ")");
265
+ .attr("transform", "translate(".concat(labelContainerOrigin.x, ", ").concat(labelContainerOrigin.y, ")"));
266
266
  labelContainer.classed("on-bar-label", true);
267
267
  return labelContainer;
268
268
  };
@@ -14,7 +14,7 @@ var windowUtils_1 = require("../utils/windowUtils");
14
14
  var plot_1 = require("./plot");
15
15
  var xyPlot_1 = require("./xyPlot");
16
16
  var Segment = /** @class */ (function (_super) {
17
- (0, tslib_1.__extends)(Segment, _super);
17
+ tslib_1.__extends(Segment, _super);
18
18
  /**
19
19
  * A Segment Plot displays line segments based on the data.
20
20
  *
@@ -6,14 +6,13 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.StackedArea = void 0;
8
8
  var tslib_1 = require("tslib");
9
- var d3 = require("d3");
10
9
  var Animators = require("../animators");
11
10
  var index_1 = require("../memoize/index");
12
11
  var Utils = require("../utils");
13
12
  var areaPlot_1 = require("./areaPlot");
14
13
  var plot_1 = require("./plot");
15
14
  var StackedArea = /** @class */ (function (_super) {
16
- (0, tslib_1.__extends)(StackedArea, _super);
15
+ tslib_1.__extends(StackedArea, _super);
17
16
  /**
18
17
  * @constructor
19
18
  */
@@ -152,7 +151,7 @@ var StackedArea = /** @class */ (function (_super) {
152
151
  var datasets = this.datasets();
153
152
  var keyAccessor = this.x().accessor;
154
153
  var keySets = datasets.map(function (dataset) {
155
- return d3.set(dataset.data().map(function (datum, i) { return Utils.Stacking.normalizeKey(keyAccessor(datum, i, dataset)); })).values();
154
+ return Utils.Array.uniq(dataset.data().map(function (datum, i) { return Utils.Stacking.normalizeKey(keyAccessor(datum, i, dataset)); }));
156
155
  });
157
156
  var domainKeys = StackedArea._domainKeys(datasets, keyAccessor);
158
157
  if (keySets.some(function (keySet) { return keySet.length !== domainKeys.length; })) {
@@ -169,16 +168,16 @@ var StackedArea = /** @class */ (function (_super) {
169
168
  * @return {string[]} An array of stringified keys
170
169
  */
171
170
  StackedArea._domainKeys = function (datasets, keyAccessor) {
172
- var domainKeys = d3.set();
171
+ var domainKeys = new Set();
173
172
  datasets.forEach(function (dataset) {
174
173
  var data = dataset.data();
175
174
  var dataLen = data.length;
176
175
  for (var index = 0; index < dataLen; index++) {
177
176
  var datum = data[index];
178
- domainKeys.add(keyAccessor(datum, index, dataset));
177
+ domainKeys.add(String(keyAccessor(datum, index, dataset)));
179
178
  }
180
179
  });
181
- return domainKeys.values();
180
+ return Array.from(domainKeys);
182
181
  };
183
182
  StackedArea.prototype._coordinateProjectors = function () {
184
183
  var _this = this;
@@ -13,7 +13,7 @@ var Utils = require("../utils");
13
13
  var barPlot_1 = require("./barPlot");
14
14
  var plot_1 = require("./plot");
15
15
  var StackedBar = /** @class */ (function (_super) {
16
- (0, tslib_1.__extends)(StackedBar, _super);
16
+ tslib_1.__extends(StackedBar, _super);
17
17
  /**
18
18
  * A StackedBar Plot stacks bars across Datasets based on the primary value of the bars.
19
19
  * On a vertical StackedBar Plot, the bars with the same X value are stacked.
@@ -65,7 +65,7 @@ var StackedBar = /** @class */ (function (_super) {
65
65
  // clearing to remove outdated font-size classes
66
66
  this._labelArea.attr("class", null)
67
67
  .classed(barPlot_1.Bar._LABEL_AREA_CLASS, true)
68
- .classed("label-" + this._labelFontSize, true);
68
+ .classed("label-".concat(this._labelFontSize), true);
69
69
  }
70
70
  _super.prototype.labelFontSize.call(this, fontSize);
71
71
  return this;
@@ -76,7 +76,7 @@ var StackedBar = /** @class */ (function (_super) {
76
76
  this._labelArea = this._renderArea
77
77
  .append("g")
78
78
  .classed(barPlot_1.Bar._LABEL_AREA_CLASS, true)
79
- .classed("label-" + this._labelFontSize, true);
79
+ .classed("label-".concat(this._labelFontSize), true);
80
80
  var context = new Typesettable.SvgContext(this._labelArea.node());
81
81
  this._measurer = new Typesettable.CacheMeasurer(context);
82
82
  this._writer = new Typesettable.Writer(this._measurer, context);
@@ -107,7 +107,7 @@ var StackedBar = /** @class */ (function (_super) {
107
107
  ? width > barThickness
108
108
  : height > barThickness;
109
109
  if (!textTooLong) {
110
- var labelContainer = _this._labelArea.append("g").attr("transform", "translate(" + x + ", " + y + ")");
110
+ var labelContainer = _this._labelArea.append("g").attr("transform", "translate(".concat(x, ", ").concat(y, ")"));
111
111
  labelContainer.classed("stacked-bar-label", true);
112
112
  var writeOptions = {
113
113
  xAlign: "center",
@@ -10,7 +10,7 @@ var Utils = require("../utils");
10
10
  var barPlot_1 = require("./barPlot");
11
11
  var plot_1 = require("./plot");
12
12
  var Waterfall = /** @class */ (function (_super) {
13
- (0, tslib_1.__extends)(Waterfall, _super);
13
+ tslib_1.__extends(Waterfall, _super);
14
14
  function Waterfall() {
15
15
  var _this = _super.call(this) || this;
16
16
  _this._connectorsEnabled = false;
@@ -11,7 +11,7 @@ var Utils = require("../utils");
11
11
  var deferredRenderer_1 = require("./deferredRenderer");
12
12
  var plot_1 = require("./plot");
13
13
  var XYPlot = /** @class */ (function (_super) {
14
- (0, tslib_1.__extends)(XYPlot, _super);
14
+ tslib_1.__extends(XYPlot, _super);
15
15
  /**
16
16
  * An XYPlot is a Plot that displays data along two primary directions, X and Y.
17
17
  *
@@ -29,10 +29,10 @@ var XYPlot = /** @class */ (function (_super) {
29
29
  return;
30
30
  }
31
31
  if (_this._renderArea != null) {
32
- _this._renderArea.attr("transform", "translate(" + tx + ", " + ty + ") scale(" + sx + ", " + sy + ")");
32
+ _this._renderArea.attr("transform", "translate(".concat(tx, ", ").concat(ty, ") scale(").concat(sx, ", ").concat(sy, ")"));
33
33
  }
34
34
  if (_this._canvas != null) {
35
- _this._canvas.style("transform", "translate(" + tx + "px, " + ty + "px) scale(" + sx + ", " + sy + ")");
35
+ _this._canvas.style("transform", "translate(".concat(tx, "px, ").concat(ty, "px) scale(").concat(sx, ", ").concat(sy, ")"));
36
36
  }
37
37
  };
38
38
  _this.addClass("xy-plot");
@@ -12,7 +12,7 @@ var Utils = require("../utils");
12
12
  var scale_1 = require("./scale");
13
13
  var TRANSFORMATION_SPACE = [0, 1];
14
14
  var Category = /** @class */ (function (_super) {
15
- (0, tslib_1.__extends)(Category, _super);
15
+ tslib_1.__extends(Category, _super);
16
16
  /**
17
17
  * A Category Scale maps strings to numbers.
18
18
  *
@@ -23,7 +23,7 @@ var Category = /** @class */ (function (_super) {
23
23
  _this._range = [0, 1];
24
24
  _this._d3Scale = d3.scaleBand();
25
25
  _this._d3Scale.range(TRANSFORMATION_SPACE);
26
- _this._d3TransformationScale = d3.scaleLinear();
26
+ _this._d3TransformationScale = d3.scaleLinear().unknown(NaN);
27
27
  _this._d3TransformationScale.domain(TRANSFORMATION_SPACE);
28
28
  var d3InnerPadding = 0.3;
29
29
  _this._innerPadding = Category._convertToPlottableInnerPadding(d3InnerPadding);
@@ -44,8 +44,27 @@ var ImplicitSeriesTracker = /** @class */ (function () {
44
44
  };
45
45
  return ImplicitSeriesTracker;
46
46
  }());
47
+ // Preserve the public D3 4 palette names removed in D3 5.
48
+ var CATEGORY20 = [
49
+ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c",
50
+ "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5",
51
+ "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f",
52
+ "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5",
53
+ ];
54
+ var CATEGORY20B = [
55
+ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939",
56
+ "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39",
57
+ "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b",
58
+ "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6",
59
+ ];
60
+ var CATEGORY20C = [
61
+ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d",
62
+ "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476",
63
+ "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc",
64
+ "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9",
65
+ ];
47
66
  var Color = /** @class */ (function (_super) {
48
- (0, tslib_1.__extends)(Color, _super);
67
+ tslib_1.__extends(Color, _super);
49
68
  /**
50
69
  * A Color Scale maps string values to color hex values expressed as a string.
51
70
  *
@@ -76,17 +95,17 @@ var Color = /** @class */ (function (_super) {
76
95
  case "Category20":
77
96
  case "category20":
78
97
  case "20":
79
- scale = d3.scaleOrdinal(d3.schemeCategory20);
98
+ scale = d3.scaleOrdinal(CATEGORY20);
80
99
  break;
81
100
  case "Category20b":
82
101
  case "category20b":
83
102
  case "20b":
84
- scale = d3.scaleOrdinal(d3.schemeCategory20b);
103
+ scale = d3.scaleOrdinal(CATEGORY20B);
85
104
  break;
86
105
  case "Category20c":
87
106
  case "category20c":
88
107
  case "20c":
89
- scale = d3.scaleOrdinal(d3.schemeCategory20c);
108
+ scale = d3.scaleOrdinal(CATEGORY20C);
90
109
  break;
91
110
  default:
92
111
  throw new Error("Unsupported ColorScale type");
@@ -117,7 +136,7 @@ var Color = /** @class */ (function (_super) {
117
136
  }
118
137
  plottableDefaultColors.push(colorHex);
119
138
  i++;
120
- colorHex = Utils.Color.colorTest(colorTester, "plottable-colors-" + i);
139
+ colorHex = Utils.Color.colorTest(colorTester, "plottable-colors-".concat(i));
121
140
  }
122
141
  colorTester.remove();
123
142
  return plottableDefaultColors;
@@ -4,17 +4,18 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.isTransformable = exports.TickGenerators = void 0;
7
+ exports.TickGenerators = void 0;
8
+ exports.isTransformable = isTransformable;
8
9
  var tslib_1 = require("tslib");
9
10
  var TickGenerators = require("./tickGenerators");
10
11
  exports.TickGenerators = TickGenerators;
11
- (0, tslib_1.__exportStar)(require("./categoryScale"), exports);
12
- (0, tslib_1.__exportStar)(require("./colorScale"), exports);
13
- (0, tslib_1.__exportStar)(require("./interpolatedColorScale"), exports);
14
- (0, tslib_1.__exportStar)(require("./linearScale"), exports);
15
- (0, tslib_1.__exportStar)(require("./logScale"), exports);
16
- (0, tslib_1.__exportStar)(require("./modifiedLogScale"), exports);
17
- (0, tslib_1.__exportStar)(require("./timeScale"), exports);
12
+ tslib_1.__exportStar(require("./categoryScale"), exports);
13
+ tslib_1.__exportStar(require("./colorScale"), exports);
14
+ tslib_1.__exportStar(require("./interpolatedColorScale"), exports);
15
+ tslib_1.__exportStar(require("./linearScale"), exports);
16
+ tslib_1.__exportStar(require("./logScale"), exports);
17
+ tslib_1.__exportStar(require("./modifiedLogScale"), exports);
18
+ tslib_1.__exportStar(require("./timeScale"), exports);
18
19
  // ---------------------------------------------------------
19
20
  var categoryScale_1 = require("./categoryScale");
20
21
  var quantitativeScale_1 = require("./quantitativeScale");
@@ -28,4 +29,3 @@ function isTransformable(scale) {
28
29
  return (scale instanceof quantitativeScale_1.QuantitativeScale ||
29
30
  scale instanceof categoryScale_1.Category);
30
31
  }
31
- exports.isTransformable = isTransformable;
@@ -10,7 +10,7 @@ var d3 = require("d3");
10
10
  var Utils = require("../utils");
11
11
  var scale_1 = require("./scale");
12
12
  var InterpolatedColor = /** @class */ (function (_super) {
13
- (0, tslib_1.__extends)(InterpolatedColor, _super);
13
+ tslib_1.__extends(InterpolatedColor, _super);
14
14
  /**
15
15
  * An InterpolatedColor Scale maps numbers to color hex values, expressed as strings.
16
16
  *
@@ -90,7 +90,7 @@ var InterpolatedColor = /** @class */ (function (_super) {
90
90
  return this;
91
91
  };
92
92
  InterpolatedColor.prototype.scale = function (value) {
93
- return this._d3Scale(value);
93
+ return this._d3Scale(+value);
94
94
  };
95
95
  InterpolatedColor.prototype._getDomain = function () {
96
96
  return this._backingScaleDomain();
@@ -112,7 +112,7 @@ var InterpolatedColor = /** @class */ (function (_super) {
112
112
  this._resetScale();
113
113
  };
114
114
  InterpolatedColor.REDS = [
115
- "#FFFFFF",
115
+ "#FFFFFF", // white
116
116
  "#FFF6E1",
117
117
  "#FEF4C0",
118
118
  "#FED976",
@@ -123,7 +123,7 @@ var InterpolatedColor = /** @class */ (function (_super) {
123
123
  "#B10026", // red
124
124
  ];
125
125
  InterpolatedColor.BLUES = [
126
- "#FFFFFF",
126
+ "#FFFFFF", // white
127
127
  "#CCFFFF",
128
128
  "#A5FFFD",
129
129
  "#85F7FB",
@@ -134,7 +134,7 @@ var InterpolatedColor = /** @class */ (function (_super) {
134
134
  "#0B02E1", // blue
135
135
  ];
136
136
  InterpolatedColor.POSNEG = [
137
- "#0B02E1",
137
+ "#0B02E1", // blue
138
138
  "#2545D3",
139
139
  "#417FD0",
140
140
  "#55A7E0",
@@ -142,7 +142,7 @@ var InterpolatedColor = /** @class */ (function (_super) {
142
142
  "#85F7FB",
143
143
  "#A5FFFD",
144
144
  "#CCFFFF",
145
- "#FFFFFF",
145
+ "#FFFFFF", // white
146
146
  "#FFF6E1",
147
147
  "#FEF4C0",
148
148
  "#FED976",
@@ -9,13 +9,13 @@ var tslib_1 = require("tslib");
9
9
  var d3 = require("d3");
10
10
  var quantitativeScale_1 = require("./quantitativeScale");
11
11
  var Linear = /** @class */ (function (_super) {
12
- (0, tslib_1.__extends)(Linear, _super);
12
+ tslib_1.__extends(Linear, _super);
13
13
  /**
14
14
  * @constructor
15
15
  */
16
16
  function Linear() {
17
17
  var _this = _super.call(this) || this;
18
- _this._d3Scale = d3.scaleLinear();
18
+ _this._d3Scale = d3.scaleLinear().unknown(NaN);
19
19
  return _this;
20
20
  }
21
21
  Linear.prototype._defaultExtent = function () {
@@ -28,7 +28,7 @@ var Linear = /** @class */ (function (_super) {
28
28
  return singleValueDomain;
29
29
  };
30
30
  Linear.prototype.scale = function (value) {
31
- return this._d3Scale(value);
31
+ return this._d3Scale(+value);
32
32
  };
33
33
  Linear.prototype.scaleTransformation = function (value) {
34
34
  return this.scale(value);
@@ -9,14 +9,14 @@ var tslib_1 = require("tslib");
9
9
  var d3 = require("d3");
10
10
  var quantitativeScale_1 = require("./quantitativeScale");
11
11
  var Log = /** @class */ (function (_super) {
12
- (0, tslib_1.__extends)(Log, _super);
12
+ tslib_1.__extends(Log, _super);
13
13
  /**
14
14
  * @constructor
15
15
  */
16
16
  function Log(base) {
17
17
  if (base === void 0) { base = 10; }
18
18
  var _this = _super.call(this) || this;
19
- _this._d3Scale = d3.scaleLog().base(base);
19
+ _this._d3Scale = d3.scaleLog().base(base).unknown(NaN);
20
20
  _this._setDomain(_this._defaultExtent());
21
21
  return _this;
22
22
  }
@@ -31,7 +31,7 @@ var Log = /** @class */ (function (_super) {
31
31
  return singleValueDomain;
32
32
  };
33
33
  Log.prototype.scale = function (value) {
34
- return this._d3Scale(value);
34
+ return this._d3Scale(+value);
35
35
  };
36
36
  Log.prototype.scaleTransformation = function (value) {
37
37
  return this.scale(value);
@@ -11,7 +11,7 @@ var Utils = require("../utils");
11
11
  var Scales = require("./");
12
12
  var quantitativeScale_1 = require("./quantitativeScale");
13
13
  var ModifiedLog = /** @class */ (function (_super) {
14
- (0, tslib_1.__extends)(ModifiedLog, _super);
14
+ tslib_1.__extends(ModifiedLog, _super);
15
15
  /**
16
16
  * A ModifiedLog Scale acts as a regular log scale for large numbers.
17
17
  * As it approaches 0, it gradually becomes linear.
@@ -66,7 +66,7 @@ var ModifiedLog = /** @class */ (function (_super) {
66
66
  }
67
67
  return ticks;
68
68
  };
69
- _this._d3Scale = d3.scaleLinear();
69
+ _this._d3Scale = d3.scaleLinear().unknown(NaN);
70
70
  _this._base = base;
71
71
  _this._pivot = _this._base;
72
72
  _this._setDomain(_this._defaultExtent());
@@ -11,7 +11,7 @@ var panZoomConstraints_1 = require("../interactions/panZoomConstraints");
11
11
  var Utils = require("../utils");
12
12
  var scale_1 = require("./scale");
13
13
  var QuantitativeScale = /** @class */ (function (_super) {
14
- (0, tslib_1.__extends)(QuantitativeScale, _super);
14
+ tslib_1.__extends(QuantitativeScale, _super);
15
15
  /**
16
16
  * A QuantitativeScale is a Scale that maps number-like values to numbers.
17
17
  * It is invertible and continuous.
@@ -3,7 +3,7 @@
3
3
  * @license MIT
4
4
  */
5
5
  import * as Scales from "./";
6
- export declare type TransformableScale<D, R> = Scale<D, R> & Scales.ITransformableScale;
6
+ export type TransformableScale<D, R> = Scale<D, R> & Scales.ITransformableScale;
7
7
  export interface IScaleCallback<S extends Scale<any, any>> {
8
8
  (scale: S): any;
9
9
  }
@@ -4,7 +4,8 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.integerTickGenerator = exports.intervalTickGenerator = void 0;
7
+ exports.intervalTickGenerator = intervalTickGenerator;
8
+ exports.integerTickGenerator = integerTickGenerator;
8
9
  var Utils = require("../utils");
9
10
  /**
10
11
  * Creates a TickGenerator using the specified interval.
@@ -30,7 +31,6 @@ function intervalTickGenerator(interval) {
30
31
  return lowTicks.concat(middleTicks).concat(highTicks);
31
32
  };
32
33
  }
33
- exports.intervalTickGenerator = intervalTickGenerator;
34
34
  /**
35
35
  * Creates a TickGenerator returns only integer tick values.
36
36
  *
@@ -42,4 +42,3 @@ function integerTickGenerator() {
42
42
  return defaultTicks.filter(function (tick, i) { return (tick % 1 === 0) || (i === 0) || (i === defaultTicks.length - 1); });
43
43
  };
44
44
  }
45
- exports.integerTickGenerator = integerTickGenerator;