gamma-app-controller 1.0.7 → 1.0.8

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.
@@ -7414,6 +7414,314 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
7414
7414
  args: ['chartDataSource']
7415
7415
  }] } });
7416
7416
 
7417
+ class GammaGeoChartComponent {
7418
+ constructor(commonService) {
7419
+ this.commonService = commonService;
7420
+ this.markers = [];
7421
+ this.bounds = new google.maps.LatLngBounds();
7422
+ this.getTableConfigOutPut = new EventEmitter();
7423
+ this.oRowClick = new EventEmitter();
7424
+ this.onrightClickContextSelection = new EventEmitter();
7425
+ this.rightClickEnable = true;
7426
+ }
7427
+ set chartDataSource(value) {
7428
+ if (value === undefined || value.length === 0) {
7429
+ return;
7430
+ }
7431
+ else {
7432
+ this.isLoader = true;
7433
+ this.page_config = value;
7434
+ this.page_parms = value.titleParams;
7435
+ if (value.kpiConfig.dataSource && value.kpiConfig.dataSource.length !== 0) {
7436
+ if (value.kpiConfig.formate == "monthly") {
7437
+ this.mapTYpe = value.kpiConfig.dataConfig.mapType;
7438
+ if (this.mapTYpe == "geoMap") {
7439
+ this.region = value.kpiConfig.dataConfig.region;
7440
+ this.regionCode = value.kpiConfig.dataConfig.regionCode;
7441
+ this.tootTipColumn = value.kpiConfig.dataConfig.chart_config;
7442
+ let data = value.kpiConfig.dataSource;
7443
+ this.chartHeight = `${value.kpiConfig.dataConfig.size}px`;
7444
+ this.chartType = value.kpiConfig.dataConfig.chartType;
7445
+ this.bacgroundColor = value.kpiConfig.dataConfig.backgroundColor;
7446
+ this.mapColors = value.kpiConfig.dataConfig.colors;
7447
+ const formattedData = [
7448
+ [
7449
+ value.kpiConfig.dataConfig["argumentField"],
7450
+ value.kpiConfig.dataConfig["chartValueField"],
7451
+ { type: "string", role: "tooltip", p: { html: true } },
7452
+ ],
7453
+ ].concat(data.map((item) => {
7454
+ const tooltip = this.getTooltip(item);
7455
+ return [
7456
+ item[value.kpiConfig.dataConfig["argumentField"]],
7457
+ item[value.kpiConfig.dataConfig["chartValueField"]],
7458
+ tooltip,
7459
+ ];
7460
+ }));
7461
+ this.charData = formattedData;
7462
+ setTimeout(() => {
7463
+ this.isLoader = false;
7464
+ }, 200);
7465
+ }
7466
+ else {
7467
+ this.locations = value.kpiConfig.dataSource;
7468
+ this.tootTipColumn = value.kpiConfig.dataConfig.chart_config;
7469
+ this.chartHeight = `${value.kpiConfig.dataConfig.size}px`;
7470
+ this.zoomValuForAll = parseFloat(this.page_config.kpiConfig.dataConfig.zoom);
7471
+ this.mapOptionForHeatMap = {
7472
+ zoom: this.zoomValuForAll
7473
+ };
7474
+ }
7475
+ }
7476
+ }
7477
+ }
7478
+ }
7479
+ ngOnInit() { }
7480
+ ngAfterViewInit() {
7481
+ if (this.mapTYpe == "geoMap") {
7482
+ this.loadGoogleCharts();
7483
+ }
7484
+ else if (this.mapTYpe == "heatMap") {
7485
+ if (this.page_config.kpiConfig.dataConfig.heatMapCategory == "heatMapOnly") {
7486
+ this.isLoader = false;
7487
+ this.loadGoogleHeatOnlyMaps(this.locations);
7488
+ }
7489
+ else if (this.page_config.kpiConfig.dataConfig.heatMapCategory == "heatMapMarker") {
7490
+ this.isLoader = false;
7491
+ this.initializeMap();
7492
+ this.addMarkers();
7493
+ }
7494
+ else {
7495
+ this.isLoader = false;
7496
+ this.initializeHeatWithMarkerMap(this.locations);
7497
+ }
7498
+ }
7499
+ }
7500
+ loadGoogleCharts() {
7501
+ google.charts.load("current", {
7502
+ packages: [this.chartType],
7503
+ });
7504
+ google.charts.setOnLoadCallback(this.drawChart.bind(this));
7505
+ }
7506
+ drawChart() {
7507
+ const data = google.visualization.arrayToDataTable(this.charData);
7508
+ const options = this.getOptionConfig();
7509
+ const chart = new google.visualization.GeoChart(this.googlMap.nativeElement);
7510
+ this.googlMap.nativeElement.style.height = this.chartHeight;
7511
+ chart.draw(data, options);
7512
+ }
7513
+ getTooltip(data) {
7514
+ let toolTipData = "";
7515
+ this.tootTipColumn.forEach((element) => {
7516
+ if (typeof data[element.dataField] === 'number') {
7517
+ toolTipData +=
7518
+ "<div class='inline'><b>" +
7519
+ element.caption +
7520
+ ":</b></div> " +
7521
+ this.commonService.roundOffTillTwo(data[element.dataField], 2) +
7522
+ "<br />";
7523
+ }
7524
+ else {
7525
+ toolTipData +=
7526
+ "<div class='inline'><b>" +
7527
+ element.caption +
7528
+ ":</b></div> " +
7529
+ data[element.dataField] +
7530
+ "<br />";
7531
+ }
7532
+ });
7533
+ return toolTipData;
7534
+ }
7535
+ getOptionConfig() {
7536
+ if (this.region == 'city') {
7537
+ const options = {
7538
+ region: this.regionCode,
7539
+ displayMode: 'markers',
7540
+ backgroundColor: this.bacgroundColor,
7541
+ tooltip: { isHtml: true },
7542
+ colorAxis: { colors: this.mapColors }
7543
+ };
7544
+ return options;
7545
+ }
7546
+ else {
7547
+ const options = {
7548
+ backgroundColor: this.bacgroundColor,
7549
+ tooltip: { isHtml: true },
7550
+ colorAxis: { colors: this.mapColors }
7551
+ };
7552
+ return options;
7553
+ }
7554
+ }
7555
+ initializeMap() {
7556
+ const mapOptions = this.mapOptionForHeatMap;
7557
+ this.map = new google.maps.Map(this.googlMap.nativeElement, mapOptions);
7558
+ this.googlMap.nativeElement.style.height = this.chartHeight;
7559
+ }
7560
+ addMarkers() {
7561
+ this.locations.forEach((location) => {
7562
+ const marker = new google.maps.Marker({
7563
+ position: {
7564
+ lat: parseFloat(location[this.page_config.kpiConfig.dataConfig.markerLatitude]),
7565
+ lng: parseFloat(location[this.page_config.kpiConfig.dataConfig.markerLongitude]),
7566
+ },
7567
+ icon: this.page_config.kpiConfig.dataConfig.icon ? {
7568
+ url: this.page_config.kpiConfig.dataConfig.icon,
7569
+ scaledSize: {
7570
+ width: 32,
7571
+ height: 32,
7572
+ },
7573
+ } : '',
7574
+ map: this.map,
7575
+ title: `${location.city}: $${location.total_sales_amount}`,
7576
+ });
7577
+ this.bounds.extend(marker.getPosition());
7578
+ this.markers.push(marker);
7579
+ let stringWithoutQuotes = this.getInfoWindoData(location);
7580
+ const infoWIndowData = this.getInfoWindoData(location);
7581
+ const infoWindow = new google.maps.InfoWindow({
7582
+ content: `<div style="height: 100%; width: 100%; color: black; font-size: 20px;">
7583
+ ${infoWIndowData}
7584
+ </div>`,
7585
+ });
7586
+ marker.addListener("click", () => {
7587
+ if (this.currentInfoWindow) {
7588
+ this.currentInfoWindow.close();
7589
+ }
7590
+ infoWindow.open(this.map, marker);
7591
+ this.currentInfoWindow = infoWindow;
7592
+ });
7593
+ });
7594
+ this.map.fitBounds(this.bounds);
7595
+ }
7596
+ getInfoWindoData(data) {
7597
+ let toolTipData = ``;
7598
+ this.tootTipColumn.forEach((element) => {
7599
+ if (typeof data[element.dataField] === "number") {
7600
+ toolTipData +=
7601
+ `<div class='inline'><b>` +
7602
+ element.caption +
7603
+ `:</b></div> ` +
7604
+ this.commonService.roundOffTillTwo(data[element.dataField], 2) +
7605
+ `<br />`;
7606
+ }
7607
+ else {
7608
+ toolTipData +=
7609
+ `<div class='inline'><b>` +
7610
+ element.caption +
7611
+ `:</b></div> ` +
7612
+ data[element.dataField] +
7613
+ `<br />`;
7614
+ }
7615
+ });
7616
+ return toolTipData;
7617
+ }
7618
+ loadGoogleHeatOnlyMaps(data) {
7619
+ this.heatmapData = [];
7620
+ data.forEach((element) => {
7621
+ let latitude = parseFloat(element[this.page_config.kpiConfig.dataConfig.markerLatitude]);
7622
+ let logtitude = parseFloat(element[this.page_config.kpiConfig.dataConfig.markerLongitude]);
7623
+ this.heatmapData.push({
7624
+ location: new google.maps.LatLng(latitude, logtitude)
7625
+ });
7626
+ this.bounds.extend(new google.maps.LatLng(latitude, logtitude));
7627
+ });
7628
+ const mapOptions = {
7629
+ zoom: this.zoomValuForAll
7630
+ };
7631
+ this.map = new google.maps.Map(this.googlMap.nativeElement, mapOptions);
7632
+ this.googlMap.nativeElement.style.height = this.chartHeight;
7633
+ this.map.fitBounds(this.bounds);
7634
+ this.heatmap = new google.maps.visualization.HeatmapLayer({
7635
+ data: this.heatmapData,
7636
+ map: this.map,
7637
+ });
7638
+ }
7639
+ initializeHeatWithMarkerMap(data) {
7640
+ this.map = new google.maps.Map(this.googlMap.nativeElement, {
7641
+ zoom: parseFloat(this.page_config.kpiConfig.dataConfig.zoom),
7642
+ });
7643
+ this.googlMap.nativeElement.style.height = this.chartHeight;
7644
+ this.heatmapData = [];
7645
+ data.forEach(element => {
7646
+ let latitude = parseFloat(element[this.page_config.kpiConfig.dataConfig.markerLatitude]);
7647
+ let logtitude = parseFloat(element[this.page_config.kpiConfig.dataConfig.markerLongitude]);
7648
+ this.heatmapData.push({
7649
+ location: new google.maps.LatLng(latitude, logtitude)
7650
+ });
7651
+ this.bounds.extend(new google.maps.LatLng(latitude, logtitude));
7652
+ });
7653
+ this.heatmap = new google.maps.visualization.HeatmapLayer({
7654
+ data: this.heatmapData,
7655
+ map: this.map,
7656
+ });
7657
+ this.locations.forEach((location) => {
7658
+ const marker = new google.maps.Marker({
7659
+ position: {
7660
+ lat: parseFloat(location[this.page_config.kpiConfig.dataConfig.markerLatitude]),
7661
+ lng: parseFloat(location[this.page_config.kpiConfig.dataConfig.markerLongitude]),
7662
+ },
7663
+ icon: this.page_config.kpiConfig.dataConfig.icon ? {
7664
+ url: this.page_config.kpiConfig.dataConfig.icon,
7665
+ scaledSize: {
7666
+ width: 32,
7667
+ height: 32,
7668
+ },
7669
+ } : '',
7670
+ map: this.map,
7671
+ title: `${location.city}: $${location.total_sales_amount}`,
7672
+ });
7673
+ this.bounds.extend(marker.getPosition());
7674
+ this.markers.push(marker);
7675
+ const infoWIndowData = this.getInfoWindoData(location);
7676
+ const infoWindow = new google.maps.InfoWindow({
7677
+ content: `<div style="height: 100%; width: 100%; color: black; font-size: 20px;">
7678
+ ${infoWIndowData}
7679
+ </div>`,
7680
+ });
7681
+ marker.addListener("click", () => {
7682
+ if (this.currentInfoWindow) {
7683
+ this.currentInfoWindow.close();
7684
+ }
7685
+ infoWindow.open(this.map, marker);
7686
+ this.currentInfoWindow = infoWindow;
7687
+ });
7688
+ });
7689
+ this.map.fitBounds(this.bounds);
7690
+ this.map.addListener('zoom_changed', () => this.handleZoomChange());
7691
+ }
7692
+ handleZoomChange() {
7693
+ const zoomLevel = this.map.getZoom();
7694
+ if (zoomLevel < 5) {
7695
+ this.heatmap.setMap(this.map);
7696
+ this.markers.forEach((marker) => marker.setMap(null));
7697
+ }
7698
+ else {
7699
+ this.heatmap.setMap(null);
7700
+ this.markers.forEach((marker) => marker.setMap(this.map));
7701
+ }
7702
+ }
7703
+ }
7704
+ GammaGeoChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GammaGeoChartComponent, deps: [{ token: CommonService }], target: i0.ɵɵFactoryTarget.Component });
7705
+ GammaGeoChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: GammaGeoChartComponent, selector: "app-gamma-geo-chart", inputs: { rightClickEnable: "rightClickEnable", chartDataSource: "chartDataSource" }, outputs: { getTableConfigOutPut: "getTableConfigOutPut", oRowClick: "oRowClick", onrightClickContextSelection: "onrightClickContextSelection" }, viewQueries: [{ propertyName: "googlMap", first: true, predicate: ["googlMap"], descendants: true }], ngImport: i0, template: "\n<div class=\"mx-2 bg-gray-800\">\n <ng-container *ngIf=\"isLoader\">\n <div class=\"flex justify-center items-start bg-gray-800 p-2\">\n <app-loader></app-loader>\n </div>\n </ng-container>\n\n <div class=\"mx-2 pb-2\">\n\n <ng-container>\n <div id=\"regions_div\" #googlMap style=\"width: 100%\" ></div> \n </ng-container>\n \n \n\n </div>\n\n\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: LoaderComponent, selector: "app-loader" }] });
7706
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GammaGeoChartComponent, decorators: [{
7707
+ type: Component,
7708
+ args: [{ selector: "app-gamma-geo-chart", template: "\n<div class=\"mx-2 bg-gray-800\">\n <ng-container *ngIf=\"isLoader\">\n <div class=\"flex justify-center items-start bg-gray-800 p-2\">\n <app-loader></app-loader>\n </div>\n </ng-container>\n\n <div class=\"mx-2 pb-2\">\n\n <ng-container>\n <div id=\"regions_div\" #googlMap style=\"width: 100%\" ></div> \n </ng-container>\n \n \n\n </div>\n\n\n</div>\n" }]
7709
+ }], ctorParameters: function () { return [{ type: CommonService }]; }, propDecorators: { googlMap: [{
7710
+ type: ViewChild,
7711
+ args: ["googlMap"]
7712
+ }], getTableConfigOutPut: [{
7713
+ type: Output
7714
+ }], oRowClick: [{
7715
+ type: Output
7716
+ }], onrightClickContextSelection: [{
7717
+ type: Output
7718
+ }], rightClickEnable: [{
7719
+ type: Input
7720
+ }], chartDataSource: [{
7721
+ type: Input,
7722
+ args: ["chartDataSource"]
7723
+ }] } });
7724
+
7417
7725
  class kpicommonService {
7418
7726
  constructor(commonService) {
7419
7727
  this.commonService = commonService;
@@ -8941,7 +9249,8 @@ class PageConfigComponent {
8941
9249
  GammaTableWithPercentageComponent,
8942
9250
  GammSingleNumberCardComponent,
8943
9251
  GammaAdvanceOperatorTableComponent,
8944
- AdvanceWidgetHeaderFilterComponent
9252
+ AdvanceWidgetHeaderFilterComponent,
9253
+ GammaGeoChartComponent
8945
9254
  };
8946
9255
  this.dataSourceMataData = [];
8947
9256
  this.queryType = "mongo";
@@ -10485,7 +10794,8 @@ PackageApplicationControllerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion
10485
10794
  GoogleGeoMapComponent,
10486
10795
  GammaTableClumnBarChartComponent,
10487
10796
  ApplicationMenusComponent,
10488
- ApplicationCreateMenuComponent], imports: [CommonModule, i2.RouterModule, DevExtremeModule,
10797
+ ApplicationCreateMenuComponent,
10798
+ GammaGeoChartComponent], imports: [CommonModule, i2.RouterModule, DevExtremeModule,
10489
10799
  DxButtonModule,
10490
10800
  DxCheckBoxModule,
10491
10801
  DxNumberBoxModule,
@@ -10542,7 +10852,8 @@ PackageApplicationControllerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion
10542
10852
  GeoMapComponent,
10543
10853
  SafeHtmlPipe,
10544
10854
  GoogleGeoMapComponent,
10545
- GammaTableClumnBarChartComponent] });
10855
+ GammaTableClumnBarChartComponent,
10856
+ GammaGeoChartComponent] });
10546
10857
  PackageApplicationControllerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PackageApplicationControllerModule, providers: [
10547
10858
  ApplicationContentService,
10548
10859
  ApplicationDatssetsCall
@@ -10624,7 +10935,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10624
10935
  GoogleGeoMapComponent,
10625
10936
  GammaTableClumnBarChartComponent,
10626
10937
  ApplicationMenusComponent,
10627
- ApplicationCreateMenuComponent
10938
+ ApplicationCreateMenuComponent,
10939
+ GammaGeoChartComponent
10628
10940
  ],
