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