ngx-deebodata 0.1.1 → 0.1.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.
- package/ng-package.json +7 -0
- package/package.json +18 -41
- package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.css +148 -0
- package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.html +29 -0
- package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.spec.ts +23 -0
- package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.ts +282 -0
- package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.css +27 -0
- package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.html +53 -0
- package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.spec.ts +23 -0
- package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.ts +214 -0
- package/src/lib/data-table/charts/column-chart/column-chart.css +19 -0
- package/src/lib/data-table/charts/column-chart/column-chart.html +47 -0
- package/src/lib/data-table/charts/column-chart/column-chart.spec.ts +23 -0
- package/src/lib/data-table/charts/column-chart/column-chart.ts +178 -0
- package/src/lib/data-table/charts/line-graph-component/line-graph-component.css +25 -0
- package/src/lib/data-table/charts/line-graph-component/line-graph-component.html +59 -0
- package/src/lib/data-table/charts/line-graph-component/line-graph-component.spec.ts +23 -0
- package/src/lib/data-table/charts/line-graph-component/line-graph-component.ts +661 -0
- package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.css +53 -0
- package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.html +27 -0
- package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.spec.ts +23 -0
- package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.ts +210 -0
- package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.css +0 -0
- package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.html +15 -0
- package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.spec.ts +23 -0
- package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.ts +197 -0
- package/src/lib/data-table/data-table-module/data-cell/data-cell.css +0 -0
- package/src/lib/data-table/data-table-module/data-cell/data-cell.html +6 -0
- package/src/lib/data-table/data-table-module/data-cell/data-cell.spec.ts +23 -0
- package/src/lib/data-table/data-table-module/data-cell/data-cell.ts +298 -0
- package/src/lib/data-table/data-table-module/data-table-header/data-table-header.css +25 -0
- package/src/lib/data-table/data-table-module/data-table-header/data-table-header.html +55 -0
- package/src/lib/data-table/data-table-module/data-table-header/data-table-header.spec.ts +23 -0
- package/src/lib/data-table/data-table-module/data-table-header/data-table-header.ts +261 -0
- package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.css +61 -0
- package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.html +24 -0
- package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.spec.ts +23 -0
- package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.ts +125 -0
- package/src/lib/data-table/data-table-module/export-component/export-component.css +83 -0
- package/src/lib/data-table/data-table-module/export-component/export-component.html +16 -0
- package/src/lib/data-table/data-table-module/export-component/export-component.spec.ts +23 -0
- package/src/lib/data-table/data-table-module/export-component/export-component.ts +206 -0
- package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.css +92 -0
- package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.html +194 -0
- package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.spec.ts +23 -0
- package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.ts +2255 -0
- package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.css +14 -0
- package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.html +27 -0
- package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.spec.ts +23 -0
- package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.ts +58 -0
- package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.css +15 -0
- package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.html +48 -0
- package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.spec.ts +23 -0
- package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.ts +599 -0
- package/src/lib/data-table/data-table-module/worker.worker.ts +44 -0
- package/src/lib/interfaces/cell-edit.ts +7 -0
- package/src/lib/interfaces/column-header.ts +10 -0
- package/src/lib/interfaces/column-styles.ts +14 -0
- package/src/lib/interfaces/column-symbol.ts +4 -0
- package/src/lib/interfaces/data-cell.ts +14 -0
- package/src/lib/interfaces/data-row.ts +11 -0
- package/src/lib/interfaces/row-number.ts +4 -0
- package/src/lib/services/common-service.spec.ts +16 -0
- package/src/lib/services/common-service.ts +336 -0
- package/src/lib/services/data-table-service.spec.ts +16 -0
- package/src/lib/services/data-table-service.ts +605 -0
- package/src/lib/services/table-drag-service.spec.ts +16 -0
- package/src/lib/services/table-drag-service.ts +347 -0
- package/src/lib/styles.css +1068 -0
- package/src/public-api.ts +8 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/fesm2022/ngx-deebodata.mjs +0 -6918
- package/fesm2022/ngx-deebodata.mjs.map +0 -1
- package/types/ngx-deebodata.d.ts +0 -444
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,41 +1,18 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ngx-deebodata",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "A robust data grid solution with integrated charts, virtual scroll, row grouping, column resizing, toggle column visibility, cell editing, tab accessibility, sorting with priority, and advanced filtering.",
|
|
5
|
-
"peerDependencies": {
|
|
6
|
-
"@angular/common": "^21.2.0",
|
|
7
|
-
"@angular/core": "^21.2.0",
|
|
8
|
-
"@angular/forms": "^21.2.0",
|
|
9
|
-
"@angular/platform-browser": "^21.2.0"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"tslib": "^2.3.0"
|
|
13
|
-
},
|
|
14
|
-
"sideEffects": false,
|
|
15
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
16
|
-
"homepage": "https://deebodata.com/angular-docs",
|
|
17
|
-
"keywords": [
|
|
18
|
-
|
|
19
|
-
"data-grid",
|
|
20
|
-
"datagrid",
|
|
21
|
-
"virtual-scroll",
|
|
22
|
-
"charts",
|
|
23
|
-
"graphs",
|
|
24
|
-
"accessibility",
|
|
25
|
-
"grouping",
|
|
26
|
-
"enterprise",
|
|
27
|
-
"commercial"
|
|
28
|
-
],
|
|
29
|
-
"module": "fesm2022/ngx-deebodata.mjs",
|
|
30
|
-
"typings": "types/ngx-deebodata.d.ts",
|
|
31
|
-
"exports": {
|
|
32
|
-
"./package.json": {
|
|
33
|
-
"default": "./package.json"
|
|
34
|
-
},
|
|
35
|
-
".": {
|
|
36
|
-
"types": "./types/ngx-deebodata.d.ts",
|
|
37
|
-
"default": "./fesm2022/ngx-deebodata.mjs"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"type": "module"
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "ngx-deebodata",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "A robust data grid solution with integrated charts, virtual scroll, row grouping, column resizing, toggle column visibility, cell editing, tab accessibility, sorting with priority, and advanced filtering.",
|
|
5
|
+
"peerDependencies": {
|
|
6
|
+
"@angular/common": "^21.2.0",
|
|
7
|
+
"@angular/core": "^21.2.0",
|
|
8
|
+
"@angular/forms": "^21.2.0",
|
|
9
|
+
"@angular/platform-browser": "^21.2.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"tslib": "^2.3.0"
|
|
13
|
+
},
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
16
|
+
"homepage": "https://deebodata.com/angular-docs",
|
|
17
|
+
"keywords": ["grid", "data-grid", "datagrid", "virtual-scroll", "charts", "graphs", "accessibility", "grouping", "enterprise", "commercial"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
.inner-bg-contain{
|
|
2
|
+
position: relative;
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.inner-bg-contain::before{
|
|
7
|
+
top: 50%;
|
|
8
|
+
left: -48px;
|
|
9
|
+
font-size: x-large;
|
|
10
|
+
position: absolute;
|
|
11
|
+
display: block;
|
|
12
|
+
color: var(--grid-color);
|
|
13
|
+
content: attr(data-yaxis);
|
|
14
|
+
transform: rotate(-90deg);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.stat-opt-contain{
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
margin-bottom: 27px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.stat-opt-btn{
|
|
23
|
+
width: 100%;
|
|
24
|
+
padding-bottom: 3px;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.stat-opt-btn-active{
|
|
29
|
+
font-weight: bold;
|
|
30
|
+
border-bottom: 2px solid var(--grid-color);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.bar-graph-y-cols{
|
|
34
|
+
z-index: 5;
|
|
35
|
+
margin-left: 5px;
|
|
36
|
+
overflow: visible;
|
|
37
|
+
position: relative;
|
|
38
|
+
vertical-align: top;
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
display: inline-block;
|
|
41
|
+
border-right: 1px solid var(--grid-color);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.bar-graph-real-vals{
|
|
45
|
+
position: relative;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.bar-graph-x-cols{
|
|
49
|
+
padding-top: 11px;
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
overflow-x: visible;
|
|
52
|
+
border-top: 1px solid var(--grid-color);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.bg-dep-var{
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
height: 70px;
|
|
58
|
+
width: 100%;
|
|
59
|
+
display: flex;
|
|
60
|
+
padding: 0 5px;
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
align-items: end;
|
|
63
|
+
font-weight: 500;
|
|
64
|
+
justify-content: right;
|
|
65
|
+
box-sizing: border-box;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.bg-dep-var div{
|
|
69
|
+
word-break:break-all;
|
|
70
|
+
color: var(--accent-color);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.bg-dep-var:first-of-type{
|
|
74
|
+
height: 17px !important;
|
|
75
|
+
position: relative;
|
|
76
|
+
overflow: visible !important;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.bg-dep-var:first-of-type::before{
|
|
80
|
+
top: 0;
|
|
81
|
+
overflow: visible;
|
|
82
|
+
position: absolute;
|
|
83
|
+
content: attr(data-number);
|
|
84
|
+
visibility: visible !important
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.bg-dep-var:last-of-type{
|
|
88
|
+
overflow: visible !important;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.bg-dep-var:last-of-type::after{
|
|
92
|
+
content: attr(data-number);
|
|
93
|
+
margin-bottom: -7px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.graph-actual-bar{
|
|
97
|
+
bottom: 0;
|
|
98
|
+
position: absolute;
|
|
99
|
+
align-items: center;
|
|
100
|
+
background: white;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.graph-actual-bar div{/*these divs are the actual colored bars*/
|
|
104
|
+
height: 0;
|
|
105
|
+
width: 80%;
|
|
106
|
+
margin: 0 auto;
|
|
107
|
+
background: #afafaf;
|
|
108
|
+
transition: height 0.3s ease-out;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.graph-actual-bar:hover{
|
|
112
|
+
z-index: 10;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.graph-actual-bar:hover::before{
|
|
116
|
+
width: 150px;
|
|
117
|
+
display: block;
|
|
118
|
+
font-weight: 500;
|
|
119
|
+
font-size: small;
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
background: white;
|
|
122
|
+
padding: 1px 2px 3px 2px;
|
|
123
|
+
content: attr(data-value);
|
|
124
|
+
border-radius: 3px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.bg-ind-var{
|
|
128
|
+
font-size: small;
|
|
129
|
+
font-weight: 500;
|
|
130
|
+
overflow: hidden;
|
|
131
|
+
text-overflow: ellipsis;
|
|
132
|
+
display: inline-block;
|
|
133
|
+
color: var(--accent-color);
|
|
134
|
+
transform: rotate(45deg);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.lbl-show{
|
|
138
|
+
overflow: visible !important;
|
|
139
|
+
transition: overflow 0.2s ease;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.bar-graph-x-label{
|
|
143
|
+
font-size: x-large;
|
|
144
|
+
font-weight: 500;
|
|
145
|
+
padding-top: 17px;
|
|
146
|
+
text-align: center;
|
|
147
|
+
overflow-x: hidden;
|
|
148
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<div #statOptsCont class="center stat-opt-contain">
|
|
2
|
+
@for(stat of statOpts; track stat){
|
|
3
|
+
<div [style.width]="statBtnWid" class="inline-b center">
|
|
4
|
+
<button class="no-btn stat-opt-btn" (click)="handleStatChange(stat)"
|
|
5
|
+
[class.stat-opt-btn-active]="selStat() === stat">{{common.titleCase(stat)}}</button>
|
|
6
|
+
</div>
|
|
7
|
+
}
|
|
8
|
+
</div>
|
|
9
|
+
<div #innerGB class="inner-bg-contain">
|
|
10
|
+
<div #yAxis class="bar-graph-y-cols" [style.height]="((bgDepVarHgt*(numYPlots-1))+17) + 'px'">
|
|
11
|
+
@for(num of numTicks(); track $index){
|
|
12
|
+
<div class="bg-dep-var" [class.invisible]="num && num === maxYVal" [attr.data-number]="num">{{(num === '0') ? '' : num}}</div>
|
|
13
|
+
}
|
|
14
|
+
</div><div #barContainer class="bar-graph-real-vals">
|
|
15
|
+
@for(bar of barVals; track bar){
|
|
16
|
+
<div [ngStyle]="{'width': xLblWidth, 'left': bar.left}"
|
|
17
|
+
class="graph-actual-bar" [attr.data-value]="bar.fullValue">
|
|
18
|
+
<div [ngStyle]="{'height': bar.height, 'background': bar.background}"></div>
|
|
19
|
+
</div>
|
|
20
|
+
}
|
|
21
|
+
</div>
|
|
22
|
+
<div #xValues class="bar-graph-x-cols">
|
|
23
|
+
@for(lbl of xLabels; track lbl){
|
|
24
|
+
<div class="bg-ind-var center" [style.width]="xLblWidth" (mouseenter)="lblMouseIn($event.target)" (mouseleave)="lblMouseOut($event.target)">
|
|
25
|
+
{{lbl}}</div>
|
|
26
|
+
}
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<div #xLabel class="bar-graph-x-label"></div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { BarGraphComponent } from './bar-graph-component';
|
|
4
|
+
|
|
5
|
+
describe('BarGraphComponent', () => {
|
|
6
|
+
let component: BarGraphComponent;
|
|
7
|
+
let fixture: ComponentFixture<BarGraphComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [BarGraphComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(BarGraphComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { Component, ElementRef, EventEmitter, Input, ViewChild, Output, HostListener, signal } from '@angular/core';
|
|
2
|
+
import { CommonService } from '../../../services/common-service';
|
|
3
|
+
import { DataTableService } from '../../../services/data-table-service';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'app-bar-graph-component',
|
|
8
|
+
imports: [CommonModule],
|
|
9
|
+
templateUrl: './bar-graph-component.html',
|
|
10
|
+
styleUrls: ['./bar-graph-component.css', '../../../styles.css']
|
|
11
|
+
})
|
|
12
|
+
export class BarGraphComponent {
|
|
13
|
+
|
|
14
|
+
@HostListener('window:resize', ['$event'])
|
|
15
|
+
onWindowResize(e: Event) {
|
|
16
|
+
this.handleStatChange(this.selStat(), true)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
numTicks = signal<string[]>([])
|
|
20
|
+
barVals: any[] = []
|
|
21
|
+
xLblWidth: string= ""
|
|
22
|
+
xLabels: string[] = []
|
|
23
|
+
maxBarWid: number = 90
|
|
24
|
+
buildingStat: boolean = false
|
|
25
|
+
maxYVal: string = "0";
|
|
26
|
+
statData: any[] = []
|
|
27
|
+
selStat = signal<string>("avg")
|
|
28
|
+
numYPlots: number = 5
|
|
29
|
+
bgDepVarHgt: number = 70//height of y ticks
|
|
30
|
+
statOpts: string[] = ["avg", "min", "max", "mode", "median", "sum"]
|
|
31
|
+
statBtnWid: string = "30px"
|
|
32
|
+
titleTrail: string = ""
|
|
33
|
+
@Input() column: string = ""
|
|
34
|
+
@Input() data: any[] = []
|
|
35
|
+
@Output("title") title: EventEmitter<string> = new EventEmitter();
|
|
36
|
+
@ViewChild("innerGB", { static: true }) innerGB!: ElementRef;
|
|
37
|
+
@ViewChild("xLabel", { static: true }) xLabel!: ElementRef;
|
|
38
|
+
@ViewChild("xValues", { static: true }) xValues!: ElementRef;
|
|
39
|
+
@ViewChild("yAxis", { static: true }) yAxis!: ElementRef;
|
|
40
|
+
@ViewChild("statOptsCont", { static: true }) statOptsCont!: ElementRef;
|
|
41
|
+
@ViewChild("barContainer", { static: true }) barContainer!: ElementRef;
|
|
42
|
+
|
|
43
|
+
constructor(public common: CommonService,
|
|
44
|
+
private dataTableService: DataTableService,
|
|
45
|
+
){ }
|
|
46
|
+
|
|
47
|
+
ngOnInit() {
|
|
48
|
+
this.buildBarGraphWithTwoCols(this.selStat())
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
ngAfterContentInit() {
|
|
52
|
+
setTimeout( () => { this.sizeUpBgDims() })
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
sizeUpBgDims() {
|
|
56
|
+
const bgWid = this.innerGB.nativeElement.getBoundingClientRect().width
|
|
57
|
+
const yWid = this.yAxis.nativeElement.getBoundingClientRect().width
|
|
58
|
+
const offY = Math.ceil(yWid+5)
|
|
59
|
+
this.statBtnWid = Math.floor((bgWid-offY)/this.statOpts.length) + "px";
|
|
60
|
+
this.statOptsCont.nativeElement.style.marginLeft = offY + "px";
|
|
61
|
+
this.xValues.nativeElement.style.marginLeft = offY + "px";
|
|
62
|
+
this.barContainer.nativeElement.style.marginLeft = offY + "px";
|
|
63
|
+
this.xLblWidth = Math.min(this.maxBarWid, (Math.floor((bgWid-offY)/this.xLabels.length))) + "px";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
buildBarGraphWithTwoCols(stat: string) {
|
|
67
|
+
const bgCols = this.column.split(this.dataTableService.bgSep)
|
|
68
|
+
const strCol = bgCols[0]
|
|
69
|
+
const numCol = bgCols[1]
|
|
70
|
+
if(!this.titleTrail)
|
|
71
|
+
this.titleTrail = this.common.titleCase(numCol) + " by " + this.common.titleCase(strCol);
|
|
72
|
+
const vals = this.dataTableService.dataFilSrtTracker[strCol].selDDVals.filter( (g: any) => g.value !== "(Select All)")
|
|
73
|
+
const vlen = vals.length
|
|
74
|
+
let o = 0
|
|
75
|
+
for(o; o < vlen; o++){
|
|
76
|
+
const val = vals[o].value
|
|
77
|
+
const justVal = this.data.filter( d => d["strColumn"] === val).map( d => d["numColumn"] )
|
|
78
|
+
const jvlen = justVal.length
|
|
79
|
+
if(jvlen){//["avg", "min", "max", "mode", "median", "sum"]
|
|
80
|
+
let statobj = {x: val, y: 0}
|
|
81
|
+
if(stat === "avg")
|
|
82
|
+
statobj.y = (justVal.reduce( (acc, curr) => (acc += curr) , 0)/jvlen)
|
|
83
|
+
if(stat === "min")
|
|
84
|
+
statobj.y = Math.min(...justVal)
|
|
85
|
+
if(stat === "max")
|
|
86
|
+
statobj.y = Math.max(...justVal)
|
|
87
|
+
if(stat === "sum")
|
|
88
|
+
statobj.y = (justVal.reduce( (acc, curr) => (acc += curr) , 0))
|
|
89
|
+
if(stat === "median")
|
|
90
|
+
statobj.y = this.findDataMedian(justVal, jvlen)
|
|
91
|
+
if(stat === "mode")
|
|
92
|
+
statobj.y = this.findDataMode(justVal)
|
|
93
|
+
this.statData.push(statobj)
|
|
94
|
+
this.xLabels.push(val)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const justNull = this.data.filter( d => d["strColumn"] === "N/A").map( d => d["numColumn"] )
|
|
98
|
+
const jlen = justNull.length
|
|
99
|
+
if(jlen){
|
|
100
|
+
let statobj = {x: "N/A", y: 0}
|
|
101
|
+
if(stat === "avg")
|
|
102
|
+
statobj.y = (justNull.reduce( (acc, curr) => (acc += curr) , 0)/jlen)
|
|
103
|
+
if(stat === "min")
|
|
104
|
+
statobj.y = Math.min(...justNull)
|
|
105
|
+
if(stat === "max")
|
|
106
|
+
statobj.y = Math.max(...justNull)
|
|
107
|
+
if(stat === "sum")
|
|
108
|
+
statobj.y = (justNull.reduce( (acc, curr) => (acc += curr) , 0))
|
|
109
|
+
if(stat === "median")
|
|
110
|
+
statobj.y = this.findDataMedian(justNull, jlen)
|
|
111
|
+
if(stat === "mode")
|
|
112
|
+
statobj.y = this.findDataMode(justNull)
|
|
113
|
+
this.statData.push(statobj)
|
|
114
|
+
this.xLabels.push("N/A")
|
|
115
|
+
}
|
|
116
|
+
const par = this.innerGB.nativeElement
|
|
117
|
+
const nums = this.statData.map( d => d["y"] );
|
|
118
|
+
let srtNums = nums.sort( (a, b) => a - b > 0 ? 1 : -1 )
|
|
119
|
+
const max = srtNums[(nums.length-1)]
|
|
120
|
+
let lbly = this.common.sanitizeUi(numCol)
|
|
121
|
+
const sym = this.dataTableService.dataFilSrtTracker[numCol].colCellSymbol
|
|
122
|
+
if(sym)
|
|
123
|
+
lbly += " ("+sym+")";
|
|
124
|
+
par.setAttribute("data-yaxis", lbly)
|
|
125
|
+
this.xLabel.nativeElement.textContent = this.common.sanitizeUi(this.common.titleCase(strCol))
|
|
126
|
+
this.buildYAxisBGVals(max)
|
|
127
|
+
setTimeout( () => { this.buildBGBars(this.statData, max, sym) })
|
|
128
|
+
setTimeout( () => { this.buildingStat = false }, 500)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
buildBGBars(data: any[], max: number, sym: any) {
|
|
132
|
+
let i = 0
|
|
133
|
+
const len = data.length
|
|
134
|
+
let background: string = "initial"
|
|
135
|
+
const yAx = this.yAxis.nativeElement
|
|
136
|
+
const ybds = yAx.getBoundingClientRect()
|
|
137
|
+
const yWid = ybds.width
|
|
138
|
+
const offY = Math.ceil(yWid+5)
|
|
139
|
+
const whiteTxt = ["white", "#FFFFFF", "#ffffff", "rgb(255, 255, 255)", "rgb(255,255,255)"];
|
|
140
|
+
if(this.dataTableService.themeColor1 && whiteTxt.indexOf(this.dataTableService.themeColor1) < 0)
|
|
141
|
+
background = this.dataTableService.themeColor1;
|
|
142
|
+
const useIncr = Math.min(this.maxBarWid, (Math.floor((this.innerGB.nativeElement.getBoundingClientRect().width-offY)/this.xLabels.length)))
|
|
143
|
+
for(i; i < len; i++){
|
|
144
|
+
const item = data[i]
|
|
145
|
+
const bhgt = item["y"]/max;
|
|
146
|
+
const strVal = item["y"].toLocaleString(undefined, {maximumFractionDigits: 2})
|
|
147
|
+
let symb4 = ""
|
|
148
|
+
let symaf = ""
|
|
149
|
+
if(sym){
|
|
150
|
+
let isCurr = ["$","€","£","¥","₣","₹"].indexOf(sym) > -1
|
|
151
|
+
if(isCurr)
|
|
152
|
+
symb4 = sym
|
|
153
|
+
else
|
|
154
|
+
symaf = sym
|
|
155
|
+
}
|
|
156
|
+
const fVal = item["x"] + ': ' + symb4 + strVal + symaf;
|
|
157
|
+
const bv = { id: item["x"], left: ((i*useIncr) + "px"), heightVal: bhgt, height: "0px", fullValue: fVal, numValue: strVal, background: background}
|
|
158
|
+
this.barVals.push(bv);
|
|
159
|
+
}
|
|
160
|
+
this.handleBGBarHgts(data)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
handleBGBarHgts(data: any[]) {
|
|
164
|
+
let i = 0
|
|
165
|
+
let show = false
|
|
166
|
+
const len = data.length
|
|
167
|
+
const ybds = this.yAxis.nativeElement.getBoundingClientRect()
|
|
168
|
+
const maxHgt = ybds.height
|
|
169
|
+
const cont = document.getElementById("insField" + this.common.elifyCol(this.column))
|
|
170
|
+
const cBds = cont?.getBoundingClientRect()
|
|
171
|
+
const insTop = document.getElementsByClassName("chart-contain-show")[0]?.scrollTop || 0;
|
|
172
|
+
if(cBds && (cBds.bottom-(cBds.height/2)) < (this.dataTableService.tblTop+insTop+this.dataTableService.dTblHeight))
|
|
173
|
+
show = true;
|
|
174
|
+
if(show){
|
|
175
|
+
for(i; i < len; i++){
|
|
176
|
+
const item = data[i]
|
|
177
|
+
const xvalue = item["x"]
|
|
178
|
+
const bv = this.barVals.find( b => b.id === xvalue)
|
|
179
|
+
if(bv){
|
|
180
|
+
setTimeout( () => {
|
|
181
|
+
bv.height = (Math.ceil(bv.heightVal*maxHgt) + "px")
|
|
182
|
+
}, 250)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
buildYAxisBGVals(max: number) {
|
|
189
|
+
let nts: string[] = []
|
|
190
|
+
// let diff = max - min
|
|
191
|
+
const incr = max/(this.numYPlots-1)
|
|
192
|
+
const strNum = (val: number) => {
|
|
193
|
+
return val < 1000 ? val.toLocaleString(undefined, {maximumFractionDigits: 0}) : this.common.doBigData(val);
|
|
194
|
+
}
|
|
195
|
+
for(let i = (this.numYPlots-1); i >= 0; i--){
|
|
196
|
+
try{
|
|
197
|
+
const inc = i*incr
|
|
198
|
+
let useVal = inc//(min + inc)
|
|
199
|
+
if(i === 0)
|
|
200
|
+
useVal = 0//min
|
|
201
|
+
if(i === (this.numYPlots-1))
|
|
202
|
+
useVal = max
|
|
203
|
+
const strVal = strNum(useVal);
|
|
204
|
+
if(i === (this.numYPlots-1))
|
|
205
|
+
this.maxYVal = strVal
|
|
206
|
+
nts.push(strVal)
|
|
207
|
+
}catch(e){}
|
|
208
|
+
}
|
|
209
|
+
this.numTicks.set([...nts])
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
handleStatChange(stat: string, resize?: boolean) {
|
|
213
|
+
if(this.selStat() === stat && !resize)
|
|
214
|
+
return;
|
|
215
|
+
this.buildingStat = true
|
|
216
|
+
this.maxYVal = "0"
|
|
217
|
+
this.selStat.set(stat)
|
|
218
|
+
this.numTicks.set([])
|
|
219
|
+
this.barVals = []
|
|
220
|
+
this.xLabels = []
|
|
221
|
+
this.statData = []
|
|
222
|
+
if(!resize)
|
|
223
|
+
this.title.emit(this.common.titleCase(stat) + " " + this.titleTrail);
|
|
224
|
+
setTimeout( () => {
|
|
225
|
+
this.buildBarGraphWithTwoCols(stat);
|
|
226
|
+
setTimeout( () => { this.sizeUpBgDims() })
|
|
227
|
+
})
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
findDataMedian(data: number[], len: number): number {
|
|
231
|
+
if(len === 1)
|
|
232
|
+
return data[0]
|
|
233
|
+
if(len === 2)
|
|
234
|
+
return (data[0]+data[1])/2
|
|
235
|
+
const isOdd = len%2 !== 0
|
|
236
|
+
if(isOdd){
|
|
237
|
+
return data[Math.ceil(len/2)]
|
|
238
|
+
} else {
|
|
239
|
+
const loMed = data[len/2]
|
|
240
|
+
const hiMed = data[len/2] + 1
|
|
241
|
+
return (loMed+hiMed)/2
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
getColumnValueCounts(data: any[]) {
|
|
246
|
+
let i = 0
|
|
247
|
+
let count: any = {}
|
|
248
|
+
const len = data.length
|
|
249
|
+
for(i; i < len; i++){
|
|
250
|
+
const d = data[i]
|
|
251
|
+
const val = "v" + d
|
|
252
|
+
if(!count[val] || typeof count[val] === "undefined")
|
|
253
|
+
count[val] = 1
|
|
254
|
+
else
|
|
255
|
+
count[val] += 1
|
|
256
|
+
}
|
|
257
|
+
return count;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
findDataMode(data: any[]): number {
|
|
261
|
+
const count = this.getColumnValueCounts(data)
|
|
262
|
+
let most = null
|
|
263
|
+
for(const prop in count){
|
|
264
|
+
if(!most)
|
|
265
|
+
most = {text: prop, amount: count[prop]}
|
|
266
|
+
if(count[prop] > most.amount)
|
|
267
|
+
most = {text: prop, amount: count[prop]}
|
|
268
|
+
}
|
|
269
|
+
if(most)
|
|
270
|
+
return parseInt(most?.text.replace("v", ""))
|
|
271
|
+
return 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
lblMouseIn(el: any) {
|
|
275
|
+
el.classList.add("lbl-show")
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
lblMouseOut(el: any) {
|
|
279
|
+
el.classList.remove("lbl-show")
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.h3-bg{
|
|
2
|
+
text-align: center;
|
|
3
|
+
margin-bottom: 7px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.chart-rel-contain{
|
|
7
|
+
z-index: 25;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.chart-contain{
|
|
11
|
+
left: 0;
|
|
12
|
+
right: 0;
|
|
13
|
+
top: 11px;
|
|
14
|
+
opacity: 0;
|
|
15
|
+
overflow: auto;
|
|
16
|
+
position: absolute;
|
|
17
|
+
background: white;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.chart-contain .relly button i{
|
|
21
|
+
font-size: 30px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.chart-contain-show{
|
|
25
|
+
opacity: 1 !important;
|
|
26
|
+
transition: all 0.5s ease-in;
|
|
27
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<div class="relly chart-rel-contain">
|
|
2
|
+
<div #chartContain class="chart-contain" (scroll)="handleChartScroll($event)" [class.chart-contain-show]="chartsReady()" [style.height]="height">
|
|
3
|
+
<div class="relly" style="z-index: 10;">
|
|
4
|
+
<button type="button" #xChartsBtn class="abs-right no-btn" (click)="closeCharts()" style="background: white;">
|
|
5
|
+
<i class="material-icons error-message heavy" aria-hidden="false">close</i>
|
|
6
|
+
</button>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="insights">
|
|
9
|
+
<h2 class="no-weight center" [innerHTML]="h2Text"></h2>
|
|
10
|
+
@for(row of iRows; track row; let r = $index){
|
|
11
|
+
<div class="insight-field-row">
|
|
12
|
+
@for(col of row; track col; let i = $index){
|
|
13
|
+
<div [id]="'insField' + common.elifyCol(col.column)" class="insight-field">
|
|
14
|
+
@if(rowIsAboveFold().indexOf(r) > -1){
|
|
15
|
+
<div style="width: 85%;">
|
|
16
|
+
<h3 class="semi-heavy" [class.h3-bg]="col.title.indexOf( ' by ') > -1">{{col.title}}</h3>
|
|
17
|
+
@if(dtCols.indexOf(col.column) > -1 && common.goodLs()){
|
|
18
|
+
<div class="lg-title-cont">
|
|
19
|
+
@if(numCols.length > 1){
|
|
20
|
+
@for(opt of numCols; track opt){
|
|
21
|
+
<button type="button" class="btn-line-graph-opts" [class.btn-lg-sel]="opt === currNumColNm[col.column]"
|
|
22
|
+
(click)="setLineGraphNumCol(r, col.column, opt)">
|
|
23
|
+
{{opt + " by " + col.column}}
|
|
24
|
+
</button>
|
|
25
|
+
}
|
|
26
|
+
} @else {
|
|
27
|
+
<span class="sp-line-graph-title">{{common.titleCase(currNumColNm[col.column]) + " by " + common.titleCase(col.column)}}</span>
|
|
28
|
+
}
|
|
29
|
+
</div>
|
|
30
|
+
@if(currNumColData[col.column]?.length){
|
|
31
|
+
<app-line-graph-component
|
|
32
|
+
[column]="col.column"
|
|
33
|
+
[data]="col.data"
|
|
34
|
+
[numCol]="currNumColNm[col.column]"
|
|
35
|
+
(title)="col.title = $event"
|
|
36
|
+
></app-line-graph-component>
|
|
37
|
+
}
|
|
38
|
+
} @else {
|
|
39
|
+
<app-column-chart
|
|
40
|
+
[column]="col.column"
|
|
41
|
+
[colData]="col.data"
|
|
42
|
+
(bgTitle)="col.title = $event"
|
|
43
|
+
></app-column-chart>
|
|
44
|
+
}
|
|
45
|
+
</div>
|
|
46
|
+
}
|
|
47
|
+
</div>
|
|
48
|
+
}
|
|
49
|
+
</div>
|
|
50
|
+
}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ChartsAndGraphs } from './charts-and-graphs';
|
|
4
|
+
|
|
5
|
+
describe('ChartsAndGraphs', () => {
|
|
6
|
+
let component: ChartsAndGraphs;
|
|
7
|
+
let fixture: ComponentFixture<ChartsAndGraphs>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [ChartsAndGraphs]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(ChartsAndGraphs);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|