bar chart
This commit is contained in:
parent
bedcc0822d
commit
f740076d60
@ -1,4 +1,4 @@
|
|||||||
<div style="display: block; height: 100%; width: 100%;">
|
<div class="chart-container">
|
||||||
<!-- Filter Controls Section -->
|
<!-- Filter Controls Section -->
|
||||||
<div class="filter-section" *ngIf="hasActiveFilters()">
|
<div class="filter-section" *ngIf="hasActiveFilters()">
|
||||||
<!-- Base Filters -->
|
<!-- Base Filters -->
|
||||||
@ -245,54 +245,90 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Header row with chart title and drilldown navigation -->
|
<!-- Header row with chart title and drilldown navigation -->
|
||||||
<div class="clr-row header-row">
|
<div class="chart-header">
|
||||||
<div class="clr-col-6">
|
<div class="clr-row header-row">
|
||||||
<h3 class="chart-title">{{charttitle || 'Bar Chart'}}</h3>
|
<div class="clr-col-6">
|
||||||
|
<h3 class="chart-title">{{charttitle || 'Bar Chart'}}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="clr-col-6" style="text-align: right;">
|
||||||
|
<!-- Add drilldown navigation controls -->
|
||||||
|
<button class="btn btn-sm btn-link" *ngIf="drilldownEnabled && drilldownStack.length > 0" (click)="navigateBack()">
|
||||||
|
<cds-icon shape="arrow" direction="left"></cds-icon>
|
||||||
|
Back to {{drilldownStack.length > 1 ? 'Previous Level' : 'Main Data'}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clr-col-6" style="text-align: right;">
|
|
||||||
<!-- Add drilldown navigation controls -->
|
|
||||||
<button class="btn btn-sm btn-link" *ngIf="drilldownEnabled && drilldownStack.length > 0" (click)="navigateBack()">
|
|
||||||
<cds-icon shape="arrow" direction="left"></cds-icon>
|
|
||||||
Back to {{drilldownStack.length > 1 ? 'Previous Level' : 'Main Data'}}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Show current drilldown level -->
|
<!-- Show current drilldown level -->
|
||||||
<div class="clr-row" *ngIf="drilldownEnabled && drilldownStack.length > 0">
|
<div class="clr-row" *ngIf="drilldownEnabled && drilldownStack.length > 0">
|
||||||
<div class="clr-col-12">
|
<div class="clr-col-12">
|
||||||
<div class="alert alert-info" style="padding: 8px 12px; margin-bottom: 12px;">
|
<div class="alert alert-info" style="padding: 8px 12px; margin-bottom: 12px;">
|
||||||
<div class="alert-items">
|
<div class="alert-items">
|
||||||
<div class="alert-item static">
|
<div class="alert-item static">
|
||||||
<div class="alert-icon-wrapper">
|
<div class="alert-icon-wrapper">
|
||||||
<cds-icon class="alert-icon" shape="info-circle"></cds-icon>
|
<cds-icon class="alert-icon" shape="info-circle"></cds-icon>
|
||||||
</div>
|
</div>
|
||||||
<span class="alert-text">
|
<span class="alert-text">
|
||||||
Drilldown Level: {{currentDrilldownLevel}}
|
Drilldown Level: {{currentDrilldownLevel}}
|
||||||
<span *ngIf="drilldownStack.length > 0">
|
<span *ngIf="drilldownStack.length > 0">
|
||||||
(Clicked on: {{drilldownStack[drilldownStack.length - 1].clickedLabel}})
|
(Clicked on: {{drilldownStack[drilldownStack.length - 1].clickedLabel}})
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- No data message -->
|
<div class="chart-wrapper">
|
||||||
<div *ngIf="noDataAvailable" style="text-align: center; padding: 20px; color: #666; font-style: italic;">
|
<div class="chart-content" [class.loading]="isLoading">
|
||||||
No data available
|
|
||||||
|
<div *ngIf="noDataAvailable" class="no-data-message">
|
||||||
|
No data available
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div *ngIf="!noDataAvailable" class="chart-display">
|
||||||
|
<canvas baseChart
|
||||||
|
[datasets]="barChartData"
|
||||||
|
[labels]="barChartLabels"
|
||||||
|
[type]="barChartType"
|
||||||
|
[options]="barChartOptions"
|
||||||
|
(chartHover)="chartHovered($event)"
|
||||||
|
(chartClick)="chartClicked($event)">
|
||||||
|
</canvas>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="loading-overlay" *ngIf="isLoading">
|
||||||
|
<div class="shimmer-bar"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Chart display -->
|
|
||||||
<div *ngIf="!noDataAvailable" style="position: relative; height: calc(100% - 50px);">
|
<!-- sheield dashboard -->
|
||||||
<canvas baseChart
|
<!--
|
||||||
[datasets]="barChartData"
|
<div class="chart-container">
|
||||||
[labels]="barChartLabels"
|
<div class="chart-header">
|
||||||
[type]="barChartType"
|
<h3>Deal Stage Wise Progress</h3>
|
||||||
[options]="barChartOptions"
|
|
||||||
(chartHover)="chartHovered($event)"
|
|
||||||
(chartClick)="chartClicked($event)">
|
|
||||||
</canvas>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="chart-wrapper">
|
||||||
|
<div class="chart-content" [class.loading]="isLoading">
|
||||||
|
<canvas
|
||||||
|
baseChart
|
||||||
|
[data]="barChartData"
|
||||||
|
[options]="barChartOptions"
|
||||||
|
[type]="barChartType"
|
||||||
|
(chartClick)="chartClicked($event)"
|
||||||
|
(chartHover)="chartHovered($event)">
|
||||||
|
</canvas>
|
||||||
|
<div class="loading-overlay" *ngIf="isLoading">
|
||||||
|
<div class="shimmer-bar"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -1,192 +1,278 @@
|
|||||||
.filter-section {
|
// Chart container structure
|
||||||
margin-bottom: 20px;
|
.chart-container {
|
||||||
padding: 15px;
|
height: 100%;
|
||||||
border: 1px solid #ddd;
|
|
||||||
border-radius: 4px;
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-group {
|
|
||||||
margin-bottom: 15px;
|
|
||||||
|
|
||||||
h4 {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
color: #333;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-controls {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-direction: column;
|
||||||
gap: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-item {
|
// Filter section styling
|
||||||
flex: 1 1 300px;
|
.filter-section {
|
||||||
min-width: 250px;
|
margin-bottom: 20px;
|
||||||
padding: 10px;
|
padding: 15px;
|
||||||
background: white;
|
border: 1px solid #ddd;
|
||||||
border: 1px solid #e0e0e0;
|
border-radius: 4px;
|
||||||
border-radius: 4px;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-label {
|
.filter-group {
|
||||||
font-weight: 500;
|
margin-bottom: 15px;
|
||||||
margin-bottom: 8px;
|
|
||||||
color: #555;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-input {
|
h4 {
|
||||||
width: 100%;
|
margin-top: 0;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.filter-text-input,
|
.filter-controls {
|
||||||
.filter-select,
|
display: flex;
|
||||||
.filter-date {
|
flex-wrap: wrap;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-item {
|
||||||
|
flex: 1 1 300px;
|
||||||
|
min-width: 250px;
|
||||||
|
padding: 10px;
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-label {
|
||||||
|
font-weight: 500;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
color: #555;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
.filter-text-input,
|
||||||
|
.filter-select,
|
||||||
|
.filter-date {
|
||||||
|
width: 100%;
|
||||||
|
padding: 6px 12px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-select {
|
||||||
|
height: 34px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.multiselect-container {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.multiselect-display {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
padding: 6px 12px;
|
padding: 6px 12px;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-size: 14px;
|
background: white;
|
||||||
|
cursor: pointer;
|
||||||
|
min-height: 34px;
|
||||||
|
|
||||||
|
.multiselect-label {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.multiselect-value {
|
||||||
|
color: #666;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-icon {
|
||||||
|
flex-shrink: 0;
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #999;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-select {
|
.multiselect-dropdown {
|
||||||
height: 34px;
|
position: absolute;
|
||||||
}
|
top: 100%;
|
||||||
}
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-top: none;
|
||||||
|
border-radius: 0 0 4px 4px;
|
||||||
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||||
|
max-height: 200px;
|
||||||
|
overflow-y: auto;
|
||||||
|
|
||||||
.multiselect-container {
|
.checkbox-group {
|
||||||
position: relative;
|
padding: 8px;
|
||||||
}
|
|
||||||
|
|
||||||
.multiselect-display {
|
.checkbox-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
gap: 8px;
|
||||||
padding: 6px 12px;
|
padding: 4px 0;
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 4px;
|
|
||||||
background: white;
|
|
||||||
cursor: pointer;
|
|
||||||
min-height: 34px;
|
|
||||||
|
|
||||||
.multiselect-label {
|
.checkbox-label {
|
||||||
flex: 1;
|
margin: 0;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.multiselect-value {
|
.date-range {
|
||||||
color: #666;
|
.date-input-group {
|
||||||
font-size: 12px;
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-icon {
|
|
||||||
flex-shrink: 0;
|
|
||||||
transition: transform 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
border-color: #999;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.multiselect-dropdown {
|
|
||||||
position: absolute;
|
|
||||||
top: 100%;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
z-index: 1000;
|
|
||||||
background: white;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-top: none;
|
|
||||||
border-radius: 0 0 4px 4px;
|
|
||||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
||||||
max-height: 200px;
|
|
||||||
overflow-y: auto;
|
|
||||||
|
|
||||||
.checkbox-group {
|
|
||||||
padding: 8px;
|
|
||||||
|
|
||||||
.checkbox-item {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
padding: 4px 0;
|
}
|
||||||
|
|
||||||
.checkbox-label {
|
.date-separator {
|
||||||
|
margin: 0 5px;
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
.toggle-label {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-actions {
|
||||||
|
margin-top: 15px;
|
||||||
|
padding-top: 15px;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chart header styling
|
||||||
|
.chart-header {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
|
||||||
|
.header-row {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
|
||||||
|
.chart-title {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 14px;
|
font-size: 18px;
|
||||||
cursor: pointer;
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chart wrapper and content
|
||||||
|
.chart-wrapper {
|
||||||
|
flex: 1;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.chart-content {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 300px; // Ensure minimum height for chart
|
||||||
|
|
||||||
|
&.loading {
|
||||||
|
opacity: 0.7;
|
||||||
|
|
||||||
|
.chart-display {
|
||||||
|
filter: blur(2px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-data-message {
|
||||||
|
text-align: center;
|
||||||
|
padding: 20px;
|
||||||
|
color: #666;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-display {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
transition: filter 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: rgba(255, 255, 255, 0.8);
|
||||||
|
|
||||||
|
.shimmer-bar {
|
||||||
|
width: 80%;
|
||||||
|
height: 20px;
|
||||||
|
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
||||||
|
background-size: 200% 100%;
|
||||||
|
animation: shimmer 1.5s infinite;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.date-range {
|
@keyframes shimmer {
|
||||||
.date-input-group {
|
0% {
|
||||||
display: flex;
|
background-position: -200% 0;
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
}
|
||||||
|
100% {
|
||||||
.date-separator {
|
background-position: 200% 0;
|
||||||
margin: 0 5px;
|
|
||||||
color: #777;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.toggle {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
|
|
||||||
.toggle-label {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 14px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-actions {
|
|
||||||
margin-top: 15px;
|
|
||||||
padding-top: 15px;
|
|
||||||
border-top: 1px solid #eee;
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// New header row styling
|
|
||||||
.header-row {
|
|
||||||
margin-bottom: 15px;
|
|
||||||
padding-bottom: 10px;
|
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
|
|
||||||
.chart-title {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #333;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Responsive design
|
// Responsive design
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.filter-controls {
|
.chart-container {
|
||||||
flex-direction: column;
|
.filter-controls {
|
||||||
}
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
.filter-item {
|
.filter-item {
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-row {
|
.chart-header {
|
||||||
.chart-title {
|
.header-row {
|
||||||
font-size: 16px;
|
.chart-title {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-content {
|
||||||
|
min-height: 250px; // Adjust for mobile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,21 +57,46 @@ export class BarChartComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
ticks: {
|
ticks: {
|
||||||
autoSkip: false,
|
autoSkip: false,
|
||||||
maxRotation: 45,
|
maxRotation: 45,
|
||||||
minRotation: 45
|
minRotation: 45,
|
||||||
|
padding: 15,
|
||||||
|
font: {
|
||||||
|
size: 12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
display: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
y: {
|
y: {
|
||||||
beginAtZero: true
|
beginAtZero: true,
|
||||||
|
ticks: {
|
||||||
|
font: {
|
||||||
|
size: 12
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
legend: {
|
legend: {
|
||||||
display: true,
|
display: true,
|
||||||
position: 'top',
|
position: 'top',
|
||||||
|
labels: {
|
||||||
|
font: {
|
||||||
|
size: 12
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
enabled: true
|
enabled: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
layout: {
|
||||||
|
padding: {
|
||||||
|
bottom: 60,
|
||||||
|
left: 15,
|
||||||
|
right: 15,
|
||||||
|
top: 15
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -84,6 +109,9 @@ export class BarChartComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
// No data state
|
// No data state
|
||||||
noDataAvailable: boolean = false;
|
noDataAvailable: boolean = false;
|
||||||
|
|
||||||
|
// Loading state
|
||||||
|
isLoading: boolean = false;
|
||||||
|
|
||||||
// Flag to prevent infinite loops
|
// Flag to prevent infinite loops
|
||||||
private isFetchingData: boolean = false;
|
private isFetchingData: boolean = false;
|
||||||
|
|
||||||
@ -463,14 +491,18 @@ export class BarChartComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fetchChartData(): void {
|
fetchChartData(): void {
|
||||||
|
// Set loading state
|
||||||
|
this.isLoading = true;
|
||||||
|
|
||||||
// Set flag to prevent recursive calls
|
// Set flag to prevent recursive calls
|
||||||
this.isFetchingData = true;
|
this.isFetchingData = true;
|
||||||
|
|
||||||
// If we're in drilldown mode, fetch the appropriate drilldown data
|
// If we're in drilldown mode, fetch the appropriate drilldown data
|
||||||
if (this.currentDrilldownLevel > 0 && this.drilldownStack.length > 0) {
|
if (this.currentDrilldownLevel > 0 && this.drilldownStack.length > 0) {
|
||||||
this.fetchDrilldownData();
|
this.fetchDrilldownData();
|
||||||
// Reset flag after fetching
|
// Reset flags after fetching
|
||||||
this.isFetchingData = false;
|
this.isFetchingData = false;
|
||||||
|
this.isLoading = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,8 +572,9 @@ export class BarChartComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.noDataAvailable = true;
|
this.noDataAvailable = true;
|
||||||
this.barChartLabels = [];
|
this.barChartLabels = [];
|
||||||
this.barChartData = [];
|
this.barChartData = [];
|
||||||
// Reset flag after fetching
|
// Reset flags after fetching
|
||||||
this.isFetchingData = false;
|
this.isFetchingData = false;
|
||||||
|
this.isLoading = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -570,8 +603,9 @@ export class BarChartComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.barChartLabels = [];
|
this.barChartLabels = [];
|
||||||
this.barChartData = [];
|
this.barChartData = [];
|
||||||
}
|
}
|
||||||
// Reset flag after fetching
|
// Reset flags after fetching
|
||||||
this.isFetchingData = false;
|
this.isFetchingData = false;
|
||||||
|
this.isLoading = false;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
console.error('=== BAR CHART ERROR ===');
|
console.error('=== BAR CHART ERROR ===');
|
||||||
@ -579,8 +613,9 @@ export class BarChartComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.noDataAvailable = true;
|
this.noDataAvailable = true;
|
||||||
this.barChartLabels = [];
|
this.barChartLabels = [];
|
||||||
this.barChartData = [];
|
this.barChartData = [];
|
||||||
// Reset flag after fetching
|
// Reset flags after fetching
|
||||||
this.isFetchingData = false;
|
this.isFetchingData = false;
|
||||||
|
this.isLoading = false;
|
||||||
// Keep default data in case of error
|
// Keep default data in case of error
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -592,8 +627,9 @@ export class BarChartComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.noDataAvailable = true;
|
this.noDataAvailable = true;
|
||||||
this.barChartLabels = [];
|
this.barChartLabels = [];
|
||||||
this.barChartData = [];
|
this.barChartData = [];
|
||||||
// Reset flag after fetching
|
// Reset flags after fetching
|
||||||
this.isFetchingData = false;
|
this.isFetchingData = false;
|
||||||
|
this.isLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,17 +791,23 @@ export class BarChartComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
// Trigger change detection
|
// Trigger change detection
|
||||||
// this.barChartData = [...this.barChartData];
|
// this.barChartData = [...this.barChartData];
|
||||||
console.log('Updated bar chart with drilldown data:', { labels: this.barChartLabels, data: this.barChartData });
|
console.log('Updated bar chart with drilldown data:', { labels: this.barChartLabels, data: this.barChartData });
|
||||||
|
// Set loading state to false
|
||||||
|
this.isLoading = false;
|
||||||
} else if (data && data.labels && data.datasets) {
|
} else if (data && data.labels && data.datasets) {
|
||||||
// Backend has already filtered the data, just display it
|
// Backend has already filtered the data, just display it
|
||||||
this.noDataAvailable = data.labels.length === 0;
|
this.noDataAvailable = data.labels.length === 0;
|
||||||
this.barChartLabels = data.labels;
|
this.barChartLabels = data.labels;
|
||||||
this.barChartData = data.datasets;
|
this.barChartData = data.datasets;
|
||||||
console.log('Updated bar chart with drilldown legacy data format:', { labels: this.barChartLabels, data: this.barChartData });
|
console.log('Updated bar chart with drilldown legacy data format:', { labels: this.barChartLabels, data: this.barChartData });
|
||||||
|
// Set loading state to false
|
||||||
|
this.isLoading = false;
|
||||||
} else {
|
} else {
|
||||||
console.warn('Drilldown received data does not have expected structure', data);
|
console.warn('Drilldown received data does not have expected structure', data);
|
||||||
this.noDataAvailable = true;
|
this.noDataAvailable = true;
|
||||||
this.barChartLabels = [];
|
this.barChartLabels = [];
|
||||||
this.barChartData = [];
|
this.barChartData = [];
|
||||||
|
// Set loading state to false
|
||||||
|
this.isLoading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
@ -773,12 +815,17 @@ export class BarChartComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.noDataAvailable = true;
|
this.noDataAvailable = true;
|
||||||
this.barChartLabels = [];
|
this.barChartLabels = [];
|
||||||
this.barChartData = [];
|
this.barChartData = [];
|
||||||
|
// Set loading state to false
|
||||||
|
this.isLoading = false;
|
||||||
// Keep current data in case of error
|
// Keep current data in case of error
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add subscription to array for cleanup
|
// Add subscription to array for cleanup
|
||||||
this.subscriptions.push(subscription);
|
this.subscriptions.push(subscription);
|
||||||
|
|
||||||
|
// Set loading state
|
||||||
|
this.isLoading = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset to original data (go back to base level)
|
// Reset to original data (go back to base level)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user