ngx-deebodata 0.0.1 → 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 (78) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -1
  3. package/ng-package.json +7 -0
  4. package/package.json +16 -33
  5. package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.css +156 -0
  6. package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.html +29 -0
  7. package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.spec.ts +23 -0
  8. package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.ts +286 -0
  9. package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.css +27 -0
  10. package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.html +53 -0
  11. package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.spec.ts +23 -0
  12. package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.ts +214 -0
  13. package/src/lib/data-table/charts/column-chart/column-chart.css +19 -0
  14. package/src/lib/data-table/charts/column-chart/column-chart.html +47 -0
  15. package/src/lib/data-table/charts/column-chart/column-chart.spec.ts +23 -0
  16. package/src/lib/data-table/charts/column-chart/column-chart.ts +178 -0
  17. package/src/lib/data-table/charts/line-graph-component/line-graph-component.css +33 -0
  18. package/src/lib/data-table/charts/line-graph-component/line-graph-component.html +59 -0
  19. package/src/lib/data-table/charts/line-graph-component/line-graph-component.spec.ts +23 -0
  20. package/src/lib/data-table/charts/line-graph-component/line-graph-component.ts +661 -0
  21. package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.css +61 -0
  22. package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.html +27 -0
  23. package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.spec.ts +23 -0
  24. package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.ts +210 -0
  25. package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.css +0 -0
  26. package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.html +15 -0
  27. package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.spec.ts +23 -0
  28. package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.ts +197 -0
  29. package/src/lib/data-table/data-table-module/data-cell/data-cell.css +0 -0
  30. package/src/lib/data-table/data-table-module/data-cell/data-cell.html +6 -0
  31. package/src/lib/data-table/data-table-module/data-cell/data-cell.spec.ts +23 -0
  32. package/src/lib/data-table/data-table-module/data-cell/data-cell.ts +271 -0
  33. package/src/lib/data-table/data-table-module/data-table-header/data-table-header.css +25 -0
  34. package/src/lib/data-table/data-table-module/data-table-header/data-table-header.html +55 -0
  35. package/src/lib/data-table/data-table-module/data-table-header/data-table-header.spec.ts +23 -0
  36. package/src/lib/data-table/data-table-module/data-table-header/data-table-header.ts +261 -0
  37. package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.css +69 -0
  38. package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.html +24 -0
  39. package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.spec.ts +23 -0
  40. package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.ts +125 -0
  41. package/src/lib/data-table/data-table-module/export-component/export-component.css +91 -0
  42. package/src/lib/data-table/data-table-module/export-component/export-component.html +16 -0
  43. package/src/lib/data-table/data-table-module/export-component/export-component.spec.ts +23 -0
  44. package/src/lib/data-table/data-table-module/export-component/export-component.ts +206 -0
  45. package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.css +91 -0
  46. package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.html +193 -0
  47. package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.spec.ts +23 -0
  48. package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.ts +2226 -0
  49. package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.css +14 -0
  50. package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.html +27 -0
  51. package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.spec.ts +23 -0
  52. package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.ts +58 -0
  53. package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.css +23 -0
  54. package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.html +48 -0
  55. package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.spec.ts +23 -0
  56. package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.ts +599 -0
  57. package/src/lib/data-table/data-table-module/worker.worker.ts +44 -0
  58. package/src/lib/interfaces/cell-edit.ts +5 -0
  59. package/src/lib/interfaces/column-header.ts +10 -0
  60. package/src/lib/interfaces/column-styles.ts +14 -0
  61. package/src/lib/interfaces/column-symbol.ts +4 -0
  62. package/src/lib/interfaces/data-cell.ts +14 -0
  63. package/src/lib/interfaces/data-row.ts +11 -0
  64. package/src/lib/interfaces/row-number.ts +4 -0
  65. package/src/lib/services/common-service.spec.ts +16 -0
  66. package/src/lib/services/common-service.ts +336 -0
  67. package/src/lib/services/data-table-service.spec.ts +16 -0
  68. package/src/lib/services/data-table-service.ts +597 -0
  69. package/src/lib/services/table-drag-service.spec.ts +16 -0
  70. package/src/lib/services/table-drag-service.ts +347 -0
  71. package/src/lib/styles.css +1065 -0
  72. package/src/public-api.ts +8 -0
  73. package/tsconfig.lib.json +17 -0
  74. package/tsconfig.lib.prod.json +11 -0
  75. package/tsconfig.spec.json +15 -0
  76. package/fesm2022/ngx-deebodata.mjs +0 -6863
  77. package/fesm2022/ngx-deebodata.mjs.map +0 -1
  78. package/types/ngx-deebodata.d.ts +0 -439
