@swimlane/ngx-charts 16.0.0 → 18.0.1

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 (226) hide show
  1. package/README.md +16 -1
  2. package/bundles/swimlane-ngx-charts.umd.js +738 -504
  3. package/bundles/swimlane-ngx-charts.umd.js.map +1 -1
  4. package/bundles/swimlane-ngx-charts.umd.min.js +2 -2
  5. package/bundles/swimlane-ngx-charts.umd.min.js.map +1 -1
  6. package/esm2015/lib/area-chart/area-chart-normalized.component.js +15 -15
  7. package/esm2015/lib/area-chart/area-chart-stacked.component.js +17 -13
  8. package/esm2015/lib/area-chart/area-chart.component.js +23 -23
  9. package/esm2015/lib/area-chart/area-chart.module.js +1 -1
  10. package/esm2015/lib/area-chart/area-series.component.js +5 -4
  11. package/esm2015/lib/bar-chart/bar-chart.module.js +1 -1
  12. package/esm2015/lib/bar-chart/bar-horizontal-2d.component.js +9 -8
  13. package/esm2015/lib/bar-chart/bar-horizontal-normalized.component.js +6 -8
  14. package/esm2015/lib/bar-chart/bar-horizontal-stacked.component.js +5 -4
  15. package/esm2015/lib/bar-chart/bar-horizontal.component.js +4 -3
  16. package/esm2015/lib/bar-chart/bar-label.component.js +1 -1
  17. package/esm2015/lib/bar-chart/bar-vertical-2d.component.js +10 -9
  18. package/esm2015/lib/bar-chart/bar-vertical-normalized.component.js +6 -8
  19. package/esm2015/lib/bar-chart/bar-vertical-stacked.component.js +5 -4
  20. package/esm2015/lib/bar-chart/bar-vertical.component.js +5 -4
  21. package/esm2015/lib/bar-chart/bar.component.js +14 -9
  22. package/esm2015/lib/bar-chart/series-horizontal.component.js +18 -14
  23. package/esm2015/lib/bar-chart/series-vertical.component.js +16 -16
  24. package/esm2015/lib/bar-chart/types/bar-chart-type.enum.js +7 -0
  25. package/esm2015/lib/bar-chart/types/bar.model.js +2 -0
  26. package/esm2015/lib/bar-chart/types/d0-type.enum.js +6 -0
  27. package/esm2015/lib/bubble-chart/bubble-chart.component.js +9 -8
  28. package/esm2015/lib/bubble-chart/bubble-chart.module.js +1 -1
  29. package/esm2015/lib/bubble-chart/bubble-chart.utils.js +7 -6
  30. package/esm2015/lib/bubble-chart/bubble-series.component.js +5 -4
  31. package/esm2015/lib/common/area.component.js +2 -3
  32. package/esm2015/lib/common/axes/axes.module.js +1 -1
  33. package/esm2015/lib/common/axes/axis-label.component.js +6 -5
  34. package/esm2015/lib/common/axes/ticks.helper.js +1 -1
  35. package/esm2015/lib/common/axes/x-axis-ticks.component.js +21 -8
  36. package/esm2015/lib/common/axes/x-axis.component.js +5 -4
  37. package/esm2015/lib/common/axes/y-axis-ticks.component.js +34 -15
  38. package/esm2015/lib/common/axes/y-axis.component.js +5 -5
  39. package/esm2015/lib/common/base-chart.component.js +22 -9
  40. package/esm2015/lib/common/chart-common.module.js +1 -1
  41. package/esm2015/lib/common/charts/chart.component.js +13 -17
  42. package/esm2015/lib/common/circle-series.component.js +14 -8
  43. package/esm2015/lib/common/circle.component.js +1 -1
  44. package/esm2015/lib/common/color.helper.js +6 -5
  45. package/esm2015/lib/common/constants/font-widths.js +89 -0
  46. package/esm2015/lib/common/count/count.directive.js +1 -1
  47. package/esm2015/lib/common/count/count.helper.js +1 -1
  48. package/esm2015/lib/common/domain.helper.js +5 -4
  49. package/esm2015/lib/common/grid-layout.helper.js +1 -1
  50. package/esm2015/lib/common/grid-panel-series.component.js +16 -6
  51. package/esm2015/lib/common/grid-panel.component.js +1 -2
  52. package/esm2015/lib/common/label.helper.js +1 -1
  53. package/esm2015/lib/common/legend/advanced-legend.component.js +3 -3
  54. package/esm2015/lib/common/legend/legend-entry.component.js +1 -1
  55. package/esm2015/lib/common/legend/legend.component.js +1 -1
  56. package/esm2015/lib/common/legend/scale-legend.component.js +3 -8
  57. package/esm2015/lib/common/shape.helper.js +1 -1
  58. package/esm2015/lib/common/svg-linear-gradient.component.js +9 -4
  59. package/esm2015/lib/common/svg-radial-gradient.component.js +1 -1
  60. package/esm2015/lib/common/tick-format.helper.js +1 -1
  61. package/esm2015/lib/common/timeline/timeline.component.js +16 -12
  62. package/esm2015/lib/common/tooltip/injection-registery.service.js +1 -1
  63. package/esm2015/lib/common/tooltip/injection.service.js +1 -1
  64. package/esm2015/lib/common/tooltip/position/index.js +1 -1
  65. package/esm2015/lib/common/tooltip/position/placement.type.js +6 -5
  66. package/esm2015/lib/common/tooltip/position/position.js +33 -33
  67. package/esm2015/lib/common/tooltip/show.type.js +1 -1
  68. package/esm2015/lib/common/tooltip/style.type.js +1 -1
  69. package/esm2015/lib/common/tooltip/tooltip.component.js +10 -4
  70. package/esm2015/lib/common/tooltip/tooltip.directive.js +7 -6
  71. package/esm2015/lib/common/tooltip/tooltip.module.js +1 -1
  72. package/esm2015/lib/common/tooltip/tooltip.service.js +1 -1
  73. package/esm2015/lib/common/tooltip-area.component.js +13 -4
  74. package/esm2015/lib/common/trim-label.helper.js +1 -1
  75. package/esm2015/lib/common/types/gradient.interface.js +2 -0
  76. package/esm2015/lib/common/types/index.js +7 -0
  77. package/esm2015/lib/common/types/legend.model.js +11 -0
  78. package/esm2015/lib/common/types/orientation.enum.js +8 -0
  79. package/esm2015/lib/common/types/scale-type.enum.js +8 -0
  80. package/esm2015/lib/common/types/text-anchor.enum.js +7 -0
  81. package/esm2015/lib/common/types/view-dimension.interface.js +2 -0
  82. package/esm2015/lib/common/view-dimensions.helper.js +5 -4
  83. package/esm2015/lib/events.js +1 -1
  84. package/esm2015/lib/gauge/gauge-arc.component.js +1 -1
  85. package/esm2015/lib/gauge/gauge-axis.component.js +5 -4
  86. package/esm2015/lib/gauge/gauge.component.js +5 -4
  87. package/esm2015/lib/gauge/gauge.module.js +1 -1
  88. package/esm2015/lib/gauge/linear-gauge.component.js +44 -9
  89. package/esm2015/lib/heat-map/heat-map-cell-series.component.js +2 -2
  90. package/esm2015/lib/heat-map/heat-map-cell.component.js +1 -2
  91. package/esm2015/lib/heat-map/heat-map.component.js +7 -6
  92. package/esm2015/lib/heat-map/heat-map.module.js +1 -1
  93. package/esm2015/lib/line-chart/line-chart.component.js +12 -11
  94. package/esm2015/lib/line-chart/line-chart.module.js +1 -1
  95. package/esm2015/lib/line-chart/line-series.component.js +9 -8
  96. package/esm2015/lib/line-chart/line.component.js +4 -5
  97. package/esm2015/lib/models/chart-data.model.js +2 -1
  98. package/esm2015/lib/ngx-charts.module.js +1 -1
  99. package/esm2015/lib/number-card/card-series.component.js +1 -2
  100. package/esm2015/lib/number-card/card.component.js +31 -6
  101. package/esm2015/lib/number-card/number-card.component.js +3 -2
  102. package/esm2015/lib/number-card/number-card.module.js +1 -1
  103. package/esm2015/lib/pie-chart/advanced-pie-chart.component.js +3 -2
  104. package/esm2015/lib/pie-chart/pie-arc.component.js +1 -1
  105. package/esm2015/lib/pie-chart/pie-chart.component.js +5 -4
  106. package/esm2015/lib/pie-chart/pie-chart.module.js +1 -1
  107. package/esm2015/lib/pie-chart/pie-grid-series.component.js +1 -1
  108. package/esm2015/lib/pie-chart/pie-grid.component.js +3 -2
  109. package/esm2015/lib/pie-chart/pie-label.component.js +24 -15
  110. package/esm2015/lib/pie-chart/pie-series.component.js +1 -1
  111. package/esm2015/lib/polar-chart/polar-chart.component.js +10 -8
  112. package/esm2015/lib/polar-chart/polar-chart.module.js +1 -1
  113. package/esm2015/lib/polar-chart/polar-series.component.js +9 -8
  114. package/esm2015/lib/polyfills.js +1 -1
  115. package/esm2015/lib/tree-map/tree-map-cell-series.component.js +2 -4
  116. package/esm2015/lib/tree-map/tree-map-cell.component.js +1 -2
  117. package/esm2015/lib/tree-map/tree-map.component.js +3 -2
  118. package/esm2015/lib/tree-map/tree-map.module.js +1 -1
  119. package/esm2015/lib/utils/calculate-width.js +7 -0
  120. package/esm2015/lib/utils/color-sets.js +17 -16
  121. package/esm2015/lib/utils/color-utils.js +1 -1
  122. package/esm2015/lib/utils/id.js +1 -1
  123. package/esm2015/lib/utils/sort.js +1 -1
  124. package/esm2015/lib/utils/throttle.js +1 -1
  125. package/esm2015/lib/utils/types.js +1 -1
  126. package/esm2015/lib/utils/visibility-observer.js +1 -1
  127. package/esm2015/public-api.js +6 -2
  128. package/esm2015/swimlane-ngx-charts.js +2 -1
  129. package/fesm2015/swimlane-ngx-charts.js +729 -482
  130. package/fesm2015/swimlane-ngx-charts.js.map +1 -1
  131. package/lib/area-chart/area-chart-normalized.component.d.ts +20 -26
  132. package/lib/area-chart/area-chart-stacked.component.d.ts +21 -27
  133. package/lib/area-chart/area-chart.component.d.ts +33 -39
  134. package/lib/area-chart/area-series.component.d.ts +8 -5
  135. package/lib/bar-chart/bar-horizontal-2d.component.d.ts +24 -29
  136. package/lib/bar-chart/bar-horizontal-normalized.component.d.ts +22 -28
  137. package/lib/bar-chart/bar-horizontal-stacked.component.d.ts +24 -29
  138. package/lib/bar-chart/bar-horizontal.component.d.ts +15 -21
  139. package/lib/bar-chart/bar-vertical-2d.component.d.ts +25 -30
  140. package/lib/bar-chart/bar-vertical-normalized.component.d.ts +22 -28
  141. package/lib/bar-chart/bar-vertical-stacked.component.d.ts +23 -28
  142. package/lib/bar-chart/bar-vertical.component.d.ts +11 -11
  143. package/lib/bar-chart/bar.component.d.ts +23 -16
  144. package/lib/bar-chart/series-horizontal.component.d.ts +31 -24
  145. package/lib/bar-chart/series-vertical.component.d.ts +18 -18
  146. package/lib/bar-chart/types/bar-chart-type.enum.d.ts +5 -0
  147. package/lib/bar-chart/types/bar.model.d.ts +15 -0
  148. package/lib/bar-chart/types/d0-type.enum.d.ts +4 -0
  149. package/lib/bubble-chart/bubble-chart.component.d.ts +25 -24
  150. package/lib/bubble-chart/bubble-chart.utils.d.ts +3 -2
  151. package/lib/bubble-chart/bubble-series.component.d.ts +7 -4
  152. package/lib/common/area.component.d.ts +11 -10
  153. package/lib/common/axes/axis-label.component.d.ts +11 -10
  154. package/lib/common/axes/ticks.helper.d.ts +1 -1
  155. package/lib/common/axes/x-axis-ticks.component.d.ts +15 -10
  156. package/lib/common/axes/x-axis.component.d.ts +10 -8
  157. package/lib/common/axes/y-axis-ticks.component.d.ts +22 -16
  158. package/lib/common/axes/y-axis.component.d.ts +11 -10
  159. package/lib/common/base-chart.component.d.ts +7 -4
  160. package/lib/common/charts/chart.component.d.ts +17 -13
  161. package/lib/common/circle-series.component.d.ts +47 -23
  162. package/lib/common/circle.component.d.ts +12 -12
  163. package/lib/common/color.helper.d.ts +9 -7
  164. package/lib/common/constants/font-widths.d.ts +88 -0
  165. package/lib/common/count/count.helper.d.ts +2 -2
  166. package/lib/common/domain.helper.d.ts +2 -1
  167. package/lib/common/grid-layout.helper.d.ts +19 -2
  168. package/lib/common/grid-panel-series.component.d.ts +23 -5
  169. package/lib/common/grid-panel.component.d.ts +4 -5
  170. package/lib/common/legend/advanced-legend.component.d.ts +20 -8
  171. package/lib/common/legend/legend-entry.component.d.ts +9 -5
  172. package/lib/common/legend/legend.component.d.ts +28 -14
  173. package/lib/common/legend/scale-legend.component.d.ts +5 -8
  174. package/lib/common/shape.helper.d.ts +1 -1
  175. package/lib/common/svg-linear-gradient.component.d.ts +13 -7
  176. package/lib/common/svg-radial-gradient.component.d.ts +3 -2
  177. package/lib/common/timeline/timeline.component.d.ts +14 -10
  178. package/lib/common/tooltip/position/placement.type.d.ts +5 -4
  179. package/lib/common/tooltip/position/position.d.ts +8 -7
  180. package/lib/common/tooltip/tooltip.component.d.ts +10 -10
  181. package/lib/common/tooltip/tooltip.directive.d.ts +6 -7
  182. package/lib/common/tooltip-area.component.d.ts +25 -9
  183. package/lib/common/types/gradient.interface.d.ts +6 -0
  184. package/lib/common/types/index.d.ts +6 -0
  185. package/lib/common/types/legend.model.d.ts +16 -0
  186. package/lib/common/types/orientation.enum.d.ts +6 -0
  187. package/lib/common/types/scale-type.enum.d.ts +6 -0
  188. package/lib/common/types/text-anchor.enum.d.ts +5 -0
  189. package/lib/common/types/view-dimension.interface.d.ts +6 -0
  190. package/lib/common/view-dimensions.helper.d.ts +4 -7
  191. package/lib/gauge/gauge-arc.component.d.ts +11 -4
  192. package/lib/gauge/gauge-axis.component.d.ts +23 -9
  193. package/lib/gauge/gauge.component.d.ts +16 -10
  194. package/lib/gauge/linear-gauge.component.d.ts +12 -6
  195. package/lib/heat-map/heat-map-cell-series.component.d.ts +23 -9
  196. package/lib/heat-map/heat-map-cell.component.d.ts +12 -17
  197. package/lib/heat-map/heat-map.component.d.ts +31 -29
  198. package/lib/line-chart/line-chart.component.d.ts +24 -31
  199. package/lib/line-chart/line-series.component.d.ts +9 -6
  200. package/lib/line-chart/line.component.d.ts +5 -5
  201. package/lib/models/chart-data.model.d.ts +22 -8
  202. package/lib/number-card/card-series.component.d.ts +11 -15
  203. package/lib/number-card/card.component.d.ts +15 -11
  204. package/lib/number-card/number-card.component.d.ts +4 -5
  205. package/lib/pie-chart/advanced-pie-chart.component.d.ts +3 -4
  206. package/lib/pie-chart/pie-arc.component.d.ts +9 -8
  207. package/lib/pie-chart/pie-chart.component.d.ts +8 -13
  208. package/lib/pie-chart/pie-grid-series.component.d.ts +15 -4
  209. package/lib/pie-chart/pie-grid.component.d.ts +12 -5
  210. package/lib/pie-chart/pie-label.component.d.ts +26 -13
  211. package/lib/pie-chart/pie-series.component.d.ts +10 -6
  212. package/lib/polar-chart/polar-chart.component.d.ts +13 -14
  213. package/lib/polar-chart/polar-series.component.d.ts +18 -8
  214. package/lib/tree-map/tree-map-cell-series.component.d.ts +18 -4
  215. package/lib/tree-map/tree-map-cell.component.d.ts +11 -14
  216. package/lib/tree-map/tree-map.component.d.ts +6 -4
  217. package/lib/utils/calculate-width.d.ts +1 -0
  218. package/lib/utils/color-sets.d.ts +5 -3
  219. package/lib/utils/color-utils.d.ts +1 -1
  220. package/lib/utils/sort.d.ts +3 -3
  221. package/package.json +21 -20
  222. package/public-api.d.ts +5 -1
  223. package/swimlane-ngx-charts.d.ts +1 -0
  224. package/swimlane-ngx-charts.metadata.json +1 -1
  225. package/esm2015/lib/common/tooltip/alignment.type.js +0 -7
  226. package/lib/common/tooltip/alignment.type.d.ts +0 -5
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/animations'), require('@angular/cdk/portal'), require('rxjs'), require('rxjs/operators'), require('d3-selection'), require('d3-brush'), require('d3-scale'), require('@angular/platform-browser'), require('d3-shape'), require('d3-array'), require('d3-interpolate'), require('d3-format'), require('d3-color'), require('d3-hierarchy'), require('d3-time-format')) :
3
- typeof define === 'function' && define.amd ? define('@swimlane/ngx-charts', ['exports', '@angular/core', '@angular/common', '@angular/animations', '@angular/cdk/portal', 'rxjs', 'rxjs/operators', 'd3-selection', 'd3-brush', 'd3-scale', '@angular/platform-browser', 'd3-shape', 'd3-array', 'd3-interpolate', 'd3-format', 'd3-color', 'd3-hierarchy', 'd3-time-format'], factory) :
4
- (global = global || self, factory((global.swimlane = global.swimlane || {}, global.swimlane['ngx-charts'] = {}), global.ng.core, global.ng.common, global.ng.animations, global.ng.cdk.portal, global.rxjs, global.rxjs.operators, global.d3Selection, global.d3Brush, global.d3Scale, global.ng.platformBrowser, global.d3Shape, global.d3Array, global.d3Interpolate, global.d3Format, global.d3_color, global.d3Hierarchy, global.d3TimeFormat));
5
- }(this, (function (exports, core, common, animations, portal, rxjs, operators, d3Selection, d3Brush, d3Scale, platformBrowser, d3Shape, d3Array, d3Interpolate, d3Format, d3_color, d3Hierarchy, d3TimeFormat) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/animations'), require('@angular/cdk/portal'), require('rxjs'), require('rxjs/operators'), require('d3-selection'), require('d3-brush'), require('d3-scale'), require('d3-shape'), require('d3-array'), require('d3-interpolate'), require('d3-format'), require('d3-color'), require('d3-hierarchy'), require('d3-time-format')) :
3
+ typeof define === 'function' && define.amd ? define('@swimlane/ngx-charts', ['exports', '@angular/core', '@angular/common', '@angular/animations', '@angular/cdk/portal', 'rxjs', 'rxjs/operators', 'd3-selection', 'd3-brush', 'd3-scale', 'd3-shape', 'd3-array', 'd3-interpolate', 'd3-format', 'd3-color', 'd3-hierarchy', 'd3-time-format'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.swimlane = global.swimlane || {}, global.swimlane['ngx-charts'] = {}), global.ng.core, global.ng.common, global.ng.animations, global.ng.cdk.portal, global.rxjs, global.rxjs.operators, global.d3Selection, global.d3Brush, global.d3Scale, global.d3Shape, global.d3Array, global.d3Interpolate, global.d3Format, global.d3_color, global.d3Hierarchy, global.d3TimeFormat));
5
+ }(this, (function (exports, core, common, animations, portal, rxjs, operators, d3Selection, d3Brush, d3Scale, d3Shape, d3Array, d3Interpolate, d3Format, d3_color, d3Hierarchy, d3TimeFormat) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -23,7 +23,7 @@
23
23
  extendStatics = Object.setPrototypeOf ||
24
24
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
25
25
  function (d, b) { for (var p in b)
26
- if (b.hasOwnProperty(p))
26
+ if (Object.prototype.hasOwnProperty.call(b, p))
27
27
  d[p] = b[p]; };
28
28
  return extendStatics(d, b);
29
29
  };
@@ -170,10 +170,10 @@
170
170
  k2 = k;
171
171
  o[k2] = m[k];
172
172
  });
173
- function __exportStar(m, exports) {
173
+ function __exportStar(m, o) {
174
174
  for (var p in m)
175
- if (p !== "default" && !exports.hasOwnProperty(p))
176
- __createBinding(exports, m, p);
175
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
176
+ __createBinding(o, m, p);
177
177
  }
178
178
  function __values(o) {
179
179
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
@@ -283,7 +283,7 @@
283
283
  var result = {};
284
284
  if (mod != null)
285
285
  for (var k in mod)
286
- if (Object.hasOwnProperty.call(mod, k))
286
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
287
287
  __createBinding(result, mod, k);
288
288
  __setModuleDefault(result, mod);
289
289
  return result;
@@ -519,35 +519,35 @@
519
519
  };
520
520
  }
521
521
 
522
- var PlacementTypes;
523
522
  (function (PlacementTypes) {
524
- PlacementTypes[PlacementTypes["top"] = 'top'] = "top";
525
- PlacementTypes[PlacementTypes["bottom"] = 'bottom'] = "bottom";
526
- PlacementTypes[PlacementTypes["left"] = 'left'] = "left";
527
- PlacementTypes[PlacementTypes["right"] = 'right'] = "right";
528
- })(PlacementTypes || (PlacementTypes = {}));
523
+ PlacementTypes["Top"] = "top";
524
+ PlacementTypes["Bottom"] = "bottom";
525
+ PlacementTypes["Left"] = "left";
526
+ PlacementTypes["Right"] = "right";
527
+ PlacementTypes["Center"] = "center";
528
+ })(exports.PlacementTypes || (exports.PlacementTypes = {}));
529
529
 
530
530
  var caretOffset = 7;
