Implement a comprehensive reports dashboard including user question summaries, AI performance metrics, and usage trends. This includes the creation of several reusable chart components and supporting services. - Add `ReportsPage` with tabbed navigation for questions and performance - Implement `ReportsService` with mock data support for rapid development - Create reusable UI components: `BarChartComponent`, `DoughnutChartComponent`, and `LineChartComponent` - Add `format.util.ts` for Persian digit and number formatting - Integrate 'Lahze' font family and add font assets - Add unit tests for `ReportsPage` and `ReportsService`
62 lines
2.3 KiB
HTML
62 lines
2.3 KiB
HTML
@if (segments().length) {
|
|
<div class="doughnut-wrapper">
|
|
<div class="doughnut-chart" role="img" [attr.aria-label]="ariaLabel()">
|
|
<svg viewBox="0 0 160 160" class="doughnut-svg">
|
|
<circle class="doughnut-base" cx="80" cy="80" [attr.r]="60" />
|
|
<g transform="rotate(-90 80 80)">
|
|
@for (arc of arcs(); track arc.label; let index = $index) {
|
|
<circle
|
|
class="doughnut-segment"
|
|
[class.doughnut-segment-active]="activeIndex() === index"
|
|
[style.stroke]="arc.color"
|
|
[style.stroke-dasharray]="arc.dashArray"
|
|
[style.stroke-dashoffset]="arc.dashOffset"
|
|
cx="80"
|
|
cy="80"
|
|
r="60"
|
|
(mouseenter)="onSegmentEnter(index, $event)"
|
|
(mouseleave)="onSegmentLeave()"
|
|
/>
|
|
}
|
|
</g>
|
|
</svg>
|
|
|
|
<div class="doughnut-center" aria-hidden="true">
|
|
<span class="doughnut-center-value">{{ centerValue() }}</span>
|
|
<span class="doughnut-center-caption">{{ centerCaption() }}</span>
|
|
</div>
|
|
|
|
@if (activeIndex() !== null) {
|
|
<div
|
|
class="chart-tooltip"
|
|
role="tooltip"
|
|
[style.inset-inline-start]="tooltipX() + 'px'"
|
|
[style.top]="tooltipY() + 'px'"
|
|
>
|
|
<strong class="chart-tooltip-title">{{ arcs()[activeIndex()!].label }}</strong>
|
|
<span class="chart-tooltip-row">تعداد: {{ formatValue(arcs()[activeIndex()!].value) }}</span>
|
|
<span class="chart-tooltip-row">سهم: {{ formatShare(arcs()[activeIndex()!].value) }}</span>
|
|
</div>
|
|
}
|
|
</div>
|
|
|
|
<ul class="doughnut-legend" role="list">
|
|
@for (arc of arcs(); track arc.label; let index = $index) {
|
|
<li
|
|
class="legend-item"
|
|
[class.legend-item-active]="activeIndex() === index"
|
|
(mouseenter)="activeIndex.set(index)"
|
|
(mouseleave)="activeIndex.set(null)"
|
|
>
|
|
<span class="legend-dot" [style.background]="arc.color"></span>
|
|
<span class="legend-label">{{ arc.label }}</span>
|
|
<span class="legend-value">{{ formatValue(arc.value) }}</span>
|
|
<span class="legend-percent">{{ formatShare(arc.value) }}</span>
|
|
</li>
|
|
}
|
|
</ul>
|
|
</div>
|
|
} @else {
|
|
<p class="chart-empty">{{ emptyText() }}</p>
|
|
}
|