plottable 3.9.0-dev-56-geb1f7fd → 3.9.0-dev-60-g2ae4d07

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 (182) hide show
  1. package/build/src/animators/easingAnimator.d.ts +2 -2
  2. package/build/src/animators/easingAnimator.js +3 -2
  3. package/build/src/animators/index.js +2 -2
  4. package/build/src/animators/nullAnimator.js +2 -1
  5. package/build/src/axes/axis.d.ts +23 -4
  6. package/build/src/axes/axis.js +35 -6
  7. package/build/src/axes/categoryAxis.d.ts +12 -5
  8. package/build/src/axes/categoryAxis.js +22 -11
  9. package/build/src/axes/index.js +3 -3
  10. package/build/src/axes/numericAxis.d.ts +9 -5
  11. package/build/src/axes/numericAxis.js +2 -1
  12. package/build/src/axes/timeAxis.d.ts +21 -14
  13. package/build/src/axes/timeAxis.js +30 -7
  14. package/build/src/components/component.d.ts +2 -2
  15. package/build/src/components/component.js +7 -6
  16. package/build/src/components/componentContainer.js +3 -2
  17. package/build/src/components/dragBoxLayer.d.ts +4 -4
  18. package/build/src/components/dragBoxLayer.js +3 -2
  19. package/build/src/components/dragLineLayer.js +2 -1
  20. package/build/src/components/gridlines.d.ts +2 -2
  21. package/build/src/components/gridlines.js +2 -1
  22. package/build/src/components/group.js +2 -1
  23. package/build/src/components/guideLineLayer.d.ts +1 -1
  24. package/build/src/components/guideLineLayer.js +2 -1
  25. package/build/src/components/index.js +14 -14
  26. package/build/src/components/interpolatedColorLegend.d.ts +7 -3
  27. package/build/src/components/interpolatedColorLegend.js +4 -3
  28. package/build/src/components/label.d.ts +4 -0
  29. package/build/src/components/label.js +7 -3
  30. package/build/src/components/legend.d.ts +5 -1
  31. package/build/src/components/legend.js +2 -1
  32. package/build/src/components/plotGroup.js +2 -1
  33. package/build/src/components/selectionBoxLayer.d.ts +4 -4
  34. package/build/src/components/selectionBoxLayer.js +2 -1
  35. package/build/src/components/table.d.ts +10 -6
  36. package/build/src/components/table.js +4 -3
  37. package/build/src/components/wrappedLabel.js +2 -1
  38. package/build/src/components/xDragBoxLayer.js +2 -1
  39. package/build/src/components/yDragBoxLayer.js +2 -1
  40. package/build/src/core/config.js +1 -0
  41. package/build/src/core/dataset.d.ts +5 -1
  42. package/build/src/core/dataset.js +1 -0
  43. package/build/src/core/formatters.d.ts +4 -0
  44. package/build/src/core/formatters.js +1 -0
  45. package/build/src/core/renderController.d.ts +1 -1
  46. package/build/src/core/renderController.js +2 -1
  47. package/build/src/core/renderPolicy.d.ts +4 -0
  48. package/build/src/core/renderPolicy.js +1 -0
  49. package/build/src/core/symbolFactories.d.ts +4 -0
  50. package/build/src/core/symbolFactories.js +1 -0
  51. package/build/src/core/version.d.ts +4 -0
  52. package/build/src/core/version.js +2 -1
  53. package/build/src/core/version.js.bak +1 -0
  54. package/build/src/dispatchers/dispatcher.d.ts +7 -3
  55. package/build/src/dispatchers/dispatcher.js +2 -1
  56. package/build/src/dispatchers/index.js +3 -3
  57. package/build/src/dispatchers/keyDispatcher.d.ts +2 -2
  58. package/build/src/dispatchers/keyDispatcher.js +2 -1
  59. package/build/src/dispatchers/mouseDispatcher.d.ts +1 -1
  60. package/build/src/dispatchers/mouseDispatcher.js +2 -1
  61. package/build/src/dispatchers/touchDispatcher.d.ts +1 -1
  62. package/build/src/dispatchers/touchDispatcher.js +2 -1
  63. package/build/src/drawers/arcDrawer.js +2 -1
  64. package/build/src/drawers/arcOutlineDrawer.js +2 -1
  65. package/build/src/drawers/areaDrawer.js +6 -5
  66. package/build/src/drawers/canvasBuffer.js +1 -0
  67. package/build/src/drawers/canvasDrawer.js +1 -0
  68. package/build/src/drawers/drawer.js +1 -0
  69. package/build/src/drawers/index.js +11 -10
  70. package/build/src/drawers/lineDrawer.js +4 -3
  71. package/build/src/drawers/rectangleDrawer.js +7 -5
  72. package/build/src/drawers/segmentDrawer.js +2 -1
  73. package/build/src/drawers/svgDrawer.d.ts +2 -2
  74. package/build/src/drawers/svgDrawer.js +1 -0
  75. package/build/src/drawers/symbolDrawer.js +6 -6
  76. package/build/src/index.d.ts +1 -1
  77. package/build/src/index.js +17 -14
  78. package/build/src/interactions/clickInteraction.d.ts +4 -4
  79. package/build/src/interactions/clickInteraction.js +2 -1
  80. package/build/src/interactions/dragInteraction.d.ts +4 -4
  81. package/build/src/interactions/dragInteraction.js +2 -1
  82. package/build/src/interactions/index.js +7 -6
  83. package/build/src/interactions/interaction.d.ts +2 -2
  84. package/build/src/interactions/interaction.js +1 -0
  85. package/build/src/interactions/keyInteraction.d.ts +2 -2
  86. package/build/src/interactions/keyInteraction.js +2 -1
  87. package/build/src/interactions/panZoomConstraints.js +1 -0
  88. package/build/src/interactions/panZoomInteraction.d.ts +13 -9
  89. package/build/src/interactions/panZoomInteraction.js +4 -3
  90. package/build/src/interactions/pointerInteraction.d.ts +3 -3
  91. package/build/src/interactions/pointerInteraction.js +2 -1
  92. package/build/src/memoize/index.js +5 -4
  93. package/build/src/memoize/memThunk.js +2 -1
  94. package/build/src/memoize/memoize.d.ts +5 -0
  95. package/build/src/memoize/memoize.js +2 -1
  96. package/build/src/memoize/memoizeProjectors.js +3 -2
  97. package/build/src/memoize/signature.d.ts +14 -0
  98. package/build/src/memoize/signature.js +4 -3
  99. package/build/src/plots/areaPlot.d.ts +9 -5
  100. package/build/src/plots/areaPlot.js +4 -3
  101. package/build/src/plots/barPlot.d.ts +26 -22
  102. package/build/src/plots/barPlot.js +35 -7
  103. package/build/src/plots/clusteredBarPlot.d.ts +3 -5
  104. package/build/src/plots/clusteredBarPlot.js +2 -1
  105. package/build/src/plots/commons.js +1 -0
  106. package/build/src/plots/deferredRenderer.d.ts +1 -1
  107. package/build/src/plots/deferredRenderer.js +1 -0
  108. package/build/src/plots/index.js +12 -12
  109. package/build/src/plots/linePlot.d.ts +6 -6
  110. package/build/src/plots/linePlot.js +5 -4
  111. package/build/src/plots/piePlot.d.ts +9 -5
  112. package/build/src/plots/piePlot.js +3 -2
  113. package/build/src/plots/plot.d.ts +5 -5
  114. package/build/src/plots/plot.js +7 -6
  115. package/build/src/plots/rectanglePlot.d.ts +10 -6
  116. package/build/src/plots/rectanglePlot.js +2 -1
  117. package/build/src/plots/scatterPlot.d.ts +19 -9
  118. package/build/src/plots/scatterPlot.js +35 -3
  119. package/build/src/plots/segmentPlot.d.ts +7 -3
  120. package/build/src/plots/segmentPlot.js +3 -2
  121. package/build/src/plots/stackedAreaPlot.d.ts +6 -2
  122. package/build/src/plots/stackedAreaPlot.js +4 -3
  123. package/build/src/plots/stackedBarPlot.d.ts +8 -4
  124. package/build/src/plots/stackedBarPlot.js +27 -6
  125. package/build/src/plots/waterfallPlot.d.ts +4 -6
  126. package/build/src/plots/waterfallPlot.js +2 -1
  127. package/build/src/plots/xyPlot.d.ts +5 -5
  128. package/build/src/plots/xyPlot.js +2 -1
  129. package/build/src/scales/categoryScale.d.ts +7 -3
  130. package/build/src/scales/categoryScale.js +3 -2
  131. package/build/src/scales/colorScale.d.ts +5 -1
  132. package/build/src/scales/colorScale.js +2 -1
  133. package/build/src/scales/index.d.ts +1 -1
  134. package/build/src/scales/index.js +8 -7
  135. package/build/src/scales/interpolatedColorScale.d.ts +7 -3
  136. package/build/src/scales/interpolatedColorScale.js +5 -4
  137. package/build/src/scales/linearScale.d.ts +4 -0
  138. package/build/src/scales/linearScale.js +2 -1
  139. package/build/src/scales/logScale.d.ts +4 -0
  140. package/build/src/scales/logScale.js +2 -1
  141. package/build/src/scales/modifiedLogScale.d.ts +8 -4
  142. package/build/src/scales/modifiedLogScale.js +2 -1
  143. package/build/src/scales/quantitativeScale.d.ts +5 -1
  144. package/build/src/scales/quantitativeScale.js +3 -2
  145. package/build/src/scales/scale.d.ts +4 -0
  146. package/build/src/scales/scale.js +1 -0
  147. package/build/src/scales/tickGenerators.js +1 -0
  148. package/build/src/scales/timeScale.js +2 -1
  149. package/build/src/utils/addD3SelectionMulti.d.ts +8 -0
  150. package/build/src/utils/arrayUtils.d.ts +4 -0
  151. package/build/src/utils/arrayUtils.js +1 -0
  152. package/build/src/utils/bucket.js +1 -0
  153. package/build/src/utils/callbackSet.js +2 -1
  154. package/build/src/utils/coerceD3.js +1 -0
  155. package/build/src/utils/colorUtils.d.ts +4 -0
  156. package/build/src/utils/colorUtils.js +1 -0
  157. package/build/src/utils/domUtils.d.ts +3 -10
  158. package/build/src/utils/domUtils.js +1 -0
  159. package/build/src/utils/entityStore.js +1 -0
  160. package/build/src/utils/index.d.ts +1 -1
  161. package/build/src/utils/index.js +9 -8
  162. package/build/src/utils/makeEnum.js +1 -0
  163. package/build/src/utils/map.d.ts +4 -0
  164. package/build/src/utils/map.js +1 -0
  165. package/build/src/utils/mathUtils.d.ts +4 -0
  166. package/build/src/utils/mathUtils.js +3 -2
  167. package/build/src/utils/objectUtils.js +1 -0
  168. package/build/src/utils/rTree.d.ts +1 -1
  169. package/build/src/utils/rTree.js +1 -0
  170. package/build/src/utils/rTreeSplitStrategies.d.ts +2 -2
  171. package/build/src/utils/rTreeSplitStrategies.js +1 -0
  172. package/build/src/utils/set.js +1 -0
  173. package/build/src/utils/stackingUtils.d.ts +5 -1
  174. package/build/src/utils/stackingUtils.js +6 -5
  175. package/build/src/utils/transformAwareTranslator.d.ts +4 -0
  176. package/build/src/utils/transformAwareTranslator.js +1 -0
  177. package/build/src/utils/windowUtils.d.ts +4 -0
  178. package/build/src/utils/windowUtils.js +1 -0
  179. package/package.json +6 -5
  180. package/plottable.css +75 -2
  181. package/plottable.js +38050 -26170
  182. package/plottable.js.map +1 -1
