barsa-echarts 0.0.2

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 (58) hide show
  1. package/README.md +25 -0
  2. package/esm2020/barsa-echarts.mjs +5 -0
  3. package/esm2020/lib/barsa-echarts.module.mjs +81 -0
  4. package/esm2020/lib/base/chart-base.directive.mjs +73 -0
  5. package/esm2020/lib/base/chart-line-time-base.directive.mjs +80 -0
  6. package/esm2020/lib/base/index.mjs +8 -0
  7. package/esm2020/lib/base/micro-chart-area-base.directive.mjs +89 -0
  8. package/esm2020/lib/base/micro-chart-bar-base.directive.mjs +48 -0
  9. package/esm2020/lib/base/micro-chart-base.directive.mjs +49 -0
  10. package/esm2020/lib/base/micro-chart-circular-base.directive.mjs +75 -0
  11. package/esm2020/lib/base/micro-chart-comparison-base.directive.mjs +99 -0
  12. package/esm2020/lib/base/micro-chart-line-base.directive.mjs +60 -0
  13. package/esm2020/lib/base/micro-chart-stackbar-base.directive.mjs +51 -0
  14. package/esm2020/lib/micro-charts/micro-chart-area/micro-chart-area.component.mjs +35 -0
  15. package/esm2020/lib/micro-charts/micro-chart-bar/micro-chart-bar.component.mjs +25 -0
  16. package/esm2020/lib/micro-charts/micro-chart-bullet/micro-chart-bullet.component.mjs +87 -0
  17. package/esm2020/lib/micro-charts/micro-chart-circular/micro-chart-circular.component.mjs +21 -0
  18. package/esm2020/lib/micro-charts/micro-chart-comparison/micro-chart-comparison.component.mjs +22 -0
  19. package/esm2020/lib/micro-charts/micro-chart-line/micro-chart-line.component.mjs +31 -0
  20. package/esm2020/lib/micro-charts/micro-chart-stackbar/micro-chart-stackbar.component.mjs +20 -0
  21. package/esm2020/lib/models/area-chart.mjs +2 -0
  22. package/esm2020/lib/models/bar-item.mjs +2 -0
  23. package/esm2020/lib/models/comparison-item.mjs +2 -0
  24. package/esm2020/lib/models/index.mjs +6 -0
  25. package/esm2020/lib/models/line-item.mjs +2 -0
  26. package/esm2020/lib/models/stackbar-item.mjs +2 -0
  27. package/esm2020/public-api.mjs +15 -0
  28. package/fesm2015/barsa-echarts.mjs +878 -0
  29. package/fesm2015/barsa-echarts.mjs.map +1 -0
  30. package/fesm2020/barsa-echarts.mjs +877 -0
  31. package/fesm2020/barsa-echarts.mjs.map +1 -0
  32. package/index.d.ts +5 -0
  33. package/lib/barsa-echarts.module.d.ts +22 -0
  34. package/lib/base/chart-base.directive.d.ts +28 -0
  35. package/lib/base/chart-line-time-base.directive.d.ts +19 -0
  36. package/lib/base/index.d.ts +7 -0
  37. package/lib/base/micro-chart-area-base.directive.d.ts +18 -0
  38. package/lib/base/micro-chart-bar-base.directive.d.ts +14 -0
  39. package/lib/base/micro-chart-base.directive.d.ts +14 -0
  40. package/lib/base/micro-chart-circular-base.directive.d.ts +13 -0
  41. package/lib/base/micro-chart-comparison-base.directive.d.ts +17 -0
  42. package/lib/base/micro-chart-line-base.directive.d.ts +15 -0
  43. package/lib/base/micro-chart-stackbar-base.directive.d.ts +14 -0
  44. package/lib/micro-charts/micro-chart-area/micro-chart-area.component.d.ts +19 -0
  45. package/lib/micro-charts/micro-chart-bar/micro-chart-bar.component.d.ts +16 -0
  46. package/lib/micro-charts/micro-chart-bullet/micro-chart-bullet.component.d.ts +35 -0
  47. package/lib/micro-charts/micro-chart-circular/micro-chart-circular.component.d.ts +10 -0
  48. package/lib/micro-charts/micro-chart-comparison/micro-chart-comparison.component.d.ts +12 -0
  49. package/lib/micro-charts/micro-chart-line/micro-chart-line.component.d.ts +18 -0
  50. package/lib/micro-charts/micro-chart-stackbar/micro-chart-stackbar.component.d.ts +11 -0
  51. package/lib/models/area-chart.d.ts +11 -0
  52. package/lib/models/bar-item.d.ts +5 -0
  53. package/lib/models/comparison-item.d.ts +9 -0
  54. package/lib/models/index.d.ts +5 -0
  55. package/lib/models/line-item.d.ts +8 -0
  56. package/lib/models/stackbar-item.d.ts +7 -0
  57. package/package.json +31 -0
  58. package/public-api.d.ts +11 -0
