@pioneer-code/pioneer-charts 1.0.1 → 1.0.3

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 (253) hide show
  1. package/README.md +27 -50
  2. package/esm2022/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.builder.mjs +272 -0
  3. package/esm2022/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.mjs +47 -0
  4. package/esm2022/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.model.mjs +2 -0
  5. package/esm2022/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.module.mjs +20 -0
  6. package/esm2022/lib/bar-chart/bar-horizontal-chart/public_api.mjs +5 -0
  7. package/esm2022/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.builder.mjs +284 -0
  8. package/esm2022/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.mjs +47 -0
  9. package/esm2022/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.model.mjs +2 -0
  10. package/esm2022/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.module.mjs +20 -0
  11. package/esm2022/lib/bar-chart/bar-vertical-chart/public_api.mjs +5 -0
  12. package/esm2022/lib/core/axis.builder.mjs +58 -0
  13. package/esm2022/lib/core/chart.mjs +90 -0
  14. package/esm2022/lib/core/chart.model.mjs +7 -0
  15. package/esm2022/lib/core/color.service.mjs +74 -0
  16. package/esm2022/lib/core/grid.builder.mjs +40 -0
  17. package/esm2022/lib/core/index.mjs +2 -0
  18. package/esm2022/lib/core/public_api.mjs +8 -0
  19. package/esm2022/lib/core/tooltip.builder.mjs +42 -0
  20. package/esm2022/lib/core/transition.service.mjs +19 -0
  21. package/esm2022/lib/line-area-chart/line-area-chart-effects.builders.mjs +117 -0
  22. package/esm2022/lib/line-area-chart/line-area-chart.builder.mjs +206 -0
  23. package/esm2022/lib/line-area-chart/line-area-chart.component.mjs +47 -0
  24. package/esm2022/lib/line-area-chart/line-area-chart.model.mjs +2 -0
  25. package/esm2022/lib/line-area-chart/line-area-chart.module.mjs +24 -0
  26. package/esm2022/lib/line-area-chart/public_api.mjs +5 -0
  27. package/esm2022/lib/pie-chart/pie-chart.builder.mjs +99 -0
  28. package/esm2022/lib/pie-chart/pie-chart.component.mjs +47 -0
  29. package/esm2022/lib/pie-chart/pie-chart.model.mjs +2 -0
  30. package/esm2022/lib/pie-chart/pie-chart.module.mjs +24 -0
  31. package/esm2022/lib/pie-chart/public_api.mjs +5 -0
  32. package/esm2022/pioneer-code-pioneer-charts.mjs +5 -0
  33. package/esm2022/public-api.mjs +9 -0
  34. package/fesm2022/pioneer-code-pioneer-charts.mjs +1493 -0
  35. package/fesm2022/pioneer-code-pioneer-charts.mjs.map +1 -0
  36. package/index.d.ts +5 -0
  37. package/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.builder.d.ts +41 -39
  38. package/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.d.ts +21 -18
  39. package/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.model.d.ts +15 -15
  40. package/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.module.d.ts +7 -2
  41. package/lib/bar-chart/bar-horizontal-chart/public_api.d.ts +4 -4
  42. package/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.builder.d.ts +42 -40
  43. package/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.d.ts +21 -18
  44. package/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.model.d.ts +15 -15
  45. package/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.module.d.ts +7 -2
  46. package/lib/bar-chart/bar-vertical-chart/public_api.d.ts +4 -4
  47. package/lib/core/axis.builder.d.ts +21 -18
  48. package/lib/core/chart.d.ts +55 -52
  49. package/lib/core/chart.model.d.ts +21 -21
  50. package/lib/core/color.service.d.ts +32 -29
  51. package/lib/core/grid.builder.d.ts +22 -19
  52. package/lib/core/index.d.ts +1 -1
  53. package/lib/core/public_api.d.ts +7 -8
  54. package/lib/core/tooltip.builder.d.ts +10 -11
  55. package/lib/core/transition.service.d.ts +7 -4
  56. package/lib/line-area-chart/line-area-chart-effects.builders.d.ts +27 -27
  57. package/lib/line-area-chart/line-area-chart.builder.d.ts +39 -38
  58. package/lib/line-area-chart/line-area-chart.component.d.ts +21 -18
  59. package/lib/line-area-chart/line-area-chart.model.d.ts +9 -9
  60. package/lib/line-area-chart/line-area-chart.module.d.ts +8 -2
  61. package/lib/line-area-chart/public_api.d.ts +4 -4
  62. package/lib/pie-chart/pie-chart.builder.d.ts +33 -34
  63. package/lib/pie-chart/pie-chart.component.d.ts +21 -18
  64. package/lib/pie-chart/pie-chart.model.d.ts +4 -4
  65. package/lib/pie-chart/pie-chart.module.d.ts +8 -2
  66. package/lib/pie-chart/public_api.d.ts +4 -4
  67. package/package.json +21 -19
  68. package/public-api.d.ts +5 -0
  69. package/scss/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.scss +19 -0
  70. package/scss/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.scss +8 -0
  71. package/scss/{core → lib/core}/theme/imports.scss +12 -12
  72. package/scss/lib/line-area-chart/line-area-chart.component.scss +35 -0
  73. package/scss/{pie-chart → lib/pie-chart}/pie-chart.component.scss +10 -10
  74. package/scss/{core/core.scss → lib/pioneer-charts.scss} +26 -13
  75. package/themes/pioneer-charts.css +22 -0
  76. package/themes/pioneer-charts.css.map +10 -0
  77. package/themes/pioneer-charts.min.css +3 -0
  78. package/themes/pioneer-charts.min.css.map +10 -0
  79. package/bundles/pioneer-code-pioneer-charts.umd.js +0 -3700
  80. package/bundles/pioneer-code-pioneer-charts.umd.js.map +0 -1
  81. package/bundles/pioneer-code-pioneer-charts.umd.min.js +0 -2
  82. package/bundles/pioneer-code-pioneer-charts.umd.min.js.map +0 -1
  83. package/esm2015/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.builder.js +0 -486
  84. package/esm2015/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.js +0 -89
  85. package/esm2015/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.model.js +0 -37
  86. package/esm2015/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.module.js +0 -19
  87. package/esm2015/lib/bar-chart/bar-horizontal-chart/index.js +0 -6
  88. package/esm2015/lib/bar-chart/bar-horizontal-chart/public_api.js +0 -9
  89. package/esm2015/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.builder.js +0 -518
  90. package/esm2015/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.js +0 -89
  91. package/esm2015/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.model.js +0 -37
  92. package/esm2015/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.module.js +0 -19
  93. package/esm2015/lib/bar-chart/bar-vertical-chart/index.js +0 -6
  94. package/esm2015/lib/bar-chart/bar-vertical-chart/public_api.js +0 -9
  95. package/esm2015/lib/core/axis.builder.js +0 -99
  96. package/esm2015/lib/core/chart.js +0 -144
  97. package/esm2015/lib/core/chart.model.js +0 -39
  98. package/esm2015/lib/core/color.service.js +0 -149
  99. package/esm2015/lib/core/core.module.js +0 -24
  100. package/esm2015/lib/core/grid.builder.js +0 -88
  101. package/esm2015/lib/core/index.js +0 -6
  102. package/esm2015/lib/core/public_api.js +0 -13
  103. package/esm2015/lib/core/tooltip.builder.js +0 -74
  104. package/esm2015/lib/core/transition.service.js +0 -23
  105. package/esm2015/lib/dialog/dialog.component.js +0 -50
  106. package/esm2015/lib/dialog/dialog.module.js +0 -23
  107. package/esm2015/lib/dialog/index.js +0 -6
  108. package/esm2015/lib/dialog/public_api.js +0 -7
  109. package/esm2015/lib/header/header.component.js +0 -21
  110. package/esm2015/lib/header/header.model.js +0 -13
  111. package/esm2015/lib/header/header.module.js +0 -19
  112. package/esm2015/lib/header/index.js +0 -6
  113. package/esm2015/lib/header/public_api.js +0 -8
  114. package/esm2015/lib/line-area-chart/index.js +0 -6
  115. package/esm2015/lib/line-area-chart/line-area-chart-effects.builders.js +0 -236
  116. package/esm2015/lib/line-area-chart/line-area-chart.builder.js +0 -386
  117. package/esm2015/lib/line-area-chart/line-area-chart.component.js +0 -89
  118. package/esm2015/lib/line-area-chart/line-area-chart.model.js +0 -23
  119. package/esm2015/lib/line-area-chart/line-area-chart.module.js +0 -19
  120. package/esm2015/lib/line-area-chart/public_api.js +0 -9
  121. package/esm2015/lib/pagination/index.js +0 -6
  122. package/esm2015/lib/pagination/pagination.component.js +0 -144
  123. package/esm2015/lib/pagination/pagination.model.js +0 -48
  124. package/esm2015/lib/pagination/pagination.module.js +0 -25
  125. package/esm2015/lib/pagination/public_api.js +0 -8
  126. package/esm2015/lib/pie-chart/index.js +0 -6
  127. package/esm2015/lib/pie-chart/pie-chart.builder.js +0 -221
  128. package/esm2015/lib/pie-chart/pie-chart.component.js +0 -89
  129. package/esm2015/lib/pie-chart/pie-chart.model.js +0 -13
  130. package/esm2015/lib/pie-chart/pie-chart.module.js +0 -19
  131. package/esm2015/lib/pie-chart/public_api.js +0 -9
  132. package/esm2015/lib/spinner/index.js +0 -6
  133. package/esm2015/lib/spinner/public_api.js +0 -7
  134. package/esm2015/lib/spinner/spinner.component.js +0 -28
  135. package/esm2015/lib/spinner/spinner.module.js +0 -23
  136. package/esm2015/lib/table/index.js +0 -6
  137. package/esm2015/lib/table/public_api.js +0 -8
  138. package/esm2015/lib/table/table-sort.service.js +0 -95
  139. package/esm2015/lib/table/table.component.js +0 -232
  140. package/esm2015/lib/table/table.model.js +0 -51
  141. package/esm2015/lib/table/table.module.js +0 -23
  142. package/esm2015/pioneer-code-pioneer-charts.js +0 -10
  143. package/esm2015/public_api.js +0 -18
  144. package/esm5/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.builder.js +0 -550
  145. package/esm5/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.js +0 -102
  146. package/esm5/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.model.js +0 -37
  147. package/esm5/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.module.js +0 -23
  148. package/esm5/lib/bar-chart/bar-horizontal-chart/index.js +0 -6
  149. package/esm5/lib/bar-chart/bar-horizontal-chart/public_api.js +0 -9
  150. package/esm5/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.builder.js +0 -582
  151. package/esm5/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.js +0 -102
  152. package/esm5/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.model.js +0 -37
  153. package/esm5/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.module.js +0 -23
  154. package/esm5/lib/bar-chart/bar-vertical-chart/index.js +0 -6
  155. package/esm5/lib/bar-chart/bar-vertical-chart/public_api.js +0 -9
  156. package/esm5/lib/core/axis.builder.js +0 -117
  157. package/esm5/lib/core/chart.js +0 -182
  158. package/esm5/lib/core/chart.model.js +0 -39
  159. package/esm5/lib/core/color.service.js +0 -199
  160. package/esm5/lib/core/core.module.js +0 -28
  161. package/esm5/lib/core/grid.builder.js +0 -100
  162. package/esm5/lib/core/index.js +0 -6
  163. package/esm5/lib/core/public_api.js +0 -13
  164. package/esm5/lib/core/tooltip.builder.js +0 -92
  165. package/esm5/lib/core/transition.service.js +0 -28
  166. package/esm5/lib/dialog/dialog.component.js +0 -58
  167. package/esm5/lib/dialog/dialog.module.js +0 -27
  168. package/esm5/lib/dialog/index.js +0 -6
  169. package/esm5/lib/dialog/public_api.js +0 -7
  170. package/esm5/lib/header/header.component.js +0 -25
  171. package/esm5/lib/header/header.model.js +0 -13
  172. package/esm5/lib/header/header.module.js +0 -23
  173. package/esm5/lib/header/index.js +0 -6
  174. package/esm5/lib/header/public_api.js +0 -8
  175. package/esm5/lib/line-area-chart/index.js +0 -6
  176. package/esm5/lib/line-area-chart/line-area-chart-effects.builders.js +0 -280
  177. package/esm5/lib/line-area-chart/line-area-chart.builder.js +0 -439
  178. package/esm5/lib/line-area-chart/line-area-chart.component.js +0 -102
  179. package/esm5/lib/line-area-chart/line-area-chart.model.js +0 -23
  180. package/esm5/lib/line-area-chart/line-area-chart.module.js +0 -23
  181. package/esm5/lib/line-area-chart/public_api.js +0 -9
  182. package/esm5/lib/pagination/index.js +0 -6
  183. package/esm5/lib/pagination/pagination.component.js +0 -182
  184. package/esm5/lib/pagination/pagination.model.js +0 -48
  185. package/esm5/lib/pagination/pagination.module.js +0 -29
  186. package/esm5/lib/pagination/public_api.js +0 -8
  187. package/esm5/lib/pie-chart/index.js +0 -6
  188. package/esm5/lib/pie-chart/pie-chart.builder.js +0 -242
  189. package/esm5/lib/pie-chart/pie-chart.component.js +0 -102
  190. package/esm5/lib/pie-chart/pie-chart.model.js +0 -13
  191. package/esm5/lib/pie-chart/pie-chart.module.js +0 -23
  192. package/esm5/lib/pie-chart/public_api.js +0 -9
  193. package/esm5/lib/spinner/index.js +0 -6
  194. package/esm5/lib/spinner/public_api.js +0 -7
  195. package/esm5/lib/spinner/spinner.component.js +0 -30
  196. package/esm5/lib/spinner/spinner.module.js +0 -27
  197. package/esm5/lib/table/index.js +0 -6
  198. package/esm5/lib/table/public_api.js +0 -8
  199. package/esm5/lib/table/table-sort.service.js +0 -119
  200. package/esm5/lib/table/table.component.js +0 -299
  201. package/esm5/lib/table/table.model.js +0 -51
  202. package/esm5/lib/table/table.module.js +0 -27
  203. package/esm5/pioneer-code-pioneer-charts.js +0 -10
  204. package/esm5/public_api.js +0 -18
  205. package/fesm2015/pioneer-code-pioneer-charts.js +0 -3077
  206. package/fesm2015/pioneer-code-pioneer-charts.js.map +0 -1
  207. package/fesm5/pioneer-code-pioneer-charts.js +0 -3665
  208. package/fesm5/pioneer-code-pioneer-charts.js.map +0 -1
  209. package/lib/bar-chart/bar-horizontal-chart/index.d.ts +0 -1
  210. package/lib/bar-chart/bar-vertical-chart/index.d.ts +0 -1
  211. package/lib/core/core.module.d.ts +0 -2
  212. package/lib/dialog/dialog.component.d.ts +0 -9
  213. package/lib/dialog/dialog.module.d.ts +0 -2
  214. package/lib/dialog/index.d.ts +0 -1
  215. package/lib/dialog/public_api.d.ts +0 -2
  216. package/lib/header/header.component.d.ts +0 -4
  217. package/lib/header/header.model.d.ts +0 -3
  218. package/lib/header/header.module.d.ts +0 -2
  219. package/lib/header/index.d.ts +0 -1
  220. package/lib/header/public_api.d.ts +0 -3
  221. package/lib/line-area-chart/index.d.ts +0 -1
  222. package/lib/pagination/index.d.ts +0 -1
  223. package/lib/pagination/pagination.component.d.ts +0 -20
  224. package/lib/pagination/pagination.model.d.ts +0 -28
  225. package/lib/pagination/pagination.module.d.ts +0 -2
  226. package/lib/pagination/public_api.d.ts +0 -3
  227. package/lib/pie-chart/index.d.ts +0 -1
  228. package/lib/spinner/index.d.ts +0 -1
  229. package/lib/spinner/public_api.d.ts +0 -2
  230. package/lib/spinner/spinner.component.d.ts +0 -4
  231. package/lib/spinner/spinner.module.d.ts +0 -2
  232. package/lib/table/index.d.ts +0 -1
  233. package/lib/table/public_api.d.ts +0 -3
  234. package/lib/table/table-sort.service.d.ts +0 -10
  235. package/lib/table/table.component.d.ts +0 -51
  236. package/lib/table/table.model.d.ts +0 -28
  237. package/lib/table/table.module.d.ts +0 -2
  238. package/pioneer-code-pioneer-charts.d.ts +0 -5
  239. package/pioneer-code-pioneer-charts.metadata.json +0 -1
  240. package/public_api.d.ts +0 -10
  241. package/scss/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.scss +0 -7
  242. package/scss/bar-chart/bar-vertical-chart/bar-vertical-chart.component.scss +0 -7
  243. package/scss/dialog/dialog.component.scss +0 -42
  244. package/scss/header/header.component.scss +0 -8
  245. package/scss/line-area-chart/line-area-chart.component.scss +0 -28
  246. package/scss/pagination/pagination.component.scss +0 -94
  247. package/scss/pcac.scss +0 -61
  248. package/scss/spinner/spinner.component.scss +0 -34
  249. package/scss/table/table.component.scss +0 -143
  250. package/themes/pcac.css +0 -291
  251. package/themes/pcac.css.map +0 -19
  252. package/themes/pcac.min.css +0 -3
  253. package/themes/pcac.min.css.map +0 -19
