made pie chart bigger and seperated header to properly resize
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
+11
-1
@@ -1,9 +1,19 @@
|
||||
<div class="pie-chart-holder">
|
||||
@if (chartTitle()) {
|
||||
<div class="pie-chart-header">
|
||||
<h4 class="pie-chart-title">{{ chartTitle() }}</h4>
|
||||
<span class="pie-chart-subtext">{{ chartSubtext() }}</span>
|
||||
</div>
|
||||
}
|
||||
@if (loading()) {
|
||||
<div class="pie-loader-overlay">
|
||||
<mat-spinner diameter="35"></mat-spinner>
|
||||
<span class="pie-loader-text">Lade Daten...</span>
|
||||
</div>
|
||||
}
|
||||
<div echarts [options]="chartOptions()" class="pie-chart-container"></div>
|
||||
<div
|
||||
echarts
|
||||
[options]="chartOptions()"
|
||||
[autoResize]="true"
|
||||
class="pie-chart-container"></div>
|
||||
</div>
|
||||
|
||||
+25
-2
@@ -4,17 +4,40 @@
|
||||
background: white;
|
||||
border: 1px solid #d7e4ff;
|
||||
border-radius: 16px;
|
||||
padding: 16px;
|
||||
padding: 1.25rem;
|
||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 380px;
|
||||
min-height: clamp(420px, 48vh, 580px);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.pie-chart-header {
|
||||
text-align: center;
|
||||
margin-bottom: 0.25rem;
|
||||
z-index: 1;
|
||||
|
||||
.pie-chart-title {
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
margin: 0;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.pie-chart-subtext {
|
||||
display: block;
|
||||
font-size: 0.75rem;
|
||||
color: #6b7280;
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.pie-chart-container {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.pie-loader-overlay {
|
||||
|
||||
+22
-27
@@ -36,6 +36,21 @@ export class UniPieChartComponent {
|
||||
readonly pieData = input<{ value: number; name: string }[] | null>(null);
|
||||
readonly loading = input<boolean>(false);
|
||||
readonly error = input<boolean>(false);
|
||||
readonly chartTitle = computed<string>(() => {
|
||||
if (this.pieData() !== null) {
|
||||
return this.titleText() ?? 'Themenverteilung';
|
||||
}
|
||||
return (
|
||||
this.titleText() ??
|
||||
(this.entityName()
|
||||
? `Verteilung: ${this.entityName()}`
|
||||
: 'Themenverteilung')
|
||||
);
|
||||
});
|
||||
|
||||
readonly chartSubtext = computed<string>(() => {
|
||||
return `Zeitraum: ${this.startYear()} - ${this.endYear()}`;
|
||||
});
|
||||
|
||||
private resolveTopicColorTokens(topic: string) {
|
||||
if (topic === 'Andere Themen') {
|
||||
@@ -80,8 +95,6 @@ export class UniPieChartComponent {
|
||||
const endYr = this.endYear();
|
||||
|
||||
let pieDataList: any[] = [];
|
||||
let title = '';
|
||||
let subtext = `Zeitraum: ${startYr} - ${endYr}`;
|
||||
|
||||
// 3. If direct pieData input is provided, use it
|
||||
const directData = this.pieData();
|
||||
@@ -99,7 +112,6 @@ export class UniPieChartComponent {
|
||||
},
|
||||
};
|
||||
});
|
||||
title = this.titleText() ?? 'Themenverteilung';
|
||||
} else {
|
||||
// Otherwise, filter and extract from TrendResponse
|
||||
const trendData = this.data();
|
||||
@@ -151,8 +163,6 @@ export class UniPieChartComponent {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
title = this.titleText() ?? `Verteilung: ${this.entityName()}`;
|
||||
}
|
||||
|
||||
if (pieDataList.length === 0) {
|
||||
@@ -167,21 +177,6 @@ export class UniPieChartComponent {
|
||||
}
|
||||
|
||||
return {
|
||||
title: {
|
||||
text: title,
|
||||
subtext: subtext,
|
||||
left: 'center',
|
||||
top: 10,
|
||||
textStyle: {
|
||||
fontSize: 13,
|
||||
fontWeight: 600,
|
||||
color: '#1f2937',
|
||||
},
|
||||
subtextStyle: {
|
||||
fontSize: 10,
|
||||
color: '#6b7280',
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{b}: <strong>{c}</strong> ({d}%)',
|
||||
@@ -193,10 +188,9 @@ export class UniPieChartComponent {
|
||||
{
|
||||
name: 'Themenverteilung',
|
||||
type: 'pie',
|
||||
radius: ['45%', '75%'],
|
||||
radius: ['38%', '76%'],
|
||||
center: ['50%', '50%'],
|
||||
avoidLabelOverlap: true,
|
||||
top: 40,
|
||||
bottom: 10,
|
||||
itemStyle: {
|
||||
borderRadius: 6,
|
||||
borderColor: '#fff',
|
||||
@@ -205,14 +199,15 @@ export class UniPieChartComponent {
|
||||
label: {
|
||||
show: true,
|
||||
position: 'outside',
|
||||
fontSize: 9,
|
||||
fontSize: 10,
|
||||
fontWeight: 500,
|
||||
formatter: '{b}: {d}%',
|
||||
color: '#374151',
|
||||
},
|
||||
labelLine: {
|
||||
show: true,
|
||||
length: 8,
|
||||
length2: 5,
|
||||
length: 12,
|
||||
length2: 8,
|
||||
smooth: true,
|
||||
},
|
||||
emphasis: {
|
||||
@@ -225,7 +220,7 @@ export class UniPieChartComponent {
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
fontSize: 10,
|
||||
fontSize: 11,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
},
|
||||
|
||||
+2
-2
@@ -195,8 +195,8 @@
|
||||
|
||||
.pie-charts-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
|
||||
gap: 1.25rem;
|
||||
grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
|
||||
gap: 1.5rem;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user