package/LICENSE CHANGED
@@ -1 +1 @@
1
- By entering into this agreement with Cedar Technologies LLC, you agree that before deploying to any live url (anything not http://localhost:4200/), you will obtain 1 deployment license PER DEVELOPER, PER APPLICATION by visiting https://deebodata.com/data-grid-checkout/angular. You will receive 1 key that can be shared by each developer a license was obtained for. The data grid module will work without restriction during development on http://localhost:4200/. Unless you opt out, the licensor - Cedar Technologies LLC, is responsible for bug fixes and adequate support for 1 Yr. upon purchase.
1
+ By entering into this agreement with Cedar Technologies LLC, you agree that before deploying to any live url (anything besides http://localhost:4200/), you will obtain 1 deployment license PER DEVELOPER, PER APPLICATION by visiting https://deebodata.com/data-grid-checkout/angular. You will receive 1 key that can be shared by each developer a license was obtained for. The data grid module will work without restriction during development on http://localhost:4200/. Unless you opt out, the licensor - Cedar Technologies LLC, is responsible for bug fixes and adequate support for 1 Yr. upon purchase.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NgxDeebodata
2
2
 
3
- DeeboData for Angular - a commercial data grid with virtual scroll, integrated charts
3
+ DeeboData for Angular - a commercial data grid with virtual scroll, integrated charts,
4
4
  column resizing, toggle column visibility, cell editing, tab accessibility, sorting with
5
5
  priority, and advanced filtering.
6
6
 
@@ -40,6 +40,7 @@ import { NgxDeebodata } from 'ngx-deebodata';
40
40
  [primaryKey]="'employee_id'"
41
41
  [defRowHgt]="'50px'"
42
42
  [defGridHgt]="500"
43
+ [licenseKey]="licenseKey"
43
44
  [pieGraphColors]="['red', 'blue', 'lightgray', 'orange', 'green']"
44
45
  [removePieCovers]="false"
45
46
  [altRowColor]="'#ececec'"
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/ngx-deebodata",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,33 +1,16 @@
1
- {
2
- "name": "ngx-deebodata",
3
- "version": "0.0.1",
4
- "peerDependencies": {
5
- "@angular/common": "^21.2.0",
6
- "@angular/core": "^21.2.0",
7
- "@angular/forms": "^21.2.0",
8
- "@angular/platform-browser": "^21.2.0"
9
- },
10
- "dependencies": {
11
- "tslib": "^2.3.0"
12
- },
13
- "sideEffects": false,
14
- "license": "(c) Copyright 2026 Cedar Technologies LLC. All rights reserved.",
15
- "keywords": [
16
- "data",
17
- "grid",
18
- "open-source",
19
- "datagrid"
20
- ],
21
- "module": "fesm2022/ngx-deebodata.mjs",
22
- "typings": "types/ngx-deebodata.d.ts",
23
- "exports": {
24
- "./package.json": {
25
- "default": "./package.json"
26
- },
27
- ".": {
28
- "types": "./types/ngx-deebodata.d.ts",
29
- "default": "./fesm2022/ngx-deebodata.mjs"
30
- }
31
- },
32
- "type": "module"
33
- }
1
+ {
2
+ "name": "ngx-deebodata",
3
+ "version": "0.0.2",
4
+ "peerDependencies": {
5
+ "@angular/common": "^21.2.0",
6
+ "@angular/core": "^21.2.0",
7
+ "@angular/forms": "^21.2.0",
8
+ "@angular/platform-browser": "^21.2.0"
9
+ },
10
+ "dependencies": {
11
+ "tslib": "^2.3.0"
12
+ },
13
+ "sideEffects": false,
14
+ "license": "(c) Copyright 2026 Cedar Technologies LLC. All rights reserved.",
15
+ "keywords": ["data", "grid", "datagrid", "enterprise", "charts", "commercial"]
16
+ }
@@ -0,0 +1,156 @@
1
+ :host{
2
+ --accent-color:rgb(50, 50, 50);
3
+ --grid-color:rgb(199, 199, 199);
4
+ --pad-left-base: 33px;
5
+ --row-num-width: 75px;
6
+ --reg-font-size: 17px
7
+ }
8
+
9
+ .inner-bg-contain{
10
+ position: relative;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ .inner-bg-contain::before{
15
+ top: 50%;
16
+ left: -48px;
17
+ font-size: x-large;
18
+ position: absolute;
19
+ display: block;
20
+ color: var(--grid-color);
21
+ content: attr(data-yaxis);
22
+ transform: rotate(-90deg);
23
+ }
24
+
25
+ .stat-opt-contain{
26
+ white-space: nowrap;
27
+ margin-bottom: 27px;
28
+ }
29
+
30
+ .stat-opt-btn{
31
+ width: 100%;
32
+ padding-bottom: 3px;
33
+ box-sizing: border-box;
34
+ }
35
+
36
+ .stat-opt-btn-active{
37
+ font-weight: bold;
38
+ border-bottom: 2px solid var(--grid-color);
39
+ }
40
+
41
+ .bar-graph-y-cols{
42
+ z-index: 5;
43
+ margin-left: 5px;
44
+ overflow: visible;
45
+ position: relative;
46
+ vertical-align: top;
47
+ box-sizing: border-box;
48
+ display: inline-block;
49
+ border-right: 1px solid var(--grid-color);
50
+ }
51
+
52
+ .bar-graph-real-vals{
53
+ position: relative;
54
+ }
55
+
56
+ .bar-graph-x-cols{
57
+ padding-top: 11px;
58
+ white-space: nowrap;
59
+ overflow-x: visible;
60
+ border-top: 1px solid var(--grid-color);
61
+ }
62
+
63
+ .bg-dep-var{
64
+ overflow: hidden;
65
+ height: 70px;
66
+ width: 100%;
67
+ display: flex;
68
+ padding: 0 5px;
69
+ font-size: 14px;
70
+ align-items: end;
71
+ font-weight: 500;
72
+ justify-content: right;
73
+ box-sizing: border-box;
74
+ }
75
+
76
+ .bg-dep-var div{
77
+ word-break:break-all;
78
+ color: var(--accent-color);
79
+ }
80
+
81
+ .bg-dep-var:first-of-type{
82
+ height: 17px !important;
83
+ position: relative;
84
+ overflow: visible !important;
85
+ }
86
+
87
+ .bg-dep-var:first-of-type::before{
88
+ top: 0;
89
+ overflow: visible;
90
+ position: absolute;
91
+ content: attr(data-number);
92
+ visibility: visible !important
93
+ }
94
+
95
+ .bg-dep-var:last-of-type{
96
+ overflow: visible !important;
97
+ }
98
+
99
+ .bg-dep-var:last-of-type::after{
100
+ content: attr(data-number);
101
+ margin-bottom: -7px;
102
+ }
103
+
104
+ .graph-actual-bar{
105
+ bottom: 0;
106
+ position: absolute;
107
+ align-items: center;
108
+ background: white;
109
+ }
110
+
111
+ .graph-actual-bar div{/*these divs are the actual colored bars*/
112
+ height: 0;
113
+ width: 80%;
114
+ margin: 0 auto;
115
+ background: #afafaf;
116
+ transition: height 0.3s ease-out;
117
+ }
118
+
119
+ .graph-actual-bar:hover{
120
+ z-index: 10;
121
+ }
122
+
123
+ .graph-actual-bar:hover::before{
124
+ width: 150px;
125
+ display: block;
126
+ font-weight: 500;
127
+ font-size: small;
128
+ white-space: nowrap;
129
+ background: white;
130
+ padding: 1px 2px 3px 2px;
131
+ content: attr(data-value);
132
+ border-radius: 3px;
133
+ }
134
+
135
+ .bg-ind-var{
136
+ font-size: small;
137
+ font-weight: 500;
138
+ overflow: hidden;
139
+ text-overflow: ellipsis;
140
+ display: inline-block;
141
+ color: var(--accent-color);
142
+ transform: rotate(45deg);
143
+ }
144
+
145
+ .lbl-show{
146
+ overflow: visible !important;
147
+ transition: overflow 0.2s ease;
148
+ }
149
+
150
+ .bar-graph-x-label{
151
+ font-size: x-large;
152
+ font-weight: 500;
153
+ padding-top: 17px;
154
+ text-align: center;
155
+ overflow-x: hidden;
156
+ }
@@ -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,286 @@
1
+ import { Component, ElementRef, EventEmitter, Input, ViewChild, Output, HostListener, signal, NgZone } 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
+ showing: boolean = false
25
+ buildingStat: boolean = false
26
+ maxYVal: string = "0";
27
+ statData: any[] = []
28
+ selStat = signal<string>("avg")
29
+ numYPlots: number = 5
30
+ bgDepVarHgt: number = 70//height of y ticks
31
+ statOpts: string[] = ["avg", "min", "max", "mode", "median", "sum"]
32
+ statBtnWid: string = "30px"
33
+ titleTrail: string = ""
34
+ @Input() column: string = ""
35
+ @Input() data: any[] = []
36
+ @Output("title") title: EventEmitter<string> = new EventEmitter();
37
+ @ViewChild("innerGB", { static: true }) innerGB!: ElementRef;
38
+ @ViewChild("xLabel", { static: true }) xLabel!: ElementRef;
39
+ @ViewChild("xValues", { static: true }) xValues!: ElementRef;
40
+ @ViewChild("yAxis", { static: true }) yAxis!: ElementRef;
41
+ @ViewChild("statOptsCont", { static: true }) statOptsCont!: ElementRef;
42
+ @ViewChild("barContainer", { static: true }) barContainer!: ElementRef;
43
+
44
+ constructor(public common: CommonService,
45
+ private dataTableService: DataTableService,
46
+ private _zone: NgZone,
47
+ ){ }
48
+
49
+ ngOnInit() {
50
+ this.buildBarGraphWithTwoCols(this.selStat())
51
+ }
52
+
53
+ ngAfterContentInit() {
54
+ this.handleBGBarHgts(this.statData)
55
+ setTimeout( () => { this.sizeUpBgDims() })
56
+ }
57
+
58
+ sizeUpBgDims() {
59
+ const bgWid = this.innerGB.nativeElement.getBoundingClientRect().width
60
+ const yWid = this.yAxis.nativeElement.getBoundingClientRect().width
61
+ const offY = Math.ceil(yWid+5)
62
+ this.statBtnWid = Math.floor((bgWid-offY)/this.statOpts.length) + "px";
63
+ this.statOptsCont.nativeElement.style.marginLeft = offY + "px";
64
+ this.xValues.nativeElement.style.marginLeft = offY + "px";
65
+ this.barContainer.nativeElement.style.marginLeft = offY + "px";
66
+ this.xLblWidth = Math.min(this.maxBarWid, (Math.floor((bgWid-offY)/this.xLabels.length))) + "px";
67
+ }
68
+
69
+ buildBarGraphWithTwoCols(stat: string) {
70
+ const bgCols = this.column.split(this.dataTableService.bgSep)
71
+ const strCol = bgCols[0]
72
+ const numCol = bgCols[1]
73
+ if(!this.titleTrail)
74
+ this.titleTrail = this.common.titleCase(numCol) + " by " + this.common.titleCase(strCol);
75
+ const vals = this.dataTableService.dataFilSrtTracker[strCol].selDDVals.filter( (g: any) => g.value !== "(Select All)")
76
+ const vlen = vals.length
77
+ let o = 0
78
+ for(o; o < vlen; o++){
79
+ const val = vals[o].value
80
+ const justVal = this.data.filter( d => d["strColumn"] === val).map( d => d["numColumn"] )
81
+ const jvlen = justVal.length
82
+ if(jvlen){//["avg", "min", "max", "mode", "median", "sum"]
83
+ let statobj = {x: val, y: 0}
84
+ if(stat === "avg")
85
+ statobj.y = (justVal.reduce( (acc, curr) => (acc += curr) , 0)/jvlen)
86
+ if(stat === "min")
87
+ statobj.y = Math.min(...justVal)
88
+ if(stat === "max")
89
+ statobj.y = Math.max(...justVal)
90
+ if(stat === "sum")
91
+ statobj.y = (justVal.reduce( (acc, curr) => (acc += curr) , 0))
92
+ if(stat === "median")
93
+ statobj.y = this.findDataMedian(justVal, jvlen)
94
+ if(stat === "mode")
95
+ statobj.y = this.findDataMode(justVal)
96
+ this.statData.push(statobj)
97
+ this.xLabels.push(val)
98
+ }
99
+ }
100
+ const justNull = this.data.filter( d => d["strColumn"] === "N/A").map( d => d["numColumn"] )
101
+ const jlen = justNull.length
102
+ if(jlen){
103
+ let statobj = {x: "N/A", y: 0}
104
+ if(stat === "avg")
105
+ statobj.y = (justNull.reduce( (acc, curr) => (acc += curr) , 0)/jlen)
106
+ if(stat === "min")
107
+ statobj.y = Math.min(...justNull)
108
+ if(stat === "max")
109
+ statobj.y = Math.max(...justNull)
110
+ if(stat === "sum")
111
+ statobj.y = (justNull.reduce( (acc, curr) => (acc += curr) , 0))
112
+ if(stat === "median")
113
+ statobj.y = this.findDataMedian(justNull, jlen)
114
+ if(stat === "mode")
115
+ statobj.y = this.findDataMode(justNull)
116
+ this.statData.push(statobj)
117
+ this.xLabels.push("N/A")
118
+ }
119
+ const par = this.innerGB.nativeElement
120
+ const nums = this.statData.map( d => d["y"] );
121
+ let srtNums = nums.sort( (a, b) => a - b > 0 ? 1 : -1 )
122
+ const max = srtNums[(nums.length-1)]
123
+ let lbly = this.common.sanitizeUi(numCol)
124
+ const sym = this.dataTableService.dataFilSrtTracker[numCol].colCellSymbol
125
+ if(sym)
126
+ lbly += " ("+sym+")";
127
+ par.setAttribute("data-yaxis", lbly)
128
+ this.xLabel.nativeElement.textContent = this.common.sanitizeUi(this.common.titleCase(strCol))
129
+ this.buildYAxisBGVals(max)
130
+ setTimeout( () => { this.buildBGBars(this.statData, max, sym) })
131
+ setTimeout( () => { this.buildingStat = false }, 500)
132
+ }
133
+
134
+ buildBGBars(data: any[], max: number, sym: any) {
135
+ let i = 0
136
+ const len = data.length
137
+ let background: string = "initial"
138
+ const yAx = this.yAxis.nativeElement
139
+ const ybds = yAx.getBoundingClientRect()
140
+ const yWid = ybds.width
141
+ const offY = Math.ceil(yWid+5)
142
+ const whiteTxt = ["white", "#FFFFFF", "#ffffff", "rgb(255, 255, 255)", "rgb(255,255,255)"];
143
+ if(this.dataTableService.themeColor1 && whiteTxt.indexOf(this.dataTableService.themeColor1) < 0)
144
+ background = this.dataTableService.themeColor1;
145
+ const useIncr = Math.min(this.maxBarWid, (Math.floor((this.innerGB.nativeElement.getBoundingClientRect().width-offY)/this.xLabels.length)))
146
+ for(i; i < len; i++){
147
+ const item = data[i]
148
+ const bhgt = item["y"]/max;
149
+ const strVal = item["y"].toLocaleString(undefined, {maximumFractionDigits: 2})
150
+ let symb4 = ""
151
+ let symaf = ""
152
+ if(sym){
153
+ let isCurr = ["$","€","£","¥","₣","₹"].indexOf(sym) > -1
154
+ if(isCurr)
155
+ symb4 = sym
156
+ else
157
+ symaf = sym
158
+ }
159
+ const fVal = item["x"] + ': ' + symb4 + strVal + symaf;
160
+ const bv = { id: item["x"], left: ((i*useIncr) + "px"), heightVal: bhgt, height: "0px", fullValue: fVal, numValue: strVal, background: background}
161
+ this.barVals.push(bv);
162
+ }
163
+ this.handleBGBarHgts(data)
164
+ }
165
+
166
+ handleBGBarHgts(data: any[]) {
167
+ let i = 0
168
+ let show = false
169
+ const len = data.length
170
+ const ybds = this.yAxis.nativeElement.getBoundingClientRect()
171
+ const maxHgt = ybds.height
172
+ const cont = document.getElementById("insField" + this.common.elifyCol(this.column))
173
+ const cBds = cont?.getBoundingClientRect()
174
+ const insTop = document.getElementsByClassName("chart-contain-show")[0]?.scrollTop || 0;
175
+ if(cBds && (cBds.bottom-(cBds.height/2)) < (this.dataTableService.tblTop+insTop+this.dataTableService.dTblHeight))
176
+ show = true;
177
+ if(show){
178
+ for(i; i < len; i++){
179
+ const item = data[i]
180
+ const xvalue = item["x"]
181
+ const bv = this.barVals.find( b => b.id === xvalue)
182
+ if(bv){
183
+ this.showing = true
184
+ setTimeout( () => {
185
+ this._zone.run( () => { bv.height = (Math.ceil(bv.heightVal*maxHgt) + "px"); this.barVals = [...this.barVals] });
186
+ }, 250 )
187
+ }
188
+ }
189
+ }
190
+ }
191
+
192
+ buildYAxisBGVals(max: number) {
193
+ let nts: string[] = []
194
+ // let diff = max - min
195
+ const incr = max/(this.numYPlots-1)
196
+ const strNum = (val: number) => {
197
+ return val < 1000 ? val.toLocaleString(undefined, {maximumFractionDigits: 0}) : this.common.doBigData(val);
198
+ }
199
+ for(let i = (this.numYPlots-1); i >= 0; i--){
200
+ try{
201
+ const inc = i*incr
202
+ let useVal = inc//(min + inc)
203
+ if(i === 0)
204
+ useVal = 0//min
205
+ if(i === (this.numYPlots-1))
206
+ useVal = max
207
+ const strVal = strNum(useVal);
208
+ if(i === (this.numYPlots-1))
209
+ this.maxYVal = strVal
210
+ nts.push(strVal)
211
+ }catch(e){}
212
+ }
213
+ this.numTicks.set([...nts])
214
+ }
215
+
216
+ handleStatChange(stat: string, resize?: boolean) {
217
+ if(this.selStat() === stat && !resize)
218
+ return;
219
+ this.buildingStat = true
220
+ this.maxYVal = "0"
221
+ this.selStat.set(stat)
222
+ this.numTicks.set([])
223
+ this.barVals = []
224
+ this.xLabels = []
225
+ this.statData = []
226
+ if(!resize)
227
+ this.title.emit(this.common.titleCase(stat) + " " + this.titleTrail);
228
+ setTimeout( () => {
229
+ this.buildBarGraphWithTwoCols(stat);
230
+ setTimeout( () => { this.sizeUpBgDims() })
231
+ })
232
+ }
233
+
234
+ findDataMedian(data: number[], len: number): number {
235
+ if(len === 1)
236
+ return data[0]
237
+ if(len === 2)
238
+ return (data[0]+data[1])/2
239
+ const isOdd = len%2 !== 0
240
+ if(isOdd){
241
+ return data[Math.ceil(len/2)]
242
+ } else {
243
+ const loMed = data[len/2]
244
+ const hiMed = data[len/2] + 1
245
+ return (loMed+hiMed)/2
246
+ }
247
+ }
248
+
249
+ getColumnValueCounts(data: any[]) {
250
+ let i = 0
251
+ let count: any = {}
252
+ const len = data.length
253
+ for(i; i < len; i++){
254
+ const d = data[i]
255
+ const val = "v" + d
256
+ if(!count[val] || typeof count[val] === "undefined")
257
+ count[val] = 1
258
+ else
259
+ count[val] += 1
260
+ }
261
+ return count;
262
+ }
263
+
264
+ findDataMode(data: any[]): number {
265
+ const count = this.getColumnValueCounts(data)
266
+ let most = null
267
+ for(const prop in count){
268
+ if(!most)
269
+ most = {text: prop, amount: count[prop]}
270
+ if(count[prop] > most.amount)
271
+ most = {text: prop, amount: count[prop]}
272
+ }
273
+ if(most)
274
+ return parseInt(most?.text.replace("v", ""))
275
+ return 0;
276
+ }
277
+
278
+ lblMouseIn(el: any) {
279
+ el.classList.add("lbl-show")
280
+ }
281
+
282
+ lblMouseOut(el: any) {
283
+ el.classList.remove("lbl-show")
284
+ }
285
+
286
+ }
@@ -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
+ });