@@ -1,3700 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-axis'), require('d3-format'), require('d3-selection'), require('@angular/core'), require('@angular/platform-browser'), require('d3-scale'), require('d3-color'), require('d3-transition'), require('rxjs'), require('d3-shape'), require('d3-interpolate'), require('d3-array'), require('@angular/common'), require('@angular/forms')) :
3
- typeof define === 'function' && define.amd ? define('@pioneer-code/pioneer-charts', ['exports', 'd3-axis', 'd3-format', 'd3-selection', '@angular/core', '@angular/platform-browser', 'd3-scale', 'd3-color', 'd3-transition', 'rxjs', 'd3-shape', 'd3-interpolate', 'd3-array', '@angular/common', '@angular/forms'], factory) :
4
- (global = global || self, factory((global['pioneer-code'] = global['pioneer-code'] || {}, global['pioneer-code']['pioneer-charts'] = {}), global.d3Axis, global.d3Format, global.d3Selection, global.ng.core, global.ng.platformBrowser, global.d3Scale, global.d3Color, global.d3Transition, global.rxjs, global.d3Shape, global.d3Interpolate, global.d3Array, global.ng.common, global.ng.forms));
5
- }(this, function (exports, d3Axis, d3Format, d3Selection, core, platformBrowser, d3Scale, d3Color, d3Transition, rxjs, d3Shape, d3Interpolate, d3Array, common, forms) { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation. All rights reserved.
9
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
10
- this file except in compliance with the License. You may obtain a copy of the
11
- License at http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16
- MERCHANTABLITY OR NON-INFRINGEMENT.
17
-
18
- See the Apache Version 2.0 License for specific language governing permissions
19
- and limitations under the License.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
-
23
- var extendStatics = function(d, b) {
24
- extendStatics = Object.setPrototypeOf ||
25
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27
- return extendStatics(d, b);
28
- };
29
-
30
- function __extends(d, b) {
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
-
36
- /**
37
- * @fileoverview added by tsickle
38
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
39
- */
40
- /** @enum {string} */
41
- var PcacTickFormatEnum = {
42
- None: 'none',
43
- Percentage: 'percentage',
44
- Minutes: 'minutes',
45
- };
46
-
47
- /**
48
- * @fileoverview added by tsickle
49
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
50
- */
51
- var PcacAxisBuilder = /** @class */ (function () {
52
- function PcacAxisBuilder() {
53
- }
54
- /**
55
- * @param {?} config
56
- * @return {?}
57
- */
58
- PcacAxisBuilder.prototype.drawAxis = /**
59
- * @param {?} config
60
- * @return {?}
61
- */
62
- function (config) {
63
- if (!config.hideXAxis) {
64
- this.drawXAxis(config);
65
- }
66
- if (!config.hideYAxis) {
67
- this.drawYAxis(config);
68
- }
69
- };
70
- /**
71
- * @private
72
- * @param {?} config
73
- * @return {?}
74
- */
75
- PcacAxisBuilder.prototype.drawYAxis = /**
76
- * @private
77
- * @param {?} config
78
- * @return {?}
79
- */
80
- function (config) {
81
- /** @type {?} */
82
- var yAxis = d3Axis.axisLeft(config.yScale).ticks(config.numberOfTicks);
83
- if (config.yFormat) {
84
- switch (config.yFormat.toLocaleLowerCase()) {
85
- case PcacTickFormatEnum.Percentage:
86
- yAxis.tickFormat(d3Format.format('.0%'));
87
- break;
88
- case PcacTickFormatEnum.Minutes:
89
- yAxis.tickFormat((/**
90
- * @param {?} d
91
- * @return {?}
92
- */
93
- function (d) { return d + 'm'; }));
94
- break;
95
- }
96
- }
97
- config.svg.append('g')
98
- .attr('class', 'pcac-y-axis')
99
- .call(yAxis);
100
- };
101
- /**
102
- * @private
103
- * @param {?} config
104
- * @return {?}
105
- */
106
- PcacAxisBuilder.prototype.drawXAxis = /**
107
- * @private
108
- * @param {?} config
109
- * @return {?}
110
- */
111
- function (config) {
112
- /** @type {?} */
113
- var xAxis = d3Axis.axisBottom(config.xScale).ticks(config.numberOfTicks);
114
- if (config.xFormat) {
115
- switch (config.xFormat.toLocaleLowerCase()) {
116
- case PcacTickFormatEnum.Percentage:
117
- xAxis.tickFormat(d3Format.format('.0%'));
118
- break;
119
- case PcacTickFormatEnum.Minutes:
120
- xAxis.tickFormat((/**
121
- * @param {?} d
122
- * @return {?}
123
- */
124
- function (d) { return d + 'm'; }));
125
- break;
126
- }
127
- }
128
- config.svg.append('g')
129
- .attr('class', 'pcac-x-axis')
130
- .attr('transform', 'translate(0,' + config.height + ')')
131
- .call(xAxis);
132
- };
133
- return PcacAxisBuilder;
134
- }());
135
-
136
- /**
137
- * @fileoverview added by tsickle
138
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
139
- */
140
- var PcacGridBuilder = /** @class */ (function () {
141
- function PcacGridBuilder() {
142
- }
143
- /**
144
- * @param {?} config
145
- * @return {?}
146
- */
147
- PcacGridBuilder.prototype.drawVerticalGrid = /**
148
- * @param {?} config
149
- * @return {?}
150
- */
151
- function (config) {
152
- config.svg.append('g')
153
- .attr('class', 'pcac-grid')
154
- .selectAll('g.rule')
155
- .data(config.xScale.ticks(5))
156
- .enter().append('svg:g')
157
- .attr('class', 'pcac-grid-rule')
158
- .attr('transform', (/**
159
- * @param {?} d
160
- * @return {?}
161
- */
162
- function (d) { return ("translate(" + config.xScale(d) + ", 0)"); }))
163
- .append('svg:line')
164
- .attr('y1', 0)
165
- .attr('y2', config.height)
166
- .attr('class', (/**
167
- * @param {?} d
168
- * @param {?} i
169
- * @return {?}
170
- */
171
- function (d, i) { return (i === 0 ? 'pcac-grid-rule-last' : ''); }));
172
- };
173
- /**
174
- * @param {?} config
175
- * @return {?}
176
- */
177
- PcacGridBuilder.prototype.drawHorizontalGrid = /**
178
- * @param {?} config
179
- * @return {?}
180
- */
181
- function (config) {
182
- config.svg.append('g')
183
- .attr('class', 'pcac-grid')
184
- .selectAll('g.pcac-grid-rule')
185
- .data(config.yScale.ticks(config.numberOfTicks))
186
- .enter().append('svg:g')
187
- .attr('class', 'pcac-grid-rule')
188
- .append('svg:line')
189
- .attr('y1', (/**
190
- * @param {?} d
191
- * @return {?}
192
- */
193
- function (d) { return config.yScale(d); }))
194
- .attr('y2', (/**
195
- * @param {?} d
196
- * @return {?}
197
- */
198
- function (d) { return config.yScale(d); }))
199
- .attr('x1', 0)
200
- .attr('x2', config.width)
201
- .attr('class', (/**
202
- * @param {?} d
203
- * @param {?} i
204
- * @return {?}
205
- */
206
- function (d, i) { return (i === 0 ? 'pcac-grid-rule-last' : ''); }));
207
- };
208
- return PcacGridBuilder;
209
- }());
210
-
211
- /**
212
- * @fileoverview added by tsickle
213
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
214
- */
215
- var PcacColorService = /** @class */ (function () {
216
- function PcacColorService() {
217
- this.primary = '#43425d';
218
- this.primaryLight = '#a3a1fb';
219
- this.success = '#5ee2a0';
220
- this.danger = '#ff6565';
221
- this.warning = '#fec163';
222
- this.orange = '#ffa177';
223
- this.blue = '#55d8fe';
224
- this.scale = (/** @type {?} */ ([
225
- this.primaryLight,
226
- this.success,
227
- this.danger,
228
- this.warning,
229
- this.orange,
230
- this.blue
231
- ]));
232
- this.alert = 'red';
233
- }
234
- /**
235
- * Get a scale of colors dynamically
236
- * @param numberOfNodes Number of items in dynamically build collection of colors
237
- */
238
- /**
239
- * Get a scale of colors dynamically
240
- * @param {?} numberOfNodes Number of items in dynamically build collection of colors
241
- * @return {?}
242
- */
243
- PcacColorService.prototype.getColorScale = /**
244
- * Get a scale of colors dynamically
245
- * @param {?} numberOfNodes Number of items in dynamically build collection of colors
246
- * @return {?}
247
- */
248
- function (numberOfNodes) {
249
- /** @type {?} */
250
- var pallette = (/** @type {?} */ ([]));
251
- for (var i = 0; i < numberOfNodes; i++) {
252
- /** @type {?} */
253
- var mark = i % this.scale.length;
254
- pallette.push(this.scale[mark]);
255
- }
256
- return pallette;
257
- };
258
- /**
259
- * @return {?}
260
- */
261
- PcacColorService.prototype.getAlert = /**
262
- * @return {?}
263
- */
264
- function () {
265
- return this.alert;
266
- };
267
- /**
268
- * Set the scale that charts use to set colors of data[x] on the UI.
269
- * @param colors A collection of hex values
270
- */
271
- /**
272
- * Set the scale that charts use to set colors of data[x] on the UI.
273
- * @param {?} colors A collection of hex values
274
- * @return {?}
275
- */
276
- PcacColorService.prototype.setScale = /**
277
- * Set the scale that charts use to set colors of data[x] on the UI.
278
- * @param {?} colors A collection of hex values
279
- * @return {?}
280
- */
281
- function (colors) {
282
- this.scale = colors;
283
- };
284
- /**
285
- * @param {?} color
286
- * @return {?}
287
- */
288
- PcacColorService.prototype.setPrimary = /**
289
- * @param {?} color
290
- * @return {?}
291
- */
292
- function (color) {
293
- this.primary = color;
294
- };
295
- /**
296
- * @param {?} color
297
- * @return {?}
298
- */
299
- PcacColorService.prototype.setPrimaryLight = /**
300
- * @param {?} color
301
- * @return {?}
302
- */
303
- function (color) {
304
- this.primaryLight = color;
305
- };
306
- /**
307
- * @param {?} color
308
- * @return {?}
309
- */
310
- PcacColorService.prototype.setSuccess = /**
311
- * @param {?} color
312
- * @return {?}
313
- */
314
- function (color) {
315
- this.success = color;
316
- };
317
- /**
318
- * @param {?} color
319
- * @return {?}
320
- */
321
- PcacColorService.prototype.setDanger = /**
322
- * @param {?} color
323
- * @return {?}
324
- */
325
- function (color) {
326
- this.danger = color;
327
- };
328
- /**
329
- * @param {?} color
330
- * @return {?}
331
- */
332
- PcacColorService.prototype.setOrange = /**
333
- * @param {?} color
334
- * @return {?}
335
- */
336
- function (color) {
337
- this.orange = color;
338
- };
339
- /**
340
- * @param {?} color
341
- * @return {?}
342
- */
343
- PcacColorService.prototype.setBlue = /**
344
- * @param {?} color
345
- * @return {?}
346
- */
347
- function (color) {
348
- this.blue = color;
349
- };
350
- /**
351
- * @return {?}
352
- */
353
- PcacColorService.prototype.setAlert = /**
354
- * @return {?}
355
- */
356
- function () {
357
- return this.alert;
358
- };
359
- return PcacColorService;
360
- }());
361
-
362
- /**
363
- * @fileoverview added by tsickle
364
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
365
- */
366
- var PcacTransitionService = /** @class */ (function () {
367
- function PcacTransitionService() {
368
- this.transitionDuration = 750;
369
- }
370
- /**
371
- * @return {?}
372
- */
373
- PcacTransitionService.prototype.getTransitionDuration = /**
374
- * @return {?}
375
- */
376
- function () {
377
- return this.transitionDuration;
378
- };
379
- return PcacTransitionService;
380
- }());
381
-
382
- /**
383
- * @fileoverview added by tsickle
384
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
385
- */
386
- var PcacTooltipBuilder = /** @class */ (function () {
387
- function PcacTooltipBuilder() {
388
- this.tooltip = (/** @type {?} */ (d3Selection.select('body').append('div').attr('class', 'pcac-d3-tooltip'))); // TODO: Strongly type
389
- }
390
- // TODO: Strongly type
391
- /**
392
- * @param {?} data
393
- * @param {?=} tickFormat
394
- * @return {?}
395
- */
396
- PcacTooltipBuilder.prototype.showBarTooltip =
397
- // TODO: Strongly type
398
- /**
399
- * @param {?} data
400
- * @param {?=} tickFormat
401
- * @return {?}
402
- */
403
- function (data, tickFormat) {
404
- this.tooltip.style('left', d3Selection.event.pageX - 50 + 'px')
405
- .style('top', d3Selection.event.pageY - 70 + 'px')
406
- .style('display', 'inline-block')
407
- .html(this.getBarTipData(data, tickFormat));
408
- };
409
- /**
410
- * @return {?}
411
- */
412
- PcacTooltipBuilder.prototype.hideTooltip = /**
413
- * @return {?}
414
- */
415
- function () {
416
- this.tooltip.style('display', 'none');
417
- };
418
- /**
419
- * @private
420
- * @param {?} data
421
- * @param {?=} tickFormat
422
- * @return {?}
423
- */
424
- PcacTooltipBuilder.prototype.getBarTipData = /**
425
- * @private
426
- * @param {?} data
427
- * @param {?=} tickFormat
428
- * @return {?}
429
- */
430
- function (data, tickFormat) {
431
- /** @type {?} */
432
- var value = data.value;
433
- if (tickFormat) {
434
- switch (tickFormat.toLocaleLowerCase()) {
435
- case PcacTickFormatEnum.Percentage:
436
- value = (/** @type {?} */ (value)) * 100 + '%';
437
- break;
438
- case PcacTickFormatEnum.Minutes:
439
- break;
440
- }
441
- }
442
- return data.key ? data.key + '</br>' + value.toString() : value.toString();
443
- };
444
- PcacTooltipBuilder.decorators = [
445
- { type: core.Injectable }
446
- ];
447
- return PcacTooltipBuilder;
448
- }());
449
-
450
- /**
451
- * @fileoverview added by tsickle
452
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
453
- */
454
- var PcacChart = /** @class */ (function () {
455
- function PcacChart(axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) {
456
- this.axisBuilder = axisBuilder;
457
- this.gridBuilder = gridBuilder;
458
- this.transitionService = transitionService;
459
- this.tooltipBuilder = tooltipBuilder;
460
- this.colorService = colorService;
461
- this.margin = { top: 8, right: 16, bottom: 20, left: 40 };
462
- this.width = 400;
463
- this.height = 400;
464
- this.colors = (/** @type {?} */ ([]));
465
- this.startData = (/** @type {?} */ ([])); // TODO: Strongly type
466
- // TODO: Strongly type
467
- this.endData = (/** @type {?} */ ([])); // TODO: Strongly type
468
- }
469
- /**
470
- * Prior to building a chart, we need to initialize the state of the chart
471
- * @param chartElm Reference to SVG on dom
472
- * @param config Chart specific configuration
473
- */
474
- /**
475
- * Prior to building a chart, we need to initialize the state of the chart
476
- * @param {?} chartElm Reference to SVG on dom
477
- * @param {?} config Chart specific configuration
478
- * @return {?}
479
- */
480
- PcacChart.prototype.initializeChartState = /**
481
- * Prior to building a chart, we need to initialize the state of the chart
482
- * @param {?} chartElm Reference to SVG on dom
483
- * @param {?} config Chart specific configuration
484
- * @return {?}
485
- */
486
- function (chartElm, config) {
487
- d3Selection.select(chartElm.nativeElement).select('g').remove();
488
- this.width = chartElm.nativeElement.parentNode.clientWidth - this.margin.left - this.margin.right;
489
- this.height = config.height;
490
- this.colors = this.colorService.getColorScale(Math.max(config.data.length, config.data[0].data ? config.data[0].data.length : 0));
491
- };
492
- /**
493
- * 1) Set the width and height of the SVG
494
- * 2) Add a group and translate it to state of {{center}} option
495
- * @param chartElm Reference to SVG on dom
496
- * @param center Are we pinning x,y to the top,left, or are we centering our drawing group inside the SVG.
497
- */
498
- /**
499
- * 1) Set the width and height of the SVG
500
- * 2) Add a group and translate it to state of {{center}} option
501
- * @param {?} chartElm Reference to SVG on dom
502
- * @param {?=} center Are we pinning x,y to the top,left, or are we centering our drawing group inside the SVG.
503
- * @return {?}
504
- */
505
- PcacChart.prototype.buildContainer = /**
506
- * 1) Set the width and height of the SVG
507
- * 2) Add a group and translate it to state of {{center}} option
508
- * @param {?} chartElm Reference to SVG on dom
509
- * @param {?=} center Are we pinning x,y to the top,left, or are we centering our drawing group inside the SVG.
510
- * @return {?}
511
- */
512
- function (chartElm, center) {
513
- if (center === void 0) { center = false; }
514
- /** @type {?} */
515
- var combinedHeight = this.height + this.margin.top + this.margin.bottom;
516
- /** @type {?} */
517
- var combinedWidth = this.width + this.margin.left + this.margin.right;
518
- this.svg = d3Selection.select(chartElm.nativeElement)
519
- .attr('width', combinedWidth)
520
- .attr('height', combinedHeight);
521
- if (center) {
522
- this.svg = this.svg
523
- .append('g')
524
- .attr('transform', 'translate(' + combinedWidth / 2 + ',' + combinedHeight / 2 + ')');
525
- return;
526
- }
527
- this.svg = this.svg
528
- .append('g')
529
- .attr('transform', 'translate(' + this.margin.left + ',' + this.margin.top + ')');
530
- };
531
- /**
532
- * Most charts share a default margin(s) state.
533
- * In some cases, that state needs to be calculated based on the content that resides in that margin.
534
- * For example, labels on a horizontal bar chart are dynamic and such the margin needs to be calculated ahead of
535
- * chart axis construction.
536
- * @param chartElm Reference to SVG on dom
537
- * @param data Generic multi-dimensional IPcacData structure
538
- * @param yScale D3 scale transformation object (d3.ScaleBand)
539
- */
540
- /**
541
- * Most charts share a default margin(s) state.
542
- * In some cases, that state needs to be calculated based on the content that resides in that margin.
543
- * For example, labels on a horizontal bar chart are dynamic and such the margin needs to be calculated ahead of
544
- * chart axis construction.
545
- * @param {?} chartElm Reference to SVG on dom
546
- * @param {?} data Generic multi-dimensional IPcacData structure
547
- * @param {?} yScale D3 scale transformation object (d3.ScaleBand)
548
- * @return {?}
549
- */
550
- PcacChart.prototype.setHorizontalMarginsBasedOnContent = /**
551
- * Most charts share a default margin(s) state.
552
- * In some cases, that state needs to be calculated based on the content that resides in that margin.
553
- * For example, labels on a horizontal bar chart are dynamic and such the margin needs to be calculated ahead of
554
- * chart axis construction.
555
- * @param {?} chartElm Reference to SVG on dom
556
- * @param {?} data Generic multi-dimensional IPcacData structure
557
- * @param {?} yScale D3 scale transformation object (d3.ScaleBand)
558
- * @return {?}
559
- */
560
- function (chartElm, data, yScale) {
561
- /** @type {?} */
562
- var axisY = d3Axis.axisLeft(yScale).ticks(5);
563
- /** @type {?} */
564
- var max = 0;
565
- d3Selection.select(chartElm.nativeElement).append('g')
566
- .call(axisY)
567
- .each((/**
568
- * @param {?} d
569
- * @param {?} i
570
- * @param {?} n
571
- * @return {?}
572
- */
573
- function (d, i, n) {
574
- if (n[i].getBBox().width > max) {
575
- max = n[i].getBBox().width;
576
- }
577
- }))
578
- .remove();
579
- this.margin.left = max;
580
- this.margin.bottom = this.margin.bottom;
581
- this.width = this.width - this.margin.left;
582
- };
583
- PcacChart.decorators = [
584
- { type: core.Injectable }
585
- ];
586
- /** @nocollapse */
587
- PcacChart.ctorParameters = function () { return [
588
- { type: PcacAxisBuilder },
589
- { type: PcacGridBuilder },
590
- { type: PcacTransitionService },
591
- { type: PcacTooltipBuilder },
592
- { type: PcacColorService }
593
- ]; };
594
- return PcacChart;
595
- }());
596
-
597
- /**
598
- * @fileoverview added by tsickle
599
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
600
- */
601
- var PcacCoreModule = /** @class */ (function () {
602
- function PcacCoreModule() {
603
- }
604
- PcacCoreModule.decorators = [
605
- { type: core.NgModule, args: [{
606
- providers: [
607
- PcacColorService,
608
- PcacTransitionService,
609
- PcacGridBuilder,
610
- PcacAxisBuilder,
611
- PcacTooltipBuilder
612
- ]
613
- },] }
614
- ];
615
- return PcacCoreModule;
616
- }());
617
-
618
- /**
619
- * @fileoverview added by tsickle
620
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
621
- */
622
-
623
- /**
624
- * @fileoverview added by tsickle
625
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
626
- */
627
-
628
- /**
629
- * @fileoverview added by tsickle
630
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
631
- */
632
- var PcacHeaderComponent = /** @class */ (function () {
633
- function PcacHeaderComponent() {
634
- }
635
- PcacHeaderComponent.decorators = [
636
- { type: core.Component, args: [{
637
- selector: 'pcac-header',
638
- template: "<section class=\"pcac-font-family pcac-header\">\r\n <div class=\"clearfix\">\r\n <div class=\"float-left\">\r\n <h3>{{config?.title}}</h3>\r\n </div>\r\n </div>\r\n</section>\r\n"
639
- }] }
640
- ];
641
- PcacHeaderComponent.propDecorators = {
642
- config: [{ type: core.Input }]
643
- };
644
- return PcacHeaderComponent;
645
- }());
646
-
647
- /**
648
- * @fileoverview added by tsickle
649
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
650
- */
651
-
652
- /**
653
- * @fileoverview added by tsickle
654
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
655
- */
656
- var PcacHeaderModule = /** @class */ (function () {
657
- function PcacHeaderModule() {
658
- }
659
- PcacHeaderModule.decorators = [
660
- { type: core.NgModule, args: [{
661
- exports: [
662
- PcacHeaderComponent
663
- ],
664
- declarations: [
665
- PcacHeaderComponent
666
- ]
667
- },] }
668
- ];
669
- return PcacHeaderModule;
670
- }());
671
-
672
- /**
673
- * @fileoverview added by tsickle
674
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
675
- */
676
-
677
- /**
678
- * @fileoverview added by tsickle
679
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
680
- */
681
-
682
- /**
683
- * @fileoverview added by tsickle
684
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
685
- */
686
- /** @enum {string} */
687
- var PcacTableSortIconsEnum = {
688
- Sort: 'pcac-icon pcac-icon-sort',
689
- SortAsc: 'pcac-icon pcac-icon-sort-asc',
690
- SortDesc: 'pcac-icon pcac-icon-sort-desc',
691
- };
692
-
693
- /**
694
- * @fileoverview added by tsickle
695
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
696
- */
697
- var TableSortService = /** @class */ (function () {
698
- function TableSortService() {
699
- }
700
- /**
701
- * @param {?} data
702
- * @param {?} columnIndex
703
- * @param {?} direction
704
- * @return {?}
705
- */
706
- TableSortService.prototype.sort = /**
707
- * @param {?} data
708
- * @param {?} columnIndex
709
- * @param {?} direction
710
- * @return {?}
711
- */
712
- function (data, columnIndex, direction) {
713
- if (data) {
714
- this.sortData(data, columnIndex, direction);
715
- }
716
- };
717
- /**
718
- * @private
719
- * @param {?} data
720
- * @param {?} columnIndex
721
- * @param {?} direction
722
- * @return {?}
723
- */
724
- TableSortService.prototype.sortData = /**
725
- * @private
726
- * @param {?} data
727
- * @param {?} columnIndex
728
- * @param {?} direction
729
- * @return {?}
730
- */
731
- function (data, columnIndex, direction) {
732
- var _this = this;
733
- data.sort((/**
734
- * @param {?} a
735
- * @param {?} b
736
- * @return {?}
737
- */
738
- function (a, b) {
739
- /** @type {?} */
740
- var comparison = (direction === PcacTableSortIconsEnum.SortAsc)
741
- ? -_this.orderByComparer(a.data[columnIndex].value, b.data[columnIndex].value)
742
- : _this.orderByComparer(a.data[columnIndex].value, b.data[columnIndex].value);
743
- if (comparison !== 0) {
744
- return comparison;
745
- }
746
- // equal each other
747
- return 0;
748
- }));
749
- };
750
- /**
751
- * @private
752
- * @param {?} a
753
- * @param {?} b
754
- * @return {?}
755
- */
756
- TableSortService.prototype.orderByComparer = /**
757
- * @private
758
- * @param {?} a
759
- * @param {?} b
760
- * @return {?}
761
- */
762
- function (a, b) {
763
- if (a === null || typeof a === 'undefined') {
764
- a = 0;
765
- }
766
- if (b === null || typeof b === 'undefined') {
767
- b = 0;
768
- }
769
- if ((isNaN(parseFloat(a)) || !isFinite(a)) || (isNaN(parseFloat(b)) || !isFinite(b))) {
770
- // is not a number so lowercase the string to properly compare
771
- if (a.toLowerCase() < b.toLowerCase()) {
772
- return -1;
773
- }
774
- if (a.toLowerCase() > b.toLowerCase()) {
775
- return 1;
776
- }
777
- }
778
- else {
779
- // parse strings as numbers to compare properly
780
- if (parseFloat(a) < parseFloat(b)) {
781
- return -1;
782
- }
783
- if (parseFloat(a) > parseFloat(b)) {
784
- return 1;
785
- }
786
- }
787
- // equal each other
788
- return 0;
789
- };
790
- TableSortService.decorators = [
791
- { type: core.Injectable }
792
- ];
793
- return TableSortService;
794
- }());
795
-
796
- /**
797
- * @fileoverview added by tsickle
798
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
799
- */
800
- var PcacTableComponent = /** @class */ (function () {
801
- function PcacTableComponent(sortService, changeDetector) {
802
- this.sortService = sortService;
803
- this.changeDetector = changeDetector;
804
- this.config = (/** @type {?} */ ({ height: 400 }));
805
- this.deleteClicked = new core.EventEmitter();
806
- this.editClicked = new core.EventEmitter();
807
- this.historyClicked = new core.EventEmitter();
808
- this.columnWidths = (/** @type {?} */ ([]));
809
- this.headers = (/** @type {?} */ ([]));
810
- this.rowData = (/** @type {?} */ ([]));
811
- this.adjustedHeight = 200;
812
- }
813
- /**
814
- * @return {?}
815
- */
816
- PcacTableComponent.prototype.ngAfterViewInit = /**
817
- * @return {?}
818
- */
819
- function () {
820
- var _this = this;
821
- this.initTableUi();
822
- // @ngFor rows finished
823
- this.rows.changes.subscribe((/**
824
- * @return {?}
825
- */
826
- function () {
827
- if (_this.config.enableStickyHeader || _this.config.enableStickyFooter) {
828
- _this.calculateColumnWidths();
829
- }
830
- }));
831
- };
832
- /**
833
- * @return {?}
834
- */
835
- PcacTableComponent.prototype.ngOnChanges = /**
836
- * @return {?}
837
- */
838
- function () {
839
- this.initTableUi();
840
- };
841
- /**
842
- * @param {?} row
843
- * @return {?}
844
- */
845
- PcacTableComponent.prototype.onEditClicked = /**
846
- * @param {?} row
847
- * @return {?}
848
- */
849
- function (row) {
850
- this.editClicked.emit(row);
851
- };
852
- /**
853
- * @param {?} row
854
- * @return {?}
855
- */
856
- PcacTableComponent.prototype.onDeleteClicked = /**
857
- * @param {?} row
858
- * @return {?}
859
- */
860
- function (row) {
861
- this.deleteClicked.emit(row);
862
- };
863
- /**
864
- * @param {?} row
865
- * @return {?}
866
- */
867
- PcacTableComponent.prototype.onHistoryClicked = /**
868
- * @param {?} row
869
- * @return {?}
870
- */
871
- function (row) {
872
- this.historyClicked.emit(row);
873
- };
874
- /**
875
- * @private
876
- * @return {?}
877
- */
878
- PcacTableComponent.prototype.initTableUi = /**
879
- * @private
880
- * @return {?}
881
- */
882
- function () {
883
- if (this.config && this.config.data && this.config.data.length > 0) {
884
- this.adjustedHeight = this.config.height + 28;
885
- if (this.config.enableStickyHeader || this.config.enableStickyFooter) {
886
- this.calculateColumnWidths();
887
- }
888
- this.setHeaders();
889
- this.setRows();
890
- }
891
- };
892
- /**
893
- * When dealing with sticky header/footer, we need to calc widths of absolute positioned
894
- * table columns.
895
- */
896
- /**
897
- * When dealing with sticky header/footer, we need to calc widths of absolute positioned
898
- * table columns.
899
- * @private
900
- * @return {?}
901
- */
902
- PcacTableComponent.prototype.calculateColumnWidths = /**
903
- * When dealing with sticky header/footer, we need to calc widths of absolute positioned
904
- * table columns.
905
- * @private
906
- * @return {?}
907
- */
908
- function () {
909
- if (this.tableBody.nativeElement.rows[0]) {
910
- /** @type {?} */
911
- var cells = this.tableBody.nativeElement.rows[0].cells;
912
- this.columnWidths = (/** @type {?} */ ([]));
913
- for (var i = 0; i < cells.length; i++) {
914
- this.columnWidths.push(cells[i].clientWidth);
915
- }
916
- // https://stackoverflow.com/questions/44922384/angular4-change-detection-expressionchangedafterithasbeencheckederror
917
- this.changeDetector.detectChanges();
918
- }
919
- };
920
- /**
921
- * Set internal cache of headers to ease template manipulation and apply icon
922
- */
923
- /**
924
- * Set internal cache of headers to ease template manipulation and apply icon
925
- * @private
926
- * @return {?}
927
- */
928
- PcacTableComponent.prototype.setHeaders = /**
929
- * Set internal cache of headers to ease template manipulation and apply icon
930
- * @private
931
- * @return {?}
932
- */
933
- function () {
934
- this.headers = (/** @type {?} */ ([]));
935
- for (var i = 0; i < this.config.data[0].data.length; i++) {
936
- this.headers.push((/** @type {?} */ ({
937
- key: this.config.data[0].data[i].key,
938
- value: this.config.data[0].data[i].value,
939
- icon: PcacTableSortIconsEnum.Sort
940
- })));
941
- }
942
- };
943
- /**
944
- * Deep copy of rows to ease template manipulation and sorting
945
- */
946
- /**
947
- * Deep copy of rows to ease template manipulation and sorting
948
- * @private
949
- * @return {?}
950
- */
951
- PcacTableComponent.prototype.setRows = /**
952
- * Deep copy of rows to ease template manipulation and sorting
953
- * @private
954
- * @return {?}
955
- */
956
- function () {
957
- this.rowData = JSON.parse(JSON.stringify(this.config.data)).slice(1);
958
- };
959
- /**
960
- * On header click, sort column.
961
- */
962
- /**
963
- * On header click, sort column.
964
- * @param {?} columnIndex
965
- * @return {?}
966
- */
967
- PcacTableComponent.prototype.sortTable = /**
968
- * On header click, sort column.
969
- * @param {?} columnIndex
970
- * @return {?}
971
- */
972
- function (columnIndex) {
973
- /** @type {?} */
974
- var direction = this.headers[columnIndex].icon === PcacTableSortIconsEnum.SortAsc ?
975
- PcacTableSortIconsEnum.SortDesc :
976
- PcacTableSortIconsEnum.SortAsc;
977
- this.clearStateExceptCurrent(columnIndex);
978
- this.sortService.sort(this.rowData, columnIndex, direction);
979
- this.headers[columnIndex].icon = direction;
980
- };
981
- /**
982
- * @private
983
- * @param {?} columnIndex
984
- * @return {?}
985
- */
986
- PcacTableComponent.prototype.clearStateExceptCurrent = /**
987
- * @private
988
- * @param {?} columnIndex
989
- * @return {?}
990
- */
991
- function (columnIndex) {
992
- for (var i = 0; i < this.headers.length; i++) {
993
- if (i !== columnIndex) {
994
- this.headers[i].icon = PcacTableSortIconsEnum.Sort;
995
- }
996
- }
997
- };
998
- /**
999
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
1000
- */
1001
- /**
1002
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
1003
- * @return {?}
1004
- */
1005
- PcacTableComponent.prototype.onResize = /**
1006
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
1007
- * @return {?}
1008
- */
1009
- function () {
1010
- /** @type {?} */
1011
- var self = this;
1012
- clearTimeout(this.resizeWindowTimeout);
1013
- this.resizeWindowTimeout = setTimeout((/**
1014
- * @return {?}
1015
- */
1016
- function () {
1017
- self.initTableUi();
1018
- }), 300);
1019
- };
1020
- PcacTableComponent.decorators = [
1021
- { type: core.Component, args: [{
1022
- selector: 'pcac-table',
1023
- template: "<section class=\"pcac-table-container pcac-font-family\" [style.max-height.px]=\"adjustedHeight\"\r\n [ngClass]=\"{'hide-first-column':config?.hideColumnOne}\">\r\n <table class=\"pcac-table\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let header of headers; let i = index\" (click)=\"sortTable(i)\">\r\n <i [ngClass]=\"header.icon\"></i>\r\n {{header.value}}\r\n </th>\r\n <th *ngIf=\"config?.enableDeleteAction || config?.enableEditAction\"></th>\r\n </tr>\r\n </thead>\r\n <tbody #tableBody>\r\n <tr *ngFor=\"let row of rowData\" #rows>\r\n <td *ngFor=\"let cell of row.data\">{{cell.value}}</td>\r\n <td *ngIf=\"config?.enableDeleteAction || config?.enableEditAction || config?.enableHistoryAction\">\r\n <section class=\"action-list\">\r\n <div (click)=\"onHistoryClicked(row)\" *ngIf=\"config?.enableHistoryAction\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\r\n <path\r\n d=\"M504 255.531c.253 136.64-111.18 248.372-247.82 248.468-59.015.042-113.223-20.53-155.822-54.911-11.077-8.94-11.905-25.541-1.839-35.607l11.267-11.267c8.609-8.609 22.353-9.551 31.891-1.984C173.062 425.135 212.781 440 256 440c101.705 0 184-82.311 184-184 0-101.705-82.311-184-184-184-48.814 0-93.149 18.969-126.068 49.932l50.754 50.754c10.08 10.08 2.941 27.314-11.313 27.314H24c-8.837 0-16-7.163-16-16V38.627c0-14.254 17.234-21.393 27.314-11.314l49.372 49.372C129.209 34.136 189.552 8 256 8c136.81 0 247.747 110.78 248 247.531zm-180.912 78.784l9.823-12.63c8.138-10.463 6.253-25.542-4.21-33.679L288 256.349V152c0-13.255-10.745-24-24-24h-16c-13.255 0-24 10.745-24 24v135.651l65.409 50.874c10.463 8.137 25.541 6.253 33.679-4.21z\">\r\n </path>\r\n </svg>\r\n </div>\r\n <div (click)=\"onEditClicked(row)\" *ngIf=\"config?.enableEditAction\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\r\n <path\r\n d=\"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z\">\r\n </path>\r\n </svg>\r\n </div>\r\n <div (click)=\"onDeleteClicked(row)\" *ngIf=\"config?.enableDeleteAction\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\">\r\n <path\r\n d=\"M0 84V56c0-13.3 10.7-24 24-24h112l9.4-18.7c4-8.2 12.3-13.3 21.4-13.3h114.3c9.1 0 17.4 5.1 21.5 13.3L312 32h112c13.3 0 24 10.7 24 24v28c0 6.6-5.4 12-12 12H12C5.4 96 0 90.6 0 84zm415.2 56.7L394.8 467c-1.6 25.3-22.6 45-47.9 45H101.1c-25.3 0-46.3-19.7-47.9-45L32.8 140.7c-.4-6.9 5.1-12.7 12-12.7h358.5c6.8 0 12.3 5.8 11.9 12.7z\">\r\n </path>\r\n </svg>\r\n </div>\r\n </section>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n <div *ngIf=\"config?.enableStickyHeader\" class=\"header\">\r\n <table class=\"pcac-table\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let header of headers; let i = index\" class=\"sortable\" [style.width.px]=\"columnWidths[i]\"\r\n (click)=\"sortTable(i)\">\r\n <i [ngClass]=\"header.icon\"></i>\r\n {{header.value}}\r\n </th>\r\n <th [style.width.px]=\"columnWidths[columnWidths.length - 1]\"\r\n *ngIf=\"config?.enableDeleteAction || config?.enableEditAction\"></th>\r\n </tr>\r\n </thead>\r\n </table>\r\n </div>\r\n <div *ngIf=\"config?.enableStickyFooter && config?.data.length > 0\" class=\"footer\" #tableFooter>\r\n <table class=\"pcac-table\">\r\n <tfoot>\r\n <tr>\r\n <td *ngFor=\"let data of config?.data[config?.data.length - 1].data; let i = index\"\r\n [style.width.px]=\"columnWidths[i]\" class=\"sticky-resize\">{{data.value}}</td>\r\n <td [style.width.px]=\"columnWidths[columnWidths.length - 1]\"\r\n *ngIf=\"config?.enableDeleteAction || config?.enableEditAction || config?.enableHistoryAction\">\r\n <section class=\"action-list action-footer\">\r\n <div (click)=\"onHistoryClicked(config?.data[config?.data.length - 1])\" *ngIf=\"config?.enableHistoryAction\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\r\n <path\r\n d=\"M504 255.531c.253 136.64-111.18 248.372-247.82 248.468-59.015.042-113.223-20.53-155.822-54.911-11.077-8.94-11.905-25.541-1.839-35.607l11.267-11.267c8.609-8.609 22.353-9.551 31.891-1.984C173.062 425.135 212.781 440 256 440c101.705 0 184-82.311 184-184 0-101.705-82.311-184-184-184-48.814 0-93.149 18.969-126.068 49.932l50.754 50.754c10.08 10.08 2.941 27.314-11.313 27.314H24c-8.837 0-16-7.163-16-16V38.627c0-14.254 17.234-21.393 27.314-11.314l49.372 49.372C129.209 34.136 189.552 8 256 8c136.81 0 247.747 110.78 248 247.531zm-180.912 78.784l9.823-12.63c8.138-10.463 6.253-25.542-4.21-33.679L288 256.349V152c0-13.255-10.745-24-24-24h-16c-13.255 0-24 10.745-24 24v135.651l65.409 50.874c10.463 8.137 25.541 6.253 33.679-4.21z\">\r\n </path>\r\n </svg>\r\n </div>\r\n <div (click)=\"onEditClicked(config?.data[config?.data.length - 1])\" *ngIf=\"config?.enableEditAction\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\r\n <path\r\n d=\"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z\">\r\n </path>\r\n </svg>\r\n </div>\r\n <div (click)=\"onDeleteClicked(config?.data[config?.data.length - 1])\" *ngIf=\"config?.enableDeleteAction\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\">\r\n <path\r\n d=\"M0 84V56c0-13.3 10.7-24 24-24h112l9.4-18.7c4-8.2 12.3-13.3 21.4-13.3h114.3c9.1 0 17.4 5.1 21.5 13.3L312 32h112c13.3 0 24 10.7 24 24v28c0 6.6-5.4 12-12 12H12C5.4 96 0 90.6 0 84zm415.2 56.7L394.8 467c-1.6 25.3-22.6 45-47.9 45H101.1c-25.3 0-46.3-19.7-47.9-45L32.8 140.7c-.4-6.9 5.1-12.7 12-12.7h358.5c6.8 0 12.3 5.8 11.9 12.7z\">\r\n </path>\r\n </svg>\r\n </div>\r\n </section>\r\n </td>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n </div>\r\n</section>\r\n",
1024
- providers: [
1025
- TableSortService
1026
- ],
1027
- styles: ["pcac-table{position:relative;width:100%;display:block}pcac-table .footer,pcac-table table.pcac-table,pcac-table tbody,pcac-table td,pcac-table tfoot,pcac-table th,pcac-table thead,pcac-table tr .header{box-sizing:border-box}pcac-table table.pcac-table{border-collapse:collapse;width:100%;border-radius:3px;line-height:18px;margin:0}pcac-table table.pcac-table tbody,pcac-table table.pcac-table tfoot,pcac-table table.pcac-table thead{background-color:#fff}pcac-table table.pcac-table caption{padding:.5rem .625rem .625rem;font-weight:700}pcac-table table.pcac-table thead{background:#f8f9fa;color:#24282e}pcac-table table.pcac-table thead i{margin:0 0 -2px;width:10px}pcac-table table.pcac-table tfoot{background:#24282e;color:#fff}pcac-table table.pcac-table tfoot tr,pcac-table table.pcac-table thead tr{background:0 0}pcac-table table.pcac-table tfoot td,pcac-table table.pcac-table tfoot th,pcac-table table.pcac-table thead td,pcac-table table.pcac-table thead th{padding:.5rem .625rem .625rem;font-weight:700;text-align:left}pcac-table table.pcac-table tbody td,pcac-table table.pcac-table tbody th{padding:.5rem .625rem .625rem}pcac-table table.pcac-table tbody tr:nth-child(even){border-bottom:0;background-color:#e9ecef}pcac-table table.pcac-table thead th{cursor:pointer;transition:background-color .25s}pcac-table table.pcac-table thead th:hover{transition:background-color .25s;background-color:#e9ecef}pcac-table .header{position:absolute;top:0}pcac-table .footer{position:absolute;bottom:0}pcac-table .action-list{display:flex;align-items:center;justify-content:flex-end}pcac-table .action-list div{margin-left:.5rem;width:12px}pcac-table .action-list svg path{fill:#adb5bd}pcac-table .action-list svg{cursor:pointer}pcac-table .action-list svg:hover path{transition:.25s;fill:#495057}pcac-table .action-list.action-footer svg path{fill:#e9ecef}pcac-table .action-list.action-footer svg path:hover{fill:#fff}.pcac-table-container{overflow:auto}.pcac-table-container.hide-first-column td:first-child,.pcac-table-container.hide-first-column th:first-child{display:none}"]
1028
- }] }
1029
- ];
1030
- /** @nocollapse */
1031
- PcacTableComponent.ctorParameters = function () { return [
1032
- { type: TableSortService },
1033
- { type: core.ChangeDetectorRef }
1034
- ]; };
1035
- PcacTableComponent.propDecorators = {
1036
- config: [{ type: core.Input }],
1037
- deleteClicked: [{ type: core.Output }],
1038
- editClicked: [{ type: core.Output }],
1039
- historyClicked: [{ type: core.Output }],
1040
- tableBody: [{ type: core.ViewChild, args: ['tableBody', { static: true },] }],
1041
- tableFooter: [{ type: core.ViewChild, args: ['tableFooter', { static: true },] }],
1042
- rows: [{ type: core.ViewChildren, args: ['rows',] }],
1043
- onResize: [{ type: core.HostListener, args: ['window:resize',] }]
1044
- };
1045
- return PcacTableComponent;
1046
- }());
1047
-
1048
- /**
1049
- * @fileoverview added by tsickle
1050
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1051
- */
1052
- var PcacTableModule = /** @class */ (function () {
1053
- function PcacTableModule() {
1054
- }
1055
- PcacTableModule.decorators = [
1056
- { type: core.NgModule, args: [{
1057
- imports: [
1058
- platformBrowser.BrowserModule
1059
- ],
1060
- exports: [
1061
- PcacTableComponent
1062
- ],
1063
- declarations: [
1064
- PcacTableComponent
1065
- ]
1066
- },] }
1067
- ];
1068
- return PcacTableModule;
1069
- }());
1070
-
1071
- /**
1072
- * @fileoverview added by tsickle
1073
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1074
- */
1075
-
1076
- /**
1077
- * @fileoverview added by tsickle
1078
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1079
- */
1080
-
1081
- /**
1082
- * @fileoverview added by tsickle
1083
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1084
- */
1085
- var BarVerticalChartBuilder = /** @class */ (function (_super) {
1086
- __extends(BarVerticalChartBuilder, _super);
1087
- function BarVerticalChartBuilder(axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) {
1088
- var _this = _super.call(this, axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) || this;
1089
- _this.axisBuilder = axisBuilder;
1090
- _this.gridBuilder = gridBuilder;
1091
- _this.transitionService = transitionService;
1092
- _this.tooltipBuilder = tooltipBuilder;
1093
- _this.colorService = colorService;
1094
- _this.barClickedSource = new rxjs.Subject();
1095
- _this.barClicked$ = _this.barClickedSource.asObservable();
1096
- return _this;
1097
- }
1098
- /**
1099
- * @param {?} chartElm
1100
- * @param {?} config
1101
- * @return {?}
1102
- */
1103
- BarVerticalChartBuilder.prototype.buildChart = /**
1104
- * @param {?} chartElm
1105
- * @param {?} config
1106
- * @return {?}
1107
- */
1108
- function (chartElm, config) {
1109
- if (config.colorOverride && config.colorOverride.colors) {
1110
- this.colors = config.colorOverride.colors;
1111
- }
1112
- if (config.hideAxis) {
1113
- this.adjustForHiddenAxis(config);
1114
- }
1115
- this.initializeChartState(chartElm, config);
1116
- if (config.colorOverride && config.colorOverride.colors) {
1117
- this.colors = config.colorOverride.colors.reverse();
1118
- }
1119
- this.buildScales(config);
1120
- this.drawChart(chartElm, config);
1121
- };
1122
- /**
1123
- * @private
1124
- * @param {?} config
1125
- * @return {?}
1126
- */
1127
- BarVerticalChartBuilder.prototype.adjustForHiddenAxis = /**
1128
- * @private
1129
- * @param {?} config
1130
- * @return {?}
1131
- */
1132
- function (config) {
1133
- /** @type {?} */
1134
- var hasGroupLabel = this.hasGroupLabel(config);
1135
- config.height = config.height + this.margin.top;
1136
- if (!hasGroupLabel) {
1137
- config.height = config.height + this.margin.bottom;
1138
- }
1139
- this.margin.top = 0;
1140
- this.margin.bottom = hasGroupLabel ? this.margin.bottom : 0;
1141
- this.margin.left = 0;
1142
- this.margin.right = 0;
1143
- };
1144
- /**
1145
- * @private
1146
- * @param {?} config
1147
- * @return {?}
1148
- */
1149
- BarVerticalChartBuilder.prototype.hasGroupLabel = /**
1150
- * @private
1151
- * @param {?} config
1152
- * @return {?}
1153
- */
1154
- function (config) {
1155
- /** @type {?} */
1156
- var hasGroupLabel = false;
1157
- config.data.forEach((/**
1158
- * @param {?} node
1159
- * @return {?}
1160
- */
1161
- function (node) {
1162
- if (node.key) {
1163
- hasGroupLabel = true;
1164
- }
1165
- }));
1166
- return hasGroupLabel;
1167
- };
1168
- /**
1169
- * @private
1170
- * @param {?} config
1171
- * @return {?}
1172
- */
1173
- BarVerticalChartBuilder.prototype.buildScales = /**
1174
- * @private
1175
- * @param {?} config
1176
- * @return {?}
1177
- */
1178
- function (config) {
1179
- this.yScale = d3Scale.scaleLinear()
1180
- .rangeRound([0, config.height])
1181
- .domain([config.domainMax, 0]);
1182
- this.xScaleStacked = d3Scale.scaleBand()
1183
- .domain(config.data.map((/**
1184
- * @param {?} d
1185
- * @return {?}
1186
- */
1187
- function (d) { return (/** @type {?} */ (d.key)); })))
1188
- .rangeRound([0, this.width])
1189
- .padding(0.1);
1190
- this.xScaleGrouped = d3Scale.scaleBand()
1191
- .padding(0.2)
1192
- .rangeRound([0, this.xScaleStacked.bandwidth()])
1193
- .domain(config.data[0].data.map((/**
1194
- * @param {?} d
1195
- * @return {?}
1196
- */
1197
- function (d) { return (/** @type {?} */ (d.key)); })));
1198
- };
1199
- /**
1200
- * @private
1201
- * @param {?} chartElm
1202
- * @param {?} config
1203
- * @return {?}
1204
- */
1205
- BarVerticalChartBuilder.prototype.drawChart = /**
1206
- * @private
1207
- * @param {?} chartElm
1208
- * @param {?} config
1209
- * @return {?}
1210
- */
1211
- function (chartElm, config) {
1212
- this.buildContainer(chartElm);
1213
- this.axisBuilder.drawAxis({
1214
- svg: this.svg,
1215
- numberOfTicks: config.numberOfTicks || 5,
1216
- height: this.height,
1217
- xScale: this.xScaleStacked,
1218
- yScale: this.yScale,
1219
- xFormat: PcacTickFormatEnum.None,
1220
- yFormat: config.tickFormat || PcacTickFormatEnum.None,
1221
- hideYAxis: config.hideAxis
1222
- });
1223
- if (!config.hideGrid) {
1224
- this.gridBuilder.drawHorizontalGrid({
1225
- svg: this.svg,
1226
- numberOfTicks: config.numberOfTicks || 5,
1227
- width: this.width,
1228
- xScale: this.xScaleStacked,
1229
- yScale: this.yScale
1230
- });
1231
- }
1232
- this.addGroups(config);
1233
- };
1234
- /**
1235
- * @private
1236
- * @param {?} config
1237
- * @return {?}
1238
- */
1239
- BarVerticalChartBuilder.prototype.addGroups = /**
1240
- * @private
1241
- * @param {?} config
1242
- * @return {?}
1243
- */
1244
- function (config) {
1245
- var _this = this;
1246
- /** @type {?} */
1247
- var groupsContainer = this.svg.append('g')
1248
- .attr('class', 'pcac-bars')
1249
- .selectAll('g')
1250
- .data(config.data)
1251
- .enter().append('g')
1252
- .attr('class', 'pcac-bar-group')
1253
- .attr('data-group-id', (/**
1254
- * @param {?} d
1255
- * @param {?} i
1256
- * @return {?}
1257
- */
1258
- function (d, i) {
1259
- return i;
1260
- }))
1261
- .attr('transform', (/**
1262
- * @param {?} d
1263
- * @param {?} i
1264
- * @return {?}
1265
- */
1266
- function (d, i) {
1267
- return 'translate(' + _this.xScaleStacked((/** @type {?} */ (d.key))) + ',0)';
1268
- }));
1269
- /** @type {?} */
1270
- var group = groupsContainer.selectAll('rect')
1271
- .data((/**
1272
- * @param {?} d
1273
- * @param {?} i
1274
- * @return {?}
1275
- */
1276
- function (d, i) {
1277
- return d.data;
1278
- }));
1279
- this.drawBarsPerGroup(group, config);
1280
- // We have no thresholds to draw
1281
- if (!config.thresholds) {
1282
- return;
1283
- }
1284
- // Draw threshold across entire chart
1285
- if (config.thresholds.length === 1 && !config.thresholds[0].data) {
1286
- this.drawThresholdAcrossChart(config);
1287
- }
1288
- // Draw threshold across each group
1289
- if (config.thresholds.length > 1 && (!config.thresholds[0].data || config.isStacked)) {
1290
- this.drawThresholdsPerGroup(group, config);
1291
- }
1292
- // Draw threshold across each bar in group
1293
- if (config.thresholds.length > 1 && config.thresholds[0].data && !config.isStacked) {
1294
- this.drawThresholdsPerBarInGroup(group, config);
1295
- }
1296
- };
1297
- /**
1298
- * @private
1299
- * @param {?} group
1300
- * @param {?} config
1301
- * @return {?}
1302
- */
1303
- BarVerticalChartBuilder.prototype.drawBarsPerGroup = /**
1304
- * @private
1305
- * @param {?} group
1306
- * @param {?} config
1307
- * @return {?}
1308
- */
1309
- function (group, config) {
1310
- var _this = this;
1311
- /** @type {?} */
1312
- var self = this;
1313
- group.enter().append('rect')
1314
- .attr('class', 'pcac-bar')
1315
- .attr('x', (/**
1316
- * @param {?} d
1317
- * @param {?} i
1318
- * @return {?}
1319
- */
1320
- function (d, i) {
1321
- return !config.isStacked ? _this.xScaleGrouped((/** @type {?} */ (d.key))) : _this.xScaleStacked((/** @type {?} */ (d.key)));
1322
- }))
1323
- .style('fill', (/**
1324
- * @param {?} d
1325
- * @param {?} i
1326
- * @param {?} n
1327
- * @return {?}
1328
- */
1329
- function (d, i, n) {
1330
- if (config.spreadColorsPerGroup) {
1331
- /** @type {?} */
1332
- var groupIndex = parseInt(n[0].parentNode.getAttribute('data-group-id'), 10);
1333
- return _this.colors[groupIndex];
1334
- }
1335
- return _this.colors[i];
1336
- }))
1337
- .attr('y', (/**
1338
- * @return {?}
1339
- */
1340
- function () {
1341
- return _this.height;
1342
- }))
1343
- .attr('height', 0)
1344
- .on('mouseover', (/**
1345
- * @param {?} d
1346
- * @param {?} i
1347
- * @param {?} n
1348
- * @return {?}
1349
- */
1350
- function (d, i, n) {
1351
- d3Selection.select(this).transition(d3Transition.transition()
1352
- .duration(self.transitionService.getTransitionDuration() / 5))
1353
- .style('fill', (/**
1354
- * @return {?}
1355
- */
1356
- function () {
1357
- if (config.spreadColorsPerGroup) {
1358
- /** @type {?} */
1359
- var groupIndex = parseInt(n[0].parentNode.getAttribute('data-group-id'), 10);
1360
- return d3Color.color(self.colors[groupIndex]).darker(1).toString();
1361
- }
1362
- return d3Color.color(self.colors[i]).darker(1).toString();
1363
- }));
1364
- }))
1365
- .on('mousemove', (/**
1366
- * @param {?} d
1367
- * @param {?} i
1368
- * @return {?}
1369
- */
1370
- function (d, i) {
1371
- self.tooltipBuilder.showBarTooltip(d, config.tickFormat || PcacTickFormatEnum.None);
1372
- }))
1373
- .on('mouseout', (/**
1374
- * @param {?} d
1375
- * @param {?} i
1376
- * @param {?} n
1377
- * @return {?}
1378
- */
1379
- function (d, i, n) {
1380
- self.tooltipBuilder.hideTooltip();
1381
- d3Selection.select(this).transition(d3Transition.transition()
1382
- .duration(self.transitionService.getTransitionDuration() / 5))
1383
- .style('fill', (/**
1384
- * @return {?}
1385
- */
1386
- function () {
1387
- if (config.spreadColorsPerGroup) {
1388
- /** @type {?} */
1389
- var groupIndex = parseInt(n[0].parentNode.getAttribute('data-group-id'), 10);
1390
- return self.colors[groupIndex];
1391
- }
1392
- return self.colors[i];
1393
- }));
1394
- }))
1395
- .on('click', (/**
1396
- * @param {?} d
1397
- * @param {?} i
1398
- * @return {?}
1399
- */
1400
- function (d, i) {
1401
- _this.barClickedSource.next(d);
1402
- }))
1403
- .transition(d3Transition.transition()
1404
- .duration(this.transitionService.getTransitionDuration()))
1405
- .attr('width', !config.isStacked ? this.xScaleGrouped.bandwidth() : this.xScaleStacked.bandwidth())
1406
- .attr('y', (/**
1407
- * @param {?} d
1408
- * @return {?}
1409
- */
1410
- function (d) {
1411
- return _this.yScale((/** @type {?} */ (d.value)));
1412
- }))
1413
- .attr('height', (/**
1414
- * @param {?} d
1415
- * @return {?}
1416
- */
1417
- function (d) {
1418
- return _this.height - _this.yScale((/** @type {?} */ (d.value)));
1419
- }));
1420
- };
1421
- /**
1422
- * @private
1423
- * @param {?} config
1424
- * @return {?}
1425
- */
1426
- BarVerticalChartBuilder.prototype.drawThresholdAcrossChart = /**
1427
- * @private
1428
- * @param {?} config
1429
- * @return {?}
1430
- */
1431
- function (config) {
1432
- var _this = this;
1433
- this.applyPreTransitionThresholdStyles(this.svg.select('.pcac-bars').append('rect'), config)
1434
- .attr('width', this.width)
1435
- .on('mousemove', (/**
1436
- * @param {?} d
1437
- * @param {?} i
1438
- * @return {?}
1439
- */
1440
- function (d, i) {
1441
- _this.tooltipBuilder.showBarTooltip(config.thresholds[i], config.tickFormat || PcacTickFormatEnum.None);
1442
- }))
1443
- .transition(d3Transition.transition()
1444
- .duration(this.transitionService.getTransitionDuration()))
1445
- .attr('y', (/**
1446
- * @param {?} d
1447
- * @param {?} i
1448
- * @return {?}
1449
- */
1450
- function (d, i) {
1451
- return _this.yScale((/** @type {?} */ (config.thresholds[i].value)));
1452
- }));
1453
- };
1454
- /**
1455
- * @private
1456
- * @param {?} group
1457
- * @param {?} config
1458
- * @return {?}
1459
- */
1460
- BarVerticalChartBuilder.prototype.drawThresholdsPerGroup = /**
1461
- * @private
1462
- * @param {?} group
1463
- * @param {?} config
1464
- * @return {?}
1465
- */
1466
- function (group, config) {
1467
- var _this = this;
1468
- this.applyPreTransitionThresholdStyles(this.svg.selectAll('.pcac-bar-group').append('rect'), config)
1469
- .attr('width', this.xScaleStacked.bandwidth())
1470
- .on('mousemove', (/**
1471
- * @param {?} d
1472
- * @param {?} i
1473
- * @return {?}
1474
- */
1475
- function (d, i) {
1476
- _this.tooltipBuilder.showBarTooltip(config.isStacked ?
1477
- config.thresholds[i].data[0] :
1478
- config.thresholds[i], config.tickFormat || PcacTickFormatEnum.None);
1479
- }))
1480
- .transition(d3Transition.transition()
1481
- .duration(this.transitionService.getTransitionDuration()))
1482
- .attr('y', (/**
1483
- * @param {?} d
1484
- * @param {?} i
1485
- * @return {?}
1486
- */
1487
- function (d, i) {
1488
- return _this.yScale(config.isStacked ? (/** @type {?} */ (config.thresholds[i].data[0].value)) : (/** @type {?} */ (config.thresholds[i].value)));
1489
- }));
1490
- };
1491
- /**
1492
- * @private
1493
- * @param {?} group
1494
- * @param {?} config
1495
- * @return {?}
1496
- */
1497
- BarVerticalChartBuilder.prototype.drawThresholdsPerBarInGroup = /**
1498
- * @private
1499
- * @param {?} group
1500
- * @param {?} config
1501
- * @return {?}
1502
- */
1503
- function (group, config) {
1504
- var _this = this;
1505
- this.applyPreTransitionThresholdStyles(group.enter().append('rect'), config)
1506
- .on('mousemove', (/**
1507
- * @param {?} d
1508
- * @param {?} i
1509
- * @param {?} n
1510
- * @return {?}
1511
- */
1512
- function (d, i, n) {
1513
- _this.tooltipBuilder.showBarTooltip(config.thresholds[n[0].parentElement.dataset['groupId']].data[i], config.tickFormat || PcacTickFormatEnum.None);
1514
- }))
1515
- .attr('width', this.xScaleGrouped.bandwidth())
1516
- .transition(d3Transition.transition()
1517
- .duration(this.transitionService.getTransitionDuration()))
1518
- .attr('y', (/**
1519
- * @param {?} d
1520
- * @param {?} i
1521
- * @param {?} n
1522
- * @return {?}
1523
- */
1524
- function (d, i, n) {
1525
- return _this.yScale((/** @type {?} */ (config.thresholds[n[0].parentElement.dataset['groupId']].data[i].value)));
1526
- }));
1527
- };
1528
- /**
1529
- * @private
1530
- * @param {?} elm
1531
- * @param {?} config
1532
- * @return {?}
1533
- */
1534
- BarVerticalChartBuilder.prototype.applyPreTransitionThresholdStyles = /**
1535
- * @private
1536
- * @param {?} elm
1537
- * @param {?} config
1538
- * @return {?}
1539
- */
1540
- function (elm, config) {
1541
- var _this = this;
1542
- return elm.attr('class', 'pcac-threshold')
1543
- .attr('x', (/**
1544
- * @param {?} d
1545
- * @return {?}
1546
- */
1547
- function (d) {
1548
- return _this.xScaleGrouped(d ? (/** @type {?} */ (d.key)) : '');
1549
- }))
1550
- .attr('y', (/**
1551
- * @return {?}
1552
- */
1553
- function () {
1554
- return _this.height;
1555
- }))
1556
- .attr('height', 0)
1557
- .style('fill', (/**
1558
- * @return {?}
1559
- */
1560
- function () {
1561
- return _this.colorService.getAlert();
1562
- }))
1563
- .style('stroke', (/**
1564
- * @return {?}
1565
- */
1566
- function () {
1567
- return _this.colorService.getAlert();
1568
- }))
1569
- .style('stroke-width', (/**
1570
- * @return {?}
1571
- */
1572
- function () {
1573
- return 2;
1574
- }))
1575
- .on('mouseout', (/**
1576
- * @return {?}
1577
- */
1578
- function () {
1579
- _this.tooltipBuilder.hideTooltip();
1580
- }))
1581
- .attr('height', (/**
1582
- * @return {?}
1583
- */
1584
- function () {
1585
- return '3px';
1586
- }));
1587
- };
1588
- BarVerticalChartBuilder.decorators = [
1589
- { type: core.Injectable }
1590
- ];
1591
- /** @nocollapse */
1592
- BarVerticalChartBuilder.ctorParameters = function () { return [
1593
- { type: PcacAxisBuilder },
1594
- { type: PcacGridBuilder },
1595
- { type: PcacTransitionService },
1596
- { type: PcacTooltipBuilder },
1597
- { type: PcacColorService }
1598
- ]; };
1599
- return BarVerticalChartBuilder;
1600
- }(PcacChart));
1601
-
1602
- /**
1603
- * @fileoverview added by tsickle
1604
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1605
- */
1606
- var PcacBarVerticalChartComponent = /** @class */ (function () {
1607
- function PcacBarVerticalChartComponent(chartBuilder) {
1608
- var _this = this;
1609
- this.chartBuilder = chartBuilder;
1610
- this.barClicked = new core.EventEmitter();
1611
- this.chartBuilder.barClicked$.subscribe((/**
1612
- * @param {?} data
1613
- * @return {?}
1614
- */
1615
- function (data) {
1616
- _this.barClicked.emit(data);
1617
- }));
1618
- }
1619
- /**
1620
- * @return {?}
1621
- */
1622
- PcacBarVerticalChartComponent.prototype.ngOnChanges = /**
1623
- * @return {?}
1624
- */
1625
- function () {
1626
- this.buildChart();
1627
- };
1628
- /**
1629
- * @return {?}
1630
- */
1631
- PcacBarVerticalChartComponent.prototype.buildChart = /**
1632
- * @return {?}
1633
- */
1634
- function () {
1635
- if (this.config && this.config.data && this.config.data.length > 0) {
1636
- this.chartBuilder.buildChart(this.chartElm, this.config);
1637
- }
1638
- };
1639
- /**
1640
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
1641
- */
1642
- /**
1643
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
1644
- * @return {?}
1645
- */
1646
- PcacBarVerticalChartComponent.prototype.onResize = /**
1647
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
1648
- * @return {?}
1649
- */
1650
- function () {
1651
- /** @type {?} */
1652
- var self = this;
1653
- clearTimeout(this.resizeWindowTimeout);
1654
- this.resizeWindowTimeout = setTimeout((/**
1655
- * @return {?}
1656
- */
1657
- function () {
1658
- self.buildChart();
1659
- }), 300);
1660
- };
1661
- PcacBarVerticalChartComponent.decorators = [
1662
- { type: core.Component, args: [{
1663
- selector: 'pcac-bar-vertical-chart',
1664
- template: "<section class=\"pcac-bar-vertical-chart\">\r\n <svg #chart></svg>\r\n</section>\r\n",
1665
- providers: [
1666
- BarVerticalChartBuilder
1667
- ]
1668
- }] }
1669
- ];
1670
- /** @nocollapse */
1671
- PcacBarVerticalChartComponent.ctorParameters = function () { return [
1672
- { type: BarVerticalChartBuilder }
1673
- ]; };
1674
- PcacBarVerticalChartComponent.propDecorators = {
1675
- config: [{ type: core.Input }],
1676
- chartElm: [{ type: core.ViewChild, args: ['chart', { static: true },] }],
1677
- barClicked: [{ type: core.Output }],
1678
- onResize: [{ type: core.HostListener, args: ['window:resize',] }]
1679
- };
1680
- return PcacBarVerticalChartComponent;
1681
- }());
1682
-
1683
- /**
1684
- * @fileoverview added by tsickle
1685
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1686
- */
1687
-
1688
- /**
1689
- * @fileoverview added by tsickle
1690
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1691
- */
1692
- var PcacBarVerticalChartModule = /** @class */ (function () {
1693
- function PcacBarVerticalChartModule() {
1694
- }
1695
- PcacBarVerticalChartModule.decorators = [
1696
- { type: core.NgModule, args: [{
1697
- exports: [
1698
- PcacBarVerticalChartComponent
1699
- ],
1700
- declarations: [
1701
- PcacBarVerticalChartComponent
1702
- ]
1703
- },] }
1704
- ];
1705
- return PcacBarVerticalChartModule;
1706
- }());
1707
-
1708
- /**
1709
- * @fileoverview added by tsickle
1710
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1711
- */
1712
-
1713
- /**
1714
- * @fileoverview added by tsickle
1715
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1716
- */
1717
-
1718
- /**
1719
- * @fileoverview added by tsickle
1720
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1721
- */
1722
- var BarHorizontalChartBuilder = /** @class */ (function (_super) {
1723
- __extends(BarHorizontalChartBuilder, _super);
1724
- function BarHorizontalChartBuilder(axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) {
1725
- var _this = _super.call(this, axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) || this;
1726
- _this.axisBuilder = axisBuilder;
1727
- _this.gridBuilder = gridBuilder;
1728
- _this.transitionService = transitionService;
1729
- _this.tooltipBuilder = tooltipBuilder;
1730
- _this.colorService = colorService;
1731
- _this.barClickedSource = new rxjs.Subject();
1732
- _this.barClicked$ = _this.barClickedSource.asObservable();
1733
- return _this;
1734
- }
1735
- /**
1736
- * @param {?} chartElm
1737
- * @param {?} config
1738
- * @return {?}
1739
- */
1740
- BarHorizontalChartBuilder.prototype.buildChart = /**
1741
- * @param {?} chartElm
1742
- * @param {?} config
1743
- * @return {?}
1744
- */
1745
- function (chartElm, config) {
1746
- this.config = JSON.parse(JSON.stringify(config));
1747
- if (this.config.hideAxis) {
1748
- this.adjustForHiddenAxis();
1749
- }
1750
- this.initializeChartState(chartElm, this.config);
1751
- if (config.colorOverride && config.colorOverride.colors) {
1752
- this.colors = config.colorOverride.colors.reverse();
1753
- }
1754
- this.buildScales(chartElm, this.config);
1755
- this.drawChart(chartElm, this.config);
1756
- };
1757
- /**
1758
- * @private
1759
- * @return {?}
1760
- */
1761
- BarHorizontalChartBuilder.prototype.adjustForHiddenAxis = /**
1762
- * @private
1763
- * @return {?}
1764
- */
1765
- function () {
1766
- if (!this.cachedMargins) {
1767
- this.cachedMargins = JSON.parse(JSON.stringify(this.margin));
1768
- }
1769
- this.margin = JSON.parse(JSON.stringify(this.cachedMargins));
1770
- this.config.height = this.config.height + this.margin.top + this.margin.bottom;
1771
- this.margin.top = 0;
1772
- this.margin.bottom = 0;
1773
- this.margin.left = 0;
1774
- this.margin.right = 0;
1775
- };
1776
- /**
1777
- * @private
1778
- * @param {?} data
1779
- * @return {?}
1780
- */
1781
- BarHorizontalChartBuilder.prototype.setStartState = /**
1782
- * @private
1783
- * @param {?} data
1784
- * @return {?}
1785
- */
1786
- function (data) {
1787
- if (data && data.data) {
1788
- for (var i = 0, l = data.data.length; i < l; ++i) {
1789
- data.data[i].value = 0;
1790
- this.setStartState(data.data[i]);
1791
- }
1792
- }
1793
- };
1794
- /**
1795
- * @private
1796
- * @param {?} chartElm
1797
- * @param {?} config
1798
- * @return {?}
1799
- */
1800
- BarHorizontalChartBuilder.prototype.buildScales = /**
1801
- * @private
1802
- * @param {?} chartElm
1803
- * @param {?} config
1804
- * @return {?}
1805
- */
1806
- function (chartElm, config) {
1807
- config.data[0].data.map((/**
1808
- * @param {?} d
1809
- * @return {?}
1810
- */
1811
- function (d) {
1812
- return d.value;
1813
- }));
1814
- this.xScale = d3Scale.scaleLinear()
1815
- .domain([0, config.domainMax]);
1816
- this.yScaleStacked = d3Scale.scaleBand()
1817
- .domain(config.data.map((/**
1818
- * @param {?} d
1819
- * @return {?}
1820
- */
1821
- function (d) { return (/** @type {?} */ (d.key)); })))
1822
- .range([this.height, 0])
1823
- .padding(0.1);
1824
- this.yScaleGrouped = d3Scale.scaleBand()
1825
- .padding(0.05)
1826
- .rangeRound([0, this.yScaleStacked.bandwidth()])
1827
- .domain(config.data[0].data.map((/**
1828
- * @param {?} d
1829
- * @return {?}
1830
- */
1831
- function (d) { return (/** @type {?} */ (d.key)); })));
1832
- this.setHorizontalMarginsBasedOnContent(chartElm, config.data, this.yScaleStacked);
1833
- this.xScale.range([0, this.width]);
1834
- };
1835
- /**
1836
- * @private
1837
- * @param {?} chartElm
1838
- * @param {?} config
1839
- * @return {?}
1840
- */
1841
- BarHorizontalChartBuilder.prototype.drawChart = /**
1842
- * @private
1843
- * @param {?} chartElm
1844
- * @param {?} config
1845
- * @return {?}
1846
- */
1847
- function (chartElm, config) {
1848
- this.buildContainer(chartElm);
1849
- this.axisBuilder.drawAxis({
1850
- svg: this.svg,
1851
- numberOfTicks: config.numberOfTicks || 5,
1852
- height: this.height,
1853
- xScale: this.xScale,
1854
- yScale: this.yScaleStacked,
1855
- xFormat: config.tickFormat || PcacTickFormatEnum.None,
1856
- yFormat: PcacTickFormatEnum.None,
1857
- hideXAxis: config.hideAxis
1858
- });
1859
- if (!config.hideGrid) {
1860
- this.gridBuilder.drawVerticalGrid({
1861
- svg: this.svg,
1862
- numberOfTicks: config.numberOfTicks || 5,
1863
- height: this.height,
1864
- xScale: this.xScale,
1865
- yScale: this.yScaleStacked
1866
- });
1867
- }
1868
- this.addGroups(config);
1869
- };
1870
- /**
1871
- * @private
1872
- * @param {?} config
1873
- * @return {?}
1874
- */
1875
- BarHorizontalChartBuilder.prototype.addGroups = /**
1876
- * @private
1877
- * @param {?} config
1878
- * @return {?}
1879
- */
1880
- function (config) {
1881
- var _this = this;
1882
- /** @type {?} */
1883
- var groupsContainer = this.svg.append('g')
1884
- .attr('class', 'pcac-bars')
1885
- .selectAll('g')
1886
- .data(config.data)
1887
- .enter().append('g')
1888
- .attr('class', 'pcac-bar-group')
1889
- .attr('data-group-id', (/**
1890
- * @param {?} d
1891
- * @param {?} i
1892
- * @return {?}
1893
- */
1894
- function (d, i) {
1895
- return i;
1896
- }))
1897
- .attr('transform', (/**
1898
- * @param {?} d
1899
- * @return {?}
1900
- */
1901
- function (d) { return 'translate(0,' + _this.yScaleStacked((/** @type {?} */ (d.key))) + ')'; }));
1902
- /** @type {?} */
1903
- var group = groupsContainer.selectAll('rect')
1904
- .data((/**
1905
- * @param {?} d
1906
- * @return {?}
1907
- */
1908
- function (d) {
1909
- return d.data;
1910
- }));
1911
- this.drawBarsPerGroup(group, config);
1912
- // We have no thresholds to draw
1913
- if (!config.thresholds) {
1914
- return;
1915
- }
1916
- // Draw threshold across entire chart
1917
- if (config.thresholds.length === 1 && !config.thresholds[0].data) {
1918
- this.drawThresholdAcrossChart(config);
1919
- }
1920
- // Draw threshold across each group
1921
- if (config.thresholds.length > 1 && (!config.thresholds[0].data || config.isStacked)) {
1922
- this.drawThresholdsPerGroup(group, config);
1923
- }
1924
- // Draw threshold across each bar in group
1925
- if (config.thresholds.length > 1 && config.thresholds[0].data && !config.isStacked) {
1926
- this.drawThresholdsPerBarInGroup(group, config);
1927
- }
1928
- };
1929
- /**
1930
- * @private
1931
- * @param {?} groups
1932
- * @param {?} config
1933
- * @return {?}
1934
- */
1935
- BarHorizontalChartBuilder.prototype.drawBarsPerGroup = /**
1936
- * @private
1937
- * @param {?} groups
1938
- * @param {?} config
1939
- * @return {?}
1940
- */
1941
- function (groups, config) {
1942
- var _this = this;
1943
- /** @type {?} */
1944
- var self = this;
1945
- groups.enter().append('rect')
1946
- .attr('class', 'pcac-bar')
1947
- .attr('x', 0)
1948
- .attr('y', (/**
1949
- * @param {?} d
1950
- * @return {?}
1951
- */
1952
- function (d) {
1953
- return !config.isStacked ? _this.yScaleGrouped((/** @type {?} */ (d.key))) : _this.yScaleStacked((/** @type {?} */ (d.key)));
1954
- }))
1955
- .attr('height', !config.isStacked ? this.yScaleGrouped.bandwidth() : this.yScaleStacked.bandwidth())
1956
- .style('fill', (/**
1957
- * @param {?} d
1958
- * @param {?} i
1959
- * @param {?} n
1960
- * @return {?}
1961
- */
1962
- function (d, i, n) {
1963
- if (config.spreadColorsPerGroup) {
1964
- /** @type {?} */
1965
- var groupIndex = parseInt(n[0].parentNode.getAttribute('data-group-id'), 10);
1966
- return _this.colors[groupIndex];
1967
- }
1968
- return _this.colors[i];
1969
- }))
1970
- .attr('width', 0)
1971
- .on('mouseover', (/**
1972
- * @param {?} d
1973
- * @param {?} i
1974
- * @param {?} n
1975
- * @return {?}
1976
- */
1977
- function (d, i, n) {
1978
- d3Selection.select(this).transition(d3Transition.transition()
1979
- .duration(self.transitionService.getTransitionDuration() / 7.5))
1980
- .style('fill', (/**
1981
- * @return {?}
1982
- */
1983
- function () {
1984
- if (config.spreadColorsPerGroup) {
1985
- /** @type {?} */
1986
- var groupIndex = parseInt(n[0].parentNode.getAttribute('data-group-id'), 10);
1987
- return d3Color.color(self.colors[groupIndex]).darker(1).toString();
1988
- }
1989
- return d3Color.color(self.colors[i]).darker(1).toString();
1990
- }));
1991
- }))
1992
- .on('mousemove', (/**
1993
- * @param {?} d
1994
- * @param {?} i
1995
- * @return {?}
1996
- */
1997
- function (d, i) {
1998
- self.tooltipBuilder.showBarTooltip(d, config.tickFormat || PcacTickFormatEnum.None);
1999
- }))
2000
- .on('mouseout', (/**
2001
- * @param {?} d
2002
- * @param {?} i
2003
- * @param {?} n
2004
- * @return {?}
2005
- */
2006
- function (d, i, n) {
2007
- self.tooltipBuilder.hideTooltip();
2008
- d3Selection.select(this).transition(d3Transition.transition()
2009
- .duration(self.transitionService.getTransitionDuration() / 5))
2010
- .style('fill', (/**
2011
- * @return {?}
2012
- */
2013
- function () {
2014
- if (config.spreadColorsPerGroup) {
2015
- /** @type {?} */
2016
- var groupIndex = parseInt(n[0].parentNode.getAttribute('data-group-id'), 10);
2017
- return self.colors[groupIndex];
2018
- }
2019
- return self.colors[i];
2020
- }));
2021
- }))
2022
- .on('click', (/**
2023
- * @param {?} d
2024
- * @param {?} i
2025
- * @return {?}
2026
- */
2027
- function (d, i) {
2028
- _this.barClickedSource.next(d);
2029
- }))
2030
- .transition(d3Transition.transition()
2031
- .duration(this.transitionService.getTransitionDuration()))
2032
- .attr('width', (/**
2033
- * @param {?} d
2034
- * @return {?}
2035
- */
2036
- function (d) {
2037
- return _this.xScale((/** @type {?} */ (d.value)));
2038
- }));
2039
- };
2040
- /**
2041
- * @private
2042
- * @param {?} config
2043
- * @return {?}
2044
- */
2045
- BarHorizontalChartBuilder.prototype.drawThresholdAcrossChart = /**
2046
- * @private
2047
- * @param {?} config
2048
- * @return {?}
2049
- */
2050
- function (config) {
2051
- var _this = this;
2052
- this.applyPreTransitionThresholdStyles(this.svg.select('.pcac-bars').append('rect'), config)
2053
- .attr('height', this.height)
2054
- .on('mousemove', (/**
2055
- * @param {?} d
2056
- * @param {?} i
2057
- * @return {?}
2058
- */
2059
- function (d, i) {
2060
- _this.tooltipBuilder.showBarTooltip(config.thresholds[i], config.tickFormat || PcacTickFormatEnum.None);
2061
- }))
2062
- .transition(d3Transition.transition()
2063
- .duration(this.transitionService.getTransitionDuration()))
2064
- .attr('x', (/**
2065
- * @param {?} d
2066
- * @param {?} i
2067
- * @return {?}
2068
- */
2069
- function (d, i) {
2070
- return _this.xScale((/** @type {?} */ (config.thresholds[i].value)));
2071
- }));
2072
- };
2073
- /**
2074
- * @private
2075
- * @param {?} group
2076
- * @param {?} config
2077
- * @return {?}
2078
- */
2079
- BarHorizontalChartBuilder.prototype.drawThresholdsPerGroup = /**
2080
- * @private
2081
- * @param {?} group
2082
- * @param {?} config
2083
- * @return {?}
2084
- */
2085
- function (group, config) {
2086
- var _this = this;
2087
- this.applyPreTransitionThresholdStyles(this.svg.selectAll('.pcac-bar-group').append('rect'), config)
2088
- .attr('height', this.yScaleStacked.bandwidth())
2089
- .on('mousemove', (/**
2090
- * @param {?} d
2091
- * @param {?} i
2092
- * @return {?}
2093
- */
2094
- function (d, i) {
2095
- _this.tooltipBuilder.showBarTooltip(config.isStacked ?
2096
- config.thresholds[i].data[0] :
2097
- config.thresholds[i], config.tickFormat || PcacTickFormatEnum.None);
2098
- }))
2099
- .transition(d3Transition.transition()
2100
- .duration(this.transitionService.getTransitionDuration()))
2101
- .attr('x', (/**
2102
- * @param {?} d
2103
- * @param {?} i
2104
- * @return {?}
2105
- */
2106
- function (d, i) {
2107
- return _this.xScale(config.isStacked ? (/** @type {?} */ (config.thresholds[i].data[0].value)) : (/** @type {?} */ (config.thresholds[i].value)));
2108
- }));
2109
- };
2110
- /**
2111
- * @private
2112
- * @param {?} group
2113
- * @param {?} config
2114
- * @return {?}
2115
- */
2116
- BarHorizontalChartBuilder.prototype.drawThresholdsPerBarInGroup = /**
2117
- * @private
2118
- * @param {?} group
2119
- * @param {?} config
2120
- * @return {?}
2121
- */
2122
- function (group, config) {
2123
- var _this = this;
2124
- this.applyPreTransitionThresholdStyles(group.enter().append('rect'), config)
2125
- .attr('height', this.yScaleGrouped.bandwidth())
2126
- .on('mousemove', (/**
2127
- * @param {?} d
2128
- * @param {?} i
2129
- * @param {?} n
2130
- * @return {?}
2131
- */
2132
- function (d, i, n) {
2133
- _this.tooltipBuilder.showBarTooltip(config.thresholds[n[0].parentElement.dataset['groupId']].data[i], config.tickFormat || PcacTickFormatEnum.None);
2134
- }))
2135
- .transition(d3Transition.transition()
2136
- .duration(this.transitionService.getTransitionDuration()))
2137
- .attr('y', (/**
2138
- * @param {?} d
2139
- * @return {?}
2140
- */
2141
- function (d) {
2142
- return _this.yScaleGrouped((/** @type {?} */ (d.key)));
2143
- }))
2144
- .attr('x', (/**
2145
- * @param {?} d
2146
- * @param {?} i
2147
- * @param {?} n
2148
- * @return {?}
2149
- */
2150
- function (d, i, n) {
2151
- return _this.xScale((/** @type {?} */ (config.thresholds[n[0].parentElement.dataset['groupId']].data[i].value)));
2152
- }));
2153
- };
2154
- /**
2155
- * @private
2156
- * @param {?} elm
2157
- * @param {?} config
2158
- * @return {?}
2159
- */
2160
- BarHorizontalChartBuilder.prototype.applyPreTransitionThresholdStyles = /**
2161
- * @private
2162
- * @param {?} elm
2163
- * @param {?} config
2164
- * @return {?}
2165
- */
2166
- function (elm, config) {
2167
- var _this = this;
2168
- return elm.attr('class', 'pcac-threshold')
2169
- .style('fill', (/**
2170
- * @return {?}
2171
- */
2172
- function () {
2173
- return _this.colorService.getAlert();
2174
- }))
2175
- .style('stroke', (/**
2176
- * @return {?}
2177
- */
2178
- function () {
2179
- return _this.colorService.getAlert();
2180
- }))
2181
- .style('stroke-width', (/**
2182
- * @return {?}
2183
- */
2184
- function () {
2185
- return 2;
2186
- }))
2187
- .attr('width', '3px')
2188
- .on('mouseout', (/**
2189
- * @return {?}
2190
- */
2191
- function () {
2192
- _this.tooltipBuilder.hideTooltip();
2193
- }));
2194
- };
2195
- BarHorizontalChartBuilder.decorators = [
2196
- { type: core.Injectable }
2197
- ];
2198
- /** @nocollapse */
2199
- BarHorizontalChartBuilder.ctorParameters = function () { return [
2200
- { type: PcacAxisBuilder },
2201
- { type: PcacGridBuilder },
2202
- { type: PcacTransitionService },
2203
- { type: PcacTooltipBuilder },
2204
- { type: PcacColorService }
2205
- ]; };
2206
- return BarHorizontalChartBuilder;
2207
- }(PcacChart));
2208
-
2209
- /**
2210
- * @fileoverview added by tsickle
2211
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2212
- */
2213
- var PcacBarChartHorizontalComponent = /** @class */ (function () {
2214
- function PcacBarChartHorizontalComponent(chartBuilder) {
2215
- var _this = this;
2216
- this.chartBuilder = chartBuilder;
2217
- this.barClicked = new core.EventEmitter();
2218
- this.chartBuilder.barClicked$.subscribe((/**
2219
- * @param {?} data
2220
- * @return {?}
2221
- */
2222
- function (data) {
2223
- _this.barClicked.emit(data);
2224
- }));
2225
- }
2226
- /**
2227
- * @return {?}
2228
- */
2229
- PcacBarChartHorizontalComponent.prototype.ngOnChanges = /**
2230
- * @return {?}
2231
- */
2232
- function () {
2233
- this.buildChart();
2234
- };
2235
- /**
2236
- * @return {?}
2237
- */
2238
- PcacBarChartHorizontalComponent.prototype.buildChart = /**
2239
- * @return {?}
2240
- */
2241
- function () {
2242
- if (this.config && this.config.data && this.config.data.length > 0) {
2243
- this.chartBuilder.buildChart(this.chartElm, this.config);
2244
- }
2245
- };
2246
- /**
2247
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
2248
- */
2249
- /**
2250
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
2251
- * @return {?}
2252
- */
2253
- PcacBarChartHorizontalComponent.prototype.onResize = /**
2254
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
2255
- * @return {?}
2256
- */
2257
- function () {
2258
- /** @type {?} */
2259
- var self = this;
2260
- clearTimeout(this.resizeWindowTimeout);
2261
- this.resizeWindowTimeout = setTimeout((/**
2262
- * @return {?}
2263
- */
2264
- function () {
2265
- self.buildChart();
2266
- }), 300);
2267
- };
2268
- PcacBarChartHorizontalComponent.decorators = [
2269
- { type: core.Component, args: [{
2270
- selector: 'pcac-bar-horizontal-chart',
2271
- template: "<section class=\"pcac-bar-horizontal-chart\">\r\n <svg #chart></svg>\r\n</section>\r\n",
2272
- providers: [
2273
- BarHorizontalChartBuilder
2274
- ]
2275
- }] }
2276
- ];
2277
- /** @nocollapse */
2278
- PcacBarChartHorizontalComponent.ctorParameters = function () { return [
2279
- { type: BarHorizontalChartBuilder }
2280
- ]; };
2281
- PcacBarChartHorizontalComponent.propDecorators = {
2282
- config: [{ type: core.Input }],
2283
- chartElm: [{ type: core.ViewChild, args: ['chart', { static: true },] }],
2284
- barClicked: [{ type: core.Output }],
2285
- onResize: [{ type: core.HostListener, args: ['window:resize',] }]
2286
- };
2287
- return PcacBarChartHorizontalComponent;
2288
- }());
2289
-
2290
- /**
2291
- * @fileoverview added by tsickle
2292
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2293
- */
2294
-
2295
- /**
2296
- * @fileoverview added by tsickle
2297
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2298
- */
2299
- var PcacBarHorizontalChartModule = /** @class */ (function () {
2300
- function PcacBarHorizontalChartModule() {
2301
- }
2302
- PcacBarHorizontalChartModule.decorators = [
2303
- { type: core.NgModule, args: [{
2304
- exports: [
2305
- PcacBarChartHorizontalComponent
2306
- ],
2307
- declarations: [
2308
- PcacBarChartHorizontalComponent
2309
- ]
2310
- },] }
2311
- ];
2312
- return PcacBarHorizontalChartModule;
2313
- }());
2314
-
2315
- /**
2316
- * @fileoverview added by tsickle
2317
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2318
- */
2319
-
2320
- /**
2321
- * @fileoverview added by tsickle
2322
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2323
- */
2324
-
2325
- /**
2326
- * @fileoverview added by tsickle
2327
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2328
- */
2329
- var PieChartBuilder = /** @class */ (function (_super) {
2330
- __extends(PieChartBuilder, _super);
2331
- function PieChartBuilder(axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) {
2332
- var _this = _super.call(this, axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) || this;
2333
- _this.axisBuilder = axisBuilder;
2334
- _this.gridBuilder = gridBuilder;
2335
- _this.transitionService = transitionService;
2336
- _this.tooltipBuilder = tooltipBuilder;
2337
- _this.colorService = colorService;
2338
- _this.sliceClickedSource = new rxjs.Subject();
2339
- _this.sliceClicked$ = _this.sliceClickedSource.asObservable();
2340
- return _this;
2341
- }
2342
- /**
2343
- * @param {?} chartElm
2344
- * @param {?} config
2345
- * @return {?}
2346
- */
2347
- PieChartBuilder.prototype.buildChart = /**
2348
- * @param {?} chartElm
2349
- * @param {?} config
2350
- * @return {?}
2351
- */
2352
- function (chartElm, config) {
2353
- this.initializeChartState(chartElm, config);
2354
- this.radius = Math.min(Math.min(this.height, this.width), Math.min(this.height, this.width)) / 2;
2355
- this.buildShapes(config);
2356
- this.drawChart(chartElm, config);
2357
- };
2358
- /**
2359
- * @private
2360
- * @param {?} config
2361
- * @return {?}
2362
- */
2363
- PieChartBuilder.prototype.buildShapes = /**
2364
- * @private
2365
- * @param {?} config
2366
- * @return {?}
2367
- */
2368
- function (config) {
2369
- /** @type {?} */
2370
- var radiusOffset = 10;
2371
- this.arcShape = d3Shape.arc()
2372
- .innerRadius(0)
2373
- .outerRadius(this.radius - radiusOffset);
2374
- this.arcOverShape = d3Shape.arc()
2375
- .innerRadius(0)
2376
- .outerRadius(this.radius - radiusOffset + radiusOffset);
2377
- this.pieAngles = d3Shape.pie()
2378
- .sort(null)
2379
- .value((/**
2380
- * @param {?} d
2381
- * @return {?}
2382
- */
2383
- function (d) { return d.value; })); // TODO: Strongly type
2384
- };
2385
- /**
2386
- * @private
2387
- * @param {?} chartElm
2388
- * @param {?} config
2389
- * @return {?}
2390
- */
2391
- PieChartBuilder.prototype.drawChart = /**
2392
- * @private
2393
- * @param {?} chartElm
2394
- * @param {?} config
2395
- * @return {?}
2396
- */
2397
- function (chartElm, config) {
2398
- var _this = this;
2399
- this.buildContainer(chartElm, true);
2400
- /** @type {?} */
2401
- var self = this;
2402
- this.svg.selectAll('.pcac-arc')
2403
- .data(this.pieAngles(config.data))
2404
- .enter().append('g')
2405
- .attr('class', 'pcac-arc')
2406
- .append('path')
2407
- .style('fill', (/**
2408
- * @param {?} d
2409
- * @param {?} i
2410
- * @return {?}
2411
- */
2412
- function (d, i) {
2413
- return _this.colors[i];
2414
- }))
2415
- .on('mouseover', (/**
2416
- * @param {?} d
2417
- * @param {?} i
2418
- * @return {?}
2419
- */
2420
- function (d, i) {
2421
- d3Selection.select(this).transition(d3Transition.transition()
2422
- .duration(self.transitionService.getTransitionDuration() / 3))
2423
- .attr('d', self.arcOverShape)
2424
- .style('fill', d3Color.color(self.colors[i]).darker(1).toString());
2425
- }))
2426
- .on('mousemove', (/**
2427
- * @param {?} d
2428
- * @return {?}
2429
- */
2430
- function (d) {
2431
- self.tooltipBuilder.showBarTooltip(d.data);
2432
- }))
2433
- .on('mouseout', (/**
2434
- * @param {?} d
2435
- * @param {?} i
2436
- * @return {?}
2437
- */
2438
- function (d, i) {
2439
- self.tooltipBuilder.hideTooltip();
2440
- d3Selection.select(this).transition(d3Transition.transition()
2441
- .duration(self.transitionService.getTransitionDuration() / 3))
2442
- .attr('d', self.arcShape)
2443
- .style('fill', self.colors[i]);
2444
- }))
2445
- .on('click', (/**
2446
- * @param {?} d
2447
- * @param {?} i
2448
- * @return {?}
2449
- */
2450
- function (d, i) {
2451
- _this.sliceClickedSource.next(d.data);
2452
- }))
2453
- .transition(d3Transition.transition()
2454
- .duration(this.transitionService.getTransitionDuration()))
2455
- .attrTween('d', (/**
2456
- * @param {?} b
2457
- * @return {?}
2458
- */
2459
- function (b) {
2460
- return _this.tweenChart(b);
2461
- }));
2462
- };
2463
- /**
2464
- * @private
2465
- * @param {?} b
2466
- * @return {?}
2467
- */
2468
- PieChartBuilder.prototype.tweenChart = /**
2469
- * @private
2470
- * @param {?} b
2471
- * @return {?}
2472
- */
2473
- function (b) {
2474
- var _this = this;
2475
- b.innerRadius = 0;
2476
- /** @type {?} */
2477
- var i = d3Interpolate.interpolate({ startAngle: 0, endAngle: 0 }, b);
2478
- return (/**
2479
- * @param {?} t
2480
- * @return {?}
2481
- */
2482
- function (t) { return _this.arcShape(i(t)); }); // TODO: Strongly type
2483
- };
2484
- PieChartBuilder.decorators = [
2485
- { type: core.Injectable }
2486
- ];
2487
- /** @nocollapse */
2488
- PieChartBuilder.ctorParameters = function () { return [
2489
- { type: PcacAxisBuilder },
2490
- { type: PcacGridBuilder },
2491
- { type: PcacTransitionService },
2492
- { type: PcacTooltipBuilder },
2493
- { type: PcacColorService }
2494
- ]; };
2495
- return PieChartBuilder;
2496
- }(PcacChart));
2497
-
2498
- /**
2499
- * @fileoverview added by tsickle
2500
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2501
- */
2502
- var PcacPieChartComponent = /** @class */ (function () {
2503
- function PcacPieChartComponent(chartBuilder) {
2504
- var _this = this;
2505
- this.chartBuilder = chartBuilder;
2506
- this.sliceClicked = new core.EventEmitter();
2507
- this.chartBuilder.sliceClicked$.subscribe((/**
2508
- * @param {?} data
2509
- * @return {?}
2510
- */
2511
- function (data) {
2512
- _this.sliceClicked.emit(data);
2513
- }));
2514
- }
2515
- /**
2516
- * @return {?}
2517
- */
2518
- PcacPieChartComponent.prototype.ngOnChanges = /**
2519
- * @return {?}
2520
- */
2521
- function () {
2522
- this.buildChart();
2523
- };
2524
- /**
2525
- * @return {?}
2526
- */
2527
- PcacPieChartComponent.prototype.buildChart = /**
2528
- * @return {?}
2529
- */
2530
- function () {
2531
- if (this.config && this.config.data && this.config.data.length > 0) {
2532
- this.chartBuilder.buildChart(this.chartElm, this.config);
2533
- }
2534
- };
2535
- /**
2536
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
2537
- */
2538
- /**
2539
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
2540
- * @return {?}
2541
- */
2542
- PcacPieChartComponent.prototype.onResize = /**
2543
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
2544
- * @return {?}
2545
- */
2546
- function () {
2547
- /** @type {?} */
2548
- var self = this;
2549
- clearTimeout(this.resizeWindowTimeout);
2550
- this.resizeWindowTimeout = setTimeout((/**
2551
- * @return {?}
2552
- */
2553
- function () {
2554
- self.buildChart();
2555
- }), 300);
2556
- };
2557
- PcacPieChartComponent.decorators = [
2558
- { type: core.Component, args: [{
2559
- selector: 'pcac-pie-chart',
2560
- template: "<section class=\"pcac-pie-chart\">\r\n <svg #chart></svg>\r\n</section>\r\n\r\n",
2561
- providers: [
2562
- PieChartBuilder
2563
- ]
2564
- }] }
2565
- ];
2566
- /** @nocollapse */
2567
- PcacPieChartComponent.ctorParameters = function () { return [
2568
- { type: PieChartBuilder }
2569
- ]; };
2570
- PcacPieChartComponent.propDecorators = {
2571
- config: [{ type: core.Input }],
2572
- chartElm: [{ type: core.ViewChild, args: ['chart', { static: true },] }],
2573
- sliceClicked: [{ type: core.Output }],
2574
- onResize: [{ type: core.HostListener, args: ['window:resize',] }]
2575
- };
2576
- return PcacPieChartComponent;
2577
- }());
2578
-
2579
- /**
2580
- * @fileoverview added by tsickle
2581
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2582
- */
2583
-
2584
- /**
2585
- * @fileoverview added by tsickle
2586
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2587
- */
2588
- var PcacPieChartModule = /** @class */ (function () {
2589
- function PcacPieChartModule() {
2590
- }
2591
- PcacPieChartModule.decorators = [
2592
- { type: core.NgModule, args: [{
2593
- exports: [
2594
- PcacPieChartComponent
2595
- ],
2596
- declarations: [
2597
- PcacPieChartComponent
2598
- ]
2599
- },] }
2600
- ];
2601
- return PcacPieChartModule;
2602
- }());
2603
-
2604
- /**
2605
- * @fileoverview added by tsickle
2606
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2607
- */
2608
-
2609
- /**
2610
- * @fileoverview added by tsickle
2611
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2612
- */
2613
-
2614
- /**
2615
- * @fileoverview added by tsickle
2616
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2617
- */
2618
- var LineAreaChartEffectsBuilder = /** @class */ (function () {
2619
- function LineAreaChartEffectsBuilder() {
2620
- this.lines = (/** @type {?} */ ([]));
2621
- }
2622
- /**
2623
- * @param {?} config
2624
- * @return {?}
2625
- */
2626
- LineAreaChartEffectsBuilder.prototype.buildEffects = /**
2627
- * @param {?} config
2628
- * @return {?}
2629
- */
2630
- function (config) {
2631
- var _this = this;
2632
- this.config = config;
2633
- this.lines = (/** @type {?} */ ([]));
2634
- this.config.svg.selectAll('.line').each((/**
2635
- * @param {?} d
2636
- * @param {?} i
2637
- * @param {?} n
2638
- * @return {?}
2639
- */
2640
- function (d, i, n) {
2641
- _this.lines.push(n[i]);
2642
- }));
2643
- this.buildCollection();
2644
- this.buildCanvas();
2645
- };
2646
- /**
2647
- * @private
2648
- * @return {?}
2649
- */
2650
- LineAreaChartEffectsBuilder.prototype.buildCollection = /**
2651
- * @private
2652
- * @return {?}
2653
- */
2654
- function () {
2655
- var _this = this;
2656
- /** @type {?} */
2657
- var collection = this.config.svg.append('g')
2658
- .attr('class', 'effects');
2659
- collection.append('path')
2660
- .attr('class', 'effect-line');
2661
- /** @type {?} */
2662
- var mousePerLine = collection.selectAll('.effect-group')
2663
- .data(this.config.data.filter((/**
2664
- * @param {?} elm
2665
- * @return {?}
2666
- */
2667
- function (elm) {
2668
- return elm.data.length > 0;
2669
- })))
2670
- .enter().append('g')
2671
- .attr('class', 'effect-group');
2672
- mousePerLine.append('circle')
2673
- .attr('r', 7)
2674
- .attr('class', 'effect-circle')
2675
- .style('stroke', (/**
2676
- * @param {?} d
2677
- * @param {?} i
2678
- * @return {?}
2679
- */
2680
- function (d, i) {
2681
- return _this.config.colors[i];
2682
- }));
2683
- mousePerLine.append('text')
2684
- .attr('class', 'effect-text')
2685
- .attr('y', 1.5)
2686
- .attr('transform', 'translate(10,3)');
2687
- };
2688
- /**
2689
- * @private
2690
- * @return {?}
2691
- */
2692
- LineAreaChartEffectsBuilder.prototype.buildCanvas = /**
2693
- * @private
2694
- * @return {?}
2695
- */
2696
- function () {
2697
- var _this = this;
2698
- this.config.svg.append('rect')
2699
- .attr('class', 'effects-canvas')
2700
- .attr('width', this.config.width)
2701
- .attr('height', this.config.height)
2702
- .attr('pointer-events', 'all')
2703
- .on('mouseout', (/**
2704
- * @return {?}
2705
- */
2706
- function () {
2707
- _this.hideEffects();
2708
- }))
2709
- .on('mouseover', (/**
2710
- * @return {?}
2711
- */
2712
- function () {
2713
- _this.showEffects();
2714
- }))
2715
- .on('mousemove', (/**
2716
- * @param {?} d
2717
- * @param {?} i
2718
- * @param {?} nodes
2719
- * @return {?}
2720
- */
2721
- function (d, i, nodes) {
2722
- _this.onMouseMove(d, i, nodes);
2723
- }));
2724
- };
2725
- /**
2726
- * @private
2727
- * @return {?}
2728
- */
2729
- LineAreaChartEffectsBuilder.prototype.showEffects = /**
2730
- * @private
2731
- * @return {?}
2732
- */
2733
- function () {
2734
- this.config.svg.select('.effect-line')
2735
- .style('opacity', '1');
2736
- this.config.svg.selectAll('.effect-group circle')
2737
- .style('opacity', '1');
2738
- this.config.svg.selectAll('.effect-group text')
2739
- .style('opacity', '1');
2740
- };
2741
- /**
2742
- * @private
2743
- * @return {?}
2744
- */
2745
- LineAreaChartEffectsBuilder.prototype.hideEffects = /**
2746
- * @private
2747
- * @return {?}
2748
- */
2749
- function () {
2750
- this.config.svg.select('.effect-line')
2751
- .style('opacity', '0');
2752
- this.config.svg.selectAll('.effect-group circle')
2753
- .style('opacity', '0');
2754
- this.config.svg.selectAll('.effect-group text')
2755
- .style('opacity', '0');
2756
- };
2757
- /**
2758
- * @private
2759
- * @param {?} d
2760
- * @param {?} i
2761
- * @param {?} nodes
2762
- * @return {?}
2763
- */
2764
- LineAreaChartEffectsBuilder.prototype.onMouseMove = /**
2765
- * @private
2766
- * @param {?} d
2767
- * @param {?} i
2768
- * @param {?} nodes
2769
- * @return {?}
2770
- */
2771
- function (d, i, nodes) {
2772
- /** @type {?} */
2773
- var mousePos = d3Selection.mouse(nodes[i]);
2774
- this.updateLine(mousePos);
2775
- this.updateEffects(mousePos);
2776
- };
2777
- /**
2778
- * @private
2779
- * @param {?} mousePos
2780
- * @return {?}
2781
- */
2782
- LineAreaChartEffectsBuilder.prototype.updateLine = /**
2783
- * @private
2784
- * @param {?} mousePos
2785
- * @return {?}
2786
- */
2787
- function (mousePos) {
2788
- var _this = this;
2789
- this.config.svg.select('.effect-line')
2790
- .attr('d', (/**
2791
- * @return {?}
2792
- */
2793
- function () {
2794
- return 'M' + mousePos[0] + ',' + _this.config.height + ' ' + mousePos[0] + ',' + 0;
2795
- }));
2796
- };
2797
- /**
2798
- * @private
2799
- * @param {?} mousePos
2800
- * @return {?}
2801
- */
2802
- LineAreaChartEffectsBuilder.prototype.updateEffects = /**
2803
- * @private
2804
- * @param {?} mousePos
2805
- * @return {?}
2806
- */
2807
- function (mousePos) {
2808
- var _this = this;
2809
- this.config.svg.selectAll('.effect-group')
2810
- .attr('transform', (/**
2811
- * @param {?} data
2812
- * @param {?} index
2813
- * @param {?} nodes
2814
- * @return {?}
2815
- */
2816
- function (data, index, nodes) {
2817
- /** @type {?} */
2818
- var beginning = 0;
2819
- /** @type {?} */
2820
- var end = _this.lines[index].getTotalLength();
2821
- /** @type {?} */
2822
- var target = 0;
2823
- /** @type {?} */
2824
- var pos;
2825
- while (true) {
2826
- target = Math.floor((beginning + end) / 2);
2827
- pos = _this.lines[index].getPointAtLength(target);
2828
- if ((target === end || target === beginning) && pos.x !== mousePos[0]) {
2829
- break;
2830
- }
2831
- if (pos.x > mousePos[0]) {
2832
- end = target;
2833
- }
2834
- else if (pos.x < mousePos[0]) {
2835
- beginning = target;
2836
- }
2837
- else {
2838
- break;
2839
- }
2840
- }
2841
- d3Selection.select(nodes[index]).select('text')
2842
- .text(_this.config.y.invert(pos.y).toFixed(0));
2843
- return 'translate(' + mousePos[0] + ',' + pos.y + ')';
2844
- }));
2845
- };
2846
- return LineAreaChartEffectsBuilder;
2847
- }());
2848
-
2849
- /**
2850
- * @fileoverview added by tsickle
2851
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2852
- */
2853
- var LineAreaChartBuilder = /** @class */ (function (_super) {
2854
- __extends(LineAreaChartBuilder, _super);
2855
- function LineAreaChartBuilder(axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) {
2856
- var _this = _super.call(this, axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) || this;
2857
- _this.axisBuilder = axisBuilder;
2858
- _this.gridBuilder = gridBuilder;
2859
- _this.transitionService = transitionService;
2860
- _this.tooltipBuilder = tooltipBuilder;
2861
- _this.colorService = colorService;
2862
- _this.dotClickedSource = new rxjs.Subject();
2863
- _this.dotClicked$ = _this.dotClickedSource.asObservable();
2864
- return _this;
2865
- }
2866
- /**
2867
- * @param {?} chartElm
2868
- * @param {?} config
2869
- * @return {?}
2870
- */
2871
- LineAreaChartBuilder.prototype.buildChart = /**
2872
- * @param {?} chartElm
2873
- * @param {?} config
2874
- * @return {?}
2875
- */
2876
- function (chartElm, config) {
2877
- this.config = JSON.parse(JSON.stringify(config));
2878
- this.startData = d3Array.range(this.config.data[0].data.length).map((/**
2879
- * @param {?} d
2880
- * @return {?}
2881
- */
2882
- function (d) {
2883
- return {
2884
- value: 0,
2885
- key: ''
2886
- };
2887
- }));
2888
- if (this.config.hideAxis) {
2889
- this.adjustForHiddenAxis();
2890
- }
2891
- this.initializeChartState(chartElm, this.config);
2892
- this.buildScales(this.config);
2893
- this.drawChart(chartElm, this.config);
2894
- };
2895
- /**
2896
- * @private
2897
- * @return {?}
2898
- */
2899
- LineAreaChartBuilder.prototype.adjustForHiddenAxis = /**
2900
- * @private
2901
- * @return {?}
2902
- */
2903
- function () {
2904
- this.config.height = this.config.height + 12;
2905
- this.margin.top = 8;
2906
- this.margin.bottom = 8;
2907
- this.margin.left = 8;
2908
- this.margin.right = 8;
2909
- };
2910
- /**
2911
- * @private
2912
- * @param {?} config
2913
- * @return {?}
2914
- */
2915
- LineAreaChartBuilder.prototype.buildScales = /**
2916
- * @private
2917
- * @param {?} config
2918
- * @return {?}
2919
- */
2920
- function (config) {
2921
- var _this = this;
2922
- this.xScale = d3Scale.scaleLinear()
2923
- .domain([0, config.data[0].data.length - 1])
2924
- .range([0, this.width]);
2925
- this.yScale = d3Scale.scaleLinear()
2926
- .domain([0, config.domainMax])
2927
- .range([this.height, 0]);
2928
- this.line = d3Shape.line()
2929
- .x((/**
2930
- * @param {?} d
2931
- * @param {?} i
2932
- * @return {?}
2933
- */
2934
- function (d, i) {
2935
- return _this.xScale(i);
2936
- }))
2937
- .y((/**
2938
- * @param {?} d
2939
- * @return {?}
2940
- */
2941
- function (d) {
2942
- return _this.yScale(d.value);
2943
- }));
2944
- this.area = d3Shape.area()
2945
- .x((/**
2946
- * @param {?} d
2947
- * @param {?} i
2948
- * @return {?}
2949
- */
2950
- function (d, i) {
2951
- return _this.xScale(i);
2952
- }))
2953
- .y0(this.height)
2954
- .y1((/**
2955
- * @param {?} d
2956
- * @return {?}
2957
- */
2958
- function (d) {
2959
- return _this.yScale(d.value);
2960
- }));
2961
- };
2962
- /**
2963
- * @private
2964
- * @param {?} chartElm
2965
- * @param {?} config
2966
- * @return {?}
2967
- */
2968
- LineAreaChartBuilder.prototype.drawChart = /**
2969
- * @private
2970
- * @param {?} chartElm
2971
- * @param {?} config
2972
- * @return {?}
2973
- */
2974
- function (chartElm, config) {
2975
- this.buildContainer(chartElm);
2976
- if (!config.hideAxis) {
2977
- this.axisBuilder.drawAxis({
2978
- svg: this.svg,
2979
- numberOfTicks: config.numberOfTicks || 5,
2980
- height: this.height,
2981
- xScale: this.xScale,
2982
- yScale: this.yScale
2983
- });
2984
- }
2985
- if (!config.hideGrid) {
2986
- this.gridBuilder.drawHorizontalGrid({
2987
- svg: this.svg,
2988
- numberOfTicks: config.numberOfTicks || 5,
2989
- width: this.width,
2990
- xScale: this.xScale,
2991
- yScale: this.yScale
2992
- });
2993
- }
2994
- this.drawLineArea(config);
2995
- if (config.enableEffects) {
2996
- this.drawEffects(config);
2997
- }
2998
- this.drawDots(config);
2999
- };
3000
- /**
3001
- * @private
3002
- * @param {?} config
3003
- * @return {?}
3004
- */
3005
- LineAreaChartBuilder.prototype.drawLineArea = /**
3006
- * @private
3007
- * @param {?} config
3008
- * @return {?}
3009
- */
3010
- function (config) {
3011
- for (var i = 0; i < config.data.length; i++) {
3012
- if (config.isArea) {
3013
- this.drawArea(config.data[i].data, i);
3014
- }
3015
- this.drawLine(config.data[i].data, i);
3016
- }
3017
- };
3018
- /**
3019
- * @private
3020
- * @param {?} lineData
3021
- * @param {?} index
3022
- * @return {?}
3023
- */
3024
- LineAreaChartBuilder.prototype.drawLine = /**
3025
- * @private
3026
- * @param {?} lineData
3027
- * @param {?} index
3028
- * @return {?}
3029
- */
3030
- function (lineData, index) {
3031
- var _this = this;
3032
- this.svg.append('g')
3033
- .attr('class', 'lines')
3034
- .append('path')
3035
- .datum(lineData)
3036
- .attr('class', 'line')
3037
- .attr('d', this.line(this.startData))
3038
- .transition(d3Transition.transition()
3039
- .duration(this.transitionService.getTransitionDuration()))
3040
- .attr('d', (/** @type {?} */ (this.line))) // TODO: strongly type
3041
- .attr('stroke', (/**
3042
- * @return {?}
3043
- */
3044
- function () {
3045
- return _this.colors[index];
3046
- }))
3047
- .attr('fill', 'none');
3048
- };
3049
- /**
3050
- * @private
3051
- * @param {?} lineData
3052
- * @param {?} index
3053
- * @return {?}
3054
- */
3055
- LineAreaChartBuilder.prototype.drawArea = /**
3056
- * @private
3057
- * @param {?} lineData
3058
- * @param {?} index
3059
- * @return {?}
3060
- */
3061
- function (lineData, index) {
3062
- var _this = this;
3063
- this.svg.append('g')
3064
- .attr('class', 'areas')
3065
- .append('path')
3066
- .datum(lineData)
3067
- .attr('class', 'area')
3068
- .style('opacity', 0.5)
3069
- .style('fill', (/**
3070
- * @return {?}
3071
- */
3072
- function () {
3073
- return _this.colors[index]; // TODO: strongly type
3074
- }))
3075
- .attr('d', this.line(this.startData))
3076
- .transition(d3Transition.transition()
3077
- .duration(this.transitionService.getTransitionDuration()))
3078
- .attr('d', (/** @type {?} */ (this.area))); // TODO: strongly type
3079
- };
3080
- /**
3081
- * @private
3082
- * @param {?} config
3083
- * @return {?}
3084
- */
3085
- LineAreaChartBuilder.prototype.drawEffects = /**
3086
- * @private
3087
- * @param {?} config
3088
- * @return {?}
3089
- */
3090
- function (config) {
3091
- if (config.enableEffects) {
3092
- /** @type {?} */
3093
- var effectsBuilder = new LineAreaChartEffectsBuilder();
3094
- effectsBuilder.buildEffects({
3095
- svg: this.svg,
3096
- height: this.height,
3097
- width: this.width,
3098
- data: config.data,
3099
- colors: this.colors,
3100
- x: this.xScale,
3101
- y: this.yScale
3102
- });
3103
- }
3104
- };
3105
- /**
3106
- * @private
3107
- * @param {?} config
3108
- * @return {?}
3109
- */
3110
- LineAreaChartBuilder.prototype.drawDots = /**
3111
- * @private
3112
- * @param {?} config
3113
- * @return {?}
3114
- */
3115
- function (config) {
3116
- var _this = this;
3117
- /** @type {?} */
3118
- var self = this;
3119
- var _loop_1 = function (index) {
3120
- this_1.svg.append('g')
3121
- .attr('class', 'dots')
3122
- .selectAll('.dot')
3123
- .data(config.data[index].data)
3124
- .enter().append('circle')
3125
- .attr('class', 'dot')
3126
- .attr('stroke', (/**
3127
- * @param {?} d
3128
- * @return {?}
3129
- */
3130
- function (d) {
3131
- return _this.colors[index];
3132
- }))
3133
- .attr('cx', (/**
3134
- * @param {?} d
3135
- * @param {?} i
3136
- * @return {?}
3137
- */
3138
- function (d, i) {
3139
- return _this.xScale(i);
3140
- }))
3141
- .attr('cy', (/**
3142
- * @param {?} d
3143
- * @return {?}
3144
- */
3145
- function (d) {
3146
- return _this.yScale(0);
3147
- }))
3148
- .attr('fill', '#fff')
3149
- .on('mouseover', (/**
3150
- * @param {?} d
3151
- * @return {?}
3152
- */
3153
- function (d) {
3154
- self.tooltipBuilder.showBarTooltip(d);
3155
- d3Selection.select(this).transition(d3Transition.transition()
3156
- .duration(self.transitionService.getTransitionDuration() / 3))
3157
- .attr('r', 6)
3158
- .attr('fill', self.colors[index]);
3159
- }))
3160
- .on('mouseout', (/**
3161
- * @return {?}
3162
- */
3163
- function () {
3164
- self.tooltipBuilder.hideTooltip();
3165
- d3Selection.select(this).transition(d3Transition.transition()
3166
- .duration(self.transitionService.getTransitionDuration() / 3))
3167
- .attr('r', 4)
3168
- .attr('fill', '#fff');
3169
- }))
3170
- .on('click', (/**
3171
- * @param {?} d
3172
- * @param {?} i
3173
- * @return {?}
3174
- */
3175
- function (d, i) {
3176
- _this.dotClickedSource.next(d);
3177
- }))
3178
- .transition(d3Transition.transition()
3179
- .duration(this_1.transitionService.getTransitionDuration()))
3180
- .attr('cy', (/**
3181
- * @param {?} d
3182
- * @return {?}
3183
- */
3184
- function (d) {
3185
- return _this.yScale((/** @type {?} */ (d.value)));
3186
- }))
3187
- .attr('r', 4);
3188
- };
3189
- var this_1 = this;
3190
- for (var index = 0; index < config.data.length; index++) {
3191
- _loop_1(index);
3192
- }
3193
- };
3194
- LineAreaChartBuilder.decorators = [
3195
- { type: core.Injectable }
3196
- ];
3197
- /** @nocollapse */
3198
- LineAreaChartBuilder.ctorParameters = function () { return [
3199
- { type: PcacAxisBuilder },
3200
- { type: PcacGridBuilder },
3201
- { type: PcacTransitionService },
3202
- { type: PcacTooltipBuilder },
3203
- { type: PcacColorService }
3204
- ]; };
3205
- return LineAreaChartBuilder;
3206
- }(PcacChart));
3207
-
3208
- /**
3209
- * @fileoverview added by tsickle
3210
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3211
- */
3212
- var PcacLineAreaChartComponent = /** @class */ (function () {
3213
- function PcacLineAreaChartComponent(chartBuilder) {
3214
- var _this = this;
3215
- this.chartBuilder = chartBuilder;
3216
- this.dotClicked = new core.EventEmitter();
3217
- this.chartBuilder.dotClicked$.subscribe((/**
3218
- * @param {?} data
3219
- * @return {?}
3220
- */
3221
- function (data) {
3222
- _this.dotClicked.emit(data);
3223
- }));
3224
- }
3225
- /**
3226
- * @return {?}
3227
- */
3228
- PcacLineAreaChartComponent.prototype.ngOnChanges = /**
3229
- * @return {?}
3230
- */
3231
- function () {
3232
- this.buildChart();
3233
- };
3234
- /**
3235
- * @return {?}
3236
- */
3237
- PcacLineAreaChartComponent.prototype.buildChart = /**
3238
- * @return {?}
3239
- */
3240
- function () {
3241
- if (this.config && this.config.data && this.config.data.length > 0) {
3242
- this.chartBuilder.buildChart(this.chartElm, this.config);
3243
- }
3244
- };
3245
- /**
3246
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
3247
- */
3248
- /**
3249
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
3250
- * @return {?}
3251
- */
3252
- PcacLineAreaChartComponent.prototype.onResize = /**
3253
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
3254
- * @return {?}
3255
- */
3256
- function () {
3257
- /** @type {?} */
3258
- var self = this;
3259
- clearTimeout(this.resizeWindowTimeout);
3260
- this.resizeWindowTimeout = setTimeout((/**
3261
- * @return {?}
3262
- */
3263
- function () {
3264
- self.buildChart();
3265
- }), 300);
3266
- };
3267
- PcacLineAreaChartComponent.decorators = [
3268
- { type: core.Component, args: [{
3269
- selector: 'pcac-line-area-chart',
3270
- template: "<section class=\"pcac-line-area-chart\">\r\n <svg #chart></svg>\r\n</section>\r\n\r\n",
3271
- providers: [
3272
- LineAreaChartBuilder
3273
- ]
3274
- }] }
3275
- ];
3276
- /** @nocollapse */
3277
- PcacLineAreaChartComponent.ctorParameters = function () { return [
3278
- { type: LineAreaChartBuilder }
3279
- ]; };
3280
- PcacLineAreaChartComponent.propDecorators = {
3281
- config: [{ type: core.Input }],
3282
- chartElm: [{ type: core.ViewChild, args: ['chart', { static: true },] }],
3283
- dotClicked: [{ type: core.Output }],
3284
- onResize: [{ type: core.HostListener, args: ['window:resize',] }]
3285
- };
3286
- return PcacLineAreaChartComponent;
3287
- }());
3288
-
3289
- /**
3290
- * @fileoverview added by tsickle
3291
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3292
- */
3293
-
3294
- /**
3295
- * @fileoverview added by tsickle
3296
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3297
- */
3298
- var PcacLineAreaChartModule = /** @class */ (function () {
3299
- function PcacLineAreaChartModule() {
3300
- }
3301
- PcacLineAreaChartModule.decorators = [
3302
- { type: core.NgModule, args: [{
3303
- exports: [
3304
- PcacLineAreaChartComponent
3305
- ],
3306
- declarations: [
3307
- PcacLineAreaChartComponent
3308
- ]
3309
- },] }
3310
- ];
3311
- return PcacLineAreaChartModule;
3312
- }());
3313
-
3314
- /**
3315
- * @fileoverview added by tsickle
3316
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3317
- */
3318
-
3319
- /**
3320
- * @fileoverview added by tsickle
3321
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3322
- */
3323
-
3324
- /**
3325
- * @fileoverview added by tsickle
3326
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3327
- */
3328
- var PcacDialogComponent = /** @class */ (function () {
3329
- function PcacDialogComponent() {
3330
- this.width = '50%';
3331
- this.closed = new core.EventEmitter();
3332
- this.opened = new core.EventEmitter();
3333
- this.show = false;
3334
- }
3335
- /**
3336
- * @return {?}
3337
- */
3338
- PcacDialogComponent.prototype.close = /**
3339
- * @return {?}
3340
- */
3341
- function () {
3342
- this.show = false;
3343
- this.closed.emit();
3344
- };
3345
- /**
3346
- * @return {?}
3347
- */
3348
- PcacDialogComponent.prototype.open = /**
3349
- * @return {?}
3350
- */
3351
- function () {
3352
- this.show = true;
3353
- this.opened.emit();
3354
- };
3355
- PcacDialogComponent.decorators = [
3356
- { type: core.Component, args: [{
3357
- selector: 'pcac-dialog',
3358
- template: "<div class=\"pcac-modal\" *ngIf=\"show\">\r\n <div class=\"pcac-modal-overlay\" (click)=\"close()\"></div>\r\n <div class=\"pcac-modal-dialog\" ng-style=\"dialogStyle\" [style.width]=\"width\">\r\n <div class=\"pcac-modal-dialog-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n</div>\r\n",
3359
- styles: [".pcac-modal{position:fixed;z-index:9999;top:0;left:0;width:100%;height:100%;border:1px solid #212529}.pcac-modal-overlay{position:absolute;z-index:9000;top:0;left:0;width:100%;height:100%;background-color:#212529;opacity:.8}.pcac-modal-dialog{z-index:9999;position:absolute;top:50%;left:50%;width:50%;overflow-x:hidden;overflow-y:auto;max-height:95%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);background-color:#fff;box-shadow:4px 4px 80px #212529;padding:1rem}.pcac-modal-dialog-content{position:relative;overflow:hidden;height:100%}"]
3360
- }] }
3361
- ];
3362
- PcacDialogComponent.propDecorators = {
3363
- width: [{ type: core.Input }],
3364
- closed: [{ type: core.Output }],
3365
- opened: [{ type: core.Output }]
3366
- };
3367
- return PcacDialogComponent;
3368
- }());
3369
-
3370
- /**
3371
- * @fileoverview added by tsickle
3372
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3373
- */
3374
- var PcacDialogModule = /** @class */ (function () {
3375
- function PcacDialogModule() {
3376
- }
3377
- PcacDialogModule.decorators = [
3378
- { type: core.NgModule, args: [{
3379
- imports: [
3380
- common.CommonModule
3381
- ],
3382
- exports: [
3383
- PcacDialogComponent
3384
- ],
3385
- declarations: [
3386
- PcacDialogComponent
3387
- ]
3388
- },] }
3389
- ];
3390
- return PcacDialogModule;
3391
- }());
3392
-
3393
- /**
3394
- * @fileoverview added by tsickle
3395
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3396
- */
3397
-
3398
- /**
3399
- * @fileoverview added by tsickle
3400
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3401
- */
3402
-
3403
- /**
3404
- * @fileoverview added by tsickle
3405
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3406
- */
3407
- var PcacSpinnerComponent = /** @class */ (function () {
3408
- function PcacSpinnerComponent() {
3409
- this.showSpinner = true;
3410
- this.showOverlay = true;
3411
- }
3412
- PcacSpinnerComponent.decorators = [
3413
- { type: core.Component, args: [{
3414
- selector: 'pcac-spinner',
3415
- template: "<section *ngIf=\"showSpinner\" class=\"pcac-spinner\">\r\n <div class=\"overlay\" *ngIf=\"showOverlay\"></div>\r\n <div class=\"wrapper\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\r\n <path d=\"M288 39.056v16.659c0 10.804 7.281 20.159 17.686 23.066C383.204 100.434 440 171.518 440 256c0 101.689-82.295 184-184 184-101.689 0-184-82.295-184-184 0-84.47 56.786-155.564 134.312-177.219C216.719 75.874 224 66.517 224 55.712V39.064c0-15.709-14.834-27.153-30.046-23.234C86.603 43.482 7.394 141.206 8.003 257.332c.72 137.052 111.477 246.956 248.531 246.667C393.255 503.711 504 392.788 504 256c0-115.633-79.14-212.779-186.211-240.236C302.678 11.889 288 23.456 288 39.056z\"></path>\r\n </svg>\r\n </div>\r\n</section>\r\n"
3416
- }] }
3417
- ];
3418
- PcacSpinnerComponent.propDecorators = {
3419
- showSpinner: [{ type: core.Input }],
3420
- showOverlay: [{ type: core.Input }]
3421
- };
3422
- return PcacSpinnerComponent;
3423
- }());
3424
-
3425
- /**
3426
- * @fileoverview added by tsickle
3427
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3428
- */
3429
- var PcacSpinnerModule = /** @class */ (function () {
3430
- function PcacSpinnerModule() {
3431
- }
3432
- PcacSpinnerModule.decorators = [
3433
- { type: core.NgModule, args: [{
3434
- imports: [
3435
- common.CommonModule
3436
- ],
3437
- exports: [
3438
- PcacSpinnerComponent
3439
- ],
3440
- declarations: [
3441
- PcacSpinnerComponent
3442
- ]
3443
- },] }
3444
- ];
3445
- return PcacSpinnerModule;
3446
- }());
3447
-
3448
- /**
3449
- * @fileoverview added by tsickle
3450
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3451
- */
3452
-
3453
- /**
3454
- * @fileoverview added by tsickle
3455
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3456
- */
3457
-
3458
- /**
3459
- * @fileoverview added by tsickle
3460
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3461
- */
3462
- /** @enum {number} */
3463
- var PcacPaginationPageSizeEnum = {
3464
- Ten: 10,
3465
- TwentyFive: 25,
3466
- Fifty: 50,
3467
- OneHundred: 100,
3468
- };
3469
- PcacPaginationPageSizeEnum[PcacPaginationPageSizeEnum.Ten] = 'Ten';
3470
- PcacPaginationPageSizeEnum[PcacPaginationPageSizeEnum.TwentyFive] = 'TwentyFive';
3471
- PcacPaginationPageSizeEnum[PcacPaginationPageSizeEnum.Fifty] = 'Fifty';
3472
- PcacPaginationPageSizeEnum[PcacPaginationPageSizeEnum.OneHundred] = 'OneHundred';
3473
-
3474
- /**
3475
- * @fileoverview added by tsickle
3476
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3477
- */
3478
- var PaginationComponent = /** @class */ (function () {
3479
- function PaginationComponent() {
3480
- this.config = (/** @type {?} */ ({
3481
- currentPageIndex: 1,
3482
- countPerPage: PcacPaginationPageSizeEnum.Ten,
3483
- totalItemsInCollection: 10,
3484
- show: false,
3485
- isCompactView: false
3486
- }));
3487
- this.perPageChanged = new core.EventEmitter();
3488
- this.startClicked = new core.EventEmitter();
3489
- this.leftClicked = new core.EventEmitter();
3490
- this.rightClicked = new core.EventEmitter();
3491
- this.endClicked = new core.EventEmitter();
3492
- }
3493
- Object.defineProperty(PaginationComponent.prototype, "leftIsActive", {
3494
- get: /**
3495
- * @return {?}
3496
- */
3497
- function () {
3498
- return this.config.currentPageIndex !== 1;
3499
- },
3500
- enumerable: true,
3501
- configurable: true
3502
- });
3503
- Object.defineProperty(PaginationComponent.prototype, "rightIsActive", {
3504
- get: /**
3505
- * @return {?}
3506
- */
3507
- function () {
3508
- return this.config.currentPageIndex !== Math.ceil(this.config.totalItemsInCollection / this.config.countPerPage);
3509
- },
3510
- enumerable: true,
3511
- configurable: true
3512
- });
3513
- Object.defineProperty(PaginationComponent.prototype, "currentRangeText", {
3514
- get: /**
3515
- * @return {?}
3516
- */
3517
- function () {
3518
- /** @type {?} */
3519
- var text = this.getStartingRangeText() + "-" + this.getEndingRangeText();
3520
- if (!this.config.isCompactView) {
3521
- text = text + (" of " + this.config.totalItemsInCollection);
3522
- }
3523
- return text;
3524
- },
3525
- enumerable: true,
3526
- configurable: true
3527
- });
3528
- /**
3529
- * @param {?} count
3530
- * @return {?}
3531
- */
3532
- PaginationComponent.prototype.onPerPageChanged = /**
3533
- * @param {?} count
3534
- * @return {?}
3535
- */
3536
- function (count) {
3537
- this.config.countPerPage = parseInt(count, 10);
3538
- this.perPageChanged.emit(this.config.countPerPage);
3539
- };
3540
- /**
3541
- * @return {?}
3542
- */
3543
- PaginationComponent.prototype.onStartClicked = /**
3544
- * @return {?}
3545
- */
3546
- function () {
3547
- if (this.leftIsActive) {
3548
- this.config.currentPageIndex = 1;
3549
- this.startClicked.emit(1);
3550
- }
3551
- };
3552
- /**
3553
- * @return {?}
3554
- */
3555
- PaginationComponent.prototype.onLeftClicked = /**
3556
- * @return {?}
3557
- */
3558
- function () {
3559
- if (this.leftIsActive) {
3560
- this.config.currentPageIndex = this.config.currentPageIndex - 1;
3561
- this.leftClicked.emit(this.config.currentPageIndex);
3562
- }
3563
- };
3564
- /**
3565
- * @return {?}
3566
- */
3567
- PaginationComponent.prototype.onRightClicked = /**
3568
- * @return {?}
3569
- */
3570
- function () {
3571
- if (this.rightIsActive) {
3572
- this.config.currentPageIndex = this.config.currentPageIndex + 1;
3573
- this.rightClicked.emit(this.config.currentPageIndex);
3574
- }
3575
- };
3576
- /**
3577
- * @return {?}
3578
- */
3579
- PaginationComponent.prototype.onEndClicked = /**
3580
- * @return {?}
3581
- */
3582
- function () {
3583
- if (this.rightIsActive) {
3584
- this.config.currentPageIndex = Math.ceil(this.config.totalItemsInCollection / this.config.countPerPage);
3585
- this.endClicked.emit(this.config.currentPageIndex);
3586
- }
3587
- };
3588
- /**
3589
- * @private
3590
- * @return {?}
3591
- */
3592
- PaginationComponent.prototype.getStartingRangeText = /**
3593
- * @private
3594
- * @return {?}
3595
- */
3596
- function () {
3597
- return this.config.countPerPage * (this.config.currentPageIndex - 1) + 1;
3598
- };
3599
- /**
3600
- * @private
3601
- * @return {?}
3602
- */
3603
- PaginationComponent.prototype.getEndingRangeText = /**
3604
- * @private
3605
- * @return {?}
3606
- */
3607
- function () {
3608
- /** @type {?} */
3609
- var totalPossiblePage = Math.ceil(this.config.totalItemsInCollection / this.config.countPerPage);
3610
- if (totalPossiblePage === 1) {
3611
- return this.config.totalItemsInCollection;
3612
- }
3613
- if (totalPossiblePage === this.config.currentPageIndex) {
3614
- /** @type {?} */
3615
- var total = this.config.countPerPage * (this.config.currentPageIndex - 1);
3616
- /** @type {?} */
3617
- var modulus = this.config.totalItemsInCollection % total;
3618
- return total + modulus;
3619
- }
3620
- return this.config.countPerPage * this.config.currentPageIndex;
3621
- };
3622
- PaginationComponent.decorators = [
3623
- { type: core.Component, args: [{
3624
- selector: 'pcac-pagination',
3625
- template: "<section class=\"pcac-pager\" *ngIf=\"config?.show\">\r\n <div class=\"per-page\">\r\n <div *ngIf=\"!config.isCompactView\">\r\n Per Page:\r\n </div>\r\n <div>\r\n <select [(ngModel)]=\"config.countPerPage\" (change)=\"onPerPageChanged($event.target.value)\">\r\n <option value=\"10\">10</option>\r\n <option value=\"25\">25</option>\r\n <option value=\"50\">50</option>\r\n <option value=\"100\">100</option>\r\n </select>\r\n </div>\r\n </div>\r\n <div class=\"range-text\">\r\n {{currentRangeText}}\r\n </div>\r\n <div class=\"direction left-end\" [ngClass]=\"{'active': leftIsActive}\" (click)=\"onStartClicked()\">\r\n <svg class=\"pcac-icon \" viewBox=\"0 0 20 20\">\r\n <path fill=\"none\" d=\"M8.388,10.049l4.76-4.873c0.303-0.31,0.297-0.804-0.012-1.105c-0.309-0.304-0.803-0.293-1.105,0.012L6.726,9.516c-0.303,0.31-0.296,0.805,0.012,1.105l5.433,5.307c0.152,0.148,0.35,0.223,0.547,0.223c0.203,0,0.406-0.08,0.559-0.236c0.303-0.309,0.295-0.803-0.012-1.104L8.388,10.049z\"></path>\r\n </svg>\r\n <svg class=\"pcac-icon pull-left\" viewBox=\"0 0 20 20\">\r\n <path fill=\"none\" d=\"M8.388,10.049l4.76-4.873c0.303-0.31,0.297-0.804-0.012-1.105c-0.309-0.304-0.803-0.293-1.105,0.012L6.726,9.516c-0.303,0.31-0.296,0.805,0.012,1.105l5.433,5.307c0.152,0.148,0.35,0.223,0.547,0.223c0.203,0,0.406-0.08,0.559-0.236c0.303-0.309,0.295-0.803-0.012-1.104L8.388,10.049z\"></path>\r\n </svg>\r\n </div>\r\n <div class=\"direction left\" [ngClass]=\"{'active': leftIsActive}\" (click)=\"onLeftClicked()\">\r\n <svg class=\"pcac-icon \" viewBox=\"0 0 20 20\">\r\n <path fill=\"none\" d=\"M8.388,10.049l4.76-4.873c0.303-0.31,0.297-0.804-0.012-1.105c-0.309-0.304-0.803-0.293-1.105,0.012L6.726,9.516c-0.303,0.31-0.296,0.805,0.012,1.105l5.433,5.307c0.152,0.148,0.35,0.223,0.547,0.223c0.203,0,0.406-0.08,0.559-0.236c0.303-0.309,0.295-0.803-0.012-1.104L8.388,10.049z\"></path>\r\n </svg>\r\n </div>\r\n <div class=\"direction right\" [ngClass]=\"{'active': rightIsActive}\" (click)=\"onRightClicked()\">\r\n <svg class=\"pcac-icon \" viewBox=\"0 0 20 20\">\r\n <path fill=\"none\" d=\"M11.611,10.049l-4.76-4.873c-0.303-0.31-0.297-0.804,0.012-1.105c0.309-0.304,0.803-0.293,1.105,0.012l5.306,5.433c0.304,0.31,0.296,0.805-0.012,1.105L7.83,15.928c-0.152,0.148-0.35,0.223-0.547,0.223c-0.203,0-0.406-0.08-0.559-0.236c-0.303-0.309-0.295-0.803,0.012-1.104L11.611,10.049z\"></path>\r\n </svg>\r\n </div>\r\n <div class=\"direction right-end\" [ngClass]=\"{'active': rightIsActive}\" (click)=\"onEndClicked()\">\r\n <svg class=\"pcac-icon \" viewBox=\"0 0 20 20\">\r\n <path fill=\"none\" d=\"M11.611,10.049l-4.76-4.873c-0.303-0.31-0.297-0.804,0.012-1.105c0.309-0.304,0.803-0.293,1.105,0.012l5.306,5.433c0.304,0.31,0.296,0.805-0.012,1.105L7.83,15.928c-0.152,0.148-0.35,0.223-0.547,0.223c-0.203,0-0.406-0.08-0.559-0.236c-0.303-0.309-0.295-0.803,0.012-1.104L11.611,10.049z\"></path>\r\n </svg>\r\n <svg class=\"pcac-icon pull-left\" viewBox=\"0 0 20 20\">\r\n <path fill=\"none\" d=\"M11.611,10.049l-4.76-4.873c-0.303-0.31-0.297-0.804,0.012-1.105c0.309-0.304,0.803-0.293,1.105,0.012l5.306,5.433c0.304,0.31,0.296,0.805-0.012,1.105L7.83,15.928c-0.152,0.148-0.35,0.223-0.547,0.223c-0.203,0-0.406-0.08-0.559-0.236c-0.303-0.309-0.295-0.803,0.012-1.104L11.611,10.049z\"></path>\r\n </svg>\r\n </div>\r\n</section>\r\n"
3626
- }] }
3627
- ];
3628
- PaginationComponent.propDecorators = {
3629
- config: [{ type: core.Input }],
3630
- perPageChanged: [{ type: core.Output }],
3631
- startClicked: [{ type: core.Output }],
3632
- leftClicked: [{ type: core.Output }],
3633
- rightClicked: [{ type: core.Output }],
3634
- endClicked: [{ type: core.Output }]
3635
- };
3636
- return PaginationComponent;
3637
- }());
3638
-
3639
- /**
3640
- * @fileoverview added by tsickle
3641
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3642
- */
3643
- var PcacPaginationModule = /** @class */ (function () {
3644
- function PcacPaginationModule() {
3645
- }
3646
- PcacPaginationModule.decorators = [
3647
- { type: core.NgModule, args: [{
3648
- imports: [
3649
- common.CommonModule,
3650
- forms.FormsModule
3651
- ],
3652
- exports: [
3653
- PaginationComponent
3654
- ],
3655
- declarations: [
3656
- PaginationComponent
3657
- ]
3658
- },] }
3659
- ];
3660
- return PcacPaginationModule;
3661
- }());
3662
-
3663
- exports.BarHorizontalChartBuilder = BarHorizontalChartBuilder;
3664
- exports.BarVerticalChartBuilder = BarVerticalChartBuilder;
3665
- exports.LineAreaChartBuilder = LineAreaChartBuilder;
3666
- exports.PaginationComponent = PaginationComponent;
3667
- exports.PcacAxisBuilder = PcacAxisBuilder;
3668
- exports.PcacBarChartHorizontalComponent = PcacBarChartHorizontalComponent;
3669
- exports.PcacBarHorizontalChartModule = PcacBarHorizontalChartModule;
3670
- exports.PcacBarVerticalChartComponent = PcacBarVerticalChartComponent;
3671
- exports.PcacBarVerticalChartModule = PcacBarVerticalChartModule;
3672
- exports.PcacChart = PcacChart;
3673
- exports.PcacColorService = PcacColorService;
3674
- exports.PcacCoreModule = PcacCoreModule;
3675
- exports.PcacDialogComponent = PcacDialogComponent;
3676
- exports.PcacDialogModule = PcacDialogModule;
3677
- exports.PcacGridBuilder = PcacGridBuilder;
3678
- exports.PcacHeaderComponent = PcacHeaderComponent;
3679
- exports.PcacHeaderModule = PcacHeaderModule;
3680
- exports.PcacLineAreaChartComponent = PcacLineAreaChartComponent;
3681
- exports.PcacLineAreaChartModule = PcacLineAreaChartModule;
3682
- exports.PcacPaginationModule = PcacPaginationModule;
3683
- exports.PcacPaginationPageSizeEnum = PcacPaginationPageSizeEnum;
3684
- exports.PcacPieChartComponent = PcacPieChartComponent;
3685
- exports.PcacPieChartModule = PcacPieChartModule;
3686
- exports.PcacSpinnerComponent = PcacSpinnerComponent;
3687
- exports.PcacSpinnerModule = PcacSpinnerModule;
3688
- exports.PcacTableComponent = PcacTableComponent;
3689
- exports.PcacTableModule = PcacTableModule;
3690
- exports.PcacTableSortIconsEnum = PcacTableSortIconsEnum;
3691
- exports.PcacTickFormatEnum = PcacTickFormatEnum;
3692
- exports.PcacTooltipBuilder = PcacTooltipBuilder;
3693
- exports.PcacTransitionService = PcacTransitionService;
3694
- exports.PieChartBuilder = PieChartBuilder;
3695
- exports.ɵa = TableSortService;
3696
-
3697
- Object.defineProperty(exports, '__esModule', { value: true });
3698
-
3699
- }));
3700
- //# sourceMappingURL=pioneer-code-pioneer-charts.umd.js.map