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,877 @@
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
+ this.xAxis?.data?.push(item.label);
220
+ const dataObj = {
221
+ value: item.value,
222
+ symbol: 'none'
223
+ };
224
+ options.series[0].data.push(dataObj);
225
+ });
226
+ this.xAxis.max = undefined;
227
+ this.xAxis.type = 'category';
228
+ // set custom yAxis
229
+ this.yAxis.min = 0;
230
+ this.yAxis.max = 6;
231
+ this.yAxis.type = 'value';
232
+ }
233
+ /* eslint-disable */
234
+ _scaleDownLineData() {
235
+ const maxValue = Math.max.apply(Math, this.line.data.map((dataItem) => dataItem.value));
236
+ return this.line.data.forEach((dataItem) => {
237
+ dataItem.value *= 6 / maxValue;
238
+ });
239
+ }
240
+ _initSeries(options) {
241
+ options.series = [
242
+ {
243
+ type: 'line',
244
+ color: this.line?.color,
245
+ data: [],
246
+ label: {
247
+ show: false
248
+ }
249
+ }
250
+ ];
251
+ }
252
+ }
253
+ 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 });
254
+ MicroChartLineBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartLineBaseDirective, selector: "[beMicroChartLine]", inputs: { line: "line" }, usesInheritance: true, ngImport: i0 });
255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartLineBaseDirective, decorators: [{
256
+ type: Directive,
257
+ args: [{
258
+ selector: '[beMicroChartLine]'
259
+ }]
260
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { line: [{
261
+ type: Input
262
+ }] } });
263
+
264
+ class MicroChartLineComponent extends BaseComponent {
265
+ constructor(el) {
266
+ super();
267
+ this.el = el;
268
+ }
269
+ ngOnInit() {
270
+ super.ngOnInit();
271
+ this.getFirstAndLastValues();
272
+ }
273
+ getFirstAndLastValues() {
274
+ const dataLength = this.line.data.length;
275
+ this.firstValue = this.line.data[0].value.toString();
276
+ this.lastValue = this.line.data[dataLength - 1].value.toString();
277
+ this.firstLabel = this.line.data[0].label;
278
+ this.lastLabel = this.line.data[dataLength - 1].label;
279
+ }
280
+ }
281
+ MicroChartLineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartLineComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
282
+ 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 });
283
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartLineComponent, decorators: [{
284
+ type: Component,
285
+ 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"] }]
286
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { line: [{
287
+ type: Input
288
+ }] } });
289
+
290
+ class MicroChartStackbarBaseDirective extends MicroChartBaseDirective {
291
+ constructor(el, renderer2) {
292
+ super(el, renderer2);
293
+ this.el = el;
294
+ this.renderer2 = renderer2;
295
+ }
296
+ setOptions(options) {
297
+ this.chartData.data.forEach((dataItem) => {
298
+ const dataConfig = this.creatData(dataItem);
299
+ options.series.push(dataConfig);
300
+ });
301
+ }
302
+ creatData(dataItem) {
303
+ return {
304
+ name: 'Direct',
305
+ barWidth: 15,
306
+ type: 'bar',
307
+ stack: 'total',
308
+ emphasis: {
309
+ focus: 'series'
310
+ },
311
+ data: [
312
+ {
313
+ value: dataItem.value,
314
+ itemStyle: {
315
+ color: dataItem.color
316
+ }
317
+ }
318
+ ],
319
+ label: {
320
+ show: true,
321
+ formatter: (d) => d.data.value.toString() + this.chartData.suffix,
322
+ fontSize: 10
323
+ }
324
+ };
325
+ }
326
+ }
327
+ 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 });
328
+ MicroChartStackbarBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartStackbarBaseDirective, selector: "[beMicroChartStackbar]", inputs: { chartData: "chartData" }, usesInheritance: true, ngImport: i0 });
329
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartStackbarBaseDirective, decorators: [{
330
+ type: Directive,
331
+ args: [{
332
+ selector: '[beMicroChartStackbar]'
333
+ }]
334
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { chartData: [{
335
+ type: Input
336
+ }] } });
337
+
338
+ class MicroChartStackbarComponent extends BaseComponent {
339
+ constructor(el) {
340
+ super();
341
+ this.el = el;
342
+ }
343
+ }
344
+ MicroChartStackbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartStackbarComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
345
+ 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 });
346
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartStackbarComponent, decorators: [{
347
+ type: Component,
348
+ 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"] }]
349
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { data: [{
350
+ type: Input
351
+ }] } });
352
+
353
+ class MicroChartCircularBaseDirective extends MicroChartBaseDirective {
354
+ constructor(el, renderer2) {
355
+ super(el, renderer2);
356
+ this.el = el;
357
+ this.renderer2 = renderer2;
358
+ }
359
+ setOptions(options) {
360
+ // remove extra data from circular chart
361
+ this._initSeries(options);
362
+ // add data to series
363
+ options.series[0].data.push({ value: this.data });
364
+ }
365
+ _initSeries(options) {
366
+ options.series = [
367
+ {
368
+ type: 'gauge',
369
+ progress: {
370
+ show: true,
371
+ width: 5
372
+ },
373
+ axisLine: {
374
+ lineStyle: {
375
+ width: 5
376
+ }
377
+ },
378
+ axisTick: {
379
+ show: false
380
+ },
381
+ splitLine: {
382
+ show: false,
383
+ length: 15,
384
+ lineStyle: {
385
+ width: 2,
386
+ color: '#999'
387
+ }
388
+ },
389
+ axisLabel: {
390
+ distance: 30,
391
+ color: '#999',
392
+ fontSize: 10,
393
+ show: false
394
+ },
395
+ anchor: {
396
+ show: true,
397
+ showAbove: true,
398
+ size: 15,
399
+ itemStyle: {
400
+ borderWidth: 1
401
+ }
402
+ },
403
+ title: {
404
+ show: false
405
+ },
406
+ detail: {
407
+ valueAnimation: true,
408
+ fontSize: 12,
409
+ offsetCenter: [0, '70%']
410
+ },
411
+ data: []
412
+ }
413
+ ];
414
+ }
415
+ }
416
+ 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 });
417
+ MicroChartCircularBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartCircularBaseDirective, selector: "[beMicroChartCircular]", inputs: { data: "data" }, usesInheritance: true, ngImport: i0 });
418
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartCircularBaseDirective, decorators: [{
419
+ type: Directive,
420
+ args: [{ selector: '[beMicroChartCircular]' }]
421
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { data: [{
422
+ type: Input
423
+ }] } });
424
+
425
+ class MicroChartCircularComponent extends BaseComponent {
426
+ constructor(el) {
427
+ super();
428
+ this.el = el;
429
+ this.data = 50;
430
+ }
431
+ }
432
+ MicroChartCircularComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartCircularComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
433
+ 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 });
434
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartCircularComponent, decorators: [{
435
+ type: Component,
436
+ 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"] }]
437
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { data: [{
438
+ type: Input
439
+ }] } });
440
+
441
+ class MicroChartComparisonBaseDirective extends MicroChartBaseDirective {
442
+ constructor(el, renderer2) {
443
+ super(el, renderer2);
444
+ this.el = el;
445
+ this.renderer2 = renderer2;
446
+ }
447
+ setOptions(options) {
448
+ // initialize series
449
+ this._initValues(options);
450
+ // set custom xAxis
451
+ this.xAxis.type = 'value';
452
+ this.xAxis.boundaryGap = ['0%', '50%'];
453
+ // set custom yAxis
454
+ this.yAxis.type = 'category';
455
+ this.yAxis.offset = 6;
456
+ this.yAxis.axisLabel = {
457
+ show: true,
458
+ inside: true,
459
+ lineHeight: 16
460
+ };
461
+ // set custom grid
462
+ this.grid.top = 10;
463
+ const textStyle = {
464
+ verticalAlign: 'bottom',
465
+ fontSize: 12,
466
+ fontWeight: 'bold'
467
+ };
468
+ this.chartData.data.forEach((item) => {
469
+ const seriesData = {
470
+ value: item.value,
471
+ itemStyle: {
472
+ color: item.color
473
+ },
474
+ label: {
475
+ position: ['100', '0%']
476
+ }
477
+ };
478
+ options.series[0].data.push(seriesData);
479
+ const yAxisData = { value: item.label, textStyle };
480
+ this.yAxis?.data?.push(yAxisData);
481
+ });
482
+ // if we have double tile
483
+ if (this.size === 'l') {
484
+ this.grid.left = 50;
485
+ this.yAxis.axisLabel.inside = false;
486
+ this.yAxis.axisLabel.lineHeight = undefined;
487
+ options.series[0].label.position = 'right';
488
+ this.yAxis.offset = -2;
489
+ options.series[0].showBackground = false;
490
+ this.xAxis.max = 112;
491
+ options.series[0].data.map((dataItem) => {
492
+ delete dataItem.label.offset;
493
+ dataItem.label.position = ['100%', '0%'];
494
+ });
495
+ }
496
+ options.series[0].label.formatter = (d) => d.data.value + this.chartData.suffix;
497
+ }
498
+ _initValues(options) {
499
+ options.series = [
500
+ {
501
+ showBackground: true,
502
+ barWidth: this.chartData.barWidth ?? 3,
503
+ type: 'bar',
504
+ data: [],
505
+ label: {
506
+ show: true,
507
+ position: 'top',
508
+ distance: 0,
509
+ valueAnimation: true,
510
+ fontFamily: 'monospace',
511
+ formatter: (d) => d.data.value + '%',
512
+ lineHeight: -10
513
+ }
514
+ }
515
+ ];
516
+ options.plotOptions = {
517
+ bar: {
518
+ horizontal: true,
519
+ distributed: true
520
+ }
521
+ };
522
+ }
523
+ }
524
+ 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 });
525
+ 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 });
526
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartComparisonBaseDirective, decorators: [{
527
+ type: Directive,
528
+ args: [{
529
+ selector: '[beMicroChartComparison]'
530
+ }]
531
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { size: [{
532
+ type: Input
533
+ }], chartData: [{
534
+ type: Input
535
+ }] } });
536
+
537
+ class MicroChartComparisonComponent extends BaseComponent {
538
+ constructor(el) {
539
+ super();
540
+ this.el = el;
541
+ }
542
+ }
543
+ MicroChartComparisonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartComparisonComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
544
+ 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 });
545
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartComparisonComponent, decorators: [{
546
+ type: Component,
547
+ 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"] }]
548
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { data: [{
549
+ type: Input
550
+ }], size: [{
551
+ type: Input
552
+ }] } });
553
+
554
+ class MicroChartAreaBaseDirective extends MicroChartBaseDirective {
555
+ constructor(el, renderer2) {
556
+ super(el, renderer2);
557
+ this.el = el;
558
+ this.renderer2 = renderer2;
559
+ this.areas = [];
560
+ }
561
+ /* eslint-disable */
562
+ setOptions(options) {
563
+ this._scaleDownLineData();
564
+ // set custom xAxis
565
+ this.xAxis.type = 'category';
566
+ this.line.data.forEach((item) => {
567
+ this.xAxis?.data?.push(item.label);
568
+ });
569
+ this.xAxis.max = undefined;
570
+ this.xAxis.boundaryGap = false;
571
+ // set custom yAxis
572
+ this.yAxis.splitLine = { show: false };
573
+ this.yAxis.type = 'value';
574
+ this.yAxis.splitNumber = 3;
575
+ this.yAxis.min = 0;
576
+ this.yAxis.max = 6;
577
+ // handel area
578
+ this.areas.forEach((area) => {
579
+ const line = this._createItem(area.color, area.data.map((c) => ({
580
+ value: c,
581
+ symbol: 'none'
582
+ })));
583
+ this.series.push(line);
584
+ });
585
+ // handel line
586
+ const seriesItem = this._createSeriesItem(this.line.data.map((item) => ({
587
+ value: item.value,
588
+ symbol: 'none'
589
+ })));
590
+ this.series.push(seriesItem);
591
+ }
592
+ _scaleDownLineData() {
593
+ const maxValue = Math.max.apply(Math, this.line.data.map((dataItem) => dataItem.value));
594
+ return this.line.data.forEach((dataItem) => {
595
+ dataItem.value *= 6 / maxValue;
596
+ });
597
+ }
598
+ _createSeriesItem(data) {
599
+ return {
600
+ type: 'line',
601
+ data,
602
+ lineStyle: { width: 1 },
603
+ color: this.line?.color || 'black',
604
+ label: {
605
+ show: false
606
+ }
607
+ };
608
+ }
609
+ _createItem(color = '', data, name = 'none', stack = 'none') {
610
+ return {
611
+ name,
612
+ type: 'line',
613
+ stack,
614
+ areaStyle: {
615
+ color
616
+ },
617
+ itemStyle: {
618
+ color
619
+ },
620
+ emphasis: {
621
+ focus: 'series'
622
+ },
623
+ data
624
+ };
625
+ }
626
+ }
627
+ 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 });
628
+ 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 });
629
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartAreaBaseDirective, decorators: [{
630
+ type: Directive,
631
+ args: [{
632
+ selector: '[beMicroChartArea]'
633
+ }]
634
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { areas: [{
635
+ type: Input
636
+ }], line: [{
637
+ type: Input
638
+ }] } });
639
+
640
+ class MicroChartAreaComponent extends BaseComponent {
641
+ constructor(el) {
642
+ super();
643
+ this.el = el;
644
+ }
645
+ ngOnInit() {
646
+ super.ngOnInit();
647
+ this.suffix = this.chartData?.line?.suffix;
648
+ this.getFirstAndLastValues();
649
+ }
650
+ getFirstAndLastValues() {
651
+ const dataLength = this.chartData.line.data.length;
652
+ this.firstValue = this.chartData.line.data[0].value.toString();
653
+ this.lastValue = this.chartData.line.data[dataLength - 1].value.toString();
654
+ this.firstLabel = this.chartData.line.data[0].label;
655
+ this.lastLabel = this.chartData.line.data[dataLength - 1].label;
656
+ }
657
+ }
658
+ MicroChartAreaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartAreaComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
659
+ 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 });
660
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartAreaComponent, decorators: [{
661
+ type: Component,
662
+ 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"] }]
663
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { size: [{
664
+ type: Input
665
+ }], chartData: [{
666
+ type: Input
667
+ }] } });
668
+
669
+ class MicroChartBarBaseDirective extends MicroChartBaseDirective {
670
+ constructor(el, renderer2) {
671
+ super(el, renderer2);
672
+ this.el = el;
673
+ this.renderer2 = renderer2;
674
+ }
675
+ setOptions(options) {
676
+ // initialize series
677
+ this._initSeries(options);
678
+ // set custom grid
679
+ this.grid.bottom = 20;
680
+ // set custom xAxis
681
+ this.xAxis.type = 'category';
682
+ this.xAxis.max = undefined;
683
+ if (this.xAxis.axisLabel) {
684
+ this.xAxis.axisLabel.show = true;
685
+ }
686
+ this.data.forEach((dataItem) => {
687
+ this?.xAxis?.data?.push(dataItem.label);
688
+ const dataSeriesItem = { value: dataItem.value, itemStyle: { color: dataItem.color } };
689
+ options.series[0].data.push(dataSeriesItem);
690
+ });
691
+ // set custom yAxis
692
+ this.yAxis.type = 'value';
693
+ }
694
+ _initSeries(options) {
695
+ options.series = [
696
+ {
697
+ type: 'bar',
698
+ data: []
699
+ }
700
+ ];
701
+ }
702
+ }
703
+ 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 });
704
+ MicroChartBarBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: MicroChartBarBaseDirective, selector: "[beMicroChartBar]", inputs: { data: "data" }, usesInheritance: true, ngImport: i0 });
705
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartBarBaseDirective, decorators: [{
706
+ type: Directive,
707
+ args: [{
708
+ selector: '[beMicroChartBar]'
709
+ }]
710
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { data: [{
711
+ type: Input
712
+ }] } });
713
+
714
+ class MicroChartBarComponent extends BaseComponent {
715
+ constructor(el) {
716
+ super();
717
+ this.el = el;
718
+ }
719
+ }
720
+ MicroChartBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartBarComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
721
+ 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 });
722
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MicroChartBarComponent, decorators: [{
723
+ type: Component,
724
+ 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"] }]
725
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { data: [{
726
+ type: Input
727
+ }], size: [{
728
+ type: Input
729
+ }], extraData: [{
730
+ type: Input
731
+ }] } });
732
+
733
+ class ChartLineTimeBaseDirective extends ChartBaseDirective {
734
+ constructor(groupbyPipe, el, renderer2) {
735
+ super(el, renderer2);
736
+ this.groupbyPipe = groupbyPipe;
737
+ this.el = el;
738
+ this.renderer2 = renderer2;
739
+ this.xAxis = [];
740
+ this.yAxis = [];
741
+ }
742
+ ngOnChanges(changes) {
743
+ super.ngOnChanges(changes);
744
+ const { chartOption } = changes;
745
+ if (chartOption) {
746
+ let options = chartOption.currentValue;
747
+ options = {
748
+ ...options,
749
+ toolbox: {
750
+ feature: {
751
+ dataZoom: {
752
+ yAxisIndex: 'none'
753
+ },
754
+ restore: {},
755
+ saveAsImage: {}
756
+ }
757
+ }
758
+ };
759
+ this._setTooltipFormatter(options, 'series', 'tooltip');
760
+ this._setTooltipFormatter(options, 'xAxis', 'axisLabel');
761
+ this._setTooltipFormatter(options, 'yAxis', 'tooltip');
762
+ if (!chartOption.firstChange) {
763
+ this._renderChart();
764
+ }
765
+ }
766
+ }
767
+ setOptions(options) {
768
+ this.options = {
769
+ ...options,
770
+ ...this.chartOption,
771
+ toolbox: {
772
+ feature: {
773
+ dataZoom: {
774
+ yAxisIndex: 'none'
775
+ },
776
+ restore: {},
777
+ saveAsImage: {}
778
+ }
779
+ }
780
+ };
781
+ // set input data
782
+ }
783
+ _setTooltipFormatter(options, prop, prop2) {
784
+ const arr = options[prop];
785
+ if (Array.isArray(arr)) {
786
+ arr.forEach((c) => {
787
+ const obj2 = c[prop2];
788
+ if (obj2 &&
789
+ obj2.formatter &&
790
+ (obj2.formatter.indexOf('=>') > -1 || obj2.formatter.indexOf('function') > -1)) {
791
+ // eslint-disable-next-line no-eval
792
+ obj2.formatter = eval(obj2.formatter);
793
+ }
794
+ });
795
+ }
796
+ }
797
+ }
798
+ 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 });
799
+ 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 });
800
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ChartLineTimeBaseDirective, decorators: [{
801
+ type: Directive,
802
+ args: [{
803
+ selector: '[beChartLineTime]'
804
+ }]
805
+ }], ctorParameters: function () { return [{ type: i1$1.GroupByPipe }, { type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { chartOption: [{
806
+ type: Input
807
+ }] } });
808
+
809
+ const components = [
810
+ MicroChartComparisonComponent,
811
+ MicroChartAreaComponent,
812
+ MicroChartBarComponent,
813
+ MicroChartAreaComponent,
814
+ MicroChartStackbarComponent,
815
+ MicroChartCircularComponent,
816
+ MicroChartLineComponent,
817
+ MicroChartAreaBaseDirective,
818
+ MicroChartLineBaseDirective,
819
+ MicroChartStackbarBaseDirective,
820
+ MicroChartComparisonBaseDirective,
821
+ MicroChartCircularComponent,
822
+ MicroChartBarBaseDirective,
823
+ MicroChartCircularBaseDirective,
824
+ MicroChartBulletComponent,
825
+ ChartLineTimeBaseDirective
826
+ ];
827
+ class BarsaEchartsModule {
828
+ }
829
+ BarsaEchartsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: BarsaEchartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
830
+ BarsaEchartsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.7", ngImport: i0, type: BarsaEchartsModule, declarations: [MicroChartComparisonComponent,
831
+ MicroChartAreaComponent,
832
+ MicroChartBarComponent,
833
+ MicroChartAreaComponent,
834
+ MicroChartStackbarComponent,
835
+ MicroChartCircularComponent,
836
+ MicroChartLineComponent,
837
+ MicroChartAreaBaseDirective,
838
+ MicroChartLineBaseDirective,
839
+ MicroChartStackbarBaseDirective,
840
+ MicroChartComparisonBaseDirective,
841
+ MicroChartCircularComponent,
842
+ MicroChartBarBaseDirective,
843
+ MicroChartCircularBaseDirective,
844
+ MicroChartBulletComponent,
845
+ ChartLineTimeBaseDirective], imports: [CommonModule, BarsaNovinRayCoreModule], exports: [MicroChartComparisonComponent,
846
+ MicroChartAreaComponent,
847
+ MicroChartBarComponent,
848
+ MicroChartAreaComponent,
849
+ MicroChartStackbarComponent,
850
+ MicroChartCircularComponent,
851
+ MicroChartLineComponent,
852
+ MicroChartAreaBaseDirective,
853
+ MicroChartLineBaseDirective,
854
+ MicroChartStackbarBaseDirective,
855
+ MicroChartComparisonBaseDirective,
856
+ MicroChartCircularComponent,
857
+ MicroChartBarBaseDirective,
858
+ MicroChartCircularBaseDirective,
859
+ MicroChartBulletComponent,
860
+ ChartLineTimeBaseDirective] });
861
+ BarsaEchartsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: BarsaEchartsModule, imports: [CommonModule, BarsaNovinRayCoreModule] });
862
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: BarsaEchartsModule, decorators: [{
863
+ type: NgModule,
864
+ args: [{
865
+ schemas: [NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA],
866
+ imports: [CommonModule, BarsaNovinRayCoreModule],
867
+ declarations: [...components],
868
+ exports: [...components]
869
+ }]
870
+ }] });
871
+
872
+ /**
873
+ * Generated bundle index. Do not edit.
874
+ */
875
+
876
+ export { BarsaEchartsModule, ChartLineTimeBaseDirective, MicroChartAreaBaseDirective, MicroChartAreaComponent, MicroChartBarBaseDirective, MicroChartBarComponent, MicroChartBulletComponent, MicroChartCircularBaseDirective, MicroChartCircularComponent, MicroChartComparisonBaseDirective, MicroChartComparisonComponent, MicroChartLineBaseDirective, MicroChartLineComponent, MicroChartStackbarBaseDirective, MicroChartStackbarComponent };
877
+ //# sourceMappingURL=barsa-echarts.mjs.map