@@ -0,0 +1,878 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, ViewChild, Input, Directive, NgModule, NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
+ import * as i1$1 from 'barsa-novin-ray-core';
4
+ import { BaseComponent, BaseDirective, BarsaNovinRayCoreModule } from 'barsa-novin-ray-core';
5
+ import * as i1 from '@angular/common';
6
+ import { CommonModule } from '@angular/common';
7
+
8
+ class MicroChartBulletComponent extends BaseComponent {
9
+ constructor(renderer) {
10
+ super();
11
+ this.renderer = renderer;
12
+ this.suffix = '';
13
+ this.separatorLinesFakeArray = [];
14
+ }
15
+ ngOnInit() {
16
+ super.ngOnInit();
17
+ this.delta = Math.abs(this.value - this.target);
18
+ this.forecastWidth = this.getWidth(this.forecast);
19
+ this.deltaWidth = this.getWidth(this.delta);
20
+ this.valueWidth = this.getWidth(this.value);
21
+ this.targetWidth = this.getWidth(this.target, true);
22
+ this.deltaBackgroundColor = this.getBackgroundColor('delta');
23
+ this.forecastBackgroundColor = this.getBackgroundColor('forecast');
24
+ this.valueBackgroundColor = this.getBackgroundColor('value');
25
+ this.targetWithSuffix = this.getValueWithSuffix(this.target);
26
+ this.deltaWithSuffix = this.getValueWithSuffix(this.delta);
27
+ this.valueWithSuffix = this.getValueWithSuffix(this.value);
28
+ this.fakeArray();
29
+ }
30
+ ngAfterViewInit() {
31
+ super.ngAfterViewInit();
32
+ if (this.deltaDom) {
33
+ const deltaLeft = this.value >= this.target ? this.getWidth(this.target) : this.getWidth(this.target - this.delta);
34
+ this.renderer.setStyle(this.deltaDom.nativeElement, 'left', deltaLeft);
35
+ const deltaPointerDom = this.deltaDom.nativeElement.querySelector('.pointer');
36
+ const deltaPointerLeft = this.value >= this.target ? '' : '0';
37
+ this.renderer.setStyle(deltaPointerDom, 'left', deltaPointerLeft);
38
+ }
39
+ }
40
+ getWidth(value, isTarget) {
41
+ if (value) {
42
+ let width = (value / this.range) * 100;
43
+ width = isTarget ? width - 2 : width;
44
+ return width.toString() + '%';
45
+ }
46
+ else {
47
+ return '0';
48
+ }
49
+ }
50
+ getValueWithSuffix(value) {
51
+ return value.toString() + (this.suffix || '');
52
+ }
53
+ getBackgroundColor(item) {
54
+ if (item === 'forecast') {
55
+ return this.forecast >= this.target ? '#a1dbb1' : '#fda8ab';
56
+ }
57
+ else {
58
+ return this.value >= this.target ? '#3fa45b' : '#dc0d0e';
59
+ }
60
+ }
61
+ fakeArray() {
62
+ for (let i = 0; i < this.separatorLines; i++) {
63
+ this.separatorLinesFakeArray.push(i);
64
+ }
65
+ }
66
+ }
67
+ MicroChartBulletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartBulletComponent, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
68
+ MicroChartBulletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartBulletComponent, selector: "be-micro-chart-bullet", inputs: { range: "range", value: "value", forecast: "forecast", target: "target", suffix: "suffix", separatorLines: "separatorLines", isDelta: "isDelta" }, viewQueries: [{ propertyName: "deltaDom", first: true, predicate: ["deltaBox"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"chart-container\">\r\n <div class=\"range\">\r\n <div class=\"target\" *ngIf=\"target\" #target [style.left]=\"targetWidth\">\r\n <span>{{ targetWithSuffix }}</span>\r\n </div>\r\n <div\r\n class=\"forecast\"\r\n *ngIf=\"forecast\"\r\n [style.background-color]=\"forecastBackgroundColor\"\r\n [style.width]=\"forecastWidth\"\r\n ></div>\r\n\r\n <div\r\n class=\"delta\"\r\n #deltaBox\r\n *ngIf=\"isDelta && delta; else valueBox\"\r\n [style.background-color]=\"deltaBackgroundColor\"\r\n [style.width]=\"deltaWidth\"\r\n >\r\n <span [style.color]=\"valueBackgroundColor\">{{ deltaWithSuffix + '\u25B2' }}</span>\r\n <div class=\"pointer\" [style.background-color]=\"deltaBackgroundColor\"></div>\r\n </div>\r\n\r\n <ng-template #valueBox>\r\n <div class=\"value\" *ngIf=\"value\" [style.background-color]=\"valueBackgroundColor\" [style.width]=\"valueWidth\">\r\n <span [style.color]=\"valueBackgroundColor\">{{ valueWithSuffix }}</span>\r\n <div class=\"pointer\" [style.background-color]=\"valueBackgroundColor\"></div>\r\n </div>\r\n </ng-template>\r\n\r\n <!-- separator lines-->\r\n </div>\r\n <div class=\"separator-lines\" *ngIf=\"separatorLines\">\r\n <div *ngFor=\"let i of separatorLinesFakeArray\" class=\"separator-line\"></div>\r\n </div>\r\n</div>\r\n", styles: [".separator-lines,.range .value,.range .target,.range .forecast,.range{margin-bottom:auto;margin-top:auto;top:0;bottom:0}:host{display:flex;width:100%;height:100%;align-items:center}.chart-container{height:15px;width:100%;position:relative}.range{width:100%;position:absolute;background-color:#e6eee8;z-index:2}.range .forecast{position:absolute;left:0}.range .target{position:absolute;z-index:5;width:2%;height:24px;background-color:#000}.range .target span{position:absolute;bottom:-20px;right:-10px}.range .value{position:absolute;left:0;height:7px}.range .value .pointer{position:absolute;width:2px;height:20px;bottom:0}.range .value span{position:absolute;bottom:19px;right:-6px}.range .delta{position:absolute;height:15px}.range .delta .pointer{position:absolute;width:2px;height:20px;bottom:0}.range .delta span{position:absolute;bottom:19px}.separator-lines{position:absolute;display:flex;justify-content:space-between;height:20px;width:100%}.separator-lines .separator-line{background-color:#e9730c;width:2px}.separator-lines .separator-line:first-child,.separator-lines .separator-line:last-child{background-color:#c21a1a!important}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartBulletComponent, decorators: [{
70
+ type: Component,
71
+ args: [{ selector: 'be-micro-chart-bullet', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"chart-container\">\r\n <div class=\"range\">\r\n <div class=\"target\" *ngIf=\"target\" #target [style.left]=\"targetWidth\">\r\n <span>{{ targetWithSuffix }}</span>\r\n </div>\r\n <div\r\n class=\"forecast\"\r\n *ngIf=\"forecast\"\r\n [style.background-color]=\"forecastBackgroundColor\"\r\n [style.width]=\"forecastWidth\"\r\n ></div>\r\n\r\n <div\r\n class=\"delta\"\r\n #deltaBox\r\n *ngIf=\"isDelta && delta; else valueBox\"\r\n [style.background-color]=\"deltaBackgroundColor\"\r\n [style.width]=\"deltaWidth\"\r\n >\r\n <span [style.color]=\"valueBackgroundColor\">{{ deltaWithSuffix + '\u25B2' }}</span>\r\n <div class=\"pointer\" [style.background-color]=\"deltaBackgroundColor\"></div>\r\n </div>\r\n\r\n <ng-template #valueBox>\r\n <div class=\"value\" *ngIf=\"value\" [style.background-color]=\"valueBackgroundColor\" [style.width]=\"valueWidth\">\r\n <span [style.color]=\"valueBackgroundColor\">{{ valueWithSuffix }}</span>\r\n <div class=\"pointer\" [style.background-color]=\"valueBackgroundColor\"></div>\r\n </div>\r\n </ng-template>\r\n\r\n <!-- separator lines-->\r\n </div>\r\n <div class=\"separator-lines\" *ngIf=\"separatorLines\">\r\n <div *ngFor=\"let i of separatorLinesFakeArray\" class=\"separator-line\"></div>\r\n </div>\r\n</div>\r\n", styles: [".separator-lines,.range .value,.range .target,.range .forecast,.range{margin-bottom:auto;margin-top:auto;top:0;bottom:0}:host{display:flex;width:100%;height:100%;align-items:center}.chart-container{height:15px;width:100%;position:relative}.range{width:100%;position:absolute;background-color:#e6eee8;z-index:2}.range .forecast{position:absolute;left:0}.range .target{position:absolute;z-index:5;width:2%;height:24px;background-color:#000}.range .target span{position:absolute;bottom:-20px;right:-10px}.range .value{position:absolute;left:0;height:7px}.range .value .pointer{position:absolute;width:2px;height:20px;bottom:0}.range .value span{position:absolute;bottom:19px;right:-6px}.range .delta{position:absolute;height:15px}.range .delta .pointer{position:absolute;width:2px;height:20px;bottom:0}.range .delta span{position:absolute;bottom:19px}.separator-lines{position:absolute;display:flex;justify-content:space-between;height:20px;width:100%}.separator-lines .separator-line{background-color:#e9730c;width:2px}.separator-lines .separator-line:first-child,.separator-lines .separator-line:last-child{background-color:#c21a1a!important}\n"] }]
72
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }]; }, propDecorators: { deltaDom: [{
73
+ type: ViewChild,
74
+ args: ['deltaBox']
75
+ }], range: [{
76
+ type: Input
77
+ }], value: [{
78
+ type: Input
79
+ }], forecast: [{
80
+ type: Input
81
+ }], target: [{
82
+ type: Input
83
+ }], suffix: [{
84
+ type: Input
85
+ }], separatorLines: [{
86
+ type: Input
87
+ }], isDelta: [{
88
+ type: Input
89
+ }] } });
90
+
91
+ class ChartBaseDirective extends BaseDirective {
92
+ constructor(el, renderer2) {
93
+ super();
94
+ this.el = el;
95
+ this.renderer2 = renderer2;
96
+ this.tooltip = {
97
+ trigger: 'item',
98
+ responsive: true,
99
+ position: 'top',
100
+ formatter: '{c}',
101
+ backgroundColor: '#fafcfe',
102
+ borderColor: '#c8e2f7',
103
+ borderWidth: '0.8',
104
+ textStyle: {
105
+ color: '#5d6f80'
106
+ }
107
+ };
108
+ this.grid = {
109
+ top: 0,
110
+ bottom: 0,
111
+ left: 0,
112
+ right: 0
113
+ };
114
+ this.xAxis = {
115
+ data: [],
116
+ type: 'value'
117
+ };
118
+ this.yAxis = {
119
+ data: [],
120
+ type: 'category'
121
+ };
122
+ this.series = [];
123
+ }
124
+ ngOnInit() {
125
+ // set some style to chart
126
+ super.ngOnInit();
127
+ const elDom = this.el.nativeElement;
128
+ this.renderer2.setStyle(elDom, 'width', '100%');
129
+ this.renderer2.setStyle(elDom, 'height', '100%');
130
+ this.renderer2.setStyle(elDom, 'display', 'block');
131
+ // initialize echart micro-charts
132
+ this._initializeOptions();
133
+ }
134
+ ngAfterViewInit() {
135
+ this.setOptions(this.options);
136
+ setTimeout(() => {
137
+ const elDom = this.el.nativeElement;
138
+ this.chart = echarts.init(elDom);
139
+ this._renderChart();
140
+ }, 300);
141
+ }
142
+ _renderChart() {
143
+ this.chart.setOption(this.options);
144
+ }
145
+ _initializeOptions() {
146
+ this.options = {
147
+ grid: this.grid,
148
+ xAxis: this.xAxis,
149
+ yAxis: this.yAxis,
150
+ series: this.series,
151
+ tooltip: this.tooltip
152
+ };
153
+ }
154
+ }
155
+ ChartBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ChartBaseDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
156
+ ChartBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: ChartBaseDirective, usesInheritance: true, ngImport: i0 });
157
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ChartBaseDirective, decorators: [{
158
+ type: Directive
159
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; } });
160
+
161
+ class MicroChartBaseDirective extends ChartBaseDirective {
162
+ constructor(el, renderer2) {
163
+ super(el, renderer2);
164
+ this.el = el;
165
+ this.renderer2 = renderer2;
166
+ this.xAxis = {
167
+ data: [],
168
+ type: 'value',
169
+ axisLine: {
170
+ show: false
171
+ },
172
+ axisLabel: {
173
+ show: false
174
+ },
175
+ splitLine: {
176
+ show: false
177
+ },
178
+ axisTick: {
179
+ show: false
180
+ },
181
+ max: 100
182
+ };
183
+ this.yAxis = {
184
+ data: [],
185
+ type: 'category',
186
+ axisLabel: {
187
+ show: false
188
+ },
189
+ axisLine: {
190
+ show: false
191
+ },
192
+ splitLine: {
193
+ show: false
194
+ },
195
+ axisTick: {
196
+ show: false
197
+ }
198
+ };
199
+ }
200
+ }
201
+ MicroChartBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartBaseDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
202
+ MicroChartBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartBaseDirective, usesInheritance: true, ngImport: i0 });
203
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartBaseDirective, decorators: [{
204
+ type: Directive
205
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; } });
206
+
207
+ class MicroChartLineBaseDirective extends MicroChartBaseDirective {
208
+ constructor(el, renderer2) {
209
+ super(el, renderer2);
210
+ this.el = el;
211
+ this.renderer2 = renderer2;
212
+ }
213
+ setOptions(options) {
214
+ this._scaleDownLineData();
215
+ // initialize series
216
+ this._initSeries(options);
217
+ // set input data
218
+ this.line.data.forEach((item) => {
219
+ var _a, _b;
220
+ (_b = (_a = this.xAxis) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.push(item.label);
221
+ const dataObj = {
222
+ value: item.value,
223
+ symbol: 'none'
224
+ };
225
+ options.series[0].data.push(dataObj);
226
+ });
227
+ this.xAxis.max = undefined;
228
+ this.xAxis.type = 'category';
229
+ // set custom yAxis
230
+ this.yAxis.min = 0;
231
+ this.yAxis.max = 6;
232
+ this.yAxis.type = 'value';
233
+ }
234
+ /* eslint-disable */
235
+ _scaleDownLineData() {
236
+ const maxValue = Math.max.apply(Math, this.line.data.map((dataItem) => dataItem.value));
237
+ return this.line.data.forEach((dataItem) => {
238
+ dataItem.value *= 6 / maxValue;
239
+ });
240
+ }
241
+ _initSeries(options) {
242
+ var _a;
243
+ options.series = [
244
+ {
245
+ type: 'line',
246
+ color: (_a = this.line) === null || _a === void 0 ? void 0 : _a.color,
247
+ data: [],
248
+ label: {
249
+ show: false
250
+ }
251
+ }
252
+ ];
253
+ }
254
+ }
255
+ MicroChartLineBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartLineBaseDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
256
+ MicroChartLineBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartLineBaseDirective, selector: "[beMicroChartLine]", inputs: { line: "line" }, usesInheritance: true, ngImport: i0 });
257
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartLineBaseDirective, decorators: [{
258
+ type: Directive,
259
+ args: [{
260
+ selector: '[beMicroChartLine]'
261
+ }]
262
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { line: [{
263
+ type: Input
264
+ }] } });
265
+
266
+ class MicroChartLineComponent extends BaseComponent {
267
+ constructor(el) {
268
+ super();
269
+ this.el = el;
270
+ }
271
+ ngOnInit() {
272
+ super.ngOnInit();
273
+ this.getFirstAndLastValues();
274
+ }
275
+ getFirstAndLastValues() {
276
+ const dataLength = this.line.data.length;
277
+ this.firstValue = this.line.data[0].value.toString();
278
+ this.lastValue = this.line.data[dataLength - 1].value.toString();
279
+ this.firstLabel = this.line.data[0].label;
280
+ this.lastLabel = this.line.data[dataLength - 1].label;
281
+ }
282
+ }
283
+ MicroChartLineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartLineComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
284
+ MicroChartLineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartLineComponent, selector: "be-micro-chart-line", inputs: { line: "line" }, usesInheritance: true, ngImport: i0, template: "<div class=\"top-labels\">\r\n <span>{{ lastValue }}{{ line?.suffix }}</span>\r\n <span>{{ firstValue }}{{ line?.suffix }}</span>\r\n</div>\r\n\r\n<div class=\"chart\">\r\n <div *untilInView=\"el\" beMicroChartLine [line]=\"line\"></div>\r\n</div>\r\n\r\n<div class=\"bottom-labels\">\r\n <span>{{ lastLabel }}</span>\r\n <span>{{ firstLabel }}</span>\r\n</div>\r\n", styles: [":host{display:block;width:100%;height:100%}.chart{width:100%;height:52%}span{margin:0;font-size:10px}.top-labels{width:100%;height:23%;display:flex;justify-content:space-between}.bottom-labels{width:100%;height:25%;display:flex;justify-content:space-between}\n"], dependencies: [{ kind: "directive", type: i1$1.UntilInViewDirective, selector: "[untilInView]", inputs: ["untilInView", "intersectionDebounce"] }, { kind: "directive", type: MicroChartLineBaseDirective, selector: "[beMicroChartLine]", inputs: ["line"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
285
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartLineComponent, decorators: [{
286
+ type: Component,
287
+ args: [{ selector: 'be-micro-chart-line', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"top-labels\">\r\n <span>{{ lastValue }}{{ line?.suffix }}</span>\r\n <span>{{ firstValue }}{{ line?.suffix }}</span>\r\n</div>\r\n\r\n<div class=\"chart\">\r\n <div *untilInView=\"el\" beMicroChartLine [line]=\"line\"></div>\r\n</div>\r\n\r\n<div class=\"bottom-labels\">\r\n <span>{{ lastLabel }}</span>\r\n <span>{{ firstLabel }}</span>\r\n</div>\r\n", styles: [":host{display:block;width:100%;height:100%}.chart{width:100%;height:52%}span{margin:0;font-size:10px}.top-labels{width:100%;height:23%;display:flex;justify-content:space-between}.bottom-labels{width:100%;height:25%;display:flex;justify-content:space-between}\n"] }]
288
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { line: [{
289
+ type: Input
290
+ }] } });
291
+
292
+ class MicroChartStackbarBaseDirective extends MicroChartBaseDirective {
293
+ constructor(el, renderer2) {
294
+ super(el, renderer2);
295
+ this.el = el;
296
+ this.renderer2 = renderer2;
297
+ }
298
+ setOptions(options) {
299
+ this.chartData.data.forEach((dataItem) => {
300
+ const dataConfig = this.creatData(dataItem);
301
+ options.series.push(dataConfig);
302
+ });
303
+ }
304
+ creatData(dataItem) {
305
+ return {
306
+ name: 'Direct',
307
+ barWidth: 15,
308
+ type: 'bar',
309
+ stack: 'total',
310
+ emphasis: {
311
+ focus: 'series'
312
+ },
313
+ data: [
314
+ {
315
+ value: dataItem.value,
316
+ itemStyle: {
317
+ color: dataItem.color
318
+ }
319
+ }
320
+ ],
321
+ label: {
322
+ show: true,
323
+ formatter: (d) => d.data.value.toString() + this.chartData.suffix,
324
+ fontSize: 10
325
+ }
326
+ };
327
+ }
328
+ }
329
+ MicroChartStackbarBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartStackbarBaseDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
330
+ MicroChartStackbarBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartStackbarBaseDirective, selector: "[beMicroChartStackbar]", inputs: { chartData: "chartData" }, usesInheritance: true, ngImport: i0 });
331
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartStackbarBaseDirective, decorators: [{
332
+ type: Directive,
333
+ args: [{
334
+ selector: '[beMicroChartStackbar]'
335
+ }]
336
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { chartData: [{
337
+ type: Input
338
+ }] } });
339
+
340
+ class MicroChartStackbarComponent extends BaseComponent {
341
+ constructor(el) {
342
+ super();
343
+ this.el = el;
344
+ }
345
+ }
346
+ MicroChartStackbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartStackbarComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
347
+ MicroChartStackbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartStackbarComponent, selector: "be-micro-chart-stackbar", inputs: { data: "data" }, usesInheritance: true, ngImport: i0, template: "<div *untilInView=\"el\" beMicroChartStackbar class=\"chart\" [chartData]=\"data\"></div>\r\n", styles: [":host{display:block;width:100%;height:100%}.chart{width:100%}\n"], dependencies: [{ kind: "directive", type: i1$1.UntilInViewDirective, selector: "[untilInView]", inputs: ["untilInView", "intersectionDebounce"] }, { kind: "directive", type: MicroChartStackbarBaseDirective, selector: "[beMicroChartStackbar]", inputs: ["chartData"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
348
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartStackbarComponent, decorators: [{
349
+ type: Component,
350
+ args: [{ selector: 'be-micro-chart-stackbar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *untilInView=\"el\" beMicroChartStackbar class=\"chart\" [chartData]=\"data\"></div>\r\n", styles: [":host{display:block;width:100%;height:100%}.chart{width:100%}\n"] }]
351
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { data: [{
352
+ type: Input
353
+ }] } });
354
+
355
+ class MicroChartCircularBaseDirective extends MicroChartBaseDirective {
356
+ constructor(el, renderer2) {
357
+ super(el, renderer2);
358
+ this.el = el;
359
+ this.renderer2 = renderer2;
360
+ }
361
+ setOptions(options) {
362
+ // remove extra data from circular chart
363
+ this._initSeries(options);
364
+ // add data to series
365
+ options.series[0].data.push({ value: this.data });
366
+ }
367
+ _initSeries(options) {
368
+ options.series = [
369
+ {
370
+ type: 'gauge',
371
+ progress: {
372
+ show: true,
373
+ width: 5
374
+ },
375
+ axisLine: {
376
+ lineStyle: {
377
+ width: 5
378
+ }
379
+ },
380
+ axisTick: {
381
+ show: false
382
+ },
383
+ splitLine: {
384
+ show: false,
385
+ length: 15,
386
+ lineStyle: {
387
+ width: 2,
388
+ color: '#999'
389
+ }
390
+ },
391
+ axisLabel: {
392
+ distance: 30,
393
+ color: '#999',
394
+ fontSize: 10,
395
+ show: false
396
+ },
397
+ anchor: {
398
+ show: true,
399
+ showAbove: true,
400
+ size: 15,
401
+ itemStyle: {
402
+ borderWidth: 1
403
+ }
404
+ },
405
+ title: {
406
+ show: false
407
+ },
408
+ detail: {
409
+ valueAnimation: true,
410
+ fontSize: 12,
411
+ offsetCenter: [0, '70%']
412
+ },
413
+ data: []
414
+ }
415
+ ];
416
+ }
417
+ }
418
+ MicroChartCircularBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartCircularBaseDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
419
+ MicroChartCircularBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartCircularBaseDirective, selector: "[beMicroChartCircular]", inputs: { data: "data" }, usesInheritance: true, ngImport: i0 });
420
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartCircularBaseDirective, decorators: [{
421
+ type: Directive,
422
+ args: [{ selector: '[beMicroChartCircular]' }]
423
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { data: [{
424
+ type: Input
425
+ }] } });
426
+
427
+ class MicroChartCircularComponent extends BaseComponent {
428
+ constructor(el) {
429
+ super();
430
+ this.el = el;
431
+ this.data = 50;
432
+ }
433
+ }
434
+ MicroChartCircularComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartCircularComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
435
+ MicroChartCircularComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartCircularComponent, selector: "be-micro-chart-circular", inputs: { data: "data" }, usesInheritance: true, ngImport: i0, template: "<div *untilInView=\"el\" beMicroChartCircular [data]=\"data\"></div>\r\n", styles: [":host{display:block;width:100%;height:100%}\n"], dependencies: [{ kind: "directive", type: i1$1.UntilInViewDirective, selector: "[untilInView]", inputs: ["untilInView", "intersectionDebounce"] }, { kind: "directive", type: MicroChartCircularBaseDirective, selector: "[beMicroChartCircular]", inputs: ["data"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
436
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartCircularComponent, decorators: [{
437
+ type: Component,
438
+ args: [{ selector: 'be-micro-chart-circular', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *untilInView=\"el\" beMicroChartCircular [data]=\"data\"></div>\r\n", styles: [":host{display:block;width:100%;height:100%}\n"] }]
439
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { data: [{
440
+ type: Input
441
+ }] } });
442
+
443
+ class MicroChartComparisonBaseDirective extends MicroChartBaseDirective {
444
+ constructor(el, renderer2) {
445
+ super(el, renderer2);
446
+ this.el = el;
447
+ this.renderer2 = renderer2;
448
+ }
449
+ setOptions(options) {
450
+ // initialize series
451
+ this._initValues(options);
452
+ // set custom xAxis
453
+ this.xAxis.type = 'value';
454
+ this.xAxis.boundaryGap = ['0%', '50%'];
455
+ // set custom yAxis
456
+ this.yAxis.type = 'category';
457
+ this.yAxis.offset = 6;
458
+ this.yAxis.axisLabel = {
459
+ show: true,
460
+ inside: true,
461
+ lineHeight: 16
462
+ };
463
+ // set custom grid
464
+ this.grid.top = 10;
465
+ const textStyle = {
466
+ verticalAlign: 'bottom',
467
+ fontSize: 12,
468
+ fontWeight: 'bold'
469
+ };
470
+ this.chartData.data.forEach((item) => {
471
+ var _a, _b;
472
+ const seriesData = {
473
+ value: item.value,
474
+ itemStyle: {
475
+ color: item.color
476
+ },
477
+ label: {
478
+ position: ['100', '0%']
479
+ }
480
+ };
481
+ options.series[0].data.push(seriesData);
482
+ const yAxisData = { value: item.label, textStyle };
483
+ (_b = (_a = this.yAxis) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.push(yAxisData);
484
+ });
485
+ // if we have double tile
486
+ if (this.size === 'l') {
487
+ this.grid.left = 50;
488
+ this.yAxis.axisLabel.inside = false;
489
+ this.yAxis.axisLabel.lineHeight = undefined;
490
+ options.series[0].label.position = 'right';
491
+ this.yAxis.offset = -2;
492
+ options.series[0].showBackground = false;
493
+ this.xAxis.max = 112;
494
+ options.series[0].data.map((dataItem) => {
495
+ delete dataItem.label.offset;
496
+ dataItem.label.position = ['100%', '0%'];
497
+ });
498
+ }
499
+ options.series[0].label.formatter = (d) => d.data.value + this.chartData.suffix;
500
+ }
501
+ _initValues(options) {
502
+ var _a;
503
+ options.series = [
504
+ {
505
+ showBackground: true,
506
+ barWidth: (_a = this.chartData.barWidth) !== null && _a !== void 0 ? _a : 3,
507
+ type: 'bar',
508
+ data: [],
509
+ label: {
510
+ show: true,
511
+ position: 'top',
512
+ distance: 0,
513
+ valueAnimation: true,
514
+ fontFamily: 'monospace',
515
+ formatter: (d) => d.data.value + '%',
516
+ lineHeight: -10
517
+ }
518
+ }
519
+ ];
520
+ options.plotOptions = {
521
+ bar: {
522
+ horizontal: true,
523
+ distributed: true
524
+ }
525
+ };
526
+ }
527
+ }
528
+ MicroChartComparisonBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartComparisonBaseDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
529
+ MicroChartComparisonBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartComparisonBaseDirective, selector: "[beMicroChartComparison]", inputs: { size: "size", chartData: "chartData" }, usesInheritance: true, ngImport: i0 });
530
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartComparisonBaseDirective, decorators: [{
531
+ type: Directive,
532
+ args: [{
533
+ selector: '[beMicroChartComparison]'
534
+ }]
535
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { size: [{
536
+ type: Input
537
+ }], chartData: [{
538
+ type: Input
539
+ }] } });
540
+
541
+ class MicroChartComparisonComponent extends BaseComponent {
542
+ constructor(el) {
543
+ super();
544
+ this.el = el;
545
+ }
546
+ }
547
+ MicroChartComparisonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartComparisonComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
548
+ MicroChartComparisonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartComparisonComponent, selector: "be-micro-chart-comparison", inputs: { data: "data", size: "size" }, usesInheritance: true, ngImport: i0, template: "<div *untilInView=\"el\" beMicroChartComparison [chartData]=\"data\" [size]=\"size\"></div>\r\n", styles: [":host{display:block;width:100%;height:100%}\n"], dependencies: [{ kind: "directive", type: i1$1.UntilInViewDirective, selector: "[untilInView]", inputs: ["untilInView", "intersectionDebounce"] }, { kind: "directive", type: MicroChartComparisonBaseDirective, selector: "[beMicroChartComparison]", inputs: ["size", "chartData"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
549
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartComparisonComponent, decorators: [{
550
+ type: Component,
551
+ args: [{ selector: 'be-micro-chart-comparison', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *untilInView=\"el\" beMicroChartComparison [chartData]=\"data\" [size]=\"size\"></div>\r\n", styles: [":host{display:block;width:100%;height:100%}\n"] }]
552
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { data: [{
553
+ type: Input
554
+ }], size: [{
555
+ type: Input
556
+ }] } });
557
+
558
+ class MicroChartAreaBaseDirective extends MicroChartBaseDirective {
559
+ constructor(el, renderer2) {
560
+ super(el, renderer2);
561
+ this.el = el;
562
+ this.renderer2 = renderer2;
563
+ this.areas = [];
564
+ }
565
+ /* eslint-disable */
566
+ setOptions(options) {
567
+ this._scaleDownLineData();
568
+ // set custom xAxis
569
+ this.xAxis.type = 'category';
570
+ this.line.data.forEach((item) => {
571
+ var _a, _b;
572
+ (_b = (_a = this.xAxis) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.push(item.label);
573
+ });
574
+ this.xAxis.max = undefined;
575
+ this.xAxis.boundaryGap = false;
576
+ // set custom yAxis
577
+ this.yAxis.splitLine = { show: false };
578
+ this.yAxis.type = 'value';
579
+ this.yAxis.splitNumber = 3;
580
+ this.yAxis.min = 0;
581
+ this.yAxis.max = 6;
582
+ // handel area
583
+ this.areas.forEach((area) => {
584
+ const line = this._createItem(area.color, area.data.map((c) => ({
585
+ value: c,
586
+ symbol: 'none'
587
+ })));
588
+ this.series.push(line);
589
+ });
590
+ // handel line
591
+ const seriesItem = this._createSeriesItem(this.line.data.map((item) => ({
592
+ value: item.value,
593
+ symbol: 'none'
594
+ })));
595
+ this.series.push(seriesItem);
596
+ }
597
+ _scaleDownLineData() {
598
+ const maxValue = Math.max.apply(Math, this.line.data.map((dataItem) => dataItem.value));
599
+ return this.line.data.forEach((dataItem) => {
600
+ dataItem.value *= 6 / maxValue;
601
+ });
602
+ }
603
+ _createSeriesItem(data) {
604
+ var _a;
605
+ return {
606
+ type: 'line',
607
+ data,
608
+ lineStyle: { width: 1 },
609
+ color: ((_a = this.line) === null || _a === void 0 ? void 0 : _a.color) || 'black',
610
+ label: {
611
+ show: false
612
+ }
613
+ };
614
+ }
615
+ _createItem(color = '', data, name = 'none', stack = 'none') {
616
+ return {
617
+ name,
618
+ type: 'line',
619
+ stack,
620
+ areaStyle: {
621
+ color
622
+ },
623
+ itemStyle: {
624
+ color
625
+ },
626
+ emphasis: {
627
+ focus: 'series'
628
+ },
629
+ data
630
+ };
631
+ }
632
+ }
633
+ MicroChartAreaBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartAreaBaseDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
634
+ MicroChartAreaBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartAreaBaseDirective, selector: "[beMicroChartArea]", inputs: { areas: "areas", line: "line" }, usesInheritance: true, ngImport: i0 });
635
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartAreaBaseDirective, decorators: [{
636
+ type: Directive,
637
+ args: [{
638
+ selector: '[beMicroChartArea]'
639
+ }]
640
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { areas: [{
641
+ type: Input
642
+ }], line: [{
643
+ type: Input
644
+ }] } });
645
+
646
+ class MicroChartAreaComponent extends BaseComponent {
647
+ constructor(el) {
648
+ super();
649
+ this.el = el;
650
+ }
651
+ ngOnInit() {
652
+ var _a, _b;
653
+ super.ngOnInit();
654
+ this.suffix = (_b = (_a = this.chartData) === null || _a === void 0 ? void 0 : _a.line) === null || _b === void 0 ? void 0 : _b.suffix;
655
+ this.getFirstAndLastValues();
656
+ }
657
+ getFirstAndLastValues() {
658
+ const dataLength = this.chartData.line.data.length;
659
+ this.firstValue = this.chartData.line.data[0].value.toString();
660
+ this.lastValue = this.chartData.line.data[dataLength - 1].value.toString();
661
+ this.firstLabel = this.chartData.line.data[0].label;
662
+ this.lastLabel = this.chartData.line.data[dataLength - 1].label;
663
+ }
664
+ }
665
+ MicroChartAreaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartAreaComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
666
+ MicroChartAreaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartAreaComponent, selector: "be-micro-chart-area", inputs: { size: "size", chartData: "chartData" }, usesInheritance: true, ngImport: i0, template: "<div class=\"right-labels\" *ngIf=\"size === 'l'\">\r\n <span [style.color]=\"chartData.lastValueColor\">{{ lastValue }}{{ chartData?.line?.suffix }}</span>\r\n <span [style.color]=\"chartData.lastValueColor\">{{ lastLabel }}</span>\r\n</div>\r\n\r\n<div class=\"top-labels\" *ngIf=\"size === 's'\">\r\n <span [style.color]=\"chartData.lastValueColor\">{{ lastValue }}{{ suffix }}</span>\r\n <span [style.color]=\"chartData.firstValueColor\">{{ firstValue }}{{ suffix }}</span>\r\n</div>\r\n\r\n<div *untilInView=\"el\" beMicroChartArea [areas]=\"chartData.areas\" [line]=\"chartData.line\"></div>\r\n\r\n<div class=\"left-labels\" *ngIf=\"size === 'l'\">\r\n <span [style.color]=\"chartData.firstValueColor\">{{ firstValue }}{{ suffix }}</span>\r\n <span [style.color]=\"chartData.firstValueColor\">{{ firstLabel }}</span>\r\n</div>\r\n<div class=\"bottom-labels\" *ngIf=\"size === 's'\">\r\n <span [style.color]=\"chartData.lastValueColor\">{{ lastLabel }}</span>\r\n <span [style.color]=\"chartData.firstValueColor\">{{ firstLabel }}</span>\r\n</div>\r\n", styles: [":host{display:block;width:100%;height:100%}span{margin:0;font-size:10px}.top-labels{width:100%;height:23%;display:flex;justify-content:space-between}.bottom-labels{width:100%;height:25%;display:flex;justify-content:space-between}.right-labels{min-width:40px;display:flex;flex-direction:column;justify-content:space-between;text-align:right}.left-labels{min-width:40px;display:flex;flex-direction:column;justify-content:space-between;text-align:left}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.UntilInViewDirective, selector: "[untilInView]", inputs: ["untilInView", "intersectionDebounce"] }, { kind: "directive", type: MicroChartAreaBaseDirective, selector: "[beMicroChartArea]", inputs: ["areas", "line"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
667
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartAreaComponent, decorators: [{
668
+ type: Component,
669
+ args: [{ selector: 'be-micro-chart-area', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"right-labels\" *ngIf=\"size === 'l'\">\r\n <span [style.color]=\"chartData.lastValueColor\">{{ lastValue }}{{ chartData?.line?.suffix }}</span>\r\n <span [style.color]=\"chartData.lastValueColor\">{{ lastLabel }}</span>\r\n</div>\r\n\r\n<div class=\"top-labels\" *ngIf=\"size === 's'\">\r\n <span [style.color]=\"chartData.lastValueColor\">{{ lastValue }}{{ suffix }}</span>\r\n <span [style.color]=\"chartData.firstValueColor\">{{ firstValue }}{{ suffix }}</span>\r\n</div>\r\n\r\n<div *untilInView=\"el\" beMicroChartArea [areas]=\"chartData.areas\" [line]=\"chartData.line\"></div>\r\n\r\n<div class=\"left-labels\" *ngIf=\"size === 'l'\">\r\n <span [style.color]=\"chartData.firstValueColor\">{{ firstValue }}{{ suffix }}</span>\r\n <span [style.color]=\"chartData.firstValueColor\">{{ firstLabel }}</span>\r\n</div>\r\n<div class=\"bottom-labels\" *ngIf=\"size === 's'\">\r\n <span [style.color]=\"chartData.lastValueColor\">{{ lastLabel }}</span>\r\n <span [style.color]=\"chartData.firstValueColor\">{{ firstLabel }}</span>\r\n</div>\r\n", styles: [":host{display:block;width:100%;height:100%}span{margin:0;font-size:10px}.top-labels{width:100%;height:23%;display:flex;justify-content:space-between}.bottom-labels{width:100%;height:25%;display:flex;justify-content:space-between}.right-labels{min-width:40px;display:flex;flex-direction:column;justify-content:space-between;text-align:right}.left-labels{min-width:40px;display:flex;flex-direction:column;justify-content:space-between;text-align:left}\n"] }]
670
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { size: [{
671
+ type: Input
672
+ }], chartData: [{
673
+ type: Input
674
+ }] } });
675
+
676
+ class MicroChartBarBaseDirective extends MicroChartBaseDirective {
677
+ constructor(el, renderer2) {
678
+ super(el, renderer2);
679
+ this.el = el;
680
+ this.renderer2 = renderer2;
681
+ }
682
+ setOptions(options) {
683
+ // initialize series
684
+ this._initSeries(options);
685
+ // set custom grid
686
+ this.grid.bottom = 20;
687
+ // set custom xAxis
688
+ this.xAxis.type = 'category';
689
+ this.xAxis.max = undefined;
690
+ if (this.xAxis.axisLabel) {
691
+ this.xAxis.axisLabel.show = true;
692
+ }
693
+ this.data.forEach((dataItem) => {
694
+ var _a, _b;
695
+ (_b = (_a = this === null || this === void 0 ? void 0 : this.xAxis) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.push(dataItem.label);
696
+ const dataSeriesItem = { value: dataItem.value, itemStyle: { color: dataItem.color } };
697
+ options.series[0].data.push(dataSeriesItem);
698
+ });
699
+ // set custom yAxis
700
+ this.yAxis.type = 'value';
701
+ }
702
+ _initSeries(options) {
703
+ options.series = [
704
+ {
705
+ type: 'bar',
706
+ data: []
707
+ }
708
+ ];
709
+ }
710
+ }
711
+ MicroChartBarBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartBarBaseDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
712
+ MicroChartBarBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartBarBaseDirective, selector: "[beMicroChartBar]", inputs: { data: "data" }, usesInheritance: true, ngImport: i0 });
713
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartBarBaseDirective, decorators: [{
714
+ type: Directive,
715
+ args: [{
716
+ selector: '[beMicroChartBar]'
717
+ }]
718
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { data: [{
719
+ type: Input
720
+ }] } });
721
+
722
+ class MicroChartBarComponent extends BaseComponent {
723
+ constructor(el) {
724
+ super();
725
+ this.el = el;
726
+ }
727
+ }
728
+ MicroChartBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartBarComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
729
+ MicroChartBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartBarComponent, selector: "be-micro-chart-bar", inputs: { data: "data", size: "size", extraData: "extraData" }, usesInheritance: true, ngImport: i0, template: "<div *untilInView=\"el\" beMicroChartBar [ngClass]=\"size === 'l' ? 'flex-50' : 'flex-100'\" [data]=\"data\"></div>\r\n<div class=\"chart-desc\" *ngIf=\"size === 'l'\">\r\n <h2>{{ extraData.value }}{{ extraData.suffix }}</h2>\r\n</div>\r\n", styles: [":host{display:flex;width:100%;height:100%}.flex-50,.flex-100{flex:50%}.chart-desc{flex:50%;display:flex;align-items:flex-end;justify-content:flex-end}.chart-desc h2{margin:0}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.UntilInViewDirective, selector: "[untilInView]", inputs: ["untilInView", "intersectionDebounce"] }, { kind: "directive", type: MicroChartBarBaseDirective, selector: "[beMicroChartBar]", inputs: ["data"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
730
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartBarComponent, decorators: [{
731
+ type: Component,
732
+ args: [{ selector: 'be-micro-chart-bar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *untilInView=\"el\" beMicroChartBar [ngClass]=\"size === 'l' ? 'flex-50' : 'flex-100'\" [data]=\"data\"></div>\r\n<div class=\"chart-desc\" *ngIf=\"size === 'l'\">\r\n <h2>{{ extraData.value }}{{ extraData.suffix }}</h2>\r\n</div>\r\n", styles: [":host{display:flex;width:100%;height:100%}.flex-50,.flex-100{flex:50%}.chart-desc{flex:50%;display:flex;align-items:flex-end;justify-content:flex-end}.chart-desc h2{margin:0}\n"] }]
733
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { data: [{
734
+ type: Input
735
+ }], size: [{
736
+ type: Input
737
+ }], extraData: [{
738
+ type: Input
739
+ }] } });
740
+
741
+ class ChartLineTimeBaseDirective extends ChartBaseDirective {
742
+ constructor(groupbyPipe, el, renderer2) {
743
+ super(el, renderer2);
744
+ this.groupbyPipe = groupbyPipe;
745
+ this.el = el;
746
+ this.renderer2 = renderer2;
747
+ this.xAxis = [];
748
+ this.yAxis = [];
749
+ }
750
+ ngOnChanges(changes) {
751
+ super.ngOnChanges(changes);
752
+ const { chartOption } = changes;
753
+ if (chartOption) {
754
+ let options = chartOption.currentValue;
755
+ options = Object.assign(Object.assign({}, options), { toolbox: {
756
+ feature: {
757
+ dataZoom: {
758
+ yAxisIndex: 'none'
759
+ },
760
+ restore: {},
761
+ saveAsImage: {}
762
+ }
763
+ } });
764
+ this._setTooltipFormatter(options, 'series', 'tooltip');
765
+ this._setTooltipFormatter(options, 'xAxis', 'axisLabel');
766
+ this._setTooltipFormatter(options, 'yAxis', 'tooltip');
767
+ if (!chartOption.firstChange) {
768
+ this._renderChart();
769
+ }
770
+ }
771
+ }
772
+ setOptions(options) {
773
+ this.options = Object.assign(Object.assign(Object.assign({}, options), this.chartOption), { toolbox: {
774
+ feature: {
775
+ dataZoom: {
776
+ yAxisIndex: 'none'
777
+ },
778
+ restore: {},
779
+ saveAsImage: {}
780
+ }
781
+ } });
782
+ // set input data
783
+ }
784
+ _setTooltipFormatter(options, prop, prop2) {
785
+ const arr = options[prop];
786
+ if (Array.isArray(arr)) {
787
+ arr.forEach((c) => {
788
+ const obj2 = c[prop2];
789
+ if (obj2 &&
790
+ obj2.formatter &&
791
+ (obj2.formatter.indexOf('=>') > -1 || obj2.formatter.indexOf('function') > -1)) {
792
+ // eslint-disable-next-line no-eval
793
+ obj2.formatter = eval(obj2.formatter);
794
+ }
795
+ });
796
+ }
797
+ }
798
+ }
799
+ ChartLineTimeBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ChartLineTimeBaseDirective, deps: [{ token: i1$1.GroupByPipe }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
800
+ ChartLineTimeBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: ChartLineTimeBaseDirective, selector: "[beChartLineTime]", inputs: { chartOption: "chartOption" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
801
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ChartLineTimeBaseDirective, decorators: [{
802
+ type: Directive,
803
+ args: [{
804
+ selector: '[beChartLineTime]'
805
+ }]
806
+ }], ctorParameters: function () { return [{ type: i1$1.GroupByPipe }, { type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { chartOption: [{
807
+ type: Input
808
+ }] } });
809
+
810
+ const components = [
811
+ MicroChartComparisonComponent,
812
+ MicroChartAreaComponent,
813
+ MicroChartBarComponent,
814
+ MicroChartAreaComponent,
815
+ MicroChartStackbarComponent,
816
+ MicroChartCircularComponent,
817
+ MicroChartLineComponent,
818
+ MicroChartAreaBaseDirective,
819
+ MicroChartLineBaseDirective,
820
+ MicroChartStackbarBaseDirective,
821
+ MicroChartComparisonBaseDirective,
822
+ MicroChartCircularComponent,
823
+ MicroChartBarBaseDirective,
824
+ MicroChartCircularBaseDirective,
825
+ MicroChartBulletComponent,
826
+ ChartLineTimeBaseDirective
827
+ ];
828
+ class BarsaEchartsModule {
829
+ }
830
+ BarsaEchartsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: BarsaEchartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
831
+ BarsaEchartsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.7", ngImport: i0, type: BarsaEchartsModule, declarations: [MicroChartComparisonComponent,
832
+ MicroChartAreaComponent,
833
+ MicroChartBarComponent,
834
+ MicroChartAreaComponent,
835
+ MicroChartStackbarComponent,
836
+ MicroChartCircularComponent,
837
+ MicroChartLineComponent,
838
+ MicroChartAreaBaseDirective,
839
+ MicroChartLineBaseDirective,
840
+ MicroChartStackbarBaseDirective,
841
+ MicroChartComparisonBaseDirective,
842
+ MicroChartCircularComponent,
843
+ MicroChartBarBaseDirective,
844
+ MicroChartCircularBaseDirective,
845
+ MicroChartBulletComponent,
846
+ ChartLineTimeBaseDirective], imports: [CommonModule, BarsaNovinRayCoreModule], exports: [MicroChartComparisonComponent,
847
+ MicroChartAreaComponent,
848
+ MicroChartBarComponent,
849
+ MicroChartAreaComponent,
850
+ MicroChartStackbarComponent,
851
+ MicroChartCircularComponent,
852
+ MicroChartLineComponent,
853
+ MicroChartAreaBaseDirective,
854
+ MicroChartLineBaseDirective,
855
+ MicroChartStackbarBaseDirective,
856
+ MicroChartComparisonBaseDirective,
857
+ MicroChartCircularComponent,
858
+ MicroChartBarBaseDirective,
859
+ MicroChartCircularBaseDirective,
860
+ MicroChartBulletComponent,
861
+ ChartLineTimeBaseDirective] });
862
+ BarsaEchartsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: BarsaEchartsModule, imports: [CommonModule, BarsaNovinRayCoreModule] });
863
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: BarsaEchartsModule, decorators: [{
864
+ type: NgModule,
865
+ args: [{
866
+ schemas: [NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA],
867
+ imports: [CommonModule, BarsaNovinRayCoreModule],
868
+ declarations: [...components],
869
+ exports: [...components]
870
+ }]
871
+ }] });
872
+
873
+ /**
874
+ * Generated bundle index. Do not edit.
875
+ */
876
+
877
+ export { BarsaEchartsModule, ChartLineTimeBaseDirective, MicroChartAreaBaseDirective, MicroChartAreaComponent, MicroChartBarBaseDirective, MicroChartBarComponent, MicroChartBulletComponent, MicroChartCircularBaseDirective, MicroChartCircularComponent, MicroChartComparisonBaseDirective, MicroChartComparisonComponent, MicroChartLineBaseDirective, MicroChartLineComponent, MicroChartStackbarBaseDirective, MicroChartStackbarComponent };
878
+ //# sourceMappingURL=barsa-echarts.mjs.map