Update editnewdash.component.ts

This commit is contained in:
Gaurav Kumar
2025-11-01 11:00:10 +05:30
parent 49f1a2fbf2
commit 64b664e625

View File

@@ -410,8 +410,8 @@ export class EditnewdashComponent implements OnInit {
// If this is a chart, set the chartType property // If this is a chart, set the chartType property
if (chartTypeMap.hasOwnProperty(dashboard.name)) { if (chartTypeMap.hasOwnProperty(dashboard.name)) {
dashboard.chartType = chartTypeMap[dashboard.name]; dashboard.chartType = chartTypeMap[dashboard.name];
// Change the name to "Unified Chart" for consistency // Keep the original name instead of changing it to "Unified Chart"
dashboard.name = "Unified Chart"; // dashboard.name = "Unified Chart";
} }
// Ensure compact filter configuration properties are properly initialized // Ensure compact filter configuration properties are properly initialized
@@ -454,6 +454,12 @@ export class EditnewdashComponent implements OnInit {
if (dashboard.name === 'Unified Chart' && dashboard.chartType && chartNameMap.hasOwnProperty(dashboard.chartType)) { if (dashboard.name === 'Unified Chart' && dashboard.chartType && chartNameMap.hasOwnProperty(dashboard.chartType)) {
dashboard.name = chartNameMap[dashboard.chartType]; dashboard.name = chartNameMap[dashboard.chartType];
} }
// Also handle the case where the chart already has the correct name
else if (dashboard.chartType && chartNameMap.hasOwnProperty(dashboard.chartType) &&
dashboard.name === chartNameMap[dashboard.chartType]) {
// The name is already correct, no need to change it
dashboard.component = "Unified Chart";
}
// Ensure compact filter configuration properties are preserved // Ensure compact filter configuration properties are preserved
if (dashboard.name === 'Compact Filter') { if (dashboard.name === 'Compact Filter') {
@@ -521,7 +527,7 @@ export class EditnewdashComponent implements OnInit {
y: 0, y: 0,
chartid: maxChartId + 1, chartid: maxChartId + 1,
component: UnifiedChartComponent, component: UnifiedChartComponent,
name: "Unified Chart", name: "Radar Chart",
chartType: 'radar', chartType: 'radar',
xAxis: '', xAxis: '',
yAxis: '', yAxis: '',
@@ -536,7 +542,7 @@ export class EditnewdashComponent implements OnInit {
y: 0, y: 0,
chartid: maxChartId + 1, chartid: maxChartId + 1,
component: UnifiedChartComponent, component: UnifiedChartComponent,
name: "Unified Chart", name: "Line Chart",
chartType: 'line', chartType: 'line',
xAxis: '', xAxis: '',
yAxis: '', yAxis: '',
@@ -551,7 +557,7 @@ export class EditnewdashComponent implements OnInit {
y: 0, y: 0,
chartid: maxChartId + 1, chartid: maxChartId + 1,
component: UnifiedChartComponent, component: UnifiedChartComponent,
name: "Unified Chart", name: "Doughnut Chart",
chartType: 'doughnut', chartType: 'doughnut',
xAxis: '', xAxis: '',
yAxis: '', yAxis: '',
@@ -566,7 +572,7 @@ export class EditnewdashComponent implements OnInit {
y: 0, y: 0,
chartid: maxChartId + 1, chartid: maxChartId + 1,
component: UnifiedChartComponent, component: UnifiedChartComponent,
name: "Unified Chart", name: "Bar Chart",
chartType: 'bar', chartType: 'bar',
xAxis: '', xAxis: '',
yAxis: '', yAxis: '',
@@ -581,7 +587,7 @@ export class EditnewdashComponent implements OnInit {
y: 0, y: 0,
chartid: maxChartId + 1, chartid: maxChartId + 1,
component: UnifiedChartComponent, component: UnifiedChartComponent,
name: "Unified Chart", name: "Pie Chart",
chartType: 'pie', chartType: 'pie',
xAxis: '', xAxis: '',
yAxis: '', yAxis: '',
@@ -596,7 +602,7 @@ export class EditnewdashComponent implements OnInit {
y: 0, y: 0,
chartid: maxChartId + 1, chartid: maxChartId + 1,
component: UnifiedChartComponent, component: UnifiedChartComponent,
name: "Unified Chart", name: "Polar Area Chart",
chartType: 'polar', chartType: 'polar',
xAxis: '', xAxis: '',
yAxis: '', yAxis: '',
@@ -611,7 +617,7 @@ export class EditnewdashComponent implements OnInit {
y: 0, y: 0,
chartid: maxChartId + 1, chartid: maxChartId + 1,
component: UnifiedChartComponent, component: UnifiedChartComponent,
name: "Unified Chart", name: "Bubble Chart",
chartType: 'bubble', chartType: 'bubble',
xAxis: '', xAxis: '',
yAxis: '', yAxis: '',
@@ -626,7 +632,7 @@ export class EditnewdashComponent implements OnInit {
y: 0, y: 0,
chartid: maxChartId + 1, chartid: maxChartId + 1,
component: UnifiedChartComponent, component: UnifiedChartComponent,
name: "Unified Chart", name: "Scatter Chart",
chartType: 'scatter', chartType: 'scatter',
xAxis: '', xAxis: '',
yAxis: '', yAxis: '',
@@ -641,7 +647,7 @@ export class EditnewdashComponent implements OnInit {
y: 0, y: 0,
chartid: maxChartId + 1, chartid: maxChartId + 1,
component: UnifiedChartComponent, component: UnifiedChartComponent,
name: "Unified Chart", name: "Dynamic Chart",
chartType: 'line', // Default to line for dynamic chart chartType: 'line', // Default to line for dynamic chart
xAxis: '', xAxis: '',
yAxis: '', yAxis: '',
@@ -656,7 +662,7 @@ export class EditnewdashComponent implements OnInit {
y: 0, y: 0,
chartid: maxChartId + 1, chartid: maxChartId + 1,
component: UnifiedChartComponent, component: UnifiedChartComponent,
name: "Unified Chart", name: "Financial Chart",
chartType: 'line', // Default to line for financial chart chartType: 'line', // Default to line for financial chart
xAxis: '', xAxis: '',
yAxis: '', yAxis: '',
@@ -1137,7 +1143,14 @@ export class EditnewdashComponent implements OnInit {
} }
// For UnifiedChartComponent, pass chart properties with chartType // For UnifiedChartComponent, pass chart properties with chartType
if (item.name === 'Unified Chart') { // Check for specific chart names that use UnifiedChartComponent
const unifiedChartNames = [
'Radar Chart', 'Line Chart', 'Doughnut Chart', 'Bar Chart',
'Pie Chart', 'Polar Area Chart', 'Bubble Chart', 'Scatter Chart',
'Dynamic Chart', 'Financial Chart', 'Unified Chart'
];
if (unifiedChartNames.includes(item.name)) {
const unifiedChartInputs = { const unifiedChartInputs = {
chartType: item.chartType || 'bar', chartType: item.chartType || 'bar',
xAxis: item.xAxis, xAxis: item.xAxis,