Gauge

TsgcHTMLComponent_Gauge — Delphi、C++ Builder、.NET で、値を最小値と最大値に対してプロットし、低、中、高の色のしきい値を備えた半円形の SVG ゲージをレンダリングします。

TsgcHTMLComponent_Gauge

自己完結型のインライン <svg> の半円を出力する KPI コンポーネントです。値、範囲、単位を設定してから、HTML プロパティを読み取ります — 値が中および高のしきい値を超えると、円弧の色が自動的に切り替わります。

コンポーネントクラス

TsgcHTMLComponent_Gauge

レンダリング内容

インライン <svg> の半円形ゲージ

ファミリー

チャート & 可視化

言語

Delphi, C++ Builder, .NET

作成し、値を設定し、レンダリングする

ValueMinValueMaxValue を設定し、しきい値を選択してから、HTML を読み取ります。単発のゲージには、静的な Build ヘルパーを使用します。

uses
  sgcHTML_Enums, sgcHTML_Component_Gauge;

var
  oGauge: TsgcHTMLComponent_Gauge;
begin
  oGauge := TsgcHTMLComponent_Gauge.Create(nil);
  try
    oGauge.Title := 'CPU Load';
    oGauge.Value := 72;
    oGauge.MinValue := 0;
    oGauge.MaxValue := 100;
    oGauge.Unit_ := '%';

    oGauge.ThresholdMid := 50;
    oGauge.ThresholdHigh := 80;
    oGauge.ColorLowStyle := hcSuccess;
    oGauge.ColorMidStyle := hcWarning;
    oGauge.ColorHighStyle := hcDanger;

    WebModule.Response := oGauge.HTML;   // inline <svg> semicircle
  finally
    oGauge.Free;
  end;
end;

// Or one line with the static Build helper:
Result := TsgcHTMLComponent_Gauge.Build('CPU Load', 72, 0, 100, '%');
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Gauge.hpp

TsgcHTMLComponent_Gauge *oGauge = new TsgcHTMLComponent_Gauge(NULL);
try
{
  oGauge->Title = "CPU Load";
  oGauge->Value = 72;
  oGauge->MinValue = 0;
  oGauge->MaxValue = 100;
  oGauge->Unit_ = "%";

  oGauge->ThresholdMid = 50;
  oGauge->ThresholdHigh = 80;
  oGauge->ColorLowStyle = hcSuccess;
  oGauge->ColorMidStyle = hcWarning;
  oGauge->ColorHighStyle = hcDanger;

  String html = oGauge->HTML;   // inline <svg> semicircle
}
__finally
{
  delete oGauge;
}

// Or one line with the static Build helper:
String html = TsgcHTMLComponent_Gauge::Build("CPU Load", 72, 0, 100, "%");
using esegece.sgcWebSockets;

var gauge = new TsgcHTMLComponent_Gauge();
gauge.Title = "CPU Load";
gauge.Value = 72;
gauge.MinValue = 0;
gauge.MaxValue = 100;
gauge.Unit_ = "%";

gauge.ThresholdMid = 50;
gauge.ThresholdHigh = 80;
gauge.ColorLowStyle = TsgcHTMLColor.hcSuccess;
gauge.ColorMidStyle = TsgcHTMLColor.hcWarning;
gauge.ColorHighStyle = TsgcHTMLColor.hcDanger;

string html = gauge.HTML;   // inline <svg> semicircle

// Or one line with the static Build helper:
string html = TsgcHTMLComponent_Gauge.Build("CPU Load", 72, 0, 100, "%");

主なプロパティとメソッド

最もよく使うメンバーです。

Value & range

ValueMinValueMaxValue(すべて Double)は、円弧がどこまで埋まるかを定義します。値は自動的に範囲内に収められます。

Labels

Title はゲージの下に印字され、Unit_ は値の横に印字されます。最小値と最大値は円弧の両端に描画されます。

Thresholds

ThresholdMidThresholdHighDouble)は、読み取り値が上昇するにつれて値の円弧がどの色を使うかを決定します。

Colours

ColorLowStyleColorMidStyleColorHighStyleTsgcHTMLColor)はしきい値の色を設定します。ColorLow/ColorMid/ColorHigh 文字列は、リテラルな CSS の色で上書きします。BackgroundArcColorStyle はトラックに色を付けます。

Sizing

Width(px、既定値 200)、ArcStrokeWidthValueFontSizeUnitFontSizeLabelFontSizeSvgViewBox は、レンダリングされる SVG を調整します。

Output & Build

HTML はインライン <svg> のゲージを返します。静的な Build(aTitle, aValue, aMin, aMax, aUnit, aGaugeID) は、同じマークアップを 1 回の呼び出しで返します。

さらに詳しく

すべての sgcHTML コンポーネント60 以上のコンポーネントの全機能マトリックスを閲覧できます。
無料体験版のダウンロード30 日間の体験版には 60.HTML デモプロジェクトが付属します。
価格完全なソースコード付きの Single、Team、Site ライセンス。

始める準備はできましたか?

無料体験版をダウンロードして、Delphi、C++ Builder、.NET の Web アプリにゲージを追加しましょう。