@@ -7,8 +7,8 @@ import { AttributeToAppliedProjector, SimpleSelection } from "../core/interfaces
7
7
  import { IAnimator } from "./animator";
8
8
  export declare type EaseFn = (normalizedTime: number) => number;
9
9
  export declare const EaseName: {
10
- circle: "circle";
11
10
  linear: "linear";
11
+ circle: "circle";
12
12
  quad: "quad";
13
13
  quadIn: "quadIn";
14
14
  quadOut: "quadOut";
@@ -163,5 +163,5 @@ export declare class Easing implements IAnimator {
163
163
  /**
164
164
  * Adjust the iterative delay, such that it takes into account the maxTotalDuration constraint
165
165
  */
166
- private _getAdjustedIterativeDelay(numberOfSteps);
166
+ private _getAdjustedIterativeDelay;
167
167
  }
@@ -4,6 +4,7 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Easing = exports.EaseName = void 0;
7
8
  var d3Ease = require("d3-ease");
8
9
  var coerceD3_1 = require("../utils/coerceD3");
9
10
  var makeEnum_1 = require("../utils/makeEnum");
@@ -46,7 +47,7 @@ var EASE_NAME_MAPPING = {
46
47
  elasticOut: d3Ease.easeElasticOut,
47
48
  elasticInOut: d3Ease.easeElasticInOut,
48
49
  };
49
- exports.EaseName = makeEnum_1.makeEnum([
50
+ exports.EaseName = (0, makeEnum_1.makeEnum)([
50
51
  "linear",
51
52
  "quad",
52
53
  "quadIn",
@@ -107,7 +108,7 @@ var Easing = /** @class */ (function () {
107
108
  };
108
109
  Easing.prototype.animate = function (selection, attrToAppliedProjector) {
109
110
  var _this = this;
110
- selection = coerceD3_1.coerceExternalD3(selection);
111
+ selection = (0, coerceD3_1.coerceExternalD3)(selection);
111
112
  var numberOfSteps = selection.size();
112
113
  var adjustedIterativeDelay = this._getAdjustedIterativeDelay(numberOfSteps);
113
114
  return selection.transition()
@@ -5,5 +5,5 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var tslib_1 = require("tslib");
8
- tslib_1.__exportStar(require("./easingAnimator"), exports);
9
- tslib_1.__exportStar(require("./nullAnimator"), exports);
8
+ (0, tslib_1.__exportStar)(require("./easingAnimator"), exports);
9
+ (0, tslib_1.__exportStar)(require("./nullAnimator"), exports);
@@ -4,6 +4,7 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Null = void 0;
7
8
  var coerceD3_1 = require("../utils/coerceD3");
8
9
  /**
9
10
  * An animator implementation with no animation. The attributes are
@@ -16,7 +17,7 @@ var Null = /** @class */ (function () {
16
17
  return 0;
17
18
  };
18
19
  Null.prototype.animate = function (selection, attrToAppliedProjector) {
19
- selection = coerceD3_1.coerceExternalD3(selection);
20
+ selection = (0, coerceD3_1.coerceExternalD3)(selection);
20
21
  return selection.attrs(attrToAppliedProjector);
21
22
  };
22
23
  return Null;
@@ -1,12 +1,17 @@
1
+ /**
2
+ * Copyright 2014-present Palantir Technologies
3
+ * @license MIT
4
+ */
1
5
  import { Component } from "../components/component";
6
+ import { LabelFontSizePx } from "../components/label";
2
7
  import { Formatter } from "../core/formatters";
3
8
  import { Point, SimpleSelection, SpaceRequest } from "../core/interfaces";
4
9
  import { Scale } from "../scales/scale";
5
10
  export declare const AxisOrientation: {
6
11
  left: "left";
7
- right: "right";
8
12
  top: "top";
9
13
  bottom: "bottom";
14
+ right: "right";
10
15
  };
11
16
  export declare type AxisOrientation = keyof typeof AxisOrientation;
12
17
  export declare class Axis<D> extends Component {
@@ -41,6 +46,11 @@ export declare class Axis<D> extends Component {
41
46
  private static _ANNOTATION_LABEL_PADDING;
42
47
  protected _tickMarkContainer: SimpleSelection<void>;
43
48
  protected _tickLabelContainer: SimpleSelection<void>;
49
+ /**
50
+ * `protected` instead of `private` to accommodate time axes which draw their own label containers
51
+ * and need access to this value.
52
+ */
53
+ protected _tickLabelFontSize: LabelFontSizePx;
44
54
  protected _baseline: SimpleSelection<void>;
45
55
  protected _scale: Scale<D, number>;
46
56
  private _formatter;
@@ -73,7 +83,15 @@ export declare class Axis<D> extends Component {
73
83
  *
74
84
  * @param {Element} element
75
85
  */
76
- tickLabelDataOnElement(element: Element): {};
86
+ tickLabelDataOnElement(element: Element): unknown;
87
+ /**
88
+ * Get the label font size in px.
89
+ */
90
+ tickLabelFontSize(): LabelFontSizePx;
91
+ /**
92
+ * Set the label font size.
93
+ */
94
+ tickLabelFontSize(fontSize: LabelFontSizePx): this;
77
95
  protected _computeWidth(): number;
78
96
  protected _computeHeight(): number;
79
97
  requestedSpace(offeredWidth: number, offeredHeight: number): SpaceRequest;
@@ -86,6 +104,7 @@ export declare class Axis<D> extends Component {
86
104
  height: number;
87
105
  };
88
106
  protected _setup(): void;
107
+ private _configureTickLabelContainer;
89
108
  protected _getTickValues(): D[];
90
109
  /**
91
110
  * Render tick marks, baseline, and annotations. Should be super called by subclasses and then overridden to draw
@@ -135,7 +154,7 @@ export declare class Axis<D> extends Component {
135
154
  */
136
155
  annotationTierCount(annotationTierCount: number): this;
137
156
  protected _drawAnnotations(): void;
138
- private _annotatedTicksToRender();
157
+ private _annotatedTicksToRender;
139
158
  /**
140
159
  * Retrieves the size of the core pieces.
141
160
  *
@@ -143,7 +162,7 @@ export declare class Axis<D> extends Component {
143
162
  */
144
163
  protected _coreSize(): number;
145
164
  protected _annotationTierHeight(): number;
146
- private _annotationToTier(measurements);
165
+ private _annotationToTier;
147
166
  protected _removeAnnotations(): void;
148
167
  protected _generateBaselineAttrHash(): {
149
168
  [key: string]: number;
@@ -4,16 +4,18 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Axis = exports.AxisOrientation = void 0;
7
8
  var tslib_1 = require("tslib");
8
9
  var d3 = require("d3");
9
10
  var Typesettable = require("typesettable");
10
11
  var component_1 = require("../components/component");
12
+ var label_1 = require("../components/label");
11
13
  var Formatters = require("../core/formatters");
12
14
  var Utils = require("../utils");
13
15
  var makeEnum_1 = require("../utils/makeEnum");
14
- exports.AxisOrientation = makeEnum_1.makeEnum(["bottom", "left", "right", "top"]);
16
+ exports.AxisOrientation = (0, makeEnum_1.makeEnum)(["bottom", "left", "right", "top"]);
15
17
  var Axis = /** @class */ (function (_super) {
16
- tslib_1.__extends(Axis, _super);
18
+ (0, tslib_1.__extends)(Axis, _super);
17
19
  /**
18
20
  * Constructs an Axis.
19
21
  * An Axis is a visual representation of a Scale.
@@ -24,6 +26,11 @@ var Axis = /** @class */ (function (_super) {
24
26
  */
25
27
  function Axis(scale, orientation) {
26
28
  var _this = _super.call(this) || this;
29
+ /**
30
+ * `protected` instead of `private` to accommodate time axes which draw their own label containers
31
+ * and need access to this value.
32
+ */
33
+ _this._tickLabelFontSize = label_1.Label._DEFAULT_FONT_SIZE_PX;
27
34
  _this._endTickLength = 5;
28
35
  _this._innerTickLength = 5;
29
36
  _this._tickLabelPadding = 10;
@@ -76,6 +83,18 @@ var Axis = /** @class */ (function (_super) {
76
83
  }
77
84
  return element === undefined ? undefined : d3.select(element).datum();
78
85
  };
86
+ Axis.prototype.tickLabelFontSize = function (fontSize) {
87
+ if (fontSize == null) {
88
+ return this._tickLabelFontSize;
89
+ }
90
+ else {
91
+ this._tickLabelFontSize = fontSize;
92
+ if (this._tickLabelContainer != null) {
93
+ this._configureTickLabelContainer();
94
+ }
95
+ return this.render();
96
+ }
97
+ };
79
98
  Axis.prototype._computeWidth = function () {
80
99
  // to be overridden by subclass logic
81
100
  return this._maxLabelTickLength();
@@ -94,7 +113,7 @@ var Axis = /** @class */ (function (_super) {
94
113
  requestedHeight += tierHeight * this.annotationTierCount();
95
114
  }
96
115
  }
97
- else {
116
+ else { // vertical
98
117
  requestedWidth = this._computeWidth() + this._margin;
99
118
  if (this.annotationsEnabled()) {
100
119
  var tierHeight = this._annotationMeasurer.measure().height + 2 * Axis._ANNOTATION_LABEL_PADDING;
@@ -147,8 +166,7 @@ var Axis = /** @class */ (function (_super) {
147
166
  _super.prototype._setup.call(this);
148
167
  this._tickMarkContainer = this.content().append("g")
149
168
  .classed(Axis.TICK_MARK_CLASS + "-container", true);
150
- this._tickLabelContainer = this.content().append("g")
151
- .classed(Axis.TICK_LABEL_CLASS + "-container", true);
169
+ this._configureTickLabelContainer();
152
170
  this._baseline = this.content().append("line").classed("baseline", true);
153
171
  this._annotationContainer = this.content().append("g")
154
172
  .classed("annotation-container", true);
@@ -160,6 +178,15 @@ var Axis = /** @class */ (function (_super) {
160
178
  this._annotationMeasurer = new Typesettable.CacheMeasurer(typesetterContext);
161
179
  this._annotationWriter = new Typesettable.Writer(this._annotationMeasurer, typesetterContext);
162
180
  };
181
+ Axis.prototype._configureTickLabelContainer = function () {
182
+ if (this._tickLabelContainer == null) {
183
+ this._tickLabelContainer = this.content().append("g");
184
+ }
185
+ // clearing to remove outdated font-size classes
186
+ this._tickLabelContainer.attr("class", null)
187
+ .classed(Axis.TICK_LABEL_CLASS + "-container", true)
188
+ .classed("label-" + this._tickLabelFontSize, true);
189
+ };
163
190
  /*
164
191
  * Function for generating tick values in data-space (as opposed to pixel values).
165
192
  * To be implemented by subclasses.
@@ -639,7 +666,9 @@ var Axis = /** @class */ (function (_super) {
639
666
  };
640
667
  Axis.prototype.invalidateCache = function () {
641
668
  _super.prototype.invalidateCache.call(this);
642
- this._annotationMeasurer.reset();
669
+ if (this._annotationMeasurer != null) {
670
+ this._annotationMeasurer.reset();
671
+ }
643
672
  };
644
673
  /**
645
674
  * The css class applied to each end tick mark (the line on the end tick).
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2014-present Palantir Technologies
3
+ * @license MIT
4
+ */
5
+ import { LabelFontSizePx } from "../components/label";
1
6
  import { Point, SpaceRequest } from "../core/interfaces";
2
7
  import * as Scales from "../scales";
3
8
  import { Axis, AxisOrientation } from "./axis";
@@ -32,12 +37,12 @@ export declare class Category extends Axis<string> {
32
37
  * A Wrapper configured according to the other properties on this axis.
33
38
  * @returns {Typesettable.Wrapper}
34
39
  */
35
- private readonly _wrapper;
40
+ private get _wrapper();
36
41
  /**
37
42
  * A Writer attached to this measurer and wrapper.
38
43
  * @returns {Typesettable.Writer}
39
44
  */
40
- private readonly _writer;
45
+ private get _writer();
41
46
  /**
42
47
  * Constructs a Category Axis.
43
48
  *
@@ -126,13 +131,15 @@ export declare class Category extends Axis<string> {
126
131
  * Return the space required by the ticks, padding included.
127
132
  * @returns {number}
128
133
  */
129
- private _tickSpaceRequired();
134
+ private _tickSpaceRequired;
130
135
  /**
131
136
  * Write ticks to the DOM.
132
137
  * @param {Plottable.Scales.Category} scale The scale this axis is representing.
133
138
  * @param {d3.Selection} ticks The tick elements to write.
134
139
  */
135
- private _drawTicks(stepWidth, ticks);
140
+ private _drawTicks;
141
+ tickLabelFontSize(): LabelFontSizePx;
142
+ tickLabelFontSize(fontSize: LabelFontSizePx): this;
136
143
  /**
137
144
  * Measures the size of the tick labels without making any (permanent) DOM changes.
138
145
  *
@@ -141,7 +148,7 @@ export declare class Category extends Axis<string> {
141
148
  * @param {Plottable.Scales.Category} scale The scale this axis is representing.
142
149
  * @param {string[]} ticks The strings that will be printed on the ticks.
143
150
  */
144
- private _measureTickLabels(axisWidth, axisHeight);
151
+ private _measureTickLabels;
145
152
  renderImmediately(): this;
146
153
  computeLayout(origin?: Point, availableWidth?: number, availableHeight?: number): this;
147
154
  invalidateCache(): void;
@@ -4,6 +4,7 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Category = void 0;
7
8
  var tslib_1 = require("tslib");
8
9
  var d3 = require("d3");
9
10
  var Typesettable = require("typesettable");
@@ -11,7 +12,7 @@ var component_1 = require("../components/component");
11
12
  var Utils = require("../utils");
12
13
  var axis_1 = require("./axis");
13
14
  var Category = /** @class */ (function (_super) {
14
- tslib_1.__extends(Category, _super);
15
+ (0, tslib_1.__extends)(Category, _super);
15
16
  /**
16
17
  * Constructs a Category Axis.
17
18
  *
@@ -47,7 +48,7 @@ var Category = /** @class */ (function (_super) {
47
48
  }
48
49
  return wrapper;
49
50
  },
50
- enumerable: true,
51
+ enumerable: false,
51
52
  configurable: true
52
53
  });
53
54
  Object.defineProperty(Category.prototype, "_writer", {
@@ -58,7 +59,7 @@ var Category = /** @class */ (function (_super) {
58
59
  get: function () {
59
60
  return new Typesettable.Writer(this._measurer, this._typesetterContext, this._wrapper);
60
61
  },
61
- enumerable: true,
62
+ enumerable: false,
62
63
  configurable: true
63
64
  });
64
65
  Category.prototype._setup = function () {
@@ -233,6 +234,14 @@ var Category = /** @class */ (function (_super) {
233
234
  self._writer.write(self.formatter()(d), width, height, writeOptions, container.node());
234
235
  });
235
236
  };
237
+ Category.prototype.tickLabelFontSize = function (fontSize) {
238
+ if (fontSize == null) {
239
+ return _super.prototype.tickLabelFontSize.call(this);
240
+ }
241
+ // Resets the measurer to measure distances using the latest font size
242
+ this.invalidateCache();
243
+ return _super.prototype.tickLabelFontSize.call(this, fontSize);
244
+ };
236
245
  /**
237
246
  * Measures the size of the tick labels without making any (permanent) DOM changes.
238
247
  *
@@ -242,18 +251,19 @@ var Category = /** @class */ (function (_super) {
242
251
  * @param {string[]} ticks The strings that will be printed on the ticks.
243
252
  */
244
253
  Category.prototype._measureTickLabels = function (axisWidth, axisHeight) {
254
+ var _a;
245
255
  var _this = this;
246
256
  var thisScale = this._scale;
247
257
  // set up a test scale to simulate rendering ticks with the given width and height.
248
258
  var scale = thisScale.cloneWithoutProviders()
249
259
  .range([0, this.isHorizontal() ? axisWidth : axisHeight]);
250
- var _a = this.getDownsampleInfo(scale), domain = _a.domain, stepWidth = _a.stepWidth;
260
+ var _b = this.getDownsampleInfo(scale), domain = _b.domain, stepWidth = _b.stepWidth;
251
261
  // HACKHACK: https://github.com/palantir/svg-typewriter/issues/25
252
262
  // the width (x-axis specific) available to a single tick label.
253
263
  var width = axisWidth - this._tickSpaceRequired(); // default for left/right
254
- if (this.isHorizontal()) {
264
+ if (this.isHorizontal()) { // case for top/bottom
255
265
  width = stepWidth; // defaults to the band width
256
- if (this._tickLabelAngle !== 0) {
266
+ if (this._tickLabelAngle !== 0) { // rotated label
257
267
  width = axisHeight - this._tickSpaceRequired(); // use the axis height
258
268
  }
259
269
  // HACKHACK: Wrapper fails under negative circumstances
@@ -262,9 +272,9 @@ var Category = /** @class */ (function (_super) {
262
272
  // HACKHACK: https://github.com/palantir/svg-typewriter/issues/25
263
273
  // the height (y-axis specific) available to a single tick label.
264
274
  var height = stepWidth; // default for left/right
265
- if (this.isHorizontal()) {
275
+ if (this.isHorizontal()) { // case for top/bottom
266
276
  height = axisHeight - this._tickSpaceRequired();
267
- if (this._tickLabelAngle !== 0) {
277
+ if (this._tickLabelAngle !== 0) { // rotated label
268
278
  height = axisWidth - this._tickSpaceRequired();
269
279
  }
270
280
  // HACKHACK: Wrapper fails under negative circumstances
@@ -284,13 +294,12 @@ var Category = /** @class */ (function (_super) {
284
294
  // If the tick labels are rotated, reverse usedWidth and usedHeight
285
295
  // HACKHACK: https://github.com/palantir/svg-typewriter/issues/25
286
296
  if (this._tickLabelAngle !== 0) {
287
- _b = [usedHeight, usedWidth], usedWidth = _b[0], usedHeight = _b[1];
297
+ _a = [usedHeight, usedWidth], usedWidth = _a[0], usedHeight = _a[1];
288
298
  }
289
299
  return {
290
300
  usedWidth: usedWidth,
291
301
  usedHeight: usedHeight,
292
302
  };
293
- var _b;
294
303
  };
295
304
  Category.prototype.renderImmediately = function () {
296
305
  var _this = this;
@@ -339,7 +348,9 @@ var Category = /** @class */ (function (_super) {
339
348
  };
340
349
  Category.prototype.invalidateCache = function () {
341
350
  _super.prototype.invalidateCache.call(this);
342
- this._measurer.reset();
351
+ if (this._measurer != null) {
352
+ this._measurer.reset();
353
+ }
343
354
  };
344
355
  /**
345
356
  * How many pixels to give labels at minimum before downsampling takes effect.
@@ -5,6 +5,6 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var tslib_1 = require("tslib");
8
- tslib_1.__exportStar(require("./categoryAxis"), exports);
9
- tslib_1.__exportStar(require("./numericAxis"), exports);
10
- tslib_1.__exportStar(require("./timeAxis"), exports);
8
+ (0, tslib_1.__exportStar)(require("./categoryAxis"), exports);
9
+ (0, tslib_1.__exportStar)(require("./numericAxis"), exports);
10
+ (0, tslib_1.__exportStar)(require("./timeAxis"), exports);
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Copyright 2014-present Palantir Technologies
3
+ * @license MIT
4
+ */
1
5
  import { QuantitativeScale } from "../scales/quantitativeScale";
2
6
  import { Axis, AxisOrientation } from "./axis";
3
7
  export declare class Numeric extends Axis<number> {
@@ -17,8 +21,8 @@ export declare class Numeric extends Axis<number> {
17
21
  constructor(scale: QuantitativeScale<number>, orientation: AxisOrientation);
18
22
  protected _setup(): void;
19
23
  protected _computeWidth(): number;
20
- private _computeExactTextWidth();
21
- private _computeApproximateTextWidth();
24
+ private _computeExactTextWidth;
25
+ private _computeApproximateTextWidth;
22
26
  protected _computeHeight(): number;
23
27
  protected _getTickValues(): number[];
24
28
  protected _rescale(): void;
@@ -53,8 +57,8 @@ export declare class Numeric extends Axis<number> {
53
57
  * @returns {Axes.Numeric} The calling Axes.Numeric.
54
58
  */
55
59
  usesTextWidthApproximation(enable: boolean): this;
56
- private _hideEndTickLabels();
57
- private _hideOverlappingTickLabels();
60
+ private _hideEndTickLabels;
61
+ private _hideOverlappingTickLabels;
58
62
  /**
59
63
  * The method is responsible for evenly spacing the labels on the axis.
60
64
  * @return test to see if taking every `interval` recrangle from `rects`
@@ -65,6 +69,6 @@ export declare class Numeric extends Axis<number> {
65
69
  * from the tick and 2 * `padding` distance (or more) from the next tick:
66
70
  * see https://github.com/palantir/plottable/pull/1812
67
71
  */
68
- private _hasOverlapWithInterval(interval, rects);
72
+ private _hasOverlapWithInterval;
69
73
  invalidateCache(): void;
70
74
  }
@@ -4,6 +4,7 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Numeric = void 0;
7
8
  var tslib_1 = require("tslib");
8
9
  var d3 = require("d3");
9
10
  var Typesettable = require("typesettable");
@@ -11,7 +12,7 @@ var Formatters = require("../core/formatters");
11
12
  var Utils = require("../utils");
12
13
  var axis_1 = require("./axis");
13
14
  var Numeric = /** @class */ (function (_super) {
14
- tslib_1.__extends(Numeric, _super);
15
+ (0, tslib_1.__extends)(Numeric, _super);
15
16
  /**
16
17
  * Constructs a Numeric Axis.
17
18
  *
@@ -1,5 +1,10 @@
1
+ /**
2
+ * Copyright 2014-present Palantir Technologies
3
+ * @license MIT
4
+ */
1
5
  import { Formatter } from "../core/formatters";
2
6
  import * as Scales from "../scales";
7
+ import { LabelFontSizePx } from "../components/label";
3
8
  import { Axis } from "./axis";
4
9
  export declare const TimeInterval: {
5
10
  second: "second";
@@ -80,6 +85,8 @@ export declare class Time extends Axis<Date> {
80
85
  * orientations.
81
86
  */
82
87
  constructor(scale: Scales.Time, orientation: TimeAxisOrientation, useUTC?: boolean);
88
+ tickLabelFontSize(): LabelFontSizePx;
89
+ tickLabelFontSize(fontSize: LabelFontSizePx): this;
83
90
  /**
84
91
  * Gets the label positions for each tier.
85
92
  */
@@ -130,33 +137,33 @@ export declare class Time extends Axis<Date> {
130
137
  /**
131
138
  * Gets the index of the most precise TimeAxisConfiguration that will fit in the current width.
132
139
  */
133
- private _getMostPreciseConfigurationIndex();
140
+ private _getMostPreciseConfigurationIndex;
134
141
  orientation(): TimeAxisOrientation;
135
142
  orientation(orientation: TimeAxisOrientation): this;
136
143
  protected _computeHeight(): number;
137
- private _getIntervalLength(config);
138
- private _maxWidthForInterval(config);
144
+ private _getIntervalLength;
145
+ private _maxWidthForInterval;
139
146
  /**
140
147
  * Check if tier configuration fits in the current width and satisfied the
141
148
  * max TimeInterval precision limit.
142
149
  */
143
- private _checkTimeAxisTierConfiguration(config);
150
+ private _checkTimeAxisTierConfiguration;
144
151
  protected _sizeFromOffer(availableWidth: number, availableHeight: number): {
145
152
  width: number;
146
153
  height: number;
147
154
  };
148
155
  protected _setup(): void;
149
- private _setupDomElements();
150
- private _getTickIntervalValues(config);
156
+ private _setupDomElements;
157
+ private _getTickIntervalValues;
151
158
  protected _getTickValues(): any[];
152
- private _cleanTiers();
153
- private _getTickValuesForConfiguration(config);
154
- private _renderTierLabels(container, config, index);
155
- private _renderTickMarks(tickValues, index);
156
- private _renderLabellessTickMarks(tickValues);
157
- private _generateLabellessTicks();
159
+ private _cleanTiers;
160
+ private _getTickValuesForConfiguration;
161
+ private _renderTierLabels;
162
+ private _renderTickMarks;
163
+ private _renderLabellessTickMarks;
164
+ private _generateLabellessTicks;
158
165
  renderImmediately(): this;
159
- private _hideOverflowingTiers();
160
- private _hideOverlappingAndCutOffLabels(index);
166
+ private _hideOverflowingTiers;
167
+ private _hideOverlappingAndCutOffLabels;
161
168
  invalidateCache(): void;
162
169
  }
@@ -3,7 +3,9 @@
3
3
  * Copyright 2014-present Palantir Technologies
4
4
  * @license MIT
5
5
  */
6
+ var _a;
6
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Time = exports.TierLabelPosition = exports.TimeAxisOrientation = exports.TimeInterval = void 0;
7
9
  var tslib_1 = require("tslib");
8
10
  var d3 = require("d3");
9
11
  var Typesettable = require("typesettable");
@@ -12,7 +14,7 @@ var Scales = require("../scales");
12
14
  var Utils = require("../utils");
13
15
  var makeEnum_1 = require("../utils/makeEnum");
14
16
  var axis_1 = require("./axis");
15
- exports.TimeInterval = makeEnum_1.makeEnum([
17
+ exports.TimeInterval = (0, makeEnum_1.makeEnum)([
16
18
  "second",
17
19
  "minute",
18
20
  "hour",
@@ -24,10 +26,10 @@ exports.TimeInterval = makeEnum_1.makeEnum([
24
26
  /**
25
27
  * Possible orientations for a Time Axis.
26
28
  */
27
- exports.TimeAxisOrientation = makeEnum_1.makeEnum(["top", "bottom"]);
28
- exports.TierLabelPosition = makeEnum_1.makeEnum(["between", "center"]);
29
+ exports.TimeAxisOrientation = (0, makeEnum_1.makeEnum)(["top", "bottom"]);
30
+ exports.TierLabelPosition = (0, makeEnum_1.makeEnum)(["between", "center"]);
29
31
  var Time = /** @class */ (function (_super) {
30
- tslib_1.__extends(Time, _super);
32
+ (0, tslib_1.__extends)(Time, _super);
31
33
  /**
32
34
  * Constructs a Time Axis.
33
35
  *
@@ -50,6 +52,23 @@ var Time = /** @class */ (function (_super) {
50
52
  _this.annotationFormatter(Formatters.time("%a %b %d, %Y", _this._useUTC));
51
53
  return _this;
52
54
  }
55
+ Time.prototype.tickLabelFontSize = function (fontSize) {
56
+ var _this = this;
57
+ if (fontSize == null) {
58
+ return _super.prototype.tickLabelFontSize.call(this);
59
+ }
60
+ if (this._tierLabelContainers != null) {
61
+ this.invalidateCache();
62
+ this._computeHeight();
63
+ this._tierLabelContainers.forEach(function (container) {
64
+ // clearing to remove outdated font-size classes
65
+ container.attr("class", null)
66
+ .classed(axis_1.Axis.TICK_LABEL_CLASS + "-container", true)
67
+ .classed("label-" + _this._tickLabelFontSize, true);
68
+ });
69
+ }
70
+ return _super.prototype.tickLabelFontSize.call(this, fontSize);
71
+ };
53
72
  Time.prototype.tierLabelPositions = function (newPositions) {
54
73
  if (newPositions == null) {
55
74
  return this._tierLabelPositions;
@@ -194,7 +213,9 @@ var Time = /** @class */ (function (_super) {
194
213
  this._baseline.remove();
195
214
  for (var i = 0; i < this._numTiers; ++i) {
196
215
  var tierContainer = this.content().append("g").classed(Time.TIME_AXIS_TIER_CLASS, true);
197
- this._tierLabelContainers.push(tierContainer.append("g").classed(axis_1.Axis.TICK_LABEL_CLASS + "-container", true));
216
+ this._tierLabelContainers.push(tierContainer.append("g")
217
+ .classed(axis_1.Axis.TICK_LABEL_CLASS + "-container", true)
218
+ .classed("label-" + this._tickLabelFontSize, true));
198
219
  this._tierMarkContainers.push(tierContainer.append("g").classed(axis_1.Axis.TICK_MARK_CLASS + "-container", true));
199
220
  this._tierBaselines.push(tierContainer.append("line").classed("baseline", true));
200
221
  }
@@ -243,6 +264,7 @@ var Time = /** @class */ (function (_super) {
243
264
  labelPos = tickPos;
244
265
  }
245
266
  var tickLabelsUpdate = container.selectAll("." + axis_1.Axis.TICK_LABEL_CLASS).data(labelPos, function (d) { return String(d.valueOf()); });
267
+ tickLabelsUpdate.remove();
246
268
  var tickLabelsEnter = tickLabelsUpdate
247
269
  .enter()
248
270
  .append("g")
@@ -417,7 +439,9 @@ var Time = /** @class */ (function (_super) {
417
439
  };
418
440
  Time.prototype.invalidateCache = function () {
419
441
  _super.prototype.invalidateCache.call(this);
420
- this._measurer.reset();
442
+ if (this._measurer != null) {
443
+ this._measurer.reset();
444
+ }
421
445
  };
422
446
  /**
423
447
  * The CSS class applied to each Time Axis tier
@@ -548,4 +572,3 @@ var Time = /** @class */ (function (_super) {
548
572
  return Time;
549
573
  }(axis_1.Axis));
550
574
  exports.Time = Time;
551
- var _a;
@@ -11,9 +11,9 @@ export declare type IResizeHandler = (size: {
11
11
  width: number;
12
12
  }) => void;
13
13
  export declare const XAlignment: {
14
+ center: "center";
14
15
  left: "left";
15
16
  right: "right";
16
- center: "center";
17
17
  };
18
18
  export declare type XAlignment = keyof typeof XAlignment;
19
19
  export declare const YAlignment: {
@@ -164,7 +164,7 @@ export declare class Component {
164
164
  */
165
165
  render(): this;
166
166
  renderLowPriority(): this;
167
- private _scheduleComputeLayout();
167
+ private _scheduleComputeLayout;
168
168
  /**
169
169
  * Sets a callback that gets called when the component resizes. The size change
170
170
  * is not guaranteed to be reflected by the DOM at the time the callback is fired.