10629
10941
  imports: [
10630
10942
  CommonModule,
@@ -10689,7 +11001,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10689
11001
  GeoMapComponent,
10690
11002
  SafeHtmlPipe,
10691
11003
  GoogleGeoMapComponent,
10692
- GammaTableClumnBarChartComponent
11004
+ GammaTableClumnBarChartComponent,
11005
+ GammaGeoChartComponent
10693
11006
  ],
10694
11007
  providers: [
10695
11008
  ApplicationContentService,
@@ -10739,5 +11052,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10739
11052
  }]
10740
11053
  }] });
10741
11054
 
10742
- export { APP_ENVIRONMENT, AdvanceWidgetHeaderFilterComponent, AppAdvanceHeaderComponent, AppHttpService, AppTitleComponent, ApplicationContentService, ApplicationDatssetsCall, ApplicationFilterComponent, ApplicationViewsComponent, BreadCrumbsComponent, CdrConfigComponent, CommonHeaderComponent, CommonService, CreateCompViewComponent, CreateDatasetComponent, CreateDatasetJsonComponent, CreateDatasetSqlComponent, DashChartComponent, DashTableComponent, GamamWidgetComponent, GammSingleNumberCardComponent, GammaAdvanceChartComponent, GammaAdvanceFilterComponent, GammaAdvanceOperatorTableComponent, GammaAppControllerComponent, GammaAppControllerModule, GammaAppControllerService, GammaTableClumnBarChartComponent, GammaTableWithPercentageComponent, GammaTodayPreviousComponent, GeoMapComponent, GoogleGeoMapComponent, IconsModule, LoaderComponent, LoadingComponent, LoadingModule, PackageApplicationControllerModule, SafeHtmlPipe, SqlPipe, TableWithBarComponent, contentSafeHtml, kpicommonService$2 as kpicommonService };
11055
+ export { APP_ENVIRONMENT, AdvanceWidgetHeaderFilterComponent, AppAdvanceHeaderComponent, AppHttpService, AppTitleComponent, ApplicationContentService, ApplicationDatssetsCall, ApplicationFilterComponent, ApplicationViewsComponent, BreadCrumbsComponent, CdrConfigComponent, CommonHeaderComponent, CommonService, CreateCompViewComponent, CreateDatasetComponent, CreateDatasetJsonComponent, CreateDatasetSqlComponent, DashChartComponent, DashTableComponent, GamamWidgetComponent, GammSingleNumberCardComponent, GammaAdvanceChartComponent, GammaAdvanceFilterComponent, GammaAdvanceOperatorTableComponent, GammaAppControllerComponent, GammaAppControllerModule, GammaAppControllerService, GammaGeoChartComponent, GammaTableClumnBarChartComponent, GammaTableWithPercentageComponent, GammaTodayPreviousComponent, GeoMapComponent, GoogleGeoMapComponent, IconsModule, LoaderComponent, LoadingComponent, LoadingModule, PackageApplicationControllerModule, SafeHtmlPipe, SqlPipe, TableWithBarComponent, contentSafeHtml, kpicommonService$2 as kpicommonService };
10743
11056
  //# sourceMappingURL=gamma-app-controller.mjs.map