+
+
+
0" style="background-color: #e0e0e0; padding: 5px; margin-bottom: 10px; border-radius: 4px; text-align: center;">
Drilldown Level: {{currentDrilldownLevel}}
diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/gadgets/bar-chart/bar-chart.component.ts b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/gadgets/bar-chart/bar-chart.component.ts
index 9b8278a..edba584 100644
--- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/gadgets/bar-chart/bar-chart.component.ts
+++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/gadgets/bar-chart/bar-chart.component.ts
@@ -1,12 +1,12 @@
-import { Component, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';
-import { Dashboard3Service } from 'src/app/services/builder/dashboard3.service';
+import { Component, Input, OnInit, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
+import { Dashboard3Service } from '../../../../../../services/builder/dashboard3.service';
@Component({
selector: 'app-bar-chart',
templateUrl: './bar-chart.component.html',
styleUrls: ['./bar-chart.component.scss']
})
-export class BarChartComponent implements OnInit, OnChanges {
+export class BarChartComponent implements OnInit, OnChanges, OnDestroy {
@Input() xAxis: string;
@Input() yAxis: string | string[];
@Input() table: string;
@@ -28,6 +28,7 @@ export class BarChartComponent implements OnInit, OnChanges {
@Input() drilldownXAxis: string;
@Input() drilldownYAxis: string;
@Input() drilldownParameter: string; // Add drilldown parameter input
+ // @Input() baseFilters: any[] = []; // Removed base filters input
// Multi-layer drilldown configuration inputs
@Input() drilldownLayers: any[] = []; // Array of drilldown layer configurations
@@ -47,6 +48,8 @@ export class BarChartComponent implements OnInit, OnChanges {
// No data state
noDataAvailable: boolean = false;
+
+ // Filter update timeout property removed
constructor(private dashboardService: Dashboard3Service) { }
@@ -70,12 +73,11 @@ export class BarChartComponent implements OnInit, OnChanges {
const drilldownYAxisChanged = changes.drilldownYAxis && !changes.drilldownYAxis.firstChange;
const drilldownLayersChanged = changes.drilldownLayers && !changes.drilldownLayers.firstChange;
- // Respond to input changes
+ // Only fetch data if the actual chart configuration changed
if (xAxisChanged || yAxisChanged || tableChanged || connectionChanged ||
drilldownEnabledChanged || drilldownApiUrlChanged || drilldownXAxisChanged || drilldownYAxisChanged ||
drilldownLayersChanged) {
- console.log('X or Y axis or table or connection or drilldown config changed, fetching new data');
- // Only fetch data if xAxis, yAxis, table, connection, or drilldown config has changed (and it's not the first change)
+ console.log('Chart configuration changed, fetching new data');
this.fetchChartData();
}
@@ -86,6 +88,8 @@ export class BarChartComponent implements OnInit, OnChanges {
}
}
+ // Filter parameters method removed
+
fetchChartData(): void {
// If we're in drilldown mode, fetch the appropriate drilldown data
if (this.currentDrilldownLevel > 0 && this.drilldownStack.length > 0) {
@@ -104,7 +108,7 @@ export class BarChartComponent implements OnInit, OnChanges {
let parameterValue = '';
// Log the URL that will be called
- const url = `chart/getdashjson/bar?tableName=${this.table}&xAxis=${this.xAxis}&yAxes=${yAxisString}${this.connection ? `&sureId=${this.connection}` : ''}`;
+ let url = `chart/getdashjson/bar?tableName=${this.table}&xAxis=${this.xAxis}&yAxes=${yAxisString}${this.connection ? `&sureId=${this.connection}` : ''}`;
console.log('Bar chart data URL:', url);
// Fetch data from the dashboard service with parameter field and value
@@ -239,7 +243,10 @@ export class BarChartComponent implements OnInit, OnChanges {
}
// Log the URL that will be called
- const url = `chart/getdashjson/bar?tableName=${actualApiUrl}&xAxis=${drilldownConfig.xAxis}&yAxes=${drilldownConfig.yAxis}${this.connection ? `&sureId=${this.connection}` : ''}`;
+ let url = `chart/getdashjson/bar?tableName=${actualApiUrl}&xAxis=${drilldownConfig.xAxis}&yAxes=${drilldownConfig.yAxis}${this.connection ? `&sureId=${this.connection}` : ''}`;
+ if (parameterField && parameterValue) {
+ url += `¶meter=${encodeURIComponent(parameterField)}¶meterValue=${encodeURIComponent(parameterValue)}`;
+ }
console.log('Drilldown data URL:', url);
// Fetch data from the dashboard service with parameter field and value
@@ -433,4 +440,8 @@ export class BarChartComponent implements OnInit, OnChanges {
public chartHovered(e: any): void {
console.log(e);
}
+
+ ngOnDestroy() {
+ // Cleanup method - no timeouts to clean up
+ }
}
\ No newline at end of file