StatCard

TsgcHTMLComponent_StatCard — renderizza una card KPI/statistica per dashboard con un’icona, una freccia di tendenza e uno sfondo a gradiente opzionale, in Delphi, C++ Builder e .NET.

TsgcHTMLComponent_StatCard

Un riquadro metrico costruito sulla card Bootstrap. Imposta un titolo e un valore, aggiungi un’icona e una tendenza, applica facoltativamente un gradiente, quindi leggi la proprietà HTML.

Classe del componente

TsgcHTMLComponent_StatCard

Renderizza

Bootstrap 5 card markup

Linguaggi

Delphi, C++ Builder, .NET

Crealo, imposta la metrica, renderizzalo

Assegna Title e Value, scegli un Color e una Trend, facoltativamente un Gradient, quindi leggi HTML — oppure usa l’helper statico Build a riga singola.

uses
  sgcHTML_Component_StatCard;

var
  oStat: TsgcHTMLComponent_StatCard;
begin
  oStat := TsgcHTMLComponent_StatCard.Create(nil);
  try
    oStat.Title := 'Monthly Revenue';
    oStat.Value := '$48,200';
    oStat.Icon := '●';
    oStat.Color := scSuccess;
    oStat.Trend := stUp;
    oStat.TrendValue := '12.5%';

    WebModule.Response := oStat.HTML;   // Bootstrap card
  finally
    oStat.Free;
  end;
end;

// Or in a single line with the static helper:
Result := TsgcHTMLComponent_StatCard.Build('Monthly Revenue', '$48,200',
  scSuccess, stUp, '12.5%', 'kpiRevenue', sgBlueViolet);
// includes: sgcHTML_Component_StatCard.hpp

TsgcHTMLComponent_StatCard *oStat = new TsgcHTMLComponent_StatCard(NULL);
try
{
  oStat->Title = "Monthly Revenue";
  oStat->Value = "$48,200";
  oStat->Icon = "●";
  oStat->Color = scSuccess;
  oStat->Trend = stUp;
  oStat->TrendValue = "12.5%";

  String html = oStat->HTML;   // Bootstrap card
}
__finally
{
  delete oStat;
}

// Or in a single line with the static helper:
String html = TsgcHTMLComponent_StatCard::Build("Monthly Revenue", "$48,200",
  scSuccess, stUp, "12.5%", "kpiRevenue", sgBlueViolet);
using esegece.sgcWebSockets;

var stat = new TsgcHTMLComponent_StatCard();
stat.Title = "Monthly Revenue";
stat.Value = "$48,200";
stat.Icon = "●";
stat.Color = TsgcHTMLStatColor.scSuccess;
stat.Trend = TsgcHTMLStatTrend.stUp;
stat.TrendValue = "12.5%";

string html = stat.HTML;   // Bootstrap card

// Or in a single line with the static helper:
string oneLine = TsgcHTMLComponent_StatCard.Build("Monthly Revenue", "$48,200",
    TsgcHTMLStatColor.scSuccess, TsgcHTMLStatTrend.stUp, "12.5%", "kpiRevenue",
    TsgcHTMLStatGradient.sgBlueViolet);

Proprietà e metodi principali

I membri che utilizzerai più spesso.

Metrica

Title etichetta la card, Value mostra il valore principale e Icon renderizza un glifo icona inline nell’angolo.

Tendenza

Trend (TsgcHTMLStatTrend: stUp, stDown, stNeutral) disegna una freccia colorata e TrendValue imposta il testo della variazione.

Colore

Color (TsgcHTMLStatColor) applica il tema a bordo, valore e icona con un colore contestuale Bootstrap.

Gradiente

Gradient (TsgcHTMLStatGradient) applica un gradiente predefinito; GradientStartColor, GradientEndColor e GradientAngle ne definiscono uno personalizzato.

Extra

FooterText aggiunge una riga di didascalia, CardID imposta l’id DOM e CSSClass aggiunge classi extra.

Build a riga singola

Build(aTitle, aValue, aColor, aTrend, aTrendValue, aCardID, aGradient) restituisce l’HTML della card con una singola chiamata statica.

Continua a esplorare

Tutti i componenti sgcHTMLEsplora la matrice completa delle funzionalità di oltre 60 componenti.
Scarica la Prova GratuitaLa prova di 30 giorni include i progetti demo 60.HTML.
PrezziLicenze Single, Team e Site con codice sorgente completo.

Pronto a Iniziare?

Scarica la versione di prova gratuita e inizia a creare interfacce web in Delphi, C++ Builder e .NET.