* @brief Builds one Chart.js canvas per numeric series, wrapped in cards. */
| 553 | * @brief Builds one Chart.js canvas per numeric series, wrapped in cards. |
| 554 | */ |
| 555 | QString Sessions::HtmlReport::buildChartsSection() const |
| 556 | { |
| 557 | QString cards; |
| 558 | for (const auto& s : m_series) { |
| 559 | QString fullName = |
| 560 | s.group.isEmpty() ? s.title : QStringLiteral("%1 / %2").arg(s.group, s.title); |
| 561 | if (!s.sourceTitle.isEmpty()) |
| 562 | fullName = QStringLiteral("%1 / %2").arg(s.sourceTitle, fullName); |
| 563 | |
| 564 | const QString units = |
| 565 | s.units.isEmpty() ? QString() : QStringLiteral(" (%1)").arg(escapeHtml(s.units)); |
| 566 | |
| 567 | const double duration = s.timesSec.empty() ? 0.0 : s.timesSec.back(); |
| 568 | const QString sub = tr("%1 samples over %2 seconds") |
| 569 | .arg(QString::number(static_cast<qulonglong>(s.totalSamples)), |
| 570 | QString::number(duration, 'f', 2)); |
| 571 | |
| 572 | cards += QStringLiteral("<div class=\"chart-card\">" |
| 573 | "<h3>%1%2</h3>" |
| 574 | "<div class=\"chart-sub\">%3</div>" |
| 575 | "<div class=\"chart-box\"><canvas id=\"chart-%4\"></canvas></div>" |
| 576 | "</div>") |
| 577 | .arg(escapeHtml(fullName), units, escapeHtml(sub), QString::number(s.uniqueId)); |
| 578 | } |
| 579 | |
| 580 | const QString overlay = |
| 581 | m_series.size() >= 2 |
| 582 | ? QStringLiteral("<section class=\"section screen-only overlay-section\">" |
| 583 | "<h2>%1 <span class=\"muted\">%2</span></h2>" |
| 584 | "<div class=\"overlay-box\"><canvas id=\"chart-overlay\"></canvas></div>" |
| 585 | "</section>") |
| 586 | .arg(escapeHtml(tr("Combined Parameter View")), |
| 587 | escapeHtml(tr("click legend items to toggle signals"))) |
| 588 | : QString(); |
| 589 | |
| 590 | return QStringLiteral("%1" |
| 591 | "<section class=\"section new-page\">" |
| 592 | "<h2 id=\"parameter-trends-heading\">%2</h2>" |
| 593 | "<div class=\"charts-grid\">%3</div>" |
| 594 | "</section>") |
| 595 | .arg(overlay, escapeHtml(tr("Parameter Trends")), cards); |
| 596 | } |
| 597 | |
| 598 | //-------------------------------------------------------------------------------------------------- |
| 599 | // JSON payload (consumed by session-report.js) |
nothing calls this directly
no test coverage detected