531
531
  function verticalPosition(elDimensions, popoverDimensions, alignment) {
532
- if (alignment === 'top') {
532
+ if (alignment === exports.PlacementTypes.Top) {
533
533
  return elDimensions.top - caretOffset;
534
534
  }
535
- if (alignment === 'bottom') {
535
+ if (alignment === exports.PlacementTypes.Bottom) {
536
536
  return elDimensions.top + elDimensions.height - popoverDimensions.height + caretOffset;
537
537
  }
538
- if (alignment === 'center') {
538
+ if (alignment === exports.PlacementTypes.Center) {
539
539
  return elDimensions.top + elDimensions.height / 2 - popoverDimensions.height / 2;
540
540
  }
541
541
  return undefined;
542
542
  }
543
543
  function horizontalPosition(elDimensions, popoverDimensions, alignment) {
544
- if (alignment === 'left') {
544
+ if (alignment === exports.PlacementTypes.Left) {
545
545
  return elDimensions.left - caretOffset;
546
546
  }
547
- if (alignment === 'right') {
547
+ if (alignment === exports.PlacementTypes.Right) {
548
548
  return elDimensions.left + elDimensions.width - popoverDimensions.width + caretOffset;
549
549
  }
550
- if (alignment === 'center') {
550
+ if (alignment === exports.PlacementTypes.Center) {
551
551
  return elDimensions.left + elDimensions.width / 2 - popoverDimensions.width / 2;
552
552
  }
553
553
  return undefined;
@@ -579,13 +579,13 @@
579
579
  */
580
580
  PositionHelper.calculateVerticalCaret = function (elDimensions, popoverDimensions, caretDimensions, alignment) {
581
581
  var result;
582
- if (alignment === 'top') {
582
+ if (alignment === exports.PlacementTypes.Top) {
583
583
  result = elDimensions.height / 2 - caretDimensions.height / 2 + caretOffset;
584
584
  }
585
- if (alignment === 'bottom') {
585
+ if (alignment === exports.PlacementTypes.Bottom) {
586
586
  result = popoverDimensions.height - elDimensions.height / 2 - caretDimensions.height / 2 - caretOffset;
587
587
  }
588
- if (alignment === 'center') {
588
+ if (alignment === exports.PlacementTypes.Center) {
589
589
  result = popoverDimensions.height / 2 - caretDimensions.height / 2;
590
590
  }
591
591
  var popoverPosition = verticalPosition(elDimensions, popoverDimensions, alignment);
@@ -613,13 +613,13 @@
613
613
  */
614
614
  PositionHelper.calculateHorizontalCaret = function (elDimensions, popoverDimensions, caretDimensions, alignment) {
615
615
  var result;
616
- if (alignment === 'left') {
616
+ if (alignment === exports.PlacementTypes.Left) {
617
617
  result = elDimensions.width / 2 - caretDimensions.width / 2 + caretOffset;
618
618
  }
619
- if (alignment === 'right') {
619
+ if (alignment === exports.PlacementTypes.Right) {
620
620
  result = popoverDimensions.width - elDimensions.width / 2 - caretDimensions.width / 2 - caretOffset;
621
621
  }
622
- if (alignment === 'center') {
622
+ if (alignment === exports.PlacementTypes.Center) {
623
623
  result = popoverDimensions.width / 2 - caretDimensions.width / 2;
624
624
  }
625
625
  var popoverPosition = horizontalPosition(elDimensions, popoverDimensions, alignment);
@@ -635,22 +635,22 @@
635
635
  */
636
636
  PositionHelper.shouldFlip = function (elDimensions, popoverDimensions, placement, spacing) {
637
637
  var flip = false;
638
- if (placement === 'right') {
638
+ if (placement === exports.PlacementTypes.Right) {
639
639
  if (elDimensions.left + elDimensions.width + popoverDimensions.width + spacing > window.innerWidth) {
640
640
  flip = true;
641
641
  }
642
642
  }
643
- if (placement === 'left') {
643
+ if (placement === exports.PlacementTypes.Left) {
644
644
  if (elDimensions.left - popoverDimensions.width - spacing < 0) {
645
645
  flip = true;
646
646
  }
647
647
  }
648
- if (placement === 'top') {
648
+ if (placement === exports.PlacementTypes.Top) {
649
649
  if (elDimensions.top - popoverDimensions.height - spacing < 0) {
650
650
  flip = true;
651
651
  }
652
652
  }
653
- if (placement === 'bottom') {
653
+ if (placement === exports.PlacementTypes.Bottom) {
654
654
  if (elDimensions.top + elDimensions.height + popoverDimensions.height + spacing > window.innerHeight) {
655
655
  flip = true;
656
656
  }
@@ -665,19 +665,19 @@
665
665
  PositionHelper.positionCaret = function (placement, elmDim, hostDim, caretDimensions, alignment) {
666
666
  var top = 0;
667
667
  var left = 0;
668
- if (placement === PlacementTypes.right) {
668
+ if (placement === exports.PlacementTypes.Right) {
669
669
  left = -7;
670
670
  top = PositionHelper.calculateVerticalCaret(hostDim, elmDim, caretDimensions, alignment);
671
671
  }
672
- else if (placement === PlacementTypes.left) {
672
+ else if (placement === exports.PlacementTypes.Left) {
673
673
  left = elmDim.width;
674
674
  top = PositionHelper.calculateVerticalCaret(hostDim, elmDim, caretDimensions, alignment);
675
675
  }
676
- else if (placement === PlacementTypes.top) {
676
+ else if (placement === exports.PlacementTypes.Top) {
677
677
  top = elmDim.height;
678
678
  left = PositionHelper.calculateHorizontalCaret(hostDim, elmDim, caretDimensions, alignment);
679
679
  }
680
- else if (placement === PlacementTypes.bottom) {
680
+ else if (placement === exports.PlacementTypes.Bottom) {
681
681
  top = -7;
682
682
  left = PositionHelper.calculateHorizontalCaret(hostDim, elmDim, caretDimensions, alignment);
683
683
  }
@@ -691,19 +691,19 @@
691
691
  PositionHelper.positionContent = function (placement, elmDim, hostDim, spacing, alignment) {
692
692
  var top = 0;
693
693
  var left = 0;
694
- if (placement === PlacementTypes.right) {
694
+ if (placement === exports.PlacementTypes.Right) {
695
695
  left = hostDim.left + hostDim.width + spacing;
696
696
  top = PositionHelper.calculateVerticalAlignment(hostDim, elmDim, alignment);
697
697
  }
698
- else if (placement === PlacementTypes.left) {
698
+ else if (placement === exports.PlacementTypes.Left) {
699
699
  left = hostDim.left - elmDim.width - spacing;
700
700
  top = PositionHelper.calculateVerticalAlignment(hostDim, elmDim, alignment);
701
701
  }
702
- else if (placement === PlacementTypes.top) {
702
+ else if (placement === exports.PlacementTypes.Top) {
703
703
  top = hostDim.top - elmDim.height - spacing;
704
704
  left = PositionHelper.calculateHorizontalAlignment(hostDim, elmDim, alignment);
705
705
  }
706
- else if (placement === PlacementTypes.bottom) {
706
+ else if (placement === exports.PlacementTypes.Bottom) {
707
707
  top = hostDim.top + hostDim.height + spacing;
708
708
  left = PositionHelper.calculateHorizontalAlignment(hostDim, elmDim, alignment);
709
709
  }
@@ -717,17 +717,17 @@
717
717
  PositionHelper.determinePlacement = function (placement, elmDim, hostDim, spacing) {
718
718
  var shouldFlip = PositionHelper.shouldFlip(hostDim, elmDim, placement, spacing);
719
719
  if (shouldFlip) {
720
- if (placement === PlacementTypes.right) {
721
- return PlacementTypes.left;
720
+ if (placement === exports.PlacementTypes.Right) {
721
+ return exports.PlacementTypes.Left;
722
722
  }
723
- else if (placement === PlacementTypes.left) {
724
- return PlacementTypes.right;
723
+ else if (placement === exports.PlacementTypes.Left) {
724
+ return exports.PlacementTypes.Right;
725
725
  }
726
- else if (placement === PlacementTypes.top) {
727
- return PlacementTypes.bottom;
726
+ else if (placement === exports.PlacementTypes.Top) {
727
+ return exports.PlacementTypes.Bottom;
728
728
  }
729
- else if (placement === PlacementTypes.bottom) {
730
- return PlacementTypes.top;
729
+ else if (placement === exports.PlacementTypes.Bottom) {
730
+ return exports.PlacementTypes.Top;
731
731
  }
732
732
  }
733
733
  return placement;
@@ -736,9 +736,10 @@
736
736
  }());
737
737
 
738
738
  var TooltipContentComponent = /** @class */ (function () {
739
- function TooltipContentComponent(element, renderer) {
739
+ function TooltipContentComponent(element, renderer, platformId) {
740
740
  this.element = element;
741
741
  this.renderer = renderer;
742
+ this.platformId = platformId;
742
743
  }
743
744
  Object.defineProperty(TooltipContentComponent.prototype, "cssClasses", {
744
745
  get: function () {
@@ -756,6 +757,9 @@
756
757
  };
757
758
  TooltipContentComponent.prototype.position = function () {
758
759
  var _this = this;
760
+ if (!common.isPlatformBrowser(this.platformId)) {
761
+ return;
762
+ }
759
763
  var nativeElm = this.element.nativeElement;
760
764
  var hostDim = this.host.nativeElement.getBoundingClientRect();
761
765
  // if no dims were found, never show
@@ -800,7 +804,8 @@
800
804
  ];
801
805
  TooltipContentComponent.ctorParameters = function () { return [
802
806
  { type: core.ElementRef },
803
- { type: core.Renderer2 }
807
+ { type: core.Renderer2 },
808
+ { type: undefined, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
804
809
  ]; };
805
810
  TooltipContentComponent.propDecorators = {
806
811
  host: [{ type: core.Input }],
@@ -906,6 +911,35 @@
906
911
  { type: InjectionService }
907
912
  ]; };
908
913
 
914
+ (function (LegendPosition) {
915
+ LegendPosition["Right"] = "right";
916
+ LegendPosition["Below"] = "below";
917
+ })(exports.LegendPosition || (exports.LegendPosition = {}));
918
+ (function (LegendType) {
919
+ LegendType["ScaleLegend"] = "scaleLegend";
920
+ LegendType["Legend"] = "legend";
921
+ })(exports.LegendType || (exports.LegendType = {}));
922
+
923
+ (function (Orientation) {
924
+ Orientation["Top"] = "top";
925
+ Orientation["Bottom"] = "bottom";
926
+ Orientation["Left"] = "left";
927
+ Orientation["Right"] = "right";
928
+ })(exports.Orientation || (exports.Orientation = {}));
929
+
930
+ (function (TextAnchor) {
931
+ TextAnchor["Start"] = "start";
932
+ TextAnchor["Middle"] = "middle";
933
+ TextAnchor["End"] = "end";
934
+ })(exports.TextAnchor || (exports.TextAnchor = {}));
935
+
936
+ (function (ScaleType) {
937
+ ScaleType["Time"] = "time";
938
+ ScaleType["Linear"] = "linear";
939
+ ScaleType["Ordinal"] = "ordinal";
940
+ ScaleType["Quantile"] = "quantile";
941
+ })(exports.ɵc || (exports.ɵc = {}));
942
+
909
943
  var ChartComponent = /** @class */ (function () {
910
944
  function ChartComponent() {
911
945
  this.showLegend = false;
@@ -913,6 +947,8 @@
913
947
  this.legendLabelClick = new core.EventEmitter();
914
948
  this.legendLabelActivate = new core.EventEmitter();
915
949
  this.legendLabelDeactivate = new core.EventEmitter();
950
+ this.LegendPosition = exports.LegendPosition;
951
+ this.LegendType = exports.LegendType;
916
952
  }
917
953
  ChartComponent.prototype.ngOnChanges = function (changes) {
918
954
  this.update();
@@ -921,8 +957,8 @@
921
957
  var legendColumns = 0;
922
958
  if (this.showLegend) {
923
959
  this.legendType = this.getLegendType();
924
- if (!this.legendOptions || this.legendOptions.position === 'right') {
925
- if (this.legendType === 'scaleLegend') {
960
+ if (!this.legendOptions || this.legendOptions.position === exports.LegendPosition.Right) {
961
+ if (this.legendType === exports.LegendType.ScaleLegend) {
926
962
  legendColumns = 1;
927
963
  }
928
964
  else {
@@ -933,17 +969,12 @@
933
969
  var chartColumns = 12 - legendColumns;
934
970
  this.chartWidth = Math.floor((this.view[0] * chartColumns) / 12.0);
935
971
  this.legendWidth =
936
- !this.legendOptions || this.legendOptions.position === 'right'
972
+ !this.legendOptions || this.legendOptions.position === exports.LegendPosition.Right
937
973
  ? Math.floor((this.view[0] * legendColumns) / 12.0)
938
974
  : this.chartWidth;
939
975
  };
940
976
  ChartComponent.prototype.getLegendType = function () {
941
- if (this.legendOptions.scaleType === 'linear') {
942
- return 'scaleLegend';
943
- }
944
- else {
945
- return 'legend';
946
- }
977
+ return this.legendOptions.scaleType === exports.ɵc.Linear ? exports.LegendType.ScaleLegend : exports.LegendType.Legend;
947
978
  };
948
979
  return ChartComponent;
949
980
  }());
@@ -951,7 +982,7 @@
951
982
  { type: core.Component, args: [{
952
983
  providers: [TooltipService],
953
984
  selector: 'ngx-charts-chart',
954
- template: "\n <div class=\"ngx-charts-outer\" [style.width.px]=\"view[0]\" [@animationState]=\"'active'\" [@.disabled]=\"!animations\">\n <svg class=\"ngx-charts\" [attr.width]=\"chartWidth\" [attr.height]=\"view[1]\">\n <ng-content></ng-content>\n </svg>\n <ngx-charts-scale-legend\n *ngIf=\"showLegend && legendType === 'scaleLegend'\"\n class=\"chart-legend\"\n [horizontal]=\"legendOptions && legendOptions.position === 'below'\"\n [valueRange]=\"legendOptions.domain\"\n [colors]=\"legendOptions.colors\"\n [height]=\"view[1]\"\n [width]=\"legendWidth\"\n >\n </ngx-charts-scale-legend>\n <ngx-charts-legend\n *ngIf=\"showLegend && legendType === 'legend'\"\n class=\"chart-legend\"\n [horizontal]=\"legendOptions && legendOptions.position === 'below'\"\n [data]=\"legendOptions.domain\"\n [title]=\"legendOptions.title\"\n [colors]=\"legendOptions.colors\"\n [height]=\"view[1]\"\n [width]=\"legendWidth\"\n [activeEntries]=\"activeEntries\"\n (labelClick)=\"legendLabelClick.emit($event)\"\n (labelActivate)=\"legendLabelActivate.emit($event)\"\n (labelDeactivate)=\"legendLabelDeactivate.emit($event)\"\n >\n </ngx-charts-legend>\n </div>\n ",
985
+ template: "\n <div class=\"ngx-charts-outer\" [style.width.px]=\"view[0]\" [@animationState]=\"'active'\" [@.disabled]=\"!animations\">\n <svg class=\"ngx-charts\" [attr.width]=\"chartWidth\" [attr.height]=\"view[1]\">\n <ng-content></ng-content>\n </svg>\n <ngx-charts-scale-legend\n *ngIf=\"showLegend && legendType === LegendType.ScaleLegend\"\n class=\"chart-legend\"\n [horizontal]=\"legendOptions && legendOptions.position === LegendPosition.Below\"\n [valueRange]=\"legendOptions.domain\"\n [colors]=\"legendOptions.colors\"\n [height]=\"view[1]\"\n [width]=\"legendWidth\"\n >\n </ngx-charts-scale-legend>\n <ngx-charts-legend\n *ngIf=\"showLegend && legendType === LegendType.Legend\"\n class=\"chart-legend\"\n [horizontal]=\"legendOptions && legendOptions.position === LegendPosition.Below\"\n [data]=\"legendOptions.domain\"\n [title]=\"legendOptions.title\"\n [colors]=\"legendOptions.colors\"\n [height]=\"view[1]\"\n [width]=\"legendWidth\"\n [activeEntries]=\"activeEntries\"\n (labelClick)=\"legendLabelClick.emit($event)\"\n (labelActivate)=\"legendLabelActivate.emit($event)\"\n (labelDeactivate)=\"legendLabelDeactivate.emit($event)\"\n >\n </ngx-charts-legend>\n </div>\n ",
955
986
  changeDetection: core.ChangeDetectionStrategy.OnPush,
956
987
  animations: [
957
988
  animations.trigger('animationState', [
@@ -964,10 +995,7 @@
964
995
  view: [{ type: core.Input }],
965
996
  showLegend: [{ type: core.Input }],
966
997
  legendOptions: [{ type: core.Input }],
967
- data: [{ type: core.Input }],
968
- legendData: [{ type: core.Input }],
969
998
  legendType: [{ type: core.Input }],
970
- colors: [{ type: core.Input }],
971
999
  activeEntries: [{ type: core.Input }],
972
1000
  animations: [{ type: core.Input }],
973
1001
  legendLabelClick: [{ type: core.Output }],
@@ -1035,19 +1063,32 @@
1035
1063
  visible: [{ type: core.Output }]
1036
1064
  };
1037
1065
 
1066
+ function isDate(value) {
1067
+ return toString.call(value) === '[object Date]';
1068
+ }
1069
+ function isNumber(value) {
1070
+ return typeof value === 'number';
1071
+ }
1072
+
1038
1073
  var BaseChartComponent = /** @class */ (function () {
1039
- function BaseChartComponent(chartElement, zone, cd) {
1074
+ function BaseChartComponent(chartElement, zone, cd, platformId) {
1040
1075
  this.chartElement = chartElement;
1041
1076
  this.zone = zone;
1042
1077
  this.cd = cd;
1078
+ this.platformId = platformId;
1043
1079
  this.scheme = 'cool';
1044
- this.schemeType = 'ordinal';
1080
+ this.schemeType = exports.ɵc.Ordinal;
1045
1081
  this.animations = true;
1046
1082
  this.select = new core.EventEmitter();
1047
1083
  }
1084
+ BaseChartComponent.prototype.ngOnInit = function () {
1085
+ if (common.isPlatformServer(this.platformId)) {
1086
+ this.animations = false;
1087
+ }
1088
+ };
1048
1089
  BaseChartComponent.prototype.ngAfterViewInit = function () {
1049
1090
  this.bindWindowResizeEvent();
1050
- // listen for visibility of the element for hidden by default scenario
1091
+ // listen for visibility ofhe element for hidden by default scenario
1051
1092
  this.visibilityObserver = new VisibilityObserver(this.chartElement, this.zone);
1052
1093
  this.visibilityObserver.visible.subscribe(this.update.bind(this));
1053
1094
  };
@@ -1096,7 +1137,7 @@
1096
1137
  var width;
1097
1138
  var height;
1098
1139
  var hostElem = this.chartElement.nativeElement;
1099
- if (hostElem.parentNode !== null) {
1140
+ if (common.isPlatformBrowser(this.platformId) && hostElem.parentNode !== null) {
1100
1141
  // Get the container dimensions
1101
1142
  var dims = hostElem.parentNode.getBoundingClientRect();
1102
1143
  width = dims.width;
@@ -1115,14 +1156,14 @@
1115
1156
  for (var i = 0; i < this.results.length; i++) {
1116
1157
  var g = this.results[i];
1117
1158
  g.label = g.name;
1118
- if (g.label instanceof Date) {
1159
+ if (isDate(g.label)) {
1119
1160
  g.label = g.label.toLocaleDateString();
1120
1161
  }
1121
1162
  if (g.series) {
1122
1163
  for (var j = 0; j < g.series.length; j++) {
1123
1164
  var d = g.series[j];
1124
1165
  d.label = d.name;
1125
- if (d.label instanceof Date) {
1166
+ if (isDate(d.label)) {
1126
1167
  d.label = d.label.toLocaleDateString();
1127
1168
  }
1128
1169
  }
@@ -1136,6 +1177,9 @@
1136
1177
  };
1137
1178
  BaseChartComponent.prototype.bindWindowResizeEvent = function () {
1138
1179
  var _this = this;
1180
+ if (!common.isPlatformBrowser(this.platformId)) {
1181
+ return;
1182
+ }
1139
1183
  var source = rxjs.fromEvent(window, 'resize');
1140
1184
  var subscription = source.pipe(operators.debounceTime(200)).subscribe(function (e) {
1141
1185
  _this.update();
@@ -1205,7 +1249,8 @@
1205
1249
  BaseChartComponent.ctorParameters = function () { return [
1206
1250
  { type: core.ElementRef },
1207
1251
  { type: core.NgZone },
1208
- { type: core.ChangeDetectorRef }
1252
+ { type: core.ChangeDetectorRef },
1253
+ { type: undefined, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
1209
1254
  ]; };
1210
1255
  BaseChartComponent.propDecorators = {
1211
1256
  results: [{ type: core.Input }],
@@ -1231,20 +1276,20 @@
1231
1276
  this.textAnchor = 'middle';
1232
1277
  this.transform = '';
1233
1278
  switch (this.orient) {
1234
- case 'top':
1279
+ case exports.Orientation.Top:
1235
1280
  this.y = this.offset;
1236
1281
  this.x = this.width / 2;
1237
1282
  break;
1238
- case 'bottom':
1283
+ case exports.Orientation.Bottom:
1239
1284
  this.y = this.offset;
1240
1285
  this.x = this.width / 2;
1241
1286
  break;
1242
- case 'left':
1287
+ case exports.Orientation.Left:
1243
1288
  this.y = -(this.offset + this.textHeight + this.margin);
1244
1289
  this.x = -this.height / 2;
1245
1290
  this.transform = 'rotate(270)';
1246
1291
  break;
1247
- case 'right':
1292
+ case exports.Orientation.Right:
1248
1293
  this.y = this.offset + this.margin;
1249
1294
  this.x = -this.height / 2;
1250
1295
  this.transform = 'rotate(270)';
@@ -1306,7 +1351,8 @@
1306
1351
  }
1307
1352
 
1308
1353
  var XAxisTicksComponent = /** @class */ (function () {
1309
- function XAxisTicksComponent() {
1354
+ function XAxisTicksComponent(platformId) {
1355
+ this.platformId = platformId;
1310
1356
  this.tickArguments = [5];
1311
1357
  this.tickStroke = '#ccc';
1312
1358
  this.trimTicks = true;
@@ -1319,10 +1365,11 @@
1319
1365
  this.innerTickSize = 6;
1320
1366
  this.outerTickSize = 6;
1321
1367
  this.tickPadding = 3;
1322
- this.textAnchor = 'middle';
1368
+ this.textAnchor = exports.TextAnchor.Middle;
1323
1369
  this.maxTicksLength = 0;
1324
1370
  this.maxAllowedLength = 16;
1325
1371
  this.height = 0;
1372
+ this.approxHeight = 10;
1326
1373
  }
1327
1374
  XAxisTicksComponent.prototype.ngOnChanges = function (changes) {
1328
1375
  this.update();
@@ -1333,10 +1380,15 @@
1333
1380
  };
1334
1381
  XAxisTicksComponent.prototype.updateDims = function () {
1335
1382
  var _this = this;
1383
+ if (!common.isPlatformBrowser(this.platformId)) {
1384
+ // for SSR, use approximate value instead of measured
1385
+ this.dimensionsChanged.emit({ height: this.approxHeight });
1386
+ return;
1387
+ }
1336
1388
  var height = parseInt(this.ticksElement.nativeElement.getBoundingClientRect().height, 10);
1337
1389
  if (height !== this.height) {
1338
1390
  this.height = height;
1339
- this.dimensionsChanged.emit({ height: height });
1391
+ this.dimensionsChanged.emit({ height: this.height });
1340
1392
  setTimeout(function () { return _this.updateDims(); });
1341
1393
  }
1342
1394
  };
@@ -1367,11 +1419,11 @@
1367
1419
  this.textTransform = '';
1368
1420
  if (angle && angle !== 0) {
1369
1421
  this.textTransform = "rotate(" + angle + ")";
1370
- this.textAnchor = 'end';
1422
+ this.textAnchor = exports.TextAnchor.End;
1371
1423
  this.verticalSpacing = 10;
1372
1424
  }
1373
1425
  else {
1374
- this.textAnchor = 'middle';
1426
+ this.textAnchor = exports.TextAnchor.Middle;
1375
1427
  }
1376
1428
  setTimeout(function () { return _this.updateDims(); });
1377
1429
  };
@@ -1389,7 +1441,7 @@
1389
1441
  }
1390
1442
  }
1391
1443
  var len = Math.min(this.maxTicksLength, this.maxAllowedLength);
1392
- var charWidth = 8; // need to measure this
1444
+ var charWidth = 7; // need to measure this
1393
1445
  var wordWidth = len * charWidth;
1394
1446
  var baseWidth = wordWidth;
1395
1447
  var maxBaseWidth = Math.floor(this.width / ticks.length);
@@ -1398,6 +1450,7 @@
1398
1450
  angle -= 30;
1399
1451
  baseWidth = Math.cos(angle * (Math.PI / 180)) * wordWidth;
1400
1452
  }
1453
+ this.approxHeight = Math.max(Math.abs(Math.sin(angle * (Math.PI / 180)) * wordWidth), 10);
1401
1454
  return angle;
1402
1455
  };
1403
1456
  XAxisTicksComponent.prototype.getTicks = function () {
@@ -1437,6 +1490,9 @@
1437
1490
  changeDetection: core.ChangeDetectionStrategy.OnPush
1438
1491
  },] }
1439
1492
  ];
1493
+ XAxisTicksComponent.ctorParameters = function () { return [
1494
+ { type: undefined, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
1495
+ ]; };
1440
1496
  XAxisTicksComponent.propDecorators = {
1441
1497
  scale: [{ type: core.Input }],
1442
1498
  orient: [{ type: core.Input }],
@@ -1458,7 +1514,7 @@
1458
1514
  function XAxisComponent() {
1459
1515
  this.rotateTicks = true;
1460
1516
  this.showGridLines = false;
1461
- this.xOrient = 'bottom';
1517
+ this.xOrient = exports.Orientation.Bottom;
1462
1518
  this.xAxisOffset = 0;
1463
1519
  this.dimensionsChanged = new core.EventEmitter();
1464
1520
  this.xAxisClassName = 'x axis';
@@ -1468,6 +1524,7 @@
1468
1524
  this.tickStroke = '#ccc';
1469
1525
  this.strokeWidth = 'none';
1470
1526
  this.padding = 5;
1527
+ this.Orientation = exports.Orientation;
1471
1528
  }
1472
1529
  XAxisComponent.prototype.ngOnChanges = function (changes) {
1473
1530
  this.update();
@@ -1494,7 +1551,7 @@
1494
1551
  XAxisComponent.decorators = [
1495
1552
  { type: core.Component, args: [{
1496
1553
  selector: 'g[ngx-charts-x-axis]',
1497
- template: "\n <svg:g [attr.class]=\"xAxisClassName\" [attr.transform]=\"transform\">\n <svg:g\n ngx-charts-x-axis-ticks\n *ngIf=\"xScale\"\n [trimTicks]=\"trimTicks\"\n [rotateTicks]=\"rotateTicks\"\n [maxTickLength]=\"maxTickLength\"\n [tickFormatting]=\"tickFormatting\"\n [tickArguments]=\"tickArguments\"\n [tickStroke]=\"tickStroke\"\n [scale]=\"xScale\"\n [orient]=\"xOrient\"\n [showGridLines]=\"showGridLines\"\n [gridLineHeight]=\"dims.height\"\n [width]=\"dims.width\"\n [tickValues]=\"ticks\"\n (dimensionsChanged)=\"emitTicksHeight($event)\"\n />\n <svg:g\n ngx-charts-axis-label\n *ngIf=\"showLabel\"\n [label]=\"labelText\"\n [offset]=\"labelOffset\"\n [orient]=\"'bottom'\"\n [height]=\"dims.height\"\n [width]=\"dims.width\"\n ></svg:g>\n </svg:g>\n ",
1554
+ template: "\n <svg:g [attr.class]=\"xAxisClassName\" [attr.transform]=\"transform\">\n <svg:g\n ngx-charts-x-axis-ticks\n *ngIf=\"xScale\"\n [trimTicks]=\"trimTicks\"\n [rotateTicks]=\"rotateTicks\"\n [maxTickLength]=\"maxTickLength\"\n [tickFormatting]=\"tickFormatting\"\n [tickArguments]=\"tickArguments\"\n [tickStroke]=\"tickStroke\"\n [scale]=\"xScale\"\n [orient]=\"xOrient\"\n [showGridLines]=\"showGridLines\"\n [gridLineHeight]=\"dims.height\"\n [width]=\"dims.width\"\n [tickValues]=\"ticks\"\n (dimensionsChanged)=\"emitTicksHeight($event)\"\n />\n <svg:g\n ngx-charts-axis-label\n *ngIf=\"showLabel\"\n [label]=\"labelText\"\n [offset]=\"labelOffset\"\n [orient]=\"Orientation.Bottom\"\n [height]=\"dims.height\"\n [width]=\"dims.width\"\n ></svg:g>\n </svg:g>\n ",
1498
1555
  changeDetection: core.ChangeDetectionStrategy.OnPush
1499
1556
  },] }
1500
1557
  ];
@@ -1509,7 +1566,6 @@
1509
1566
  showLabel: [{ type: core.Input }],
1510
1567
  labelText: [{ type: core.Input }],
1511
1568
  ticks: [{ type: core.Input }],
1512
- xAxisTickInterval: [{ type: core.Input }],
1513
1569
  xAxisTickCount: [{ type: core.Input }],
1514
1570
  xOrient: [{ type: core.Input }],
1515
1571
  xAxisOffset: [{ type: core.Input }],
@@ -1564,7 +1620,8 @@
1564
1620
  }
1565
1621
 
1566
1622
  var YAxisTicksComponent = /** @class */ (function () {
1567
- function YAxisTicksComponent() {
1623
+ function YAxisTicksComponent(platformId) {
1624
+ this.platformId = platformId;
1568
1625
  this.tickArguments = [5];
1569
1626
  this.tickStroke = '#ccc';
1570
1627
  this.trimTicks = true;
@@ -1576,11 +1633,12 @@
1576
1633
  this.innerTickSize = 6;
1577
1634
  this.tickPadding = 3;
1578
1635
  this.verticalSpacing = 20;
1579
- this.textAnchor = 'middle';
1636
+ this.textAnchor = exports.TextAnchor.Middle;
1580
1637
  this.width = 0;
1581
1638
  this.outerTickSize = 6;
1582
1639
  this.rotateLabels = false;
1583
1640
  this.referenceLineLength = 0;
1641
+ this.Orientation = exports.Orientation;
1584
1642
  }
1585
1643
  YAxisTicksComponent.prototype.ngOnChanges = function (changes) {
1586
1644
  this.update();
@@ -1591,6 +1649,12 @@
1591
1649
  };
1592
1650
  YAxisTicksComponent.prototype.updateDims = function () {
1593
1651
  var _this = this;
1652
+ if (!common.isPlatformBrowser(this.platformId)) {
1653
+ // for SSR, use approximate value instead of measured
1654
+ this.width = this.getApproximateAxisWidth();
1655
+ this.dimensionsChanged.emit({ width: this.width });
1656
+ return;
1657
+ }
1594
1658
  var width = parseInt(this.ticksElement.nativeElement.getBoundingClientRect().width, 10);
1595
1659
  if (width !== this.width) {
1596
1660
  this.width = width;
@@ -1601,7 +1665,7 @@
1601
1665
  YAxisTicksComponent.prototype.update = function () {
1602
1666
  var _this = this;
1603
1667
  var scale;
1604
- var sign = this.orient === 'top' || this.orient === 'right' ? -1 : 1;
1668
+ var sign = this.orient === exports.Orientation.Top || this.orient === exports.Orientation.Right ? -1 : 1;
1605
1669
  this.tickSpacing = Math.max(this.innerTickSize, 0) + this.tickPadding;
1606
1670
  scale = this.scale;
1607
1671
  this.ticks = this.getTicks();
@@ -1628,38 +1692,38 @@
1628
1692
  this.setReferencelines();
1629
1693
  }
1630
1694
  switch (this.orient) {
1631
- case 'top':
1695
+ case exports.Orientation.Top:
1632
1696
  this.transform = function (tick) {
1633
1697
  return 'translate(' + this.adjustedScale(tick) + ',0)';
1634
1698
  };
1635
- this.textAnchor = 'middle';
1699
+ this.textAnchor = exports.TextAnchor.Middle;
1636
1700
  this.y2 = this.innerTickSize * sign;
1637
1701
  this.y1 = this.tickSpacing * sign;
1638
1702
  this.dy = sign < 0 ? '0em' : '.71em';
1639
1703
  break;
1640
- case 'bottom':
1704
+ case exports.Orientation.Bottom:
1641
1705
  this.transform = function (tick) {
1642
1706
  return 'translate(' + this.adjustedScale(tick) + ',0)';
1643
1707
  };
1644
- this.textAnchor = 'middle';
1708
+ this.textAnchor = exports.TextAnchor.Middle;
1645
1709
  this.y2 = this.innerTickSize * sign;
1646
1710
  this.y1 = this.tickSpacing * sign;
1647
1711
  this.dy = sign < 0 ? '0em' : '.71em';
1648
1712
  break;
1649
- case 'left':
1713
+ case exports.Orientation.Left:
1650
1714
  this.transform = function (tick) {
1651
1715
  return 'translate(0,' + this.adjustedScale(tick) + ')';
1652
1716
  };
1653
- this.textAnchor = 'end';
1717
+ this.textAnchor = exports.TextAnchor.End;
1654
1718
  this.x2 = this.innerTickSize * -sign;
1655
1719
  this.x1 = this.tickSpacing * -sign;
1656
1720
  this.dy = '.32em';
1657
1721
  break;
1658
- case 'right':
1722
+ case exports.Orientation.Right:
1659
1723
  this.transform = function (tick) {
1660
1724
  return 'translate(0,' + this.adjustedScale(tick) + ')';
1661
1725
  };
1662
- this.textAnchor = 'start';
1726
+ this.textAnchor = exports.TextAnchor.Start;
1663
1727
  this.x2 = this.innerTickSize * -sign;
1664
1728
  this.x1 = this.tickSpacing * -sign;
1665
1729
  this.dy = '.32em';
@@ -1707,15 +1771,24 @@
1707
1771
  YAxisTicksComponent.prototype.tickTrim = function (label) {
1708
1772
  return this.trimTicks ? trimLabel(label, this.maxTickLength) : label;
1709
1773
  };
1774
+ YAxisTicksComponent.prototype.getApproximateAxisWidth = function () {
1775
+ var _this = this;
1776
+ var maxChars = Math.max.apply(Math, __spread(this.ticks.map(function (t) { return _this.tickTrim(_this.tickFormat(t)).length; })));
1777
+ var charWidth = 7;
1778
+ return maxChars * charWidth;
1779
+ };
1710
1780
  return YAxisTicksComponent;
1711
1781
  }());
1712
1782
  YAxisTicksComponent.decorators = [
1713
1783
  { type: core.Component, args: [{
1714
1784
  selector: 'g[ngx-charts-y-axis-ticks]',
1715
- template: "\n <svg:g #ticksel>\n <svg:g *ngFor=\"let tick of ticks\" class=\"tick\" [attr.transform]=\"transform(tick)\">\n <title>{{ tickFormat(tick) }}</title>\n <svg:text\n stroke-width=\"0.01\"\n [attr.dy]=\"dy\"\n [attr.x]=\"x1\"\n [attr.y]=\"y1\"\n [attr.text-anchor]=\"textAnchor\"\n [style.font-size]=\"'12px'\"\n >\n {{ tickTrim(tickFormat(tick)) }}\n </svg:text>\n </svg:g>\n </svg:g>\n\n <svg:path\n *ngIf=\"referenceLineLength > 1 && refMax && refMin && showRefLines\"\n class=\"reference-area\"\n [attr.d]=\"referenceAreaPath\"\n [attr.transform]=\"gridLineTransform()\"\n />\n <svg:g *ngFor=\"let tick of ticks\" [attr.transform]=\"transform(tick)\">\n <svg:g *ngIf=\"showGridLines\" [attr.transform]=\"gridLineTransform()\">\n <svg:line\n *ngIf=\"orient === 'left'\"\n class=\"gridline-path gridline-path-horizontal\"\n x1=\"0\"\n [attr.x2]=\"gridLineWidth\"\n />\n <svg:line\n *ngIf=\"orient === 'right'\"\n class=\"gridline-path gridline-path-horizontal\"\n x1=\"0\"\n [attr.x2]=\"-gridLineWidth\"\n />\n </svg:g>\n </svg:g>\n\n <svg:g *ngFor=\"let refLine of referenceLines\">\n <svg:g *ngIf=\"showRefLines\" [attr.transform]=\"transform(refLine.value)\">\n <svg:line\n class=\"refline-path gridline-path-horizontal\"\n x1=\"0\"\n [attr.x2]=\"gridLineWidth\"\n [attr.transform]=\"gridLineTransform()\"\n />\n <svg:g *ngIf=\"showRefLabels\">\n <title>{{ tickTrim(tickFormat(refLine.value)) }}</title>\n <svg:text\n class=\"refline-label\"\n [attr.dy]=\"dy\"\n [attr.y]=\"-6\"\n [attr.x]=\"gridLineWidth\"\n [attr.text-anchor]=\"textAnchor\"\n >\n {{ refLine.name }}\n </svg:text>\n </svg:g>\n </svg:g>\n </svg:g>\n ",
1785
+ template: "\n <svg:g #ticksel>\n <svg:g *ngFor=\"let tick of ticks\" class=\"tick\" [attr.transform]=\"transform(tick)\">\n <title>{{ tickFormat(tick) }}</title>\n <svg:text\n stroke-width=\"0.01\"\n [attr.dy]=\"dy\"\n [attr.x]=\"x1\"\n [attr.y]=\"y1\"\n [attr.text-anchor]=\"textAnchor\"\n [style.font-size]=\"'12px'\"\n >\n {{ tickTrim(tickFormat(tick)) }}\n </svg:text>\n </svg:g>\n </svg:g>\n\n <svg:path\n *ngIf=\"referenceLineLength > 1 && refMax && refMin && showRefLines\"\n class=\"reference-area\"\n [attr.d]=\"referenceAreaPath\"\n [attr.transform]=\"gridLineTransform()\"\n />\n <svg:g *ngFor=\"let tick of ticks\" [attr.transform]=\"transform(tick)\">\n <svg:g *ngIf=\"showGridLines\" [attr.transform]=\"gridLineTransform()\">\n <svg:line\n *ngIf=\"orient === Orientation.Left\"\n class=\"gridline-path gridline-path-horizontal\"\n x1=\"0\"\n [attr.x2]=\"gridLineWidth\"\n />\n <svg:line\n *ngIf=\"orient === Orientation.Right\"\n class=\"gridline-path gridline-path-horizontal\"\n x1=\"0\"\n [attr.x2]=\"-gridLineWidth\"\n />\n </svg:g>\n </svg:g>\n\n <svg:g *ngFor=\"let refLine of referenceLines\">\n <svg:g *ngIf=\"showRefLines\" [attr.transform]=\"transform(refLine.value)\">\n <svg:line\n class=\"refline-path gridline-path-horizontal\"\n x1=\"0\"\n [attr.x2]=\"gridLineWidth\"\n [attr.transform]=\"gridLineTransform()\"\n />\n <svg:g *ngIf=\"showRefLabels\">\n <title>{{ tickTrim(tickFormat(refLine.value)) }}</title>\n <svg:text\n class=\"refline-label\"\n [attr.dy]=\"dy\"\n [attr.y]=\"-6\"\n [attr.x]=\"gridLineWidth\"\n [attr.text-anchor]=\"textAnchor\"\n >\n {{ refLine.name }}\n </svg:text>\n </svg:g>\n </svg:g>\n </svg:g>\n ",
1716
1786
  changeDetection: core.ChangeDetectionStrategy.OnPush
1717
1787
  },] }
1718
1788
  ];
1789
+ YAxisTicksComponent.ctorParameters = function () { return [
1790
+ { type: undefined, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
1791
+ ]; };
1719
1792
  YAxisTicksComponent.propDecorators = {
1720
1793
  scale: [{ type: core.Input }],
1721
1794
  orient: [{ type: core.Input }],
@@ -1738,7 +1811,7 @@
1738
1811
  var YAxisComponent = /** @class */ (function () {
1739
1812
  function YAxisComponent() {
1740
1813
  this.showGridLines = false;
1741
- this.yOrient = 'left';
1814
+ this.yOrient = exports.Orientation.Left;
1742
1815
  this.yAxisOffset = 0;
1743
1816
  this.dimensionsChanged = new core.EventEmitter();
1744
1817
  this.yAxisClassName = 'y axis';
@@ -1754,7 +1827,7 @@
1754
1827
  };
1755
1828
  YAxisComponent.prototype.update = function () {
1756
1829
  this.offset = -(this.yAxisOffset + this.padding);
1757
- if (this.yOrient === 'right') {
1830
+ if (this.yOrient === exports.Orientation.Right) {
1758
1831
  this.labelOffset = 65;
1759
1832
  this.transform = "translate(" + (this.offset + this.dims.width) + " , 0)";
1760
1833
  }
@@ -1769,7 +1842,7 @@
1769
1842
  YAxisComponent.prototype.emitTicksWidth = function (_a) {
1770
1843
  var _this = this;
1771
1844
  var width = _a.width;
1772
- if (width !== this.labelOffset && this.yOrient === 'right') {
1845
+ if (width !== this.labelOffset && this.yOrient === exports.Orientation.Right) {
1773
1846
  this.labelOffset = width + this.labelOffset;
1774
1847
  setTimeout(function () {
1775
1848
  _this.dimensionsChanged.emit({ width: width });
@@ -1801,7 +1874,6 @@
1801
1874
  showGridLines: [{ type: core.Input }],
1802
1875
  showLabel: [{ type: core.Input }],
1803
1876
  labelText: [{ type: core.Input }],
1804
- yAxisTickInterval: [{ type: core.Input }],
1805
1877
  yAxisTickCount: [{ type: core.Input }],
1806
1878
  yOrient: [{ type: core.Input }],
1807
1879
  referenceLines: [{ type: core.Input }],
@@ -1830,12 +1902,6 @@
1830
1902
  StyleTypes[StyleTypes["tooltip"] = 'tooltip'] = "tooltip";
1831
1903
  })(exports.StyleTypes || (exports.StyleTypes = {}));
1832
1904
 
1833
- (function (AlignmentTypes) {
1834
- AlignmentTypes[AlignmentTypes["left"] = 'left'] = "left";
1835
- AlignmentTypes[AlignmentTypes["center"] = 'center'] = "center";
1836
- AlignmentTypes[AlignmentTypes["right"] = 'right'] = "right";
1837
- })(exports.AlignmentTypes || (exports.AlignmentTypes = {}));
1838
-
1839
1905
  (function (ShowTypes) {
1840
1906
  ShowTypes[ShowTypes["all"] = 'all'] = "all";
1841
1907
  ShowTypes[ShowTypes["focus"] = 'focus'] = "focus";
@@ -1853,8 +1919,8 @@
1853
1919
  this.tooltipSpacing = 10;
1854
1920
  this.tooltipDisabled = false;
1855
1921
  this.tooltipShowCaret = true;
1856
- this.tooltipPlacement = PlacementTypes.top;
1857
- this.tooltipAlignment = exports.AlignmentTypes.center;
1922
+ this.tooltipPlacement = exports.PlacementTypes.Top;
1923
+ this.tooltipAlignment = exports.PlacementTypes.Center;
1858
1924
  this.tooltipType = exports.StyleTypes.popover;
1859
1925
  this.tooltipCloseOnClickOutside = true;
1860
1926
  this.tooltipCloseOnMouseLeave = true;
@@ -1918,7 +1984,9 @@
1918
1984
  var _this = this;
1919
1985
  if (this.component || this.tooltipDisabled)
1920
1986
  return;
1921
- var time = immediate ? 0 : this.tooltipShowTimeout;
1987
+ var time = immediate
1988
+ ? 0
1989
+ : this.tooltipShowTimeout + (navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) ? 300 : 0);
1922
1990
  clearTimeout(this.timeout);
1923
1991
  this.timeout = setTimeout(function () {
1924
1992
  _this.tooltipService.destroyAll();
@@ -1947,7 +2015,7 @@
1947
2015
  }
1948
2016
  // content close on click outside
1949
2017
  if (this.tooltipCloseOnClickOutside) {
1950
- this.documentClickEvent = this.renderer.listen(document, 'click', function (event) {
2018
+ this.documentClickEvent = this.renderer.listen('window', 'click', function (event) {
1951
2019
  var contains = tooltip.contains(event.target);
1952
2020
  if (!contains)
1953
2021
  _this.hideTooltip();
@@ -2103,9 +2171,14 @@
2103
2171
  return id();
2104
2172
  }
2105
2173
 
2174
+ var SeriesType;
2175
+ (function (SeriesType) {
2176
+ SeriesType["Standard"] = "standard";
2177
+ SeriesType["Stacked"] = "stacked";
2178
+ })(SeriesType || (SeriesType = {}));
2106
2179
  var CircleSeriesComponent = /** @class */ (function () {
2107
2180
  function CircleSeriesComponent() {
2108
- this.type = 'standard';
2181
+ this.type = SeriesType.Standard;
2109
2182
  this.tooltipDisabled = false;
2110
2183
  this.select = new core.EventEmitter();
2111
2184
  this.activate = new core.EventEmitter();
@@ -2116,7 +2189,7 @@
2116
2189
  this.gradientId = 'grad' + id().toString();
2117
2190
  this.gradientFill = "url(#" + this.gradientId + ")";
2118
2191
  };
2119
- CircleSeriesComponent.prototype.ngOnChanges = function (changes) {
2192
+ CircleSeriesComponent.prototype.ngOnChanges = function () {
2120
2193
  this.update();
2121
2194
  };
2122
2195
  CircleSeriesComponent.prototype.update = function () {
@@ -2140,22 +2213,22 @@
2140
2213
  var label = d.name;
2141
2214
  var tooltipLabel = formatLabel(label);
2142
2215
  var cx;
2143
- if (this.scaleType === 'time') {
2216
+ if (this.scaleType === exports.ɵc.Time) {
2144
2217
  cx = this.xScale(label);
2145
2218
  }
2146
- else if (this.scaleType === 'linear') {
2219
+ else if (this.scaleType === exports.ɵc.Linear) {
2147
2220
  cx = this.xScale(Number(label));
2148
2221
  }
2149
2222
  else {
2150
2223
  cx = this.xScale(label);
2151
2224
  }
2152
- var cy = this.yScale(this.type === 'standard' ? value : d.d1);
2225
+ var cy = this.yScale(this.type === SeriesType.Standard ? value : d.d1);
2153
2226
  var radius = 5;
2154
2227
  var height = this.yScale.range()[0] - cy;
2155
2228
  var opacity = 1;
2156
2229
  var color;
2157
- if (this.colors.scaleType === 'linear') {
2158
- if (this.type === 'standard') {
2230
+ if (this.colors.scaleType === exports.ɵc.Linear) {
2231
+ if (this.type === SeriesType.Standard) {
2159
2232
  color = this.colors.getColor(value);
2160
2233
  }
2161
2234
  else {
@@ -2345,13 +2418,22 @@
2345
2418
  },] }
2346
2419
  ];
2347
2420
  GridPanelComponent.propDecorators = {
2348
- path: [{ type: core.Input }],
2349
2421
  width: [{ type: core.Input }],
2350
2422
  height: [{ type: core.Input }],
2351
2423
  x: [{ type: core.Input }],
2352
2424
  y: [{ type: core.Input }]
2353
2425
  };
2354
2426
 
2427
+ var GridOrientation;
2428
+ (function (GridOrientation) {
2429
+ GridOrientation["Vertical"] = "vertical";
2430
+ GridOrientation["Horizontal"] = "horizontal";
2431
+ })(GridOrientation || (GridOrientation = {}));
2432
+ var ClassEnum;
2433
+ (function (ClassEnum) {
2434
+ ClassEnum["Odd"] = "odd";
2435
+ ClassEnum["Even"] = "even";
2436
+ })(ClassEnum || (ClassEnum = {}));
2355
2437
  var GridPanelSeriesComponent = /** @class */ (function () {
2356
2438
  function GridPanelSeriesComponent() {
2357
2439
  }
@@ -2369,12 +2451,12 @@
2369
2451
  var height;
2370
2452
  var x;
2371
2453
  var y;
2372
- var className = 'odd';
2373
- if (_this.orient === 'vertical') {
2454
+ var className = ClassEnum.Odd;
2455
+ if (_this.orient === GridOrientation.Vertical) {
2374
2456
  var position = _this.xScale(d.name);
2375
2457
  var positionIndex = Number.parseInt((position / _this.xScale.step()).toString(), 10);
2376
2458
  if (positionIndex % 2 === 1) {
2377
- className = 'even';
2459
+ className = ClassEnum.Even;
2378
2460
  }
2379
2461
  offset = _this.xScale.bandwidth() * _this.xScale.paddingInner();
2380
2462
  width = _this.xScale.bandwidth() + offset;
@@ -2382,11 +2464,11 @@
2382
2464
  x = _this.xScale(d.name) - offset / 2;
2383
2465
  y = 0;
2384
2466
  }
2385
- else if (_this.orient === 'horizontal') {
2467
+ else if (_this.orient === GridOrientation.Horizontal) {
2386
2468
  var position = _this.yScale(d.name);
2387
2469
  var positionIndex = Number.parseInt((position / _this.yScale.step()).toString(), 10);
2388
2470
  if (positionIndex % 2 === 1) {
2389
- className = 'even';
2471
+ className = ClassEnum.Even;
2390
2472
  }
2391
2473
  offset = _this.yScale.bandwidth() * _this.yScale.paddingInner();
2392
2474
  width = _this.dims.width;
@@ -2421,19 +2503,24 @@
2421
2503
  orient: [{ type: core.Input }]
2422
2504
  };
2423
2505
 
2506
+ var Orientation;
2507
+ (function (Orientation) {
2508
+ Orientation["Vertical"] = "vertical";
2509
+ Orientation["Horizontal"] = "horizontal";
2510
+ })(Orientation || (Orientation = {}));
2424
2511
  var SvgLinearGradientComponent = /** @class */ (function () {
2425
2512
  function SvgLinearGradientComponent() {
2426
- this.orientation = 'vertical';
2513
+ this.orientation = Orientation.Vertical;
2427
2514
  }
2428
2515
  SvgLinearGradientComponent.prototype.ngOnChanges = function (changes) {
2429
2516
  this.x1 = '0%';
2430
2517
  this.x2 = '0%';
2431
2518
  this.y1 = '0%';
2432
2519
  this.y2 = '0%';
2433
- if (this.orientation === 'horizontal') {
2520
+ if (this.orientation === Orientation.Horizontal) {
2434
2521
  this.x2 = '100%';
2435
2522
  }
2436
- else if (this.orientation === 'vertical') {
2523
+ else if (this.orientation === Orientation.Vertical) {
2437
2524
  this.y1 = '100%';
2438
2525
  }
2439
2526
  };
@@ -2516,7 +2603,7 @@
2516
2603
  this.hasGradient = false;
2517
2604
  this.element = element.nativeElement;
2518
2605
  }
2519
- AreaComponent.prototype.ngOnChanges = function (changes) {
2606
+ AreaComponent.prototype.ngOnChanges = function () {
2520
2607
  if (!this.initialized) {
2521
2608
  this.loadAnimation();
2522
2609
  this.initialized = true;
@@ -2587,7 +2674,6 @@
2587
2674
  opacity: [{ type: core.Input }],
2588
2675
  startOpacity: [{ type: core.Input }],
2589
2676
  endOpacity: [{ type: core.Input }],
2590
- activeLabel: [{ type: core.Input }],
2591
2677
  gradient: [{ type: core.Input }],
2592
2678
  stops: [{ type: core.Input }],
2593
2679
  animations: [{ type: core.Input }],
@@ -2782,7 +2868,8 @@
2782
2868
  }
2783
2869
 
2784
2870
  var TooltipArea = /** @class */ (function () {
2785
- function TooltipArea() {
2871
+ function TooltipArea(platformId) {
2872
+ this.platformId = platformId;
2786
2873
  this.anchorOpacity = 0;
2787
2874
  this.anchorPos = -1;
2788
2875
  this.anchorValues = [];
@@ -2808,7 +2895,7 @@
2808
2895
  val = (item.d1 - item.d0).toFixed(2) + '%';
2809
2896
  }
2810
2897
  var color = void 0;
2811
- if (this.colors.scaleType === 'linear') {
2898
+ if (this.colors.scaleType === exports.ɵc.Linear) {
2812
2899
  var v = val;
2813
2900
  if (item.d1) {
2814
2901
  v = item.d1;
@@ -2840,6 +2927,9 @@
2840
2927
  return results;
2841
2928
  };
2842
2929
  TooltipArea.prototype.mouseMove = function (event) {
2930
+ if (!common.isPlatformBrowser(this.platformId)) {
2931
+ return;
2932
+ }
2843
2933
  var xPos = event.pageX - event.target.getBoundingClientRect().left;
2844
2934
  var closestIndex = this.findClosestPointIndex(xPos);
2845
2935
  var closestPoint = this.xSet[closestIndex];
@@ -2953,6 +3043,9 @@
2953
3043
  ]
2954
3044
  },] }
2955
3045
  ];
3046
+ TooltipArea.ctorParameters = function () { return [
3047
+ { type: undefined, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
3048
+ ]; };
2956
3049
  TooltipArea.propDecorators = {
2957
3050
  dims: [{ type: core.Input }],
2958
3051
  xSet: [{ type: core.Input }],
@@ -2967,6 +3060,11 @@
2967
3060
  tooltipAnchor: [{ type: core.ViewChild, args: ['tooltipAnchor', { static: false },] }]
2968
3061
  };
2969
3062
 
3063
+ (function (TimelineScaleType) {
3064
+ TimelineScaleType["Time"] = "time";
3065
+ TimelineScaleType["Linear"] = "linear";
3066
+ TimelineScaleType["Ordinal"] = "ordinal";
3067
+ })(exports.TimelineScaleType || (exports.TimelineScaleType = {}));
2970
3068
  var Timeline = /** @class */ (function () {
2971
3069
  function Timeline(element, cd) {
2972
3070
  this.cd = cd;
@@ -3028,12 +3126,12 @@
3028
3126
  finally { if (e_1) throw e_1.error; }
3029
3127
  }
3030
3128
  var domain = [];
3031
- if (this.scaleType === 'time') {
3129
+ if (this.scaleType === exports.TimelineScaleType.Time) {
3032
3130
  var min = Math.min.apply(Math, __spread(values));
3033
3131
  var max = Math.max.apply(Math, __spread(values));
3034
3132
  domain = [min, max];
3035
3133
  }
3036
- else if (this.scaleType === 'linear') {
3134
+ else if (this.scaleType === exports.TimelineScaleType.Linear) {
3037
3135
  values = values.map(function (v) { return Number(v); });
3038
3136
  var min = Math.min.apply(Math, __spread(values));
3039
3137
  var max = Math.max.apply(Math, __spread(values));
@@ -3046,13 +3144,13 @@
3046
3144
  };
3047
3145
  Timeline.prototype.getXScale = function () {
3048
3146
  var scale;
3049
- if (this.scaleType === 'time') {
3147
+ if (this.scaleType === exports.TimelineScaleType.Time) {
3050
3148
  scale = d3Scale.scaleTime().range([0, this.dims.width]).domain(this.xDomain);
3051
3149
  }
3052
- else if (this.scaleType === 'linear') {
3150
+ else if (this.scaleType === exports.TimelineScaleType.Linear) {
3053
3151
  scale = d3Scale.scaleLinear().range([0, this.dims.width]).domain(this.xDomain);
3054
3152
  }
3055
- else if (this.scaleType === 'ordinal') {
3153
+ else if (this.scaleType === exports.TimelineScaleType.Ordinal) {
3056
3154
  scale = d3Scale.scalePoint().range([0, this.dims.width]).padding(0.1).domain(this.xDomain);
3057
3155
  }
3058
3156
  return scale;
@@ -3068,9 +3166,10 @@
3068
3166
  [0, 0],
3069
3167
  [width, height]
3070
3168
  ])
3071
- .on('brush end', function () {
3072
- var selection = d3Selection.event.selection || _this.xScale.range();
3073
- var newDomain = selection.map(_this.xScale.invert);
3169
+ .on('brush end', function (_a) {
3170
+ var selection = _a.selection;
3171
+ var newSelection = selection || _this.xScale.range();
3172
+ var newDomain = newSelection.map(_this.xScale.invert);
3074
3173
  _this.onDomainChange.emit(newDomain);
3075
3174
  _this.cd.markForCheck();
3076
3175
  });
@@ -3119,12 +3218,10 @@
3119
3218
  ]; };
3120
3219
  Timeline.propDecorators = {
3121
3220
  view: [{ type: core.Input }],
3122
- state: [{ type: core.Input }],
3123
3221
  results: [{ type: core.Input }],
3124
3222
  scheme: [{ type: core.Input }],
3125
3223
  customColors: [{ type: core.Input }],
3126
3224
  legend: [{ type: core.Input }],
3127
- miniChart: [{ type: core.Input }],
3128
3225
  autoScale: [{ type: core.Input }],
3129
3226
  scaleType: [{ type: core.Input }],
3130
3227
  height: [{ type: core.Input }],
@@ -3268,14 +3365,13 @@
3268
3365
  };
3269
3366
 
3270
3367
  var ScaleLegendComponent = /** @class */ (function () {
3271
- function ScaleLegendComponent(sanitizer) {
3272
- this.sanitizer = sanitizer;
3368
+ function ScaleLegendComponent() {
3273
3369
  this.horizontal = false;
3274
3370
  }
3275
3371
  ScaleLegendComponent.prototype.ngOnChanges = function (changes) {
3276
3372
  var gradientValues = this.gradientString(this.colors.range(), this.colors.domain());
3277
3373
  var direction = this.horizontal ? 'right' : 'bottom';
3278
- this.gradient = this.sanitizer.bypassSecurityTrustStyle("linear-gradient(to " + direction + ", " + gradientValues + ")");
3374
+ this.gradient = "linear-gradient(to " + direction + ", " + gradientValues + ")";
3279
3375
  };
3280
3376
  /**
3281
3377
  * Generates the string used in the gradient stylesheet properties
@@ -3302,9 +3398,6 @@
3302
3398
  styles: [".chart-legend{display:inline-block;padding:0;width:auto!important}.chart-legend .scale-legend{display:flex;flex-direction:column;text-align:center}.chart-legend .scale-legend-wrap{border-radius:5px;display:inline-block;flex:1;margin:0 auto;width:30px}.chart-legend .scale-legend-label{font-size:12px}.chart-legend .horizontal-legend.scale-legend{flex-direction:row}.chart-legend .horizontal-legend .scale-legend-wrap{height:30px;margin:0 16px;width:auto}"]
3303
3399
  },] }
3304
3400
  ];
3305
- ScaleLegendComponent.ctorParameters = function () { return [
3306
- { type: platformBrowser.DomSanitizer }
3307
- ]; };
3308
3401
  ScaleLegendComponent.propDecorators = {
3309
3402
  valueRange: [{ type: core.Input }],
3310
3403
  colors: [{ type: core.Input }],
@@ -3329,7 +3422,7 @@
3329
3422
  this.update();
3330
3423
  };
3331
3424
  AdvancedLegendComponent.prototype.getTotal = function () {
3332
- return this.data.map(function (d) { return d.value; }).reduce(function (sum, d) { return sum + d; }, 0);
3425
+ return this.data.map(function (d) { return Number(d.value); }).reduce(function (sum, d) { return sum + d; }, 0);
3333
3426
  };
3334
3427
  AdvancedLegendComponent.prototype.update = function () {
3335
3428
  this.total = this.getTotal();
@@ -3357,7 +3450,7 @@
3357
3450
  });
3358
3451
  };
3359
3452
  AdvancedLegendComponent.prototype.trackBy = function (item) {
3360
- return item.formattedLabel;
3453
+ return item.label;
3361
3454
  };
3362
3455
  return AdvancedLegendComponent;
3363
3456
  }());
@@ -3416,12 +3509,12 @@
3416
3509
  ];
3417
3510
 
3418
3511
  function calculateViewDimensions(_a) {
3419
- var width = _a.width, height = _a.height, margins = _a.margins, _b = _a.showXAxis, showXAxis = _b === void 0 ? false : _b, _c = _a.showYAxis, showYAxis = _c === void 0 ? false : _c, _d = _a.xAxisHeight, xAxisHeight = _d === void 0 ? 0 : _d, _e = _a.yAxisWidth, yAxisWidth = _e === void 0 ? 0 : _e, _f = _a.showXLabel, showXLabel = _f === void 0 ? false : _f, _g = _a.showYLabel, showYLabel = _g === void 0 ? false : _g, _h = _a.showLegend, showLegend = _h === void 0 ? false : _h, _j = _a.legendType, legendType = _j === void 0 ? 'ordinal' : _j, _k = _a.legendPosition, legendPosition = _k === void 0 ? 'right' : _k, _l = _a.columns, columns = _l === void 0 ? 12 : _l;
3512
+ var width = _a.width, height = _a.height, margins = _a.margins, _b = _a.showXAxis, showXAxis = _b === void 0 ? false : _b, _c = _a.showYAxis, showYAxis = _c === void 0 ? false : _c, _d = _a.xAxisHeight, xAxisHeight = _d === void 0 ? 0 : _d, _e = _a.yAxisWidth, yAxisWidth = _e === void 0 ? 0 : _e, _f = _a.showXLabel, showXLabel = _f === void 0 ? false : _f, _g = _a.showYLabel, showYLabel = _g === void 0 ? false : _g, _h = _a.showLegend, showLegend = _h === void 0 ? false : _h, _j = _a.legendType, legendType = _j === void 0 ? exports.ɵc.Ordinal : _j, _k = _a.legendPosition, legendPosition = _k === void 0 ? exports.LegendPosition.Right : _k, _l = _a.columns, columns = _l === void 0 ? 12 : _l;
3420
3513
  var xOffset = margins[3];
3421
3514
  var chartWidth = width;
3422
3515
  var chartHeight = height - margins[0] - margins[2];
3423
- if (showLegend && legendPosition === 'right') {
3424
- if (legendType === 'ordinal') {
3516
+ if (showLegend && legendPosition === exports.LegendPosition.Right) {
3517
+ if (legendType === exports.ɵc.Ordinal) {
3425
3518
  columns -= 2;
3426
3519
  }
3427
3520
  else {
@@ -3464,7 +3557,7 @@
3464
3557
  {
3465
3558
  name: 'vivid',
3466
3559
  selectable: true,
3467
- group: 'Ordinal',
3560
+ group: exports.ɵc.Ordinal,
3468
3561
  domain: [
3469
3562
  '#647c8a',
3470
3563
  '#3f51b5',
@@ -3481,7 +3574,7 @@
3481
3574
  {
3482
3575
  name: 'natural',
3483
3576
  selectable: true,
3484
- group: 'Ordinal',
3577
+ group: exports.ɵc.Ordinal,
3485
3578
  domain: [
3486
3579
  '#bf9d76',
3487
3580
  '#e99450',
@@ -3498,7 +3591,7 @@
3498
3591
  {
3499
3592
  name: 'cool',
3500
3593
  selectable: true,
3501
- group: 'Ordinal',
3594
+ group: exports.ɵc.Ordinal,
3502
3595
  domain: [
3503
3596
  '#a8385d',
3504
3597
  '#7aa3e5',
@@ -3515,13 +3608,13 @@
3515
3608
  {
3516
3609
  name: 'fire',
3517
3610
  selectable: true,
3518
- group: 'Ordinal',
3611
+ group: exports.ɵc.Ordinal,
3519
3612
  domain: ['#ff3d00', '#bf360c', '#ff8f00', '#ff6f00', '#ff5722', '#e65100', '#ffca28', '#ffab00']
3520
3613
  },
3521
3614
  {
3522
3615
  name: 'solar',
3523
3616
  selectable: true,
3524
- group: 'Continuous',
3617
+ group: exports.ɵc.Linear,
3525
3618
  domain: [
3526
3619
  '#fff8e1',
3527
3620
  '#ffecb3',
@@ -3538,7 +3631,7 @@
3538
3631
  {
3539
3632
  name: 'air',
3540
3633
  selectable: true,
3541
- group: 'Continuous',
3634
+ group: exports.ɵc.Linear,
3542
3635
  domain: [
3543
3636
  '#e1f5fe',
3544
3637
  '#b3e5fc',
@@ -3555,7 +3648,7 @@
3555
3648
  {
3556
3649
  name: 'aqua',
3557
3650
  selectable: true,
3558
- group: 'Continuous',
3651
+ group: exports.ɵc.Linear,
3559
3652
  domain: [
3560
3653
  '#e0f7fa',
3561
3654
  '#b2ebf2',
@@ -3572,7 +3665,7 @@
3572
3665
  {
3573
3666
  name: 'flame',
3574
3667
  selectable: false,
3575
- group: 'Ordinal',
3668
+ group: exports.ɵc.Ordinal,
3576
3669
  domain: [
3577
3670
  '#A10A28',
3578
3671
  '#D3342D',
@@ -3589,7 +3682,7 @@
3589
3682
  {
3590
3683
  name: 'ocean',
3591
3684
  selectable: false,
3592
- group: 'Ordinal',
3685
+ group: exports.ɵc.Ordinal,
3593
3686
  domain: [
3594
3687
  '#1D68FB',
3595
3688
  '#33C0FC',
@@ -3606,7 +3699,7 @@
3606
3699
  {
3607
3700
  name: 'forest',
3608
3701
  selectable: false,
3609
- group: 'Ordinal',
3702
+ group: exports.ɵc.Ordinal,
3610
3703
  domain: [
3611
3704
  '#55C22D',
3612
3705
  '#C1F33D',
@@ -3623,7 +3716,7 @@
3623
3716
  {
3624
3717
  name: 'horizon',
3625
3718
  selectable: false,
3626
- group: 'Ordinal',
3719
+ group: exports.ɵc.Ordinal,
3627
3720
  domain: [
3628
3721
  '#2597FB',
3629
3722
  '#65EBFD',
@@ -3640,7 +3733,7 @@
3640
3733
  {
3641
3734
  name: 'neons',
3642
3735
  selectable: false,
3643
- group: 'Ordinal',
3736
+ group: exports.ɵc.Ordinal,
3644
3737
  domain: [
3645
3738
  '#FF3333',
3646
3739
  '#FF33FF',
@@ -3657,7 +3750,7 @@
3657
3750
  {
3658
3751
  name: 'picnic',
3659
3752
  selectable: false,
3660
- group: 'Ordinal',
3753
+ group: exports.ɵc.Ordinal,
3661
3754
  domain: [
3662
3755
  '#FAC51D',
3663
3756
  '#66BD6D',
@@ -3674,7 +3767,7 @@
3674
3767
  {
3675
3768
  name: 'night',
3676
3769
  selectable: false,
3677
- group: 'Ordinal',
3770
+ group: exports.ɵc.Ordinal,
3678
3771
  domain: [
3679
3772
  '#2B1B5A',
3680
3773
  '#501356',
@@ -3696,7 +3789,7 @@
3696
3789
  {
3697
3790
  name: 'nightLights',
3698
3791
  selectable: false,
3699
- group: 'Ordinal',
3792
+ group: exports.ɵc.Ordinal,
3700
3793
  domain: [
3701
3794
  '#4e31a5',
3702
3795
  '#9c25a7',
@@ -3737,13 +3830,13 @@
3737
3830
  });
3738
3831
  }
3739
3832
  var colorScale;
3740
- if (type === 'quantile') {
3833
+ if (type === exports.ɵc.Quantile) {
3741
3834
  colorScale = d3Scale.scaleQuantile().range(scheme.domain).domain(domain);
3742
3835
  }
3743
- else if (type === 'ordinal') {
3836
+ else if (type === exports.ɵc.Ordinal) {
3744
3837
  colorScale = d3Scale.scaleOrdinal().range(scheme.domain).domain(domain);
3745
3838
  }
3746
- else if (type === 'linear') {
3839
+ else if (type === exports.ɵc.Linear) {
3747
3840
  // linear schemes must have at least 2 colors
3748
3841
  var colorDomain = __spread(scheme.domain);
3749
3842
  if (colorDomain.length === 1) {
@@ -3759,7 +3852,7 @@
3759
3852
  if (value === undefined || value === null) {
3760
3853
  throw new Error('Value can not be null');
3761
3854
  }
3762
- if (this.scaleType === 'linear') {
3855
+ if (this.scaleType === exports.ɵc.Linear) {
3763
3856
  var valueScale = d3Scale.scaleLinear().domain(this.domain).range([0, 1]);
3764
3857
  return this.scale(valueScale(value));
3765
3858
  }
@@ -3901,23 +3994,28 @@
3901
3994
  if (checkDateType) {
3902
3995
  var allDates = values.every(function (value) { return value instanceof Date; });
3903
3996
  if (allDates) {
3904
- return 'time';
3997
+ return exports.ɵc.Time;
3905
3998
  }
3906
3999
  }
3907
4000
  var allNumbers = values.every(function (value) { return typeof value === 'number'; });
3908
4001
  if (allNumbers) {
3909
- return 'linear';
4002
+ return exports.ɵc.Linear;
3910
4003
  }
3911
- return 'ordinal';
4004
+ return exports.ɵc.Ordinal;
3912
4005
  }
3913
4006
 
3914
4007
  var AreaChartComponent = /** @class */ (function (_super) {
3915
4008
  __extends(AreaChartComponent, _super);
3916
4009
  function AreaChartComponent() {
3917
4010
  var _this = _super.apply(this, __spread(arguments)) || this;
4011
+ _this.legend = false;
3918
4012
  _this.legendTitle = 'Legend';
3919
- _this.legendPosition = 'right';
4013
+ _this.legendPosition = exports.LegendPosition.Right;
4014
+ _this.xAxis = false;
4015
+ _this.yAxis = false;
3920
4016
  _this.baseValue = 'auto';
4017
+ _this.autoScale = false;
4018
+ _this.timeline = false;
3921
4019
  _this.showGridLines = true;
3922
4020
  _this.curve = d3Shape.curveLinear;
3923
4021
  _this.activeEntries = [];
@@ -3984,16 +4082,16 @@
3984
4082
  var values = getUniqueXDomainValues(this.results);
3985
4083
  this.scaleType = getScaleType(values);
3986
4084
  var domain = [];
3987
- if (this.scaleType === 'linear') {
4085
+ if (this.scaleType === exports.ɵc.Linear) {
3988
4086
  values = values.map(function (v) { return Number(v); });
3989
4087
  }
3990
4088
  var min;
3991
4089
  var max;
3992
- if (this.scaleType === 'time' || this.scaleType === 'linear') {
4090
+ if (this.scaleType === exports.ɵc.Time || this.scaleType === exports.ɵc.Linear) {
3993
4091
  min = this.xScaleMin ? this.xScaleMin : Math.min.apply(Math, __spread(values));
3994
4092
  max = this.xScaleMax ? this.xScaleMax : Math.max.apply(Math, __spread(values));
3995
4093
  }
3996
- if (this.scaleType === 'time') {
4094
+ if (this.scaleType === exports.ɵc.Time) {
3997
4095
  domain = [new Date(min), new Date(max)];
3998
4096
  this.xSet = __spread(values).sort(function (a, b) {
3999
4097
  var aDate = a.getTime();
@@ -4005,7 +4103,7 @@
4005
4103
  return 0;
4006
4104
  });
4007
4105
  }
4008
- else if (this.scaleType === 'linear') {
4106
+ else if (this.scaleType === exports.ɵc.Linear) {
4009
4107
  domain = [min, max];
4010
4108
  // Use compare function to sort numbers numerically
4011
4109
  this.xSet = __spread(values).sort(function (a, b) { return a - b; });
@@ -4062,13 +4160,13 @@
4062
4160
  };
4063
4161
  AreaChartComponent.prototype.getXScale = function (domain, width) {
4064
4162
  var scale;
4065
- if (this.scaleType === 'time') {
4163
+ if (this.scaleType === exports.ɵc.Time) {
4066
4164
  scale = d3Scale.scaleTime();
4067
4165
  }
4068
- else if (this.scaleType === 'linear') {
4166
+ else if (this.scaleType === exports.ɵc.Linear) {
4069
4167
  scale = d3Scale.scaleLinear();
4070
4168
  }
4071
- else if (this.scaleType === 'ordinal') {
4169
+ else if (this.scaleType === exports.ɵc.Ordinal) {
4072
4170
  scale = d3Scale.scalePoint().padding(0.1);
4073
4171
  }
4074
4172
  scale.range([0, width]).domain(domain);
@@ -4085,10 +4183,10 @@
4085
4183
  try {
4086
4184
  for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
4087
4185
  var value = values_1_1.value;
4088
- if (!this.isDate(value)) {
4186
+ if (isDate(value)) {
4089
4187
  date = false;
4090
4188
  }
4091
- if (typeof value !== 'number') {
4189
+ if (isNumber(value)) {
4092
4190
  num = false;
4093
4191
  }
4094
4192
  }
@@ -4101,18 +4199,12 @@
4101
4199
  finally { if (e_3) throw e_3.error; }
4102
4200
  }
4103
4201
  if (date) {
4104
- return 'time';
4202
+ return exports.ɵc.Time;
4105
4203
  }
4106
4204
  if (num) {
4107
- return 'linear';
4108
- }
4109
- return 'ordinal';
4110
- };
4111
- AreaChartComponent.prototype.isDate = function (value) {
4112
- if (value instanceof Date) {
4113
- return true;
4205
+ return exports.ɵc.Linear;
4114
4206
  }
4115
- return false;
4207
+ return exports.ɵc.Ordinal;
4116
4208
  };
4117
4209
  AreaChartComponent.prototype.updateDomain = function (domain) {
4118
4210
  this.filteredDomain = domain;
@@ -4138,7 +4230,7 @@
4138
4230
  };
4139
4231
  AreaChartComponent.prototype.setColors = function () {
4140
4232
  var domain;
4141
- if (this.schemeType === 'ordinal') {
4233
+ if (this.schemeType === exports.ɵc.Ordinal) {
4142
4234
  domain = this.seriesDomain;
4143
4235
  }
4144
4236
  else {
@@ -4154,7 +4246,7 @@
4154
4246
  title: undefined,
4155
4247
  position: this.legendPosition
4156
4248
  };
4157
- if (opts.scaleType === 'ordinal') {
4249
+ if (opts.scaleType === exports.ɵc.Ordinal) {
4158
4250
  opts.domain = this.seriesDomain;
4159
4251
  opts.colors = this.colors;
4160
4252
  opts.title = this.legendTitle;
@@ -4226,7 +4318,6 @@
4226
4318
  legend: [{ type: core.Input }],
4227
4319
  legendTitle: [{ type: core.Input }],
4228
4320
  legendPosition: [{ type: core.Input }],
4229
- state: [{ type: core.Input }],
4230
4321
  xAxis: [{ type: core.Input }],
4231
4322
  yAxis: [{ type: core.Input }],
4232
4323
  baseValue: [{ type: core.Input }],
@@ -4269,7 +4360,9 @@
4269
4360
  var _this = _super.apply(this, __spread(arguments)) || this;
4270
4361
  _this.legend = false;
4271
4362
  _this.legendTitle = 'Legend';
4272
- _this.legendPosition = 'right';
4363
+ _this.legendPosition = exports.LegendPosition.Right;
4364
+ _this.showXAxisLabel = false;
4365
+ _this.showYAxisLabel = false;
4273
4366
  _this.showGridLines = true;
4274
4367
  _this.curve = d3Shape.curveLinear;
4275
4368
  _this.activeEntries = [];
@@ -4282,6 +4375,7 @@
4282
4375
  _this.tooltipDisabled = false;
4283
4376
  _this.activate = new core.EventEmitter();
4284
4377
  _this.deactivate = new core.EventEmitter();
4378
+ _this.yDomain = [0, 100];
4285
4379
  _this.margin = [10, 20, 10, 20];
4286
4380
  _this.xAxisHeight = 0;
4287
4381
  _this.yAxisWidth = 0;
@@ -4313,7 +4407,6 @@
4313
4407
  if (this.filteredDomain) {
4314
4408
  this.xDomain = this.filteredDomain;
4315
4409
  }
4316
- this.yDomain = this.getYDomain();
4317
4410
  this.seriesDomain = this.getSeriesDomain();
4318
4411
  this.xScale = this.getXScale(this.xDomain, this.dims.width);
4319
4412
  this.yScale = this.getYScale(this.yDomain, this.dims.height);
@@ -4328,7 +4421,7 @@
4328
4421
  var d = group.series.find(function (item) {
4329
4422
  var a = item.name;
4330
4423
  var b = val;
4331
- if (_this.scaleType === 'time') {
4424
+ if (_this.scaleType === exports.ɵc.Time) {
4332
4425
  a = a.valueOf();
4333
4426
  b = b.valueOf();
4334
4427
  }
@@ -4352,7 +4445,7 @@
4352
4445
  var d = group.series.find(function (item) {
4353
4446
  var a = item.name;
4354
4447
  var b = val;
4355
- if (_this.scaleType === 'time') {
4448
+ if (_this.scaleType === exports.ɵc.Time) {
4356
4449
  a = a.valueOf();
4357
4450
  b = b.valueOf();
4358
4451
  }
@@ -4414,7 +4507,7 @@
4414
4507
  var values = getUniqueXDomainValues(this.results);
4415
4508
  this.scaleType = getScaleType(values);
4416
4509
  var domain = [];
4417
- if (this.scaleType === 'time') {
4510
+ if (this.scaleType === exports.ɵc.Time) {
4418
4511
  var min = Math.min.apply(Math, __spread(values));
4419
4512
  var max = Math.max.apply(Math, __spread(values));
4420
4513
  domain = [new Date(min), new Date(max)];
@@ -4428,7 +4521,7 @@
4428
4521
  return 0;
4429
4522
  });
4430
4523
  }
4431
- else if (this.scaleType === 'linear') {
4524
+ else if (this.scaleType === exports.ɵc.Linear) {
4432
4525
  values = values.map(function (v) { return Number(v); });
4433
4526
  var min = Math.min.apply(Math, __spread(values));
4434
4527
  var max = Math.max.apply(Math, __spread(values));
@@ -4442,21 +4535,18 @@
4442
4535
  }
4443
4536
  return domain;
4444
4537
  };
4445
- AreaChartNormalizedComponent.prototype.getYDomain = function () {
4446
- return [0, 100];
4447
- };
4448
4538
  AreaChartNormalizedComponent.prototype.getSeriesDomain = function () {
4449
4539
  return this.results.map(function (d) { return d.name; });
4450
4540
  };
4451
4541
  AreaChartNormalizedComponent.prototype.getXScale = function (domain, width) {
4452
4542
  var scale;
4453
- if (this.scaleType === 'time') {
4543
+ if (this.scaleType === exports.ɵc.Time) {
4454
4544
  scale = d3Scale.scaleTime();
4455
4545
  }
4456
- else if (this.scaleType === 'linear') {
4546
+ else if (this.scaleType === exports.ɵc.Linear) {
4457
4547
  scale = d3Scale.scaleLinear();
4458
4548
  }
4459
- else if (this.scaleType === 'ordinal') {
4549
+ else if (this.scaleType === exports.ɵc.Ordinal) {
4460
4550
  scale = d3Scale.scalePoint().padding(0.1);
4461
4551
  }
4462
4552
  scale.range([0, width]).domain(domain);
@@ -4490,7 +4580,7 @@
4490
4580
  };
4491
4581
  AreaChartNormalizedComponent.prototype.setColors = function () {
4492
4582
  var domain;
4493
- if (this.schemeType === 'ordinal') {
4583
+ if (this.schemeType === exports.ɵc.Ordinal) {
4494
4584
  domain = this.seriesDomain;
4495
4585
  }
4496
4586
  else {
@@ -4506,7 +4596,7 @@
4506
4596
  title: undefined,
4507
4597
  position: this.legendPosition
4508
4598
  };
4509
- if (opts.scaleType === 'ordinal') {
4599
+ if (opts.scaleType === exports.ɵc.Ordinal) {
4510
4600
  opts.domain = this.seriesDomain;
4511
4601
  opts.colors = this.colors;
4512
4602
  opts.title = this.legendTitle;
@@ -4614,7 +4704,10 @@
4614
4704
  var _this = _super.apply(this, __spread(arguments)) || this;
4615
4705
  _this.legend = false;
4616
4706
  _this.legendTitle = 'Legend';
4617
- _this.legendPosition = 'right';
4707
+ _this.legendPosition = exports.LegendPosition.Right;
4708
+ _this.xAxis = false;
4709
+ _this.yAxis = false;
4710
+ _this.timeline = false;
4618
4711
  _this.showGridLines = true;
4619
4712
  _this.curve = d3Shape.curveLinear;
4620
4713
  _this.activeEntries = [];
@@ -4672,7 +4765,7 @@
4672
4765
  var d = group.series.find(function (item) {
4673
4766
  var a = item.name;
4674
4767
  var b = val;
4675
- if (_this.scaleType === 'time') {
4768
+ if (_this.scaleType === exports.ɵc.Time) {
4676
4769
  a = a.valueOf();
4677
4770
  b = b.valueOf();
4678
4771
  }
@@ -4726,16 +4819,16 @@
4726
4819
  var values = getUniqueXDomainValues(this.results);
4727
4820
  this.scaleType = getScaleType(values);
4728
4821
  var domain = [];
4729
- if (this.scaleType === 'linear') {
4822
+ if (this.scaleType === exports.ɵc.Linear) {
4730
4823
  values = values.map(function (v) { return Number(v); });
4731
4824
  }
4732
4825
  var min;
4733
4826
  var max;
4734
- if (this.scaleType === 'time' || this.scaleType === 'linear') {
4827
+ if (this.scaleType === exports.ɵc.Time || this.scaleType === exports.ɵc.Linear) {
4735
4828
  min = this.xScaleMin ? this.xScaleMin : Math.min.apply(Math, __spread(values));
4736
4829
  max = this.xScaleMax ? this.xScaleMax : Math.max.apply(Math, __spread(values));
4737
4830
  }
4738
- if (this.scaleType === 'time') {
4831
+ if (this.scaleType === exports.ɵc.Time) {
4739
4832
  domain = [new Date(min), new Date(max)];
4740
4833
  this.xSet = __spread(values).sort(function (a, b) {
4741
4834
  var aDate = a.getTime();
@@ -4747,7 +4840,7 @@
4747
4840
  return 0;
4748
4841
  });
4749
4842
  }
4750
- else if (this.scaleType === 'linear') {
4843
+ else if (this.scaleType === exports.ɵc.Linear) {
4751
4844
  domain = [min, max];
4752
4845
  // Use compare function to sort numbers numerically
4753
4846
  this.xSet = __spread(values).sort(function (a, b) { return a - b; });
@@ -4771,7 +4864,7 @@
4771
4864
  var d = group.series.find(function (item) {
4772
4865
  var a = item.name;
4773
4866
  var b = val;
4774
- if (_this.scaleType === 'time') {
4867
+ if (_this.scaleType === exports.ɵc.Time) {
4775
4868
  a = a.valueOf();
4776
4869
  b = b.valueOf();
4777
4870
  }
@@ -4804,13 +4897,13 @@
4804
4897
  };
4805
4898
  AreaChartStackedComponent.prototype.getXScale = function (domain, width) {
4806
4899
  var scale;
4807
- if (this.scaleType === 'time') {
4900
+ if (this.scaleType === exports.ɵc.Time) {
4808
4901
  scale = d3Scale.scaleTime();
4809
4902
  }
4810
- else if (this.scaleType === 'linear') {
4903
+ else if (this.scaleType === exports.ɵc.Linear) {
4811
4904
  scale = d3Scale.scaleLinear();
4812
4905
  }
4813
- else if (this.scaleType === 'ordinal') {
4906
+ else if (this.scaleType === exports.ɵc.Ordinal) {
4814
4907
  scale = d3Scale.scalePoint().padding(0.1);
4815
4908
  }
4816
4909
  scale.range([0, width]).domain(domain);
@@ -4844,7 +4937,7 @@
4844
4937
  };
4845
4938
  AreaChartStackedComponent.prototype.setColors = function () {
4846
4939
  var domain;
4847
- if (this.schemeType === 'ordinal') {
4940
+ if (this.schemeType === exports.ɵc.Ordinal) {
4848
4941
  domain = this.seriesDomain;
4849
4942
  }
4850
4943
  else {
@@ -4860,7 +4953,7 @@
4860
4953
  title: undefined,
4861
4954
  position: this.legendPosition
4862
4955
  };
4863
- if (opts.scaleType === 'ordinal') {
4956
+ if (opts.scaleType === exports.ɵc.Ordinal) {
4864
4957
  opts.domain = this.seriesDomain;
4865
4958
  opts.colors = this.colors;
4866
4959
  opts.title = this.legendTitle;
@@ -5058,10 +5151,10 @@
5058
5151
  startingArea.curve(this.curve);
5059
5152
  this.opacity = 0.8;
5060
5153
  var data = this.data.series;
5061
- if (this.scaleType === 'linear') {
5154
+ if (this.scaleType === exports.ɵc.Linear) {
5062
5155
  data = sortLinear(data, 'name');
5063
5156
  }
5064
- else if (this.scaleType === 'time') {
5157
+ else if (this.scaleType === exports.ɵc.Time) {
5065
5158
  data = sortByTime(data, 'name');
5066
5159
  }
5067
5160
  else {
@@ -5071,7 +5164,7 @@
5071
5164
  this.startingPath = startingArea(data);
5072
5165
  };
5073
5166
  AreaSeriesComponent.prototype.updateGradient = function () {
5074
- if (this.colors.scaleType === 'linear') {
5167
+ if (this.colors.scaleType === exports.ɵc.Linear) {
5075
5168
  this.hasGradient = true;
5076
5169
  if (this.stacked || this.normalized) {
5077
5170
  var d0values = this.data.series.map(function (d) { return d.d0; });
@@ -5145,6 +5238,11 @@
5145
5238
  },] }
5146
5239
  ];
5147
5240
 
5241
+ var BarOrientation;
5242
+ (function (BarOrientation) {
5243
+ BarOrientation["Vertical"] = "vertical";
5244
+ BarOrientation["Horizontal"] = "horizontal";
5245
+ })(BarOrientation || (BarOrientation = {}));
5148
5246
  var BarComponent = /** @class */ (function () {
5149
5247
  function BarComponent(element) {
5150
5248
  this.roundEdges = true;
@@ -5217,20 +5315,20 @@
5217
5315
  var radius = this.getRadius();
5218
5316
  var path;
5219
5317
  if (this.roundEdges) {
5220
- if (this.orientation === 'vertical') {
5318
+ if (this.orientation === BarOrientation.Vertical) {
5221
5319
  radius = Math.min(this.height, radius);
5222
5320
  path = roundedRect(this.x, this.y + this.height, this.width, 1, 0, this.edges);
5223
5321
  }
5224
- else if (this.orientation === 'horizontal') {
5322
+ else if (this.orientation === BarOrientation.Horizontal) {
5225
5323
  radius = Math.min(this.width, radius);
5226
5324
  path = roundedRect(this.x, this.y, 1, this.height, 0, this.edges);
5227
5325
  }
5228
5326
  }
5229
5327
  else {
5230
- if (this.orientation === 'vertical') {
5328
+ if (this.orientation === BarOrientation.Vertical) {
5231
5329
  path = roundedRect(this.x, this.y + this.height, this.width, 1, 0, this.edges);
5232
5330
  }
5233
- else if (this.orientation === 'horizontal') {
5331
+ else if (this.orientation === BarOrientation.Horizontal) {
5234
5332
  path = roundedRect(this.x, this.y, 1, this.height, 0, this.edges);
5235
5333
  }
5236
5334
  }
@@ -5273,7 +5371,7 @@
5273
5371
  get: function () {
5274
5372
  var edges = [false, false, false, false];
5275
5373
  if (this.roundEdges) {
5276
- if (this.orientation === 'vertical') {
5374
+ if (this.orientation === BarOrientation.Vertical) {
5277
5375
  if (this.data.value > 0) {
5278
5376
  edges = [true, true, false, false];
5279
5377
  }
@@ -5281,7 +5379,7 @@
5281
5379
  edges = [false, false, true, true];
5282
5380
  }
5283
5381
  }
5284
- else if (this.orientation === 'horizontal') {
5382
+ else if (this.orientation === BarOrientation.Horizontal) {
5285
5383
  if (this.data.value > 0) {
5286
5384
  edges = [false, true, false, true];
5287
5385
  }
@@ -5304,8 +5402,8 @@
5304
5402
  BarComponent.prototype.checkToHideBar = function () {
5305
5403
  this.hideBar =
5306
5404
  this.noBarWhenZero &&
5307
- ((this.orientation === 'vertical' && this.height === 0) ||
5308
- (this.orientation === 'horizontal' && this.width === 0));
5405
+ ((this.orientation === BarOrientation.Vertical && this.height === 0) ||
5406
+ (this.orientation === BarOrientation.Horizontal && this.width === 0));
5309
5407
  };
5310
5408
  return BarComponent;
5311
5409
  }());
@@ -5348,7 +5446,7 @@
5348
5446
  var _this = _super.apply(this, __spread(arguments)) || this;
5349
5447
  _this.legend = false;
5350
5448
  _this.legendTitle = 'Legend';
5351
- _this.legendPosition = 'right';
5449
+ _this.legendPosition = exports.LegendPosition.Right;
5352
5450
  _this.tooltipDisabled = false;
5353
5451
  _this.showGridLines = true;
5354
5452
  _this.activeEntries = [];
@@ -5421,7 +5519,7 @@
5421
5519
  };
5422
5520
  BarHorizontalComponent.prototype.setColors = function () {
5423
5521
  var domain;
5424
- if (this.schemeType === 'ordinal') {
5522
+ if (this.schemeType === exports.ɵc.Ordinal) {
5425
5523
  domain = this.yDomain;
5426
5524
  }
5427
5525
  else {
@@ -5560,7 +5658,7 @@
5560
5658
  var _this = _super.apply(this, __spread(arguments)) || this;
5561
5659
  _this.legend = false;
5562
5660
  _this.legendTitle = 'Legend';
5563
- _this.legendPosition = 'right';
5661
+ _this.legendPosition = exports.LegendPosition.Right;
5564
5662
  _this.tooltipDisabled = false;
5565
5663
  _this.showGridLines = true;
5566
5664
  _this.activeEntries = [];
@@ -5606,7 +5704,7 @@
5606
5704
  this.formatDates();
5607
5705
  this.groupDomain = this.getGroupDomain();
5608
5706
  this.innerDomain = this.getInnerDomain();
5609
- this.valuesDomain = this.getValueDomain();
5707
+ this.valueDomain = this.getValueDomain();
5610
5708
  this.groupScale = this.getGroupScale();
5611
5709
  this.innerScale = this.getInnerScale();
5612
5710
  this.valueScale = this.getValueScale();
@@ -5628,7 +5726,7 @@
5628
5726
  return d3Scale.scaleBand().rangeRound([0, height]).paddingInner(spacing).domain(this.innerDomain);
5629
5727
  };
5630
5728
  BarHorizontal2DComponent.prototype.getValueScale = function () {
5631
- var scale = d3Scale.scaleLinear().range([0, this.dims.width]).domain(this.valuesDomain);
5729
+ var scale = d3Scale.scaleLinear().range([0, this.dims.width]).domain(this.valueDomain);
5632
5730
  return this.roundDomains ? scale.nice() : scale;
5633
5731
  };
5634
5732
  BarHorizontal2DComponent.prototype.getGroupDomain = function () {
@@ -5731,11 +5829,11 @@
5731
5829
  };
5732
5830
  BarHorizontal2DComponent.prototype.setColors = function () {
5733
5831
  var domain;
5734
- if (this.schemeType === 'ordinal') {
5832
+ if (this.schemeType === exports.ɵc.Ordinal) {
5735
5833
  domain = this.innerDomain;
5736
5834
  }
5737
5835
  else {
5738
- domain = this.valuesDomain;
5836
+ domain = this.valueDomain;
5739
5837
  }
5740
5838
  this.colors = new ColorHelper(this.scheme, this.schemeType, domain, this.customColors);
5741
5839
  };
@@ -5747,13 +5845,13 @@
5747
5845
  title: undefined,
5748
5846
  position: this.legendPosition
5749
5847
  };
5750
- if (opts.scaleType === 'ordinal') {
5848
+ if (opts.scaleType === exports.ɵc.Ordinal) {
5751
5849
  opts.domain = this.innerDomain;
5752
5850
  opts.colors = this.colors;
5753
5851
  opts.title = this.legendTitle;
5754
5852
  }
5755
5853
  else {
5756
- opts.domain = this.valuesDomain;
5854
+ opts.domain = this.valueDomain;
5757
5855
  opts.colors = this.colors.scale;
5758
5856
  }
5759
5857
  return opts;
@@ -5881,7 +5979,7 @@
5881
5979
  var _this = _super.apply(this, __spread(arguments)) || this;
5882
5980
  _this.legend = false;
5883
5981
  _this.legendTitle = 'Legend';
5884
- _this.legendPosition = 'right';
5982
+ _this.legendPosition = exports.LegendPosition.Right;
5885
5983
  _this.tooltipDisabled = false;
5886
5984
  _this.showGridLines = true;
5887
5985
  _this.activeEntries = [];
@@ -5895,6 +5993,7 @@
5895
5993
  _this.noBarWhenZero = true;
5896
5994
  _this.activate = new core.EventEmitter();
5897
5995
  _this.deactivate = new core.EventEmitter();
5996
+ _this.valueDomain = [0, 100];
5898
5997
  _this.margin = [10, 20, 10, 20];
5899
5998
  _this.xAxisHeight = 0;
5900
5999
  _this.yAxisWidth = 0;
@@ -5919,7 +6018,6 @@
5919
6018
  this.formatDates();
5920
6019
  this.groupDomain = this.getGroupDomain();
5921
6020
  this.innerDomain = this.getInnerDomain();
5922
- this.valueDomain = this.getValueDomain();
5923
6021
  this.xScale = this.getXScale();
5924
6022
  this.yScale = this.getYScale();
5925
6023
  this.setColors();
@@ -5978,9 +6076,6 @@
5978
6076
  }
5979
6077
  return domain;
5980
6078
  };
5981
- BarHorizontalNormalizedComponent.prototype.getValueDomain = function () {
5982
- return [0, 100];
5983
- };
5984
6079
  BarHorizontalNormalizedComponent.prototype.getYScale = function () {
5985
6080
  var spacing = this.groupDomain.length / (this.dims.height / this.barPadding + 1);
5986
6081
  return d3Scale.scaleBand().rangeRound([0, this.dims.height]).paddingInner(spacing).domain(this.groupDomain);
@@ -6003,7 +6098,7 @@
6003
6098
  };
6004
6099
  BarHorizontalNormalizedComponent.prototype.setColors = function () {
6005
6100
  var domain;
6006
- if (this.schemeType === 'ordinal') {
6101
+ if (this.schemeType === exports.ɵc.Ordinal) {
6007
6102
  domain = this.innerDomain;
6008
6103
  }
6009
6104
  else {
@@ -6019,7 +6114,7 @@
6019
6114
  title: undefined,
6020
6115
  position: this.legendPosition
6021
6116
  };
6022
- if (opts.scaleType === 'ordinal') {
6117
+ if (opts.scaleType === exports.ɵc.Ordinal) {
6023
6118
  opts.domain = this.innerDomain;
6024
6119
  opts.colors = this.colors;
6025
6120
  opts.title = this.legendTitle;
@@ -6136,7 +6231,7 @@
6136
6231
  var _this = _super.apply(this, __spread(arguments)) || this;
6137
6232
  _this.legend = false;
6138
6233
  _this.legendTitle = 'Legend';
6139
- _this.legendPosition = 'right';
6234
+ _this.legendPosition = exports.LegendPosition.Right;
6140
6235
  _this.tooltipDisabled = false;
6141
6236
  _this.showGridLines = true;
6142
6237
  _this.activeEntries = [];
@@ -6308,7 +6403,7 @@
6308
6403
  };
6309
6404
  BarHorizontalStackedComponent.prototype.setColors = function () {
6310
6405
  var domain;
6311
- if (this.schemeType === 'ordinal') {
6406
+ if (this.schemeType === exports.ɵc.Ordinal) {
6312
6407
  domain = this.innerDomain;
6313
6408
  }
6314
6409
  else {
@@ -6324,7 +6419,7 @@
6324
6419
  title: undefined,
6325
6420
  position: this.legendPosition
6326
6421
  };
6327
- if (opts.scaleType === 'ordinal') {
6422
+ if (opts.scaleType === exports.ɵc.Ordinal) {
6328
6423
  opts.domain = this.innerDomain;
6329
6424
  opts.colors = this.colors;
6330
6425
  opts.title = this.legendTitle;
@@ -6456,7 +6551,7 @@
6456
6551
  var _this = _super.apply(this, __spread(arguments)) || this;
6457
6552
  _this.legend = false;
6458
6553
  _this.legendTitle = 'Legend';
6459
- _this.legendPosition = 'right';
6554
+ _this.legendPosition = exports.LegendPosition.Right;
6460
6555
  _this.tooltipDisabled = false;
6461
6556
  _this.showGridLines = true;
6462
6557
  _this.activeEntries = [];
@@ -6538,7 +6633,7 @@
6538
6633
  };
6539
6634
  BarVerticalComponent.prototype.setColors = function () {
6540
6635
  var domain;
6541
- if (this.schemeType === 'ordinal') {
6636
+ if (this.schemeType === exports.ɵc.Ordinal) {
6542
6637
  domain = this.xDomain;
6543
6638
  }
6544
6639
  else {
@@ -6554,7 +6649,7 @@
6554
6649
  title: undefined,
6555
6650
  position: this.legendPosition
6556
6651
  };
6557
- if (opts.scaleType === 'ordinal') {
6652
+ if (opts.scaleType === exports.ɵc.Ordinal) {
6558
6653
  opts.domain = this.xDomain;
6559
6654
  opts.colors = this.colors;
6560
6655
  opts.title = this.legendTitle;
@@ -6677,9 +6772,9 @@
6677
6772
  var _this = _super.apply(this, __spread(arguments)) || this;
6678
6773
  _this.legend = false;
6679
6774
  _this.legendTitle = 'Legend';
6680
- _this.legendPosition = 'right';
6775
+ _this.legendPosition = exports.LegendPosition.Right;
6681
6776
  _this.tooltipDisabled = false;
6682
- _this.scaleType = 'ordinal';
6777
+ _this.scaleType = exports.ɵc.Ordinal;
6683
6778
  _this.showGridLines = true;
6684
6779
  _this.activeEntries = [];
6685
6780
  _this.trimXAxisTicks = true;
@@ -6727,7 +6822,7 @@
6727
6822
  this.formatDates();
6728
6823
  this.groupDomain = this.getGroupDomain();
6729
6824
  this.innerDomain = this.getInnerDomain();
6730
- this.valuesDomain = this.getValueDomain();
6825
+ this.valueDomain = this.getValueDomain();
6731
6826
  this.groupScale = this.getGroupScale();
6732
6827
  this.innerScale = this.getInnerScale();
6733
6828
  this.valueScale = this.getValueScale();
@@ -6761,7 +6856,7 @@
6761
6856
  return d3Scale.scaleBand().rangeRound([0, width]).paddingInner(spacing).domain(this.innerDomain);
6762
6857
  };
6763
6858
  BarVertical2DComponent.prototype.getValueScale = function () {
6764
- var scale = d3Scale.scaleLinear().range([this.dims.height, 0]).domain(this.valuesDomain);
6859
+ var scale = d3Scale.scaleLinear().range([this.dims.height, 0]).domain(this.valueDomain);
6765
6860
  return this.roundDomains ? scale.nice() : scale;
6766
6861
  };
6767
6862
  BarVertical2DComponent.prototype.getGroupDomain = function () {
@@ -6864,11 +6959,11 @@
6864
6959
  };
6865
6960
  BarVertical2DComponent.prototype.setColors = function () {
6866
6961
  var domain;
6867
- if (this.schemeType === 'ordinal') {
6962
+ if (this.schemeType === exports.ɵc.Ordinal) {
6868
6963
  domain = this.innerDomain;
6869
6964
  }
6870
6965
  else {
6871
- domain = this.valuesDomain;
6966
+ domain = this.valueDomain;
6872
6967
  }
6873
6968
  this.colors = new ColorHelper(this.scheme, this.schemeType, domain, this.customColors);
6874
6969
  };
@@ -6880,13 +6975,13 @@
6880
6975
  title: undefined,
6881
6976
  position: this.legendPosition
6882
6977
  };
6883
- if (opts.scaleType === 'ordinal') {
6978
+ if (opts.scaleType === exports.ɵc.Ordinal) {
6884
6979
  opts.domain = this.innerDomain;
6885
6980
  opts.colors = this.colors;
6886
6981
  opts.title = this.legendTitle;
6887
6982
  }
6888
6983
  else {
6889
- opts.domain = this.valuesDomain;
6984
+ opts.domain = this.valueDomain;
6890
6985
  opts.colors = this.colors.scale;
6891
6986
  }
6892
6987
  return opts;
@@ -7003,7 +7098,7 @@
7003
7098
  var _this = _super.apply(this, __spread(arguments)) || this;
7004
7099
  _this.legend = false;
7005
7100
  _this.legendTitle = 'Legend';
7006
- _this.legendPosition = 'right';
7101
+ _this.legendPosition = exports.LegendPosition.Right;
7007
7102
  _this.tooltipDisabled = false;
7008
7103
  _this.showGridLines = true;
7009
7104
  _this.activeEntries = [];
@@ -7017,6 +7112,7 @@
7017
7112
  _this.noBarWhenZero = true;
7018
7113
  _this.activate = new core.EventEmitter();
7019
7114
  _this.deactivate = new core.EventEmitter();
7115
+ _this.valueDomain = [0, 100];
7020
7116
  _this.margin = [10, 20, 10, 20];
7021
7117
  _this.xAxisHeight = 0;
7022
7118
  _this.yAxisWidth = 0;
@@ -7041,7 +7137,6 @@
7041
7137
  this.formatDates();
7042
7138
  this.groupDomain = this.getGroupDomain();
7043
7139
  this.innerDomain = this.getInnerDomain();
7044
- this.valueDomain = this.getValueDomain();
7045
7140
  this.xScale = this.getXScale();
7046
7141
  this.yScale = this.getYScale();
7047
7142
  this.setColors();
@@ -7100,9 +7195,6 @@
7100
7195
  }
7101
7196
  return domain;
7102
7197
  };
7103
- BarVerticalNormalizedComponent.prototype.getValueDomain = function () {
7104
- return [0, 100];
7105
- };
7106
7198
  BarVerticalNormalizedComponent.prototype.getXScale = function () {
7107
7199
  var spacing = this.groupDomain.length / (this.dims.width / this.barPadding + 1);
7108
7200
  return d3Scale.scaleBand().rangeRound([0, this.dims.width]).paddingInner(spacing).domain(this.groupDomain);
@@ -7125,7 +7217,7 @@
7125
7217
  };
7126
7218
  BarVerticalNormalizedComponent.prototype.setColors = function () {
7127
7219
  var domain;
7128
- if (this.schemeType === 'ordinal') {
7220
+ if (this.schemeType === exports.ɵc.Ordinal) {
7129
7221
  domain = this.innerDomain;
7130
7222
  }
7131
7223
  else {
@@ -7141,7 +7233,7 @@
7141
7233
  title: undefined,
7142
7234
  position: this.legendPosition
7143
7235
  };
7144
- if (opts.scaleType === 'ordinal') {
7236
+ if (opts.scaleType === exports.ɵc.Ordinal) {
7145
7237
  opts.domain = this.innerDomain;
7146
7238
  opts.colors = this.colors;
7147
7239
  opts.title = this.legendTitle;
@@ -7258,7 +7350,7 @@
7258
7350
  var _this = _super.apply(this, __spread(arguments)) || this;
7259
7351
  _this.legend = false;
7260
7352
  _this.legendTitle = 'Legend';
7261
- _this.legendPosition = 'right';
7353
+ _this.legendPosition = exports.LegendPosition.Right;
7262
7354
  _this.tooltipDisabled = false;
7263
7355
  _this.showGridLines = true;
7264
7356
  _this.activeEntries = [];
@@ -7445,7 +7537,7 @@
7445
7537
  };
7446
7538
  BarVerticalStackedComponent.prototype.setColors = function () {
7447
7539
  var domain;
7448
- if (this.schemeType === 'ordinal') {
7540
+ if (this.schemeType === exports.ɵc.Ordinal) {
7449
7541
  domain = this.innerDomain;
7450
7542
  }
7451
7543
  else {
@@ -7461,7 +7553,7 @@
7461
7553
  title: undefined,
7462
7554
  position: this.legendPosition
7463
7555
  };
7464
- if (opts.scaleType === 'ordinal') {
7556
+ if (opts.scaleType === exports.ɵc.Ordinal) {
7465
7557
  opts.domain = this.innerDomain;
7466
7558
  opts.colors = this.colors;
7467
7559
  opts.title = this.legendTitle;
@@ -7575,13 +7667,20 @@
7575
7667
  tooltipTemplate: [{ type: core.ContentChild, args: ['tooltipTemplate',] }]
7576
7668
  };
7577
7669
 
7670
+ (function (BarChartType) {
7671
+ BarChartType["Standard"] = "standard";
7672
+ BarChartType["Normalized"] = "normalized";
7673
+ BarChartType["Stacked"] = "stacked";
7674
+ })(exports.BarChartType || (exports.BarChartType = {}));
7675
+
7578
7676
  (function (D0Types) {
7579
7677
  D0Types["positive"] = "positive";
7580
7678
  D0Types["negative"] = "negative";
7581
7679
  })(exports.D0Types || (exports.D0Types = {}));
7582
- var SeriesVerticalComponent = /** @class */ (function () {
7583
- function SeriesVerticalComponent() {
7584
- this.type = 'standard';
7680
+
7681
+ var SeriesHorizontal = /** @class */ (function () {
7682
+ function SeriesHorizontal() {
7683
+ this.type = exports.BarChartType.Standard;
7585
7684
  this.tooltipDisabled = false;
7586
7685
  this.animations = true;
7587
7686
  this.showDataLabel = false;
@@ -7589,32 +7688,28 @@
7589
7688
  this.select = new core.EventEmitter();
7590
7689
  this.activate = new core.EventEmitter();
7591
7690
  this.deactivate = new core.EventEmitter();
7592
- this.dataLabelHeightChanged = new core.EventEmitter();
7691
+ this.dataLabelWidthChanged = new core.EventEmitter();
7593
7692
  this.barsForDataLabels = [];
7594
7693
  }
7595
- SeriesVerticalComponent.prototype.ngOnChanges = function (changes) {
7694
+ SeriesHorizontal.prototype.ngOnChanges = function (changes) {
7596
7695
  this.update();
7597
7696
  };
7598
- SeriesVerticalComponent.prototype.update = function () {
7697
+ SeriesHorizontal.prototype.update = function () {
7599
7698
  var _a;
7600
7699
  var _this = this;
7601
7700
  this.updateTooltipSettings();
7602
- var width;
7603
- if (this.series.length) {
7604
- width = this.xScale.bandwidth();
7605
- }
7606
- width = Math.round(width);
7607
- var yScaleMin = Math.max(this.yScale.domain()[0], 0);
7608
7701
  var d0 = (_a = {},
7609
7702
  _a[exports.D0Types.positive] = 0,
7610
7703
  _a[exports.D0Types.negative] = 0,
7611
7704
  _a);
7612
- var d0Type = exports.D0Types.positive;
7705
+ var d0Type;
7706
+ d0Type = exports.D0Types.positive;
7613
7707
  var total;
7614
- if (this.type === 'normalized') {
7708
+ if (this.type === exports.BarChartType.Normalized) {
7615
7709
  total = this.series.map(function (d) { return d.value; }).reduce(function (sum, d) { return sum + d; }, 0);
7616
7710
  }
7617
- this.bars = this.series.map(function (d, index) {
7711
+ var xScaleMin = Math.max(this.xScale.domain()[0], 0);
7712
+ this.bars = this.series.map(function (d) {
7618
7713
  var value = d.value;
7619
7714
  var label = _this.getLabel(d);
7620
7715
  var formattedLabel = formatLabel(label);
@@ -7625,33 +7720,30 @@
7625
7720
  label: label,
7626
7721
  roundEdges: roundEdges,
7627
7722
  data: d,
7628
- width: width,
7629
- formattedLabel: formattedLabel,
7630
- height: 0,
7631
- x: 0,
7632
- y: 0
7723
+ formattedLabel: formattedLabel
7633
7724
  };
7634
- if (_this.type === 'standard') {
7635
- bar.height = Math.abs(_this.yScale(value) - _this.yScale(yScaleMin));
7636
- bar.x = _this.xScale(label);
7725
+ bar.height = _this.yScale.bandwidth();
7726
+ if (_this.type === exports.BarChartType.Standard) {
7727
+ bar.width = Math.abs(_this.xScale(value) - _this.xScale(xScaleMin));
7637
7728
  if (value < 0) {
7638
- bar.y = _this.yScale(0);
7729
+ bar.x = _this.xScale(value);
7639
7730
  }
7640
7731
  else {
7641
- bar.y = _this.yScale(value);
7732
+ bar.x = _this.xScale(xScaleMin);
7642
7733
  }
7734
+ bar.y = _this.yScale(label);
7643
7735
  }
7644
- else if (_this.type === 'stacked') {
7736
+ else if (_this.type === exports.BarChartType.Stacked) {
7645
7737
  var offset0 = d0[d0Type];
7646
7738
  var offset1 = offset0 + value;
7647
7739
  d0[d0Type] += value;
7648
- bar.height = _this.yScale(offset0) - _this.yScale(offset1);
7649
- bar.x = 0;
7650
- bar.y = _this.yScale(offset1);
7740
+ bar.width = _this.xScale(offset1) - _this.xScale(offset0);
7741
+ bar.x = _this.xScale(offset0);
7742
+ bar.y = 0;
7651
7743
  bar.offset0 = offset0;
7652
7744
  bar.offset1 = offset1;
7653
7745
  }
7654
- else if (_this.type === 'normalized') {
7746
+ else if (_this.type === exports.BarChartType.Normalized) {
7655
7747
  var offset0 = d0[d0Type];
7656
7748
  var offset1 = offset0 + value;
7657
7749
  d0[d0Type] += value;
@@ -7663,18 +7755,18 @@
7663
7755
  offset0 = 0;
7664
7756
  offset1 = 0;
7665
7757
  }
7666
- bar.height = _this.yScale(offset0) - _this.yScale(offset1);
7667
- bar.x = 0;
7668
- bar.y = _this.yScale(offset1);
7758
+ bar.width = _this.xScale(offset1) - _this.xScale(offset0);
7759
+ bar.x = _this.xScale(offset0);
7760
+ bar.y = 0;
7669
7761
  bar.offset0 = offset0;
7670
7762
  bar.offset1 = offset1;
7671
7763
  value = (offset1 - offset0).toFixed(2) + '%';
7672
7764
  }
7673
- if (_this.colors.scaleType === 'ordinal') {
7765
+ if (_this.colors.scaleType === exports.ɵc.Ordinal) {
7674
7766
  bar.color = _this.colors.getColor(label);
7675
7767
  }
7676
7768
  else {
7677
- if (_this.type === 'standard') {
7769
+ if (_this.type === exports.BarChartType.Standard) {
7678
7770
  bar.color = _this.colors.getColor(value);
7679
7771
  bar.gradientStops = _this.colors.getLinearGradientStops(value);
7680
7772
  }
@@ -7697,9 +7789,9 @@
7697
7789
  });
7698
7790
  this.updateDataLabels();
7699
7791
  };
7700
- SeriesVerticalComponent.prototype.updateDataLabels = function () {
7792
+ SeriesHorizontal.prototype.updateDataLabels = function () {
7701
7793
  var _this = this;
7702
- if (this.type === 'stacked') {
7794
+ if (this.type === exports.BarChartType.Stacked) {
7703
7795
  this.barsForDataLabels = [];
7704
7796
  var section = {};
7705
7797
  section.series = this.seriesName;
@@ -7708,13 +7800,14 @@
7708
7800
  section.total = totalPositive + totalNegative;
7709
7801
  section.x = 0;
7710
7802
  section.y = 0;
7803
+ // if total is positive then we show it on the right, otherwise on the left
7711
7804
  if (section.total > 0) {
7712
- section.height = this.yScale(totalPositive);
7805
+ section.width = this.xScale(totalPositive);
7713
7806
  }
7714
7807
  else {
7715
- section.height = this.yScale(totalNegative);
7808
+ section.width = this.xScale(totalNegative);
7716
7809
  }
7717
- section.width = this.xScale.bandwidth();
7810
+ section.height = this.yScale.bandwidth();
7718
7811
  this.barsForDataLabels.push(section);
7719
7812
  }
7720
7813
  else {
@@ -7722,19 +7815,19 @@
7722
7815
  var section = {};
7723
7816
  section.series = _this.seriesName ? _this.seriesName : d.label;
7724
7817
  section.total = d.value;
7725
- section.x = _this.xScale(d.label);
7726
- section.y = _this.yScale(0);
7727
- section.height = _this.yScale(section.total) - _this.yScale(0);
7728
- section.width = _this.xScale.bandwidth();
7818
+ section.x = _this.xScale(0);
7819
+ section.y = _this.yScale(d.label);
7820
+ section.width = _this.xScale(section.total) - _this.xScale(0);
7821
+ section.height = _this.yScale.bandwidth();
7729
7822
  return section;
7730
7823
  });
7731
7824
  }
7732
7825
  };
7733
- SeriesVerticalComponent.prototype.updateTooltipSettings = function () {
7734
- this.tooltipPlacement = this.tooltipDisabled ? undefined : 'top';
7735
- this.tooltipType = this.tooltipDisabled ? undefined : 'tooltip';
7826
+ SeriesHorizontal.prototype.updateTooltipSettings = function () {
7827
+ this.tooltipPlacement = this.tooltipDisabled ? undefined : exports.PlacementTypes.Top;
7828
+ this.tooltipType = this.tooltipDisabled ? undefined : exports.StyleTypes.tooltip;
7736
7829
  };
7737
- SeriesVerticalComponent.prototype.isActive = function (entry) {
7830
+ SeriesHorizontal.prototype.isActive = function (entry) {
7738
7831
  if (!this.activeEntries)
7739
7832
  return false;
7740
7833
  var item = this.activeEntries.find(function (d) {
@@ -7742,27 +7835,27 @@
7742
7835
  });
7743
7836
  return item !== undefined;
7744
7837
  };
7745
- SeriesVerticalComponent.prototype.onClick = function (data) {
7746
- this.select.emit(data);
7747
- };
7748
- SeriesVerticalComponent.prototype.getLabel = function (dataItem) {
7838
+ SeriesHorizontal.prototype.getLabel = function (dataItem) {
7749
7839
  if (dataItem.label) {
7750
7840
  return dataItem.label;
7751
7841
  }
7752
7842
  return dataItem.name;
7753
7843
  };
7754
- SeriesVerticalComponent.prototype.trackBy = function (index, bar) {
7844
+ SeriesHorizontal.prototype.trackBy = function (index, bar) {
7755
7845
  return bar.label;
7756
7846
  };
7757
- SeriesVerticalComponent.prototype.trackDataLabelBy = function (index, barLabel) {
7847
+ SeriesHorizontal.prototype.trackDataLabelBy = function (index, barLabel) {
7758
7848
  return index + '#' + barLabel.series + '#' + barLabel.total;
7759
7849
  };
7760
- return SeriesVerticalComponent;
7850
+ SeriesHorizontal.prototype.click = function (data) {
7851
+ this.select.emit(data);
7852
+ };
7853
+ return SeriesHorizontal;
7761
7854
  }());
7762
- SeriesVerticalComponent.decorators = [
7855
+ SeriesHorizontal.decorators = [
7763
7856
  { type: core.Component, args: [{
7764
- selector: 'g[ngx-charts-series-vertical]',
7765
- template: "\n <svg:g\n ngx-charts-bar\n *ngFor=\"let bar of bars; trackBy: trackBy\"\n [@animationState]=\"'active'\"\n [@.disabled]=\"!animations\"\n [width]=\"bar.width\"\n [height]=\"bar.height\"\n [x]=\"bar.x\"\n [y]=\"bar.y\"\n [fill]=\"bar.color\"\n [stops]=\"bar.gradientStops\"\n [data]=\"bar.data\"\n [orientation]=\"'vertical'\"\n [roundEdges]=\"bar.roundEdges\"\n [gradient]=\"gradient\"\n [ariaLabel]=\"bar.ariaLabel\"\n [isActive]=\"isActive(bar.data)\"\n (select)=\"onClick($event)\"\n (activate)=\"activate.emit($event)\"\n (deactivate)=\"deactivate.emit($event)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"tooltipPlacement\"\n [tooltipType]=\"tooltipType\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : bar.tooltipText\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"bar.data\"\n [noBarWhenZero]=\"noBarWhenZero\"\n [animations]=\"animations\"\n ></svg:g>\n <svg:g *ngIf=\"showDataLabel\">\n <svg:g\n ngx-charts-bar-label\n *ngFor=\"let b of barsForDataLabels; let i = index; trackBy: trackDataLabelBy\"\n [barX]=\"b.x\"\n [barY]=\"b.y\"\n [barWidth]=\"b.width\"\n [barHeight]=\"b.height\"\n [value]=\"b.total\"\n [valueFormatting]=\"dataLabelFormatting\"\n [orientation]=\"'vertical'\"\n (dimensionsChanged)=\"dataLabelHeightChanged.emit({ size: $event, index: i })\"\n />\n </svg:g>\n ",
7857
+ selector: 'g[ngx-charts-series-horizontal]',
7858
+ template: "\n <svg:g\n ngx-charts-bar\n *ngFor=\"let bar of bars; trackBy: trackBy\"\n [@animationState]=\"'active'\"\n [width]=\"bar.width\"\n [height]=\"bar.height\"\n [x]=\"bar.x\"\n [y]=\"bar.y\"\n [fill]=\"bar.color\"\n [stops]=\"bar.gradientStops\"\n [data]=\"bar.data\"\n [orientation]=\"'horizontal'\"\n [roundEdges]=\"bar.roundEdges\"\n (select)=\"click($event)\"\n [gradient]=\"gradient\"\n [isActive]=\"isActive(bar.data)\"\n [ariaLabel]=\"bar.ariaLabel\"\n [animations]=\"animations\"\n (activate)=\"activate.emit($event)\"\n (deactivate)=\"deactivate.emit($event)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"tooltipPlacement\"\n [tooltipType]=\"tooltipType\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : bar.tooltipText\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"bar.data\"\n [noBarWhenZero]=\"noBarWhenZero\"\n ></svg:g>\n <svg:g *ngIf=\"showDataLabel\">\n <svg:g\n ngx-charts-bar-label\n *ngFor=\"let b of barsForDataLabels; let i = index; trackBy: trackDataLabelBy\"\n [barX]=\"b.x\"\n [barY]=\"b.y\"\n [barWidth]=\"b.width\"\n [barHeight]=\"b.height\"\n [value]=\"b.total\"\n [valueFormatting]=\"dataLabelFormatting\"\n [orientation]=\"'horizontal'\"\n (dimensionsChanged)=\"dataLabelWidthChanged.emit({ size: $event, index: i })\"\n />\n </svg:g>\n ",
7766
7859
  changeDetection: core.ChangeDetectionStrategy.OnPush,
7767
7860
  animations: [
7768
7861
  animations.trigger('animationState', [
@@ -7776,17 +7869,17 @@
7776
7869
  ]
7777
7870
  },] }
7778
7871
  ];
7779
- SeriesVerticalComponent.propDecorators = {
7872
+ SeriesHorizontal.propDecorators = {
7780
7873
  dims: [{ type: core.Input }],
7781
7874
  type: [{ type: core.Input }],
7782
7875
  series: [{ type: core.Input }],
7783
7876
  xScale: [{ type: core.Input }],
7784
7877
  yScale: [{ type: core.Input }],
7785
7878
  colors: [{ type: core.Input }],
7879
+ tooltipDisabled: [{ type: core.Input }],
7786
7880
  gradient: [{ type: core.Input }],
7787
7881
  activeEntries: [{ type: core.Input }],
7788
7882
  seriesName: [{ type: core.Input }],
7789
- tooltipDisabled: [{ type: core.Input }],
7790
7883
  tooltipTemplate: [{ type: core.Input }],
7791
7884
  roundEdges: [{ type: core.Input }],
7792
7885
  animations: [{ type: core.Input }],
@@ -7796,13 +7889,12 @@
7796
7889
  select: [{ type: core.Output }],
7797
7890
  activate: [{ type: core.Output }],
7798
7891
  deactivate: [{ type: core.Output }],
7799
- dataLabelHeightChanged: [{ type: core.Output }]
7892
+ dataLabelWidthChanged: [{ type: core.Output }]
7800
7893
  };
7801
7894
 
7802
- var SeriesHorizontal = /** @class */ (function () {
7803
- function SeriesHorizontal() {
7804
- this.barsForDataLabels = [];
7805
- this.type = 'standard';
7895
+ var SeriesVerticalComponent = /** @class */ (function () {
7896
+ function SeriesVerticalComponent() {
7897
+ this.type = exports.BarChartType.Standard;
7806
7898
  this.tooltipDisabled = false;
7807
7899
  this.animations = true;
7808
7900
  this.showDataLabel = false;
@@ -7810,26 +7902,31 @@
7810
7902
  this.select = new core.EventEmitter();
7811
7903
  this.activate = new core.EventEmitter();
7812
7904
  this.deactivate = new core.EventEmitter();
7813
- this.dataLabelWidthChanged = new core.EventEmitter();
7905
+ this.dataLabelHeightChanged = new core.EventEmitter();
7906
+ this.barsForDataLabels = [];
7814
7907
  }
7815
- SeriesHorizontal.prototype.ngOnChanges = function (changes) {
7908
+ SeriesVerticalComponent.prototype.ngOnChanges = function (changes) {
7816
7909
  this.update();
7817
7910
  };
7818
- SeriesHorizontal.prototype.update = function () {
7911
+ SeriesVerticalComponent.prototype.update = function () {
7819
7912
  var _a;
7820
7913
  var _this = this;
7821
7914
  this.updateTooltipSettings();
7915
+ var width;
7916
+ if (this.series.length) {
7917
+ width = this.xScale.bandwidth();
7918
+ }
7919
+ width = Math.round(width);
7920
+ var yScaleMin = Math.max(this.yScale.domain()[0], 0);
7822
7921
  var d0 = (_a = {},
7823
7922
  _a[exports.D0Types.positive] = 0,
7824
7923
  _a[exports.D0Types.negative] = 0,
7825
7924
  _a);
7826
- var d0Type;
7827
- d0Type = exports.D0Types.positive;
7925
+ var d0Type = exports.D0Types.positive;
7828
7926
  var total;
7829
- if (this.type === 'normalized') {
7927
+ if (this.type === exports.BarChartType.Normalized) {
7830
7928
  total = this.series.map(function (d) { return d.value; }).reduce(function (sum, d) { return sum + d; }, 0);
7831
7929
  }
7832
- var xScaleMin = Math.max(this.xScale.domain()[0], 0);
7833
7930
  this.bars = this.series.map(function (d, index) {
7834
7931
  var value = d.value;
7835
7932
  var label = _this.getLabel(d);
@@ -7841,30 +7938,33 @@
7841
7938
  label: label,
7842
7939
  roundEdges: roundEdges,
7843
7940
  data: d,
7844
- formattedLabel: formattedLabel
7941
+ width: width,
7942
+ formattedLabel: formattedLabel,
7943
+ height: 0,
7944
+ x: 0,
7945
+ y: 0
7845
7946
  };
7846
- bar.height = _this.yScale.bandwidth();
7847
- if (_this.type === 'standard') {
7848
- bar.width = Math.abs(_this.xScale(value) - _this.xScale(xScaleMin));
7947
+ if (_this.type === exports.BarChartType.Standard) {
7948
+ bar.height = Math.abs(_this.yScale(value) - _this.yScale(yScaleMin));
7949
+ bar.x = _this.xScale(label);
7849
7950
  if (value < 0) {
7850
- bar.x = _this.xScale(value);
7951
+ bar.y = _this.yScale(0);
7851
7952
  }
7852
7953
  else {
7853
- bar.x = _this.xScale(xScaleMin);
7954
+ bar.y = _this.yScale(value);
7854
7955
  }
7855
- bar.y = _this.yScale(label);
7856
7956
  }
7857
- else if (_this.type === 'stacked') {
7957
+ else if (_this.type === exports.BarChartType.Stacked) {
7858
7958
  var offset0 = d0[d0Type];
7859
7959
  var offset1 = offset0 + value;
7860
7960
  d0[d0Type] += value;
7861
- bar.width = _this.xScale(offset1) - _this.xScale(offset0);
7862
- bar.x = _this.xScale(offset0);
7863
- bar.y = 0;
7961
+ bar.height = _this.yScale(offset0) - _this.yScale(offset1);
7962
+ bar.x = 0;
7963
+ bar.y = _this.yScale(offset1);
7864
7964
  bar.offset0 = offset0;
7865
7965
  bar.offset1 = offset1;
7866
7966
  }
7867
- else if (_this.type === 'normalized') {
7967
+ else if (_this.type === exports.BarChartType.Normalized) {
7868
7968
  var offset0 = d0[d0Type];
7869
7969
  var offset1 = offset0 + value;
7870
7970
  d0[d0Type] += value;
@@ -7876,18 +7976,18 @@
7876
7976
  offset0 = 0;
7877
7977
  offset1 = 0;
7878
7978
  }
7879
- bar.width = _this.xScale(offset1) - _this.xScale(offset0);
7880
- bar.x = _this.xScale(offset0);
7881
- bar.y = 0;
7979
+ bar.height = _this.yScale(offset0) - _this.yScale(offset1);
7980
+ bar.x = 0;
7981
+ bar.y = _this.yScale(offset1);
7882
7982
  bar.offset0 = offset0;
7883
7983
  bar.offset1 = offset1;
7884
7984
  value = (offset1 - offset0).toFixed(2) + '%';
7885
7985
  }
7886
- if (_this.colors.scaleType === 'ordinal') {
7986
+ if (_this.colors.scaleType === exports.ɵc.Ordinal) {
7887
7987
  bar.color = _this.colors.getColor(label);
7888
7988
  }
7889
7989
  else {
7890
- if (_this.type === 'standard') {
7990
+ if (_this.type === exports.BarChartType.Standard) {
7891
7991
  bar.color = _this.colors.getColor(value);
7892
7992
  bar.gradientStops = _this.colors.getLinearGradientStops(value);
7893
7993
  }
@@ -7910,9 +8010,9 @@
7910
8010
  });
7911
8011
  this.updateDataLabels();
7912
8012
  };
7913
- SeriesHorizontal.prototype.updateDataLabels = function () {
8013
+ SeriesVerticalComponent.prototype.updateDataLabels = function () {
7914
8014
  var _this = this;
7915
- if (this.type === 'stacked') {
8015
+ if (this.type === exports.BarChartType.Stacked) {
7916
8016
  this.barsForDataLabels = [];
7917
8017
  var section = {};
7918
8018
  section.series = this.seriesName;
@@ -7921,14 +8021,13 @@
7921
8021
  section.total = totalPositive + totalNegative;
7922
8022
  section.x = 0;
7923
8023
  section.y = 0;
7924
- // if total is positive then we show it on the right, otherwise on the left
7925
8024
  if (section.total > 0) {
7926
- section.width = this.xScale(totalPositive);
8025
+ section.height = this.yScale(totalPositive);
7927
8026
  }
7928
8027
  else {
7929
- section.width = this.xScale(totalNegative);
8028
+ section.height = this.yScale(totalNegative);
7930
8029
  }
7931
- section.height = this.yScale.bandwidth();
8030
+ section.width = this.xScale.bandwidth();
7932
8031
  this.barsForDataLabels.push(section);
7933
8032
  }
7934
8033
  else {
@@ -7936,19 +8035,19 @@
7936
8035
  var section = {};
7937
8036
  section.series = _this.seriesName ? _this.seriesName : d.label;
7938
8037
  section.total = d.value;
7939
- section.x = _this.xScale(0);
7940
- section.y = _this.yScale(d.label);
7941
- section.width = _this.xScale(section.total) - _this.xScale(0);
7942
- section.height = _this.yScale.bandwidth();
8038
+ section.x = _this.xScale(d.label);
8039
+ section.y = _this.yScale(0);
8040
+ section.height = _this.yScale(section.total) - _this.yScale(0);
8041
+ section.width = _this.xScale.bandwidth();
7943
8042
  return section;
7944
8043
  });
7945
8044
  }
7946
8045
  };
7947
- SeriesHorizontal.prototype.updateTooltipSettings = function () {
7948
- this.tooltipPlacement = this.tooltipDisabled ? undefined : 'top';
7949
- this.tooltipType = this.tooltipDisabled ? undefined : 'tooltip';
8046
+ SeriesVerticalComponent.prototype.updateTooltipSettings = function () {
8047
+ this.tooltipPlacement = this.tooltipDisabled ? undefined : exports.PlacementTypes.Top;
8048
+ this.tooltipType = this.tooltipDisabled ? undefined : exports.StyleTypes.tooltip;
7950
8049
  };
7951
- SeriesHorizontal.prototype.isActive = function (entry) {
8050
+ SeriesVerticalComponent.prototype.isActive = function (entry) {
7952
8051
  if (!this.activeEntries)
7953
8052
  return false;
7954
8053
  var item = this.activeEntries.find(function (d) {
@@ -7956,27 +8055,27 @@
7956
8055
  });
7957
8056
  return item !== undefined;
7958
8057
  };
7959
- SeriesHorizontal.prototype.getLabel = function (dataItem) {
8058
+ SeriesVerticalComponent.prototype.onClick = function (data) {
8059
+ this.select.emit(data);
8060
+ };
8061
+ SeriesVerticalComponent.prototype.getLabel = function (dataItem) {
7960
8062
  if (dataItem.label) {
7961
8063
  return dataItem.label;
7962
8064
  }
7963
8065
  return dataItem.name;
7964
8066
  };
7965
- SeriesHorizontal.prototype.trackBy = function (index, bar) {
8067
+ SeriesVerticalComponent.prototype.trackBy = function (index, bar) {
7966
8068
  return bar.label;
7967
8069
  };
7968
- SeriesHorizontal.prototype.trackDataLabelBy = function (index, barLabel) {
8070
+ SeriesVerticalComponent.prototype.trackDataLabelBy = function (index, barLabel) {
7969
8071
  return index + '#' + barLabel.series + '#' + barLabel.total;
7970
8072
  };
7971
- SeriesHorizontal.prototype.click = function (data) {
7972
- this.select.emit(data);
7973
- };
7974
- return SeriesHorizontal;
8073
+ return SeriesVerticalComponent;
7975
8074
  }());
7976
- SeriesHorizontal.decorators = [
8075
+ SeriesVerticalComponent.decorators = [
7977
8076
  { type: core.Component, args: [{
7978
- selector: 'g[ngx-charts-series-horizontal]',
7979
- template: "\n <svg:g\n ngx-charts-bar\n *ngFor=\"let bar of bars; trackBy: trackBy\"\n [@animationState]=\"'active'\"\n [width]=\"bar.width\"\n [height]=\"bar.height\"\n [x]=\"bar.x\"\n [y]=\"bar.y\"\n [fill]=\"bar.color\"\n [stops]=\"bar.gradientStops\"\n [data]=\"bar.data\"\n [orientation]=\"'horizontal'\"\n [roundEdges]=\"bar.roundEdges\"\n (select)=\"click($event)\"\n [gradient]=\"gradient\"\n [isActive]=\"isActive(bar.data)\"\n [ariaLabel]=\"bar.ariaLabel\"\n [animations]=\"animations\"\n (activate)=\"activate.emit($event)\"\n (deactivate)=\"deactivate.emit($event)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"tooltipPlacement\"\n [tooltipType]=\"tooltipType\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : bar.tooltipText\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"bar.data\"\n [noBarWhenZero]=\"noBarWhenZero\"\n ></svg:g>\n <svg:g *ngIf=\"showDataLabel\">\n <svg:g\n ngx-charts-bar-label\n *ngFor=\"let b of barsForDataLabels; let i = index; trackBy: trackDataLabelBy\"\n [barX]=\"b.x\"\n [barY]=\"b.y\"\n [barWidth]=\"b.width\"\n [barHeight]=\"b.height\"\n [value]=\"b.total\"\n [valueFormatting]=\"dataLabelFormatting\"\n [orientation]=\"'horizontal'\"\n (dimensionsChanged)=\"dataLabelWidthChanged.emit({ size: $event, index: i })\"\n />\n </svg:g>\n ",
8077
+ selector: 'g[ngx-charts-series-vertical]',
8078
+ template: "\n <svg:g\n ngx-charts-bar\n *ngFor=\"let bar of bars; trackBy: trackBy\"\n [@animationState]=\"'active'\"\n [@.disabled]=\"!animations\"\n [width]=\"bar.width\"\n [height]=\"bar.height\"\n [x]=\"bar.x\"\n [y]=\"bar.y\"\n [fill]=\"bar.color\"\n [stops]=\"bar.gradientStops\"\n [data]=\"bar.data\"\n [orientation]=\"'vertical'\"\n [roundEdges]=\"bar.roundEdges\"\n [gradient]=\"gradient\"\n [ariaLabel]=\"bar.ariaLabel\"\n [isActive]=\"isActive(bar.data)\"\n (select)=\"onClick($event)\"\n (activate)=\"activate.emit($event)\"\n (deactivate)=\"deactivate.emit($event)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"tooltipPlacement\"\n [tooltipType]=\"tooltipType\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : bar.tooltipText\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"bar.data\"\n [noBarWhenZero]=\"noBarWhenZero\"\n [animations]=\"animations\"\n ></svg:g>\n <svg:g *ngIf=\"showDataLabel\">\n <svg:g\n ngx-charts-bar-label\n *ngFor=\"let b of barsForDataLabels; let i = index; trackBy: trackDataLabelBy\"\n [barX]=\"b.x\"\n [barY]=\"b.y\"\n [barWidth]=\"b.width\"\n [barHeight]=\"b.height\"\n [value]=\"b.total\"\n [valueFormatting]=\"dataLabelFormatting\"\n [orientation]=\"'vertical'\"\n (dimensionsChanged)=\"dataLabelHeightChanged.emit({ size: $event, index: i })\"\n />\n </svg:g>\n ",
7980
8079
  changeDetection: core.ChangeDetectionStrategy.OnPush,
7981
8080
  animations: [
7982
8081
  animations.trigger('animationState', [
@@ -7990,17 +8089,17 @@
7990
8089
  ]
7991
8090
  },] }
7992
8091
  ];
7993
- SeriesHorizontal.propDecorators = {
8092
+ SeriesVerticalComponent.propDecorators = {
7994
8093
  dims: [{ type: core.Input }],
7995
8094
  type: [{ type: core.Input }],
7996
8095
  series: [{ type: core.Input }],
7997
8096
  xScale: [{ type: core.Input }],
7998
8097
  yScale: [{ type: core.Input }],
7999
8098
  colors: [{ type: core.Input }],
8000
- tooltipDisabled: [{ type: core.Input }],
8001
8099
  gradient: [{ type: core.Input }],
8002
8100
  activeEntries: [{ type: core.Input }],
8003
8101
  seriesName: [{ type: core.Input }],
8102
+ tooltipDisabled: [{ type: core.Input }],
8004
8103
  tooltipTemplate: [{ type: core.Input }],
8005
8104
  roundEdges: [{ type: core.Input }],
8006
8105
  animations: [{ type: core.Input }],
@@ -8010,7 +8109,7 @@
8010
8109
  select: [{ type: core.Output }],
8011
8110
  activate: [{ type: core.Output }],
8012
8111
  deactivate: [{ type: core.Output }],
8013
- dataLabelWidthChanged: [{ type: core.Output }]
8112
+ dataLabelHeightChanged: [{ type: core.Output }]
8014
8113
  };
8015
8114
 
8016
8115
  var BarLabelComponent = /** @class */ (function () {
@@ -8132,13 +8231,13 @@
8132
8231
 
8133
8232
  function getDomain(values, scaleType, autoScale, minVal, maxVal) {
8134
8233
  var domain = [];
8135
- if (scaleType === 'linear') {
8234
+ if (scaleType === exports.ɵc.Linear) {
8136
8235
  values = values.map(function (v) { return Number(v); });
8137
8236
  if (!autoScale) {
8138
8237
  values.push(0);
8139
8238
  }
8140
8239
  }
8141
- if (scaleType === 'time' || scaleType === 'linear') {
8240
+ if (scaleType === exports.ɵc.Time || scaleType === exports.ɵc.Linear) {
8142
8241
  var min = minVal ? minVal : Math.min.apply(Math, __spread(values));
8143
8242
  var max = maxVal ? maxVal : Math.max.apply(Math, __spread(values));
8144
8243
  domain = [min, max];
@@ -8150,16 +8249,16 @@
8150
8249
  }
8151
8250
  function getScale(domain, range, scaleType, roundDomains) {
8152
8251
  var scale;
8153
- if (scaleType === 'time') {
8252
+ if (scaleType === exports.ɵc.Time) {
8154
8253
  scale = d3Scale.scaleTime().range(range).domain(domain);
8155
8254
  }
8156
- else if (scaleType === 'linear') {
8255
+ else if (scaleType === exports.ɵc.Linear) {
8157
8256
  scale = d3Scale.scaleLinear().range(range).domain(domain);
8158
8257
  if (roundDomains) {
8159
8258
  scale = scale.nice();
8160
8259
  }
8161
8260
  }
8162
- else if (scaleType === 'ordinal') {
8261
+ else if (scaleType === exports.ɵc.Ordinal) {
8163
8262
  scale = d3Scale.scalePoint().range([range[0], range[1]]).domain(domain);
8164
8263
  }
8165
8264
  return scale;
@@ -8172,7 +8271,7 @@
8172
8271
  _this.showGridLines = true;
8173
8272
  _this.legend = false;
8174
8273
  _this.legendTitle = 'Legend';
8175
- _this.legendPosition = 'right';
8274
+ _this.legendPosition = exports.LegendPosition.Right;
8176
8275
  _this.xAxis = true;
8177
8276
  _this.yAxis = true;
8178
8277
  _this.trimXAxisTicks = true;
@@ -8183,11 +8282,11 @@
8183
8282
  _this.roundDomains = false;
8184
8283
  _this.maxRadius = 10;
8185
8284
  _this.minRadius = 3;
8186
- _this.schemeType = 'ordinal';
8285
+ _this.schemeType = exports.ɵc.Ordinal;
8187
8286
  _this.tooltipDisabled = false;
8188
8287
  _this.activate = new core.EventEmitter();
8189
8288
  _this.deactivate = new core.EventEmitter();
8190
- _this.scaleType = 'linear';
8289
+ _this.scaleType = exports.ɵc.Linear;
8191
8290
  _this.margin = [10, 20, 10, 20];
8192
8291
  _this.bubblePadding = [0, 0, 0, 0];
8193
8292
  _this.xAxisHeight = 0;
@@ -8216,7 +8315,7 @@
8216
8315
  this.xDomain = this.getXDomain();
8217
8316
  this.yDomain = this.getYDomain();
8218
8317
  this.transform = "translate(" + this.dims.xOffset + "," + this.margin[0] + ")";
8219
- var colorDomain = this.schemeType === 'ordinal' ? this.seriesDomain : this.rDomain;
8318
+ var colorDomain = this.schemeType === exports.ɵc.Ordinal ? this.seriesDomain : this.rDomain;
8220
8319
  this.colors = new ColorHelper(this.scheme, this.schemeType, colorDomain, this.customColors);
8221
8320
  this.data = this.results;
8222
8321
  this.minRadius = Math.max(this.minRadius, 1);
@@ -8252,8 +8351,8 @@
8252
8351
  for (var _e = (e_2 = void 0, __values(s.series)), _f = _e.next(); !_f.done; _f = _e.next()) {
8253
8352
  var d = _f.value;
8254
8353
  var r = this.rScale(d.r);
8255
- var cx = this.xScaleType === 'linear' ? this.xScale(Number(d.x)) : this.xScale(d.x);
8256
- var cy = this.yScaleType === 'linear' ? this.yScale(Number(d.y)) : this.yScale(d.y);
8354
+ var cx = this.xScaleType === exports.ɵc.Linear ? this.xScale(Number(d.x)) : this.xScale(d.x);
8355
+ var cy = this.yScaleType === exports.ɵc.Linear ? this.yScale(Number(d.y)) : this.yScale(d.y);
8257
8356
  xMin = Math.max(r - cx, xMin);
8258
8357
  yMin = Math.max(r - cy, yMin);
8259
8358
  yMax = Math.max(cy + r, yMax);
@@ -8310,7 +8409,7 @@
8310
8409
  position: this.legendPosition,
8311
8410
  title: undefined
8312
8411
  };
8313
- if (opts.scaleType === 'ordinal') {
8412
+ if (opts.scaleType === exports.ɵc.Ordinal) {
8314
8413
  opts.domain = this.seriesDomain;
8315
8414
  opts.colors = this.colors;
8316
8415
  opts.title = this.legendTitle;
@@ -8552,9 +8651,9 @@
8552
8651
  var r = d.r;
8553
8652
  var radius = _this.rScale(r || 1);
8554
8653
  var tooltipLabel = formatLabel(d.name);
8555
- var cx = _this.xScaleType === 'linear' ? _this.xScale(Number(x)) : _this.xScale(x);
8556
- var cy = _this.yScaleType === 'linear' ? _this.yScale(Number(y)) : _this.yScale(y);
8557
- var color = _this.colors.scaleType === 'linear' ? _this.colors.getColor(r) : _this.colors.getColor(seriesName);
8654
+ var cx = _this.xScaleType === exports.ɵc.Linear ? _this.xScale(Number(x)) : _this.xScale(x);
8655
+ var cy = _this.yScaleType === exports.ɵc.Linear ? _this.yScale(Number(y)) : _this.yScale(y);
8656
+ var color = _this.colors.scaleType === exports.ɵc.Linear ? _this.colors.getColor(r) : _this.colors.getColor(seriesName);
8558
8657
  var isActive = !_this.activeEntries.length ? true : _this.isActive({ name: seriesName });
8559
8658
  var opacity = isActive ? 1 : 0.3;
8560
8659
  var data = Object.assign({}, d, {
@@ -8751,7 +8850,6 @@
8751
8850
  width: [{ type: core.Input }],
8752
8851
  height: [{ type: core.Input }],
8753
8852
  data: [{ type: core.Input }],
8754
- label: [{ type: core.Input }],
8755
8853
  gradient: [{ type: core.Input }],
8756
8854
  animations: [{ type: core.Input }],
8757
8855
  select: [{ type: core.Output }],
@@ -8808,7 +8906,7 @@
8808
8906
  return "\n <span class=\"tooltip-label\">" + escapeLabel(series) + " \u2022 " + escapeLabel(label) + "</span>\n <span class=\"tooltip-val\">" + data.toLocaleString() + "</span>\n ";
8809
8907
  };
8810
8908
  HeatCellSeriesComponent.prototype.trackBy = function (index, item) {
8811
- return item.tooltipText;
8909
+ return item.label;
8812
8910
  };
8813
8911
  HeatCellSeriesComponent.prototype.onClick = function (data) {
8814
8912
  this.select.emit(data);
@@ -8842,7 +8940,7 @@
8842
8940
  function HeatMapComponent() {
8843
8941
  var _this = _super.apply(this, __spread(arguments)) || this;
8844
8942
  _this.legendTitle = 'Legend';
8845
- _this.legendPosition = 'right';
8943
+ _this.legendPosition = exports.LegendPosition.Right;
8846
8944
  _this.innerPadding = 8;
8847
8945
  _this.trimXAxisTicks = true;
8848
8946
  _this.trimYAxisTicks = true;
@@ -8856,7 +8954,7 @@
8856
8954
  _this.margin = [10, 20, 10, 20];
8857
8955
  _this.xAxisHeight = 0;
8858
8956
  _this.yAxisWidth = 0;
8859
- _this.scaleType = 'linear';
8957
+ _this.scaleType = exports.ɵc.Linear;
8860
8958
  return _this;
8861
8959
  }
8862
8960
  HeatMapComponent.prototype.update = function () {
@@ -8880,7 +8978,7 @@
8880
8978
  legendType: this.scaleType,
8881
8979
  legendPosition: this.legendPosition
8882
8980
  });
8883
- if (this.scaleType === 'linear') {
8981
+ if (this.scaleType === exports.ɵc.Linear) {
8884
8982
  var min = this.min;
8885
8983
  var max = this.max;
8886
8984
  if (!this.min) {
@@ -9048,8 +9146,8 @@
9048
9146
  return {
9049
9147
  scaleType: this.scaleType,
9050
9148
  domain: this.valueDomain,
9051
- colors: this.scaleType === 'ordinal' ? this.colors : this.colors.scale,
9052
- title: this.scaleType === 'ordinal' ? this.legendTitle : undefined,
9149
+ colors: this.scaleType === exports.ɵc.Ordinal ? this.colors : this.colors.scale,
9150
+ title: this.scaleType === exports.ɵc.Ordinal ? this.legendTitle : undefined,
9053
9151
  position: this.legendPosition
9054
9152
  };
9055
9153
  };
@@ -9159,7 +9257,7 @@
9159
9257
  this.element = element;
9160
9258
  this.fill = 'none';
9161
9259
  this.animations = true;
9162
- this.select = new core.EventEmitter();
9260
+ // @Output() select = new EventEmitter();
9163
9261
  this.initialized = false;
9164
9262
  }
9165
9263
  LineComponent.prototype.ngOnChanges = function (changes) {
@@ -9210,8 +9308,7 @@
9210
9308
  stroke: [{ type: core.Input }],
9211
9309
  data: [{ type: core.Input }],
9212
9310
  fill: [{ type: core.Input }],
9213
- animations: [{ type: core.Input }],
9214
- select: [{ type: core.Output }]
9311
+ animations: [{ type: core.Input }]
9215
9312
  };
9216
9313
 
9217
9314
  var LineChartComponent = /** @class */ (function (_super) {
@@ -9219,7 +9316,7 @@
9219
9316
  function LineChartComponent() {
9220
9317
  var _this = _super.apply(this, __spread(arguments)) || this;
9221
9318
  _this.legendTitle = 'Legend';
9222
- _this.legendPosition = 'right';
9319
+ _this.legendPosition = exports.LegendPosition.Right;
9223
9320
  _this.showGridLines = true;
9224
9321
  _this.curve = d3Shape.curveLinear;
9225
9322
  _this.activeEntries = [];
@@ -9288,16 +9385,16 @@
9288
9385
  var values = getUniqueXDomainValues(this.results);
9289
9386
  this.scaleType = getScaleType(values);
9290
9387
  var domain = [];
9291
- if (this.scaleType === 'linear') {
9388
+ if (this.scaleType === exports.ɵc.Linear) {
9292
9389
  values = values.map(function (v) { return Number(v); });
9293
9390
  }
9294
9391
  var min;
9295
9392
  var max;
9296
- if (this.scaleType === 'time' || this.scaleType === 'linear') {
9393
+ if (this.scaleType === exports.ɵc.Time || this.scaleType === exports.ɵc.Linear) {
9297
9394
  min = this.xScaleMin ? this.xScaleMin : Math.min.apply(Math, __spread(values));
9298
9395
  max = this.xScaleMax ? this.xScaleMax : Math.max.apply(Math, __spread(values));
9299
9396
  }
9300
- if (this.scaleType === 'time') {
9397
+ if (this.scaleType === exports.ɵc.Time) {
9301
9398
  domain = [new Date(min), new Date(max)];
9302
9399
  this.xSet = __spread(values).sort(function (a, b) {
9303
9400
  var aDate = a.getTime();
@@ -9309,7 +9406,7 @@
9309
9406
  return 0;
9310
9407
  });
9311
9408
  }
9312
- else if (this.scaleType === 'linear') {
9409
+ else if (this.scaleType === exports.ɵc.Linear) {
9313
9410
  domain = [min, max];
9314
9411
  // Use compare function to sort numbers numerically
9315
9412
  this.xSet = __spread(values).sort(function (a, b) { return a - b; });
@@ -9375,16 +9472,16 @@
9375
9472
  };
9376
9473
  LineChartComponent.prototype.getXScale = function (domain, width) {
9377
9474
  var scale;
9378
- if (this.scaleType === 'time') {
9475
+ if (this.scaleType === exports.ɵc.Time) {
9379
9476
  scale = d3Scale.scaleTime().range([0, width]).domain(domain);
9380
9477
  }
9381
- else if (this.scaleType === 'linear') {
9478
+ else if (this.scaleType === exports.ɵc.Linear) {
9382
9479
  scale = d3Scale.scaleLinear().range([0, width]).domain(domain);
9383
9480
  if (this.roundDomains) {
9384
9481
  scale = scale.nice();
9385
9482
  }
9386
9483
  }
9387
- else if (this.scaleType === 'ordinal') {
9484
+ else if (this.scaleType === exports.ɵc.Ordinal) {
9388
9485
  scale = d3Scale.scalePoint().range([0, width]).padding(0.1).domain(domain);
9389
9486
  }
9390
9487
  return scale;
@@ -9414,7 +9511,7 @@
9414
9511
  };
9415
9512
  LineChartComponent.prototype.setColors = function () {
9416
9513
  var domain;
9417
- if (this.schemeType === 'ordinal') {
9514
+ if (this.schemeType === exports.ɵc.Ordinal) {
9418
9515
  domain = this.seriesDomain;
9419
9516
  }
9420
9517
  else {
@@ -9430,7 +9527,7 @@
9430
9527
  title: undefined,
9431
9528
  position: this.legendPosition
9432
9529
  };
9433
- if (opts.scaleType === 'ordinal') {
9530
+ if (opts.scaleType === exports.ɵc.Ordinal) {
9434
9531
  opts.domain = this.seriesDomain;
9435
9532
  opts.colors = this.colors;
9436
9533
  opts.title = this.legendTitle;
@@ -9591,10 +9688,10 @@
9591
9688
  .x(function (d) {
9592
9689
  var label = d.name;
9593
9690
  var value;
9594
- if (_this.scaleType === 'time') {
9691
+ if (_this.scaleType === exports.ɵc.Time) {
9595
9692
  value = _this.xScale(label);
9596
9693
  }
9597
- else if (_this.scaleType === 'linear') {
9694
+ else if (_this.scaleType === exports.ɵc.Linear) {
9598
9695
  value = _this.xScale(Number(label));
9599
9696
  }
9600
9697
  else {
@@ -9611,10 +9708,10 @@
9611
9708
  .x(function (d) {
9612
9709
  var label = d.name;
9613
9710
  var value;
9614
- if (_this.scaleType === 'time') {
9711
+ if (_this.scaleType === exports.ɵc.Time) {
9615
9712
  value = _this.xScale(label);
9616
9713
  }
9617
- else if (_this.scaleType === 'linear') {
9714
+ else if (_this.scaleType === exports.ɵc.Linear) {
9618
9715
  value = _this.xScale(Number(label));
9619
9716
  }
9620
9717
  else {
@@ -9639,10 +9736,10 @@
9639
9736
  .curve(this.curve);
9640
9737
  };
9641
9738
  LineSeriesComponent.prototype.sortData = function (data) {
9642
- if (this.scaleType === 'linear') {
9739
+ if (this.scaleType === exports.ɵc.Linear) {
9643
9740
  data = sortLinear(data, 'name');
9644
9741
  }
9645
- else if (this.scaleType === 'time') {
9742
+ else if (this.scaleType === exports.ɵc.Time) {
9646
9743
  data = sortByTime(data, 'name');
9647
9744
  }
9648
9745
  else {
@@ -9651,7 +9748,7 @@
9651
9748
  return data;
9652
9749
  };
9653
9750
  LineSeriesComponent.prototype.updateGradients = function () {
9654
- if (this.colors.scaleType === 'linear') {
9751
+ if (this.colors.scaleType === exports.ɵc.Linear) {
9655
9752
  this.hasGradient = true;
9656
9753
  this.gradientId = 'grad' + id().toString();
9657
9754
  this.gradientUrl = "url(#" + this.gradientId + ")";
@@ -9718,20 +9815,13 @@
9718
9815
  },] }
9719
9816
  ];
9720
9817
 
9721
- function isDate(value) {
9722
- return toString.call(value) === '[object Date]';
9723
- }
9724
- function isNumber(value) {
9725
- return typeof value === 'number';
9726
- }
9727
-
9728
9818
  var twoPI = 2 * Math.PI;
9729
9819
  var PolarChartComponent = /** @class */ (function (_super) {
9730
9820
  __extends(PolarChartComponent, _super);
9731
9821
  function PolarChartComponent() {
9732
9822
  var _this = _super.apply(this, __spread(arguments)) || this;
9733
9823
  _this.legendTitle = 'Legend';
9734
- _this.legendPosition = 'right';
9824
+ _this.legendPosition = exports.LegendPosition.Right;
9735
9825
  _this.showGridLines = true;
9736
9826
  _this.curve = d3Shape.curveCardinalClosed;
9737
9827
  _this.activeEntries = [];
@@ -9747,6 +9837,7 @@
9747
9837
  _this.labelTrimSize = 10;
9748
9838
  _this.activate = new core.EventEmitter();
9749
9839
  _this.deactivate = new core.EventEmitter();
9840
+ // series: any; // ???
9750
9841
  _this.margin = [10, 20, 10, 20];
9751
9842
  _this.xAxisHeight = 0;
9752
9843
  _this.yAxisWidth = 0;
@@ -9884,12 +9975,12 @@
9884
9975
  };
9885
9976
  PolarChartComponent.prototype.getXDomain = function (values) {
9886
9977
  if (values === void 0) { values = this.getXValues(); }
9887
- if (this.scaleType === 'time') {
9978
+ if (this.scaleType === exports.ɵc.Time) {
9888
9979
  var min = Math.min.apply(Math, __spread(values));
9889
9980
  var max = Math.max.apply(Math, __spread(values));
9890
9981
  return [min, max];
9891
9982
  }
9892
- else if (this.scaleType === 'linear') {
9983
+ else if (this.scaleType === exports.ɵc.Linear) {
9893
9984
  values = values.map(function (v) { return Number(v); });
9894
9985
  var min = Math.min.apply(Math, __spread(values));
9895
9986
  var max = Math.max.apply(Math, __spread(values));
@@ -9954,9 +10045,9 @@
9954
10045
  };
9955
10046
  PolarChartComponent.prototype.getXScale = function (domain, width) {
9956
10047
  switch (this.scaleType) {
9957
- case 'time':
10048
+ case exports.ɵc.Time:
9958
10049
  return d3Scale.scaleTime().range([0, width]).domain(domain);
9959
- case 'linear':
10050
+ case exports.ɵc.Linear:
9960
10051
  var scale = d3Scale.scaleLinear().range([0, width]).domain(domain);
9961
10052
  return this.roundDomains ? scale.nice() : scale;
9962
10053
  default:
@@ -9977,11 +10068,11 @@
9977
10068
  this.select.emit(data);
9978
10069
  };
9979
10070
  PolarChartComponent.prototype.setColors = function () {
9980
- var domain = this.schemeType === 'ordinal' ? this.seriesDomain : this.yDomain.reverse();
10071
+ var domain = this.schemeType === exports.ɵc.Ordinal ? this.seriesDomain : this.yDomain.reverse();
9981
10072
  this.colors = new ColorHelper(this.scheme, this.schemeType, domain, this.customColors);
9982
10073
  };
9983
10074
  PolarChartComponent.prototype.getLegendOptions = function () {
9984
- if (this.schemeType === 'ordinal') {
10075
+ if (this.schemeType === exports.ɵc.Ordinal) {
9985
10076
  return {
9986
10077
  scaleType: this.schemeType,
9987
10078
  colors: this.colors,
@@ -10121,7 +10212,7 @@
10121
10212
  var line = this.getLineGenerator();
10122
10213
  var data = this.sortData(this.data.series);
10123
10214
  var seriesName = this.data.name;
10124
- var linearScaleType = this.colors.scaleType === 'linear';
10215
+ var linearScaleType = this.colors.scaleType === exports.ɵc.Linear;
10125
10216
  var min = this.yScale.domain()[0];
10126
10217
  this.seriesColor = this.colors.getColor(linearScaleType ? min : seriesName);
10127
10218
  this.path = line(data) || '';
@@ -10150,10 +10241,10 @@
10150
10241
  };
10151
10242
  PolarSeriesComponent.prototype.getAngle = function (d) {
10152
10243
  var label = d.name;
10153
- if (this.scaleType === 'time') {
10244
+ if (this.scaleType === exports.ɵc.Time) {
10154
10245
  return this.xScale(label);
10155
10246
  }
10156
- else if (this.scaleType === 'linear') {
10247
+ else if (this.scaleType === exports.ɵc.Linear) {
10157
10248
  return this.xScale(Number(label));
10158
10249
  }
10159
10250
  return this.xScale(label);
@@ -10169,10 +10260,10 @@
10169
10260
  .curve(this.curve);
10170
10261
  };
10171
10262
  PolarSeriesComponent.prototype.sortData = function (data) {
10172
- if (this.scaleType === 'linear') {
10263
+ if (this.scaleType === exports.ɵc.Linear) {
10173
10264
  return sortLinear(data, 'name');
10174
10265
  }
10175
- else if (this.scaleType === 'time') {
10266
+ else if (this.scaleType === exports.ɵc.Time) {
10176
10267
  return sortByTime(data, 'name');
10177
10268
  }
10178
10269
  return sortByDomain(data, 'name', 'asc', this.xScale.domain());
@@ -10198,13 +10289,13 @@
10198
10289
  return "\n <span class=\"tooltip-label\">" + escapeLabel(this.data.name) + " \u2022 " + escapeLabel(label) + "</span>\n <span class=\"tooltip-val\">" + value.toLocaleString() + "</span>\n ";
10199
10290
  };
10200
10291
  PolarSeriesComponent.prototype.updateGradients = function () {
10201
- this.hasGradient = this.gradient || this.colors.scaleType === 'linear';
10292
+ this.hasGradient = this.gradient || this.colors.scaleType === exports.ɵc.Linear;
10202
10293
  if (!this.hasGradient) {
10203
10294
  return;
10204
10295
  }
10205
10296
  this.gradientId = 'grad' + id().toString();
10206
10297
  this.gradientUrl = "url(#" + this.gradientId + ")";
10207
- if (this.colors.scaleType === 'linear') {
10298
+ if (this.colors.scaleType === exports.ɵc.Linear) {
10208
10299
  var values = this.data.series.map(function (d) { return d.value; });
10209
10300
  var max = Math.max.apply(Math, __spread(values));
10210
10301
  var min = Math.min.apply(Math, __spread(values));
@@ -10279,7 +10370,7 @@
10279
10370
  this.select.emit(data);
10280
10371
  };
10281
10372
  AdvancedPieChartComponent.prototype.setColors = function () {
10282
- this.colors = new ColorHelper(this.scheme, 'ordinal', this.domain, this.customColors);
10373
+ this.colors = new ColorHelper(this.scheme, exports.ɵc.Ordinal, this.domain, this.customColors);
10283
10374
  };
10284
10375
  AdvancedPieChartComponent.prototype.onActivate = function (item, fromLegend) {
10285
10376
  if (fromLegend === void 0) { fromLegend = false; }
@@ -10343,16 +10434,30 @@
10343
10434
  };
10344
10435
 
10345
10436
  var PieLabelComponent = /** @class */ (function () {
10346
- function PieLabelComponent() {
10437
+ function PieLabelComponent(platformId) {
10438
+ this.platformId = platformId;
10347
10439
  this.animations = true;
10348
10440
  this.labelTrim = true;
10349
10441
  this.labelTrimSize = 10;
10350
- this.isIE = /(edge|msie|trident)/i.test(navigator.userAgent);
10351
10442
  this.trimLabel = trimLabel;
10352
10443
  }
10353
10444
  PieLabelComponent.prototype.ngOnChanges = function (changes) {
10445
+ this.setTransforms();
10354
10446
  this.update();
10355
10447
  };
10448
+ PieLabelComponent.prototype.setTransforms = function () {
10449
+ if (common.isPlatformServer(this.platformId)) {
10450
+ this.styleTransform = "translate3d(" + this.textX + "px," + this.textY + "px, 0)";
10451
+ this.attrTransform = "translate(" + this.textX + "," + this.textY + ")";
10452
+ this.textTransition = !this.animations ? null : 'transform 0.75s';
10453
+ }
10454
+ else {
10455
+ var isIE = /(edge|msie|trident)/i.test(navigator.userAgent);
10456
+ this.styleTransform = isIE ? null : "translate3d(" + this.textX + "px," + this.textY + "px, 0)";
10457
+ this.attrTransform = !isIE ? null : "translate(" + this.textX + "," + this.textY + ")";
10458
+ this.textTransition = isIE || !this.animations ? null : 'transform 0.75s';
10459
+ }
10460
+ };
10356
10461
  PieLabelComponent.prototype.update = function () {
10357
10462
  var startRadius = this.radius;
10358
10463
  if (this.explodeSlices) {
@@ -10382,29 +10487,8 @@
10382
10487
  enumerable: false,
10383
10488
  configurable: true
10384
10489
  });
10385
- Object.defineProperty(PieLabelComponent.prototype, "styleTransform", {
10386
- get: function () {
10387
- return this.isIE ? null : "translate3d(" + this.textX + "px," + this.textY + "px, 0)";
10388
- },
10389
- enumerable: false,
10390
- configurable: true
10391
- });
10392
- Object.defineProperty(PieLabelComponent.prototype, "attrTransform", {
10393
- get: function () {
10394
- return !this.isIE ? null : "translate(" + this.textX + "," + this.textY + ")";
10395
- },
10396
- enumerable: false,
10397
- configurable: true
10398
- });
10399
- Object.defineProperty(PieLabelComponent.prototype, "textTransition", {
10400
- get: function () {
10401
- return this.isIE || !this.animations ? null : 'transform 0.75s';
10402
- },
10403
- enumerable: false,
10404
- configurable: true
10405
- });
10406
10490
  PieLabelComponent.prototype.textAnchor = function () {
10407
- return this.midAngle(this.data) < Math.PI ? 'start' : 'end';
10491
+ return this.midAngle(this.data) < Math.PI ? exports.TextAnchor.Start : exports.TextAnchor.End;
10408
10492
  };
10409
10493
  PieLabelComponent.prototype.midAngle = function (d) {
10410
10494
  return d.startAngle + (d.endAngle - d.startAngle) / 2;
@@ -10418,7 +10502,9 @@
10418
10502
  changeDetection: core.ChangeDetectionStrategy.OnPush
10419
10503
  },] }
10420
10504
  ];
10421
- PieLabelComponent.ctorParameters = function () { return []; };
10505
+ PieLabelComponent.ctorParameters = function () { return [
10506
+ { type: undefined, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
10507
+ ]; };
10422
10508
  PieLabelComponent.propDecorators = {
10423
10509
  data: [{ type: core.Input }],
10424
10510
  radius: [{ type: core.Input }],
@@ -10582,7 +10668,7 @@
10582
10668
  _this.labels = false;
10583
10669
  _this.legend = false;
10584
10670
  _this.legendTitle = 'Legend';
10585
- _this.legendPosition = 'right';
10671
+ _this.legendPosition = exports.LegendPosition.Right;
10586
10672
  _this.explodeSlices = false;
10587
10673
  _this.doughnut = false;
10588
10674
  _this.arcWidth = 0.25;
@@ -10644,11 +10730,11 @@
10644
10730
  this.select.emit(data);
10645
10731
  };
10646
10732
  PieChartComponent.prototype.setColors = function () {
10647
- this.colors = new ColorHelper(this.scheme, 'ordinal', this.domain, this.customColors);
10733
+ this.colors = new ColorHelper(this.scheme, exports.ɵc.Ordinal, this.domain, this.customColors);
10648
10734
  };
10649
10735
  PieChartComponent.prototype.getLegendOptions = function () {
10650
10736
  return {
10651
- scaleType: 'ordinal',
10737
+ scaleType: exports.ɵc.Ordinal,
10652
10738
  domain: this.domain,
10653
10739
  colors: this.colors,
10654
10740
  title: this.legendTitle,
@@ -10873,7 +10959,7 @@
10873
10959
  this.select.emit(data);
10874
10960
  };
10875
10961
  PieGridComponent.prototype.setColors = function () {
10876
- this.colorScale = new ColorHelper(this.scheme, 'ordinal', this.domain, this.customColors);
10962
+ this.colorScale = new ColorHelper(this.scheme, exports.ɵc.Ordinal, this.domain, this.customColors);
10877
10963
  };
10878
10964
  PieGridComponent.prototype.onActivate = function (item, fromLegend) {
10879
10965
  if (fromLegend === void 0) { fromLegend = false; }
@@ -11188,10 +11274,108 @@
11188
11274
  },] }
11189
11275
  ];
11190
11276
 
11277
+ function calculateTextWidth(fontFamilyKey, text, defaultWidth) {
11278
+ if (defaultWidth === void 0) { defaultWidth = 8; }
11279
+ return text.split('').reduce(function (acc, curr) {
11280
+ var width = fontFamilyKey[curr] || defaultWidth;
11281
+ return acc + width;
11282
+ }, 0);
11283
+ }
11284
+
11285
+ var VERDANA_FONT_WIDTHS_16_PX = {
11286
+ '0': 10,
11287
+ '1': 10,
11288
+ '2': 10,
11289
+ '3': 10,
11290
+ '4': 10,
11291
+ '5': 10,
11292
+ '6': 10,
11293
+ '7': 10,
11294
+ '8': 10,
11295
+ '9': 10,
11296
+ A: 11,
11297
+ B: 11,
11298
+ C: 11,
11299
+ D: 12,
11300
+ E: 10,
11301
+ F: 9,
11302
+ G: 12,
11303
+ H: 12,
11304
+ I: 7,
11305
+ J: 7,
11306
+ K: 11,
11307
+ L: 9,
11308
+ M: 13,
11309
+ N: 12,
11310
+ O: 13,
11311
+ P: 10,
11312
+ Q: 13,
11313
+ R: 11,
11314
+ S: 11,
11315
+ T: 10,
11316
+ U: 12,
11317
+ V: 11,
11318
+ W: 16,
11319
+ X: 11,
11320
+ Y: 10,
11321
+ Z: 11,
11322
+ a: 10,
11323
+ b: 10,
11324
+ c: 8,
11325
+ d: 10,
11326
+ e: 10,
11327
+ f: 6,
11328
+ g: 10,
11329
+ h: 10,
11330
+ i: 4,
11331
+ j: 6,
11332
+ k: 9,
11333
+ l: 4,
11334
+ m: 16,
11335
+ n: 10,
11336
+ o: 10,
11337
+ p: 10,
11338
+ q: 10,
11339
+ r: 7,
11340
+ s: 8,
11341
+ t: 6,
11342
+ u: 10,
11343
+ v: 9,
11344
+ w: 13,
11345
+ x: 9,
11346
+ y: 9,
11347
+ z: 8,
11348
+ '!': 6,
11349
+ '@': 16,
11350
+ '#': 13,
11351
+ $: 10,
11352
+ '%': 17,
11353
+ '^': 13,
11354
+ '&': 12,
11355
+ '*': 10,
11356
+ '(': 7,
11357
+ ')': 7,
11358
+ _: 10,
11359
+ '-': 7,
11360
+ '+': 13,
11361
+ '=': 13,
11362
+ ',': 6,
11363
+ '.': 6,
11364
+ '/': 7,
11365
+ "'": 4,
11366
+ ':': 7,
11367
+ '|': 7,
11368
+ '?': 9,
11369
+ ';': 7,
11370
+ '<': 13,
11371
+ '>': 13
11372
+ };
11373
+
11191
11374
  var CardComponent = /** @class */ (function () {
11192
- function CardComponent(element, cd, zone) {
11375
+ function CardComponent(element, cd, zone, platformId) {
11193
11376
  this.cd = cd;
11194
11377
  this.zone = zone;
11378
+ this.platformId = platformId;
11195
11379
  this.animations = true;
11196
11380
  this.select = new core.EventEmitter();
11197
11381
  this.value = '';
@@ -11206,8 +11390,15 @@
11206
11390
  CardComponent.prototype.ngOnChanges = function (changes) {
11207
11391
  this.update();
11208
11392
  };
11393
+ CardComponent.prototype.ngOnInit = function () {
11394
+ if (common.isPlatformServer(this.platformId)) {
11395
+ this.scaleTextSSR();
11396
+ }
11397
+ };
11209
11398
  CardComponent.prototype.ngOnDestroy = function () {
11210
- cancelAnimationFrame(this.animationReq);
11399
+ if (common.isPlatformBrowser(this.platformId)) {
11400
+ cancelAnimationFrame(this.animationReq);
11401
+ }
11211
11402
  };
11212
11403
  CardComponent.prototype.update = function () {
11213
11404
  var _this = this;
@@ -11232,7 +11423,9 @@
11232
11423
  _this.setPadding();
11233
11424
  _this.bandPath = roundedRect(0, 0, _this.cardWidth, _this.bandHeight, 3, [false, false, true, true]);
11234
11425
  setTimeout(function () {
11235
- _this.scaleText();
11426
+ if (common.isPlatformBrowser(_this.platformId)) {
11427
+ _this.scaleText();
11428
+ }
11236
11429
  _this.value = value;
11237
11430
  if (hasValue && !_this.initialized) {
11238
11431
  setTimeout(function () { return _this.startCount(); }, 20);
@@ -11285,6 +11478,17 @@
11285
11478
  _this.cd.markForCheck();
11286
11479
  });
11287
11480
  };
11481
+ CardComponent.prototype.scaleTextSSR = function () {
11482
+ var width = calculateTextWidth(VERDANA_FONT_WIDTHS_16_PX, this.value, 10);
11483
+ var height = 18;
11484
+ var textPadding = (this.textPadding[1] = this.textPadding[3] = this.cardWidth / 8);
11485
+ var availableWidth = this.cardWidth - 2 * textPadding;
11486
+ var availableHeight = this.cardHeight / 3;
11487
+ var resizeScale = Math.min(availableWidth / width, availableHeight / height);
11488
+ this.textFontSize = Math.floor(this.textFontSize * resizeScale);
11489
+ this.labelFontSize = Math.min(this.textFontSize, 15);
11490
+ this.setPadding();
11491
+ };
11288
11492
  CardComponent.prototype.setPadding = function () {
11289
11493
  this.textPadding[1] = this.textPadding[3] = this.cardWidth / 8;
11290
11494
  var padding = this.cardHeight / 2;
@@ -11306,7 +11510,8 @@
11306
11510
  CardComponent.ctorParameters = function () { return [
11307
11511
  { type: core.ElementRef },
11308
11512
  { type: core.ChangeDetectorRef },
11309
- { type: core.NgZone }
11513
+ { type: core.NgZone },
11514
+ { type: undefined, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
11310
11515
  ]; };
11311
11516
  CardComponent.propDecorators = {
11312
11517
  color: [{ type: core.Input }],
@@ -11446,7 +11651,6 @@
11446
11651
  ];
11447
11652
  CardSeriesComponent.propDecorators = {
11448
11653
  data: [{ type: core.Input }],
11449
- slots: [{ type: core.Input }],
11450
11654
  dims: [{ type: core.Input }],
11451
11655
  colors: [{ type: core.Input }],
11452
11656
  innerPadding: [{ type: core.Input }],
@@ -11502,7 +11706,7 @@
11502
11706
  this.select.emit(data);
11503
11707
  };
11504
11708
  NumberCardComponent.prototype.setColors = function () {
11505
- this.colors = new ColorHelper(this.scheme, 'ordinal', this.domain, this.customColors);
11709
+ this.colors = new ColorHelper(this.scheme, exports.ɵc.Ordinal, this.domain, this.customColors);
11506
11710
  };
11507
11711
  return NumberCardComponent;
11508
11712
  }(BaseChartComponent));
@@ -11635,7 +11839,6 @@
11635
11839
  height: [{ type: core.Input }],
11636
11840
  label: [{ type: core.Input }],
11637
11841
  value: [{ type: core.Input }],
11638
- valueType: [{ type: core.Input }],
11639
11842
  valueFormatting: [{ type: core.Input }],
11640
11843
  labelFormatting: [{ type: core.Input }],
11641
11844
  gradient: [{ type: core.Input }],
@@ -11669,8 +11872,7 @@
11669
11872
  height: d.y1 - d.y0,
11670
11873
  fill: _this.colors.getColor(label),
11671
11874
  label: label,
11672
- value: d.value,
11673
- valueType: d.valueType
11875
+ value: d.value
11674
11876
  };
11675
11877
  });
11676
11878
  };
@@ -11689,7 +11891,7 @@
11689
11891
  TreeMapCellSeriesComponent.decorators = [
11690
11892
  { type: core.Component, args: [{
11691
11893
  selector: 'g[ngx-charts-tree-map-cell-series]',
11692
- template: "\n <svg:g\n ngx-charts-tree-map-cell\n *ngFor=\"let c of cells; trackBy: trackBy\"\n [data]=\"c.data\"\n [x]=\"c.x\"\n [y]=\"c.y\"\n [width]=\"c.width\"\n [height]=\"c.height\"\n [fill]=\"c.fill\"\n [label]=\"c.label\"\n [value]=\"c.value\"\n [valueType]=\"c.valueType\"\n [valueFormatting]=\"valueFormatting\"\n [labelFormatting]=\"labelFormatting\"\n [gradient]=\"gradient\"\n [animations]=\"animations\"\n (select)=\"onClick($event)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"'top'\"\n [tooltipType]=\"'tooltip'\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : getTooltipText(c)\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"c.data\"\n ></svg:g>\n ",
11894
+ template: "\n <svg:g\n ngx-charts-tree-map-cell\n *ngFor=\"let c of cells; trackBy: trackBy\"\n [data]=\"c.data\"\n [x]=\"c.x\"\n [y]=\"c.y\"\n [width]=\"c.width\"\n [height]=\"c.height\"\n [fill]=\"c.fill\"\n [label]=\"c.label\"\n [value]=\"c.value\"\n [valueFormatting]=\"valueFormatting\"\n [labelFormatting]=\"labelFormatting\"\n [gradient]=\"gradient\"\n [animations]=\"animations\"\n (select)=\"onClick($event)\"\n ngx-tooltip\n [tooltipDisabled]=\"tooltipDisabled\"\n [tooltipPlacement]=\"'top'\"\n [tooltipType]=\"'tooltip'\"\n [tooltipTitle]=\"tooltipTemplate ? undefined : getTooltipText(c)\"\n [tooltipTemplate]=\"tooltipTemplate\"\n [tooltipContext]=\"c.data\"\n ></svg:g>\n ",
11693
11895
  changeDetection: core.ChangeDetectionStrategy.OnPush
11694
11896
  },] }
11695
11897
  ];
@@ -11754,7 +11956,7 @@
11754
11956
  this.select.emit(data);
11755
11957
  };
11756
11958
  TreeMapComponent.prototype.setColors = function () {
11757
- this.colors = new ColorHelper(this.scheme, 'ordinal', this.domain, this.customColors);
11959
+ this.colors = new ColorHelper(this.scheme, exports.ɵc.Ordinal, this.domain, this.customColors);
11758
11960
  };
11759
11961
  return TreeMapComponent;
11760
11962
  }(BaseChartComponent));
@@ -11790,6 +11992,11 @@
11790
11992
  },] }
11791
11993
  ];
11792
11994
 
11995
+ var ElementType;
11996
+ (function (ElementType) {
11997
+ ElementType["Value"] = "value";
11998
+ ElementType["Units"] = "units";
11999
+ })(ElementType || (ElementType = {}));
11793
12000
  var LinearGaugeComponent = /** @class */ (function (_super) {
11794
12001
  __extends(LinearGaugeComponent, _super);
11795
12002
  function LinearGaugeComponent() {
@@ -11810,8 +12017,8 @@
11810
12017
  var _this = this;
11811
12018
  _super.prototype.ngAfterViewInit.call(this);
11812
12019
  setTimeout(function () {
11813
- _this.scaleText('value');
11814
- _this.scaleText('units');
12020
+ _this.scaleText(ElementType.Value);
12021
+ _this.scaleText(ElementType.Units);
11815
12022
  });
11816
12023
  };
11817
12024
  LinearGaugeComponent.prototype.update = function () {
@@ -11839,8 +12046,14 @@
11839
12046
  this.transformLine = "translate(" + (this.margin[3] + this.valueScale(this.previousValue)) + ", " + yOffset + ")";
11840
12047
  this.valueTranslate = "translate(0, -15)";
11841
12048
  this.unitsTranslate = "translate(0, 15)";
11842
- setTimeout(function () { return _this.scaleText('value'); }, 50);
11843
- setTimeout(function () { return _this.scaleText('units'); }, 50);
12049
+ if (common.isPlatformServer(this.platformId)) {
12050
+ this.scaleTextSSR('value');
12051
+ this.scaleTextSSR('units');
12052
+ }
12053
+ else {
12054
+ setTimeout(function () { return _this.scaleText(ElementType.Value); }, 50);
12055
+ setTimeout(function () { return _this.scaleText(ElementType.Units); }, 50);
12056
+ }
11844
12057
  };
11845
12058
  LinearGaugeComponent.prototype.getValueDomain = function () {
11846
12059
  return [this.min, this.max];
@@ -11859,7 +12072,7 @@
11859
12072
  if (repeat === void 0) { repeat = true; }
11860
12073
  var el;
11861
12074
  var resizeScale;
11862
- if (element === 'value') {
12075
+ if (element === ElementType.Value) {
11863
12076
  el = this.valueTextEl;
11864
12077
  resizeScale = this.valueResizeScale;
11865
12078
  }
@@ -11877,7 +12090,7 @@
11877
12090
  var resizeScaleHeight = Math.floor((availableHeight / (height / resizeScale)) * 100) / 100;
11878
12091
  resizeScale = Math.min(resizeScaleHeight, resizeScaleWidth);
11879
12092
  if (resizeScale !== oldScale) {
11880
- if (element === 'value') {
12093
+ if (element === ElementType.Value) {
11881
12094
  this.valueResizeScale = resizeScale;
11882
12095
  this.valueTextTransform = "scale(" + resizeScale + ", " + resizeScale + ")";
11883
12096
  }
@@ -11886,13 +12099,33 @@
11886
12099
  this.unitsTextTransform = "scale(" + resizeScale + ", " + resizeScale + ")";
11887
12100
  }
11888
12101
  this.cd.markForCheck();
11889
- if (repeat) {
12102
+ if (repeat && common.isPlatformBrowser(this.platformId)) {
11890
12103
  setTimeout(function () {
11891
12104
  _this.scaleText(element, false);
11892
12105
  }, 50);
11893
12106
  }
11894
12107
  }
11895
12108
  };
12109
+ LinearGaugeComponent.prototype.scaleTextSSR = function (element) {
12110
+ var resizeScale = 1;
12111
+ var value = element === 'value' ? this.displayValue : this.units;
12112
+ var width = calculateTextWidth(VERDANA_FONT_WIDTHS_16_PX, value, 10);
12113
+ var height = 25;
12114
+ var availableWidth = this.dims.width;
12115
+ var availableHeight = Math.max(this.dims.height / 2 - 15, 0);
12116
+ var resizeScaleWidth = Math.floor((availableWidth / (width / resizeScale)) * 100) / 100;
12117
+ var resizeScaleHeight = Math.floor((availableHeight / (height / resizeScale)) * 100) / 100;
12118
+ resizeScale = Math.min(resizeScaleHeight, resizeScaleWidth);
12119
+ if (element === 'value') {
12120
+ this.valueResizeScale = resizeScale;
12121
+ this.valueTextTransform = "scale(" + resizeScale + ", " + resizeScale + ")";
12122
+ }
12123
+ else {
12124
+ this.unitsResizeScale = resizeScale;
12125
+ this.unitsTextTransform = "scale(" + resizeScale + ", " + resizeScale + ")";
12126
+ }
12127
+ this.cd.markForCheck();
12128
+ };
11896
12129
  LinearGaugeComponent.prototype.onClick = function () {
11897
12130
  this.select.emit({
11898
12131
  name: 'Value',
@@ -11900,7 +12133,7 @@
11900
12133
  });
11901
12134
  };
11902
12135
  LinearGaugeComponent.prototype.setColors = function () {
11903
- this.colors = new ColorHelper(this.scheme, 'ordinal', [this.value], this.customColors);
12136
+ this.colors = new ColorHelper(this.scheme, exports.ɵc.Ordinal, [this.value], this.customColors);
11904
12137
  };
11905
12138
  return LinearGaugeComponent;
11906
12139
  }(BaseChartComponent));
@@ -11930,7 +12163,7 @@
11930
12163
  var _this = _super.apply(this, __spread(arguments)) || this;
11931
12164
  _this.legend = false;
11932
12165
  _this.legendTitle = 'Legend';
11933
- _this.legendPosition = 'right';
12166
+ _this.legendPosition = exports.LegendPosition.Right;
11934
12167
  _this.min = 0;
11935
12168
  _this.max = 100;
11936
12169
  _this.bigSegments = 10;
@@ -12104,7 +12337,7 @@
12104
12337
  };
12105
12338
  GaugeComponent.prototype.getLegendOptions = function () {
12106
12339
  return {
12107
- scaleType: 'ordinal',
12340
+ scaleType: exports.ɵc.Ordinal,
12108
12341
  colors: this.colors,
12109
12342
  domain: this.domain,
12110
12343
  title: this.legendTitle,
@@ -12112,7 +12345,7 @@
12112
12345
  };
12113
12346
  };
12114
12347
  GaugeComponent.prototype.setColors = function () {
12115
- this.colors = new ColorHelper(this.scheme, 'ordinal', this.domain, this.customColors);
12348
+ this.colors = new ColorHelper(this.scheme, exports.ɵc.Ordinal, this.domain, this.customColors);
12116
12349
  };
12117
12350
  GaugeComponent.prototype.onActivate = function (item) {
12118
12351
  var idx = this.activeEntries.findIndex(function (d) {
@@ -12285,12 +12518,12 @@
12285
12518
  // [136, 225] = 'middle';
12286
12519
  // [226, 315] = 'end';
12287
12520
  angle = (this.startAngle + angle) % 360;
12288
- var textAnchor = 'middle';
12521
+ var textAnchor = exports.TextAnchor.Middle;
12289
12522
  if (angle > 45 && angle <= 135) {
12290
- textAnchor = 'start';
12523
+ textAnchor = exports.TextAnchor.Start;
12291
12524
  }
12292
12525
  else if (angle > 225 && angle <= 315) {
12293
- textAnchor = 'end';
12526
+ textAnchor = exports.TextAnchor.End;
12294
12527
  }
12295
12528
  return textAnchor;
12296
12529
  };
@@ -12461,6 +12694,7 @@
12461
12694
  exports.PolarChartModule = PolarChartModule;
12462
12695
  exports.PolarSeriesComponent = PolarSeriesComponent;
12463
12696
  exports.ScaleLegendComponent = ScaleLegendComponent;
12697
+ exports.ScaleType = exports.ɵc;
12464
12698
  exports.SeriesHorizontal = SeriesHorizontal;
12465
12699
  exports.SeriesVerticalComponent = SeriesVerticalComponent;
12466
12700
  exports.SvgLinearGradientComponent = SvgLinearGradientComponent;