TreeMap
TsgcHTMLComponent_TreeMap — Delphi, C++ Builder 및 .NET에서 차트 라이브러리 없이, 서버에서 생성되는 독립형 인라인 SVG로 정방형화된 트리맵을 렌더링합니다.
TsgcHTMLComponent_TreeMap — Delphi, C++ Builder 및 .NET에서 차트 라이브러리 없이, 서버에서 생성되는 독립형 인라인 SVG로 정방형화된 트리맵을 렌더링합니다.
레이블과 값을 가진 항목을 추가한(또는 데이터셋을 바인딩한) 다음, 색상 구성표를 선택하고, HTML 속성을 읽습니다.
TsgcHTMLComponent_TreeMap
독립형 인라인 SVG, 정방형화 레이아웃
Delphi, C++ Builder, .NET
사각형마다 AddItem을 호출하고, ColorScheme을 선택한 다음, HTML을 읽습니다. 레이아웃은 서버 측에서 계산되며 클라이언트 측 라이브러리가 필요하지 않습니다.
uses
sgcHTML_Component_TreeMap;
var
oTreeMap: TsgcHTMLComponent_TreeMap;
begin
oTreeMap := TsgcHTMLComponent_TreeMap.Create(nil);
try
oTreeMap.Width := 640;
oTreeMap.Height := 360;
oTreeMap.ColorScheme := tmCool;
oTreeMap.ShowValues := True;
oTreeMap.AddItem('Engineering', 420000);
oTreeMap.AddItem('Sales', 260000);
oTreeMap.AddItem('Marketing', 140000);
oTreeMap.AddItem('Support', 90000, '#20c997'); // explicit colour overrides the scheme
WebModule.Response := oTreeMap.HTML; // <svg> squarified rectangles, no client-side library
finally
oTreeMap.Free;
end;
end;
// Or bind it straight to a dataset:
oTreeMap.LoadFromDataSet(qryBudget, 'Department', 'Amount');
// One-shot helper, no instance to manage:
Response := TsgcHTMLComponent_TreeMap.Build(['Engineering', 'Sales'], [420000, 260000]);
// includes: sgcHTML_Component_TreeMap.hpp
TsgcHTMLComponent_TreeMap *oTreeMap = new TsgcHTMLComponent_TreeMap(NULL);
try
{
oTreeMap->Width = 640;
oTreeMap->Height = 360;
oTreeMap->ColorScheme = tmCool;
oTreeMap->ShowValues = true;
oTreeMap->AddItem("Engineering", 420000);
oTreeMap->AddItem("Sales", 260000);
oTreeMap->AddItem("Marketing", 140000);
oTreeMap->AddItem("Support", 90000, "#20c997"); // explicit colour overrides the scheme
String html = oTreeMap->HTML; // <svg> squarified rectangles, no client-side library
}
__finally
{
delete oTreeMap;
}
using esegece.sgcWebSockets;
var treeMap = new TsgcHTMLComponent_TreeMap();
treeMap.Width = 640;
treeMap.Height = 360;
treeMap.ColorScheme = TsgcHTMLTreeMapScheme.tmCool;
treeMap.ShowValues = true;
treeMap.AddItem("Engineering", 420000);
treeMap.AddItem("Sales", 260000);
treeMap.AddItem("Marketing", 140000);
treeMap.AddItem("Support", 90000, "#20c997"); // explicit colour overrides the scheme
string html = treeMap.HTML; // <svg> squarified rectangles, no client-side library
// One-shot helper, no instance to manage:
string quick = TsgcHTMLComponent_TreeMap.Build(new[] { "Engineering", "Sales" }, new[] { 420000d, 260000d });
가장 자주 사용하게 되는 멤버.
AddItem(aLabel, aValue, aColor)는 리프 사각형을 하나 추가합니다. 명시적인 aColor는 활성화된 ColorScheme보다 우선합니다.
Items는 2단계 트리맵을 지원합니다. 부모 및 자식 항목에 ID / ParentID를 설정하면 자식 사각형이 흐릿하게 표시된 부모 안에 중첩됩니다.
LoadFromDataSet(aDataSet, aLabelField, aValueField)는 행마다 평면 항목을 하나씩 로드합니다.
클래스 함수 Build(aLabels, aValues)는 관리할 컴포넌트 인스턴스 없이 평면 트리맵을 곧바로 문자열로 렌더링합니다.
Width, Height, Padding 및 ColorScheme(default/blue/green/warm/cool/gray)이 캔버스와 자동 지정되는 사각형 색상을 제어합니다.
ShowLabels, ShowValues, MinLabelSize 및 FontSize가 사각형 캡션이 그려지는 시점과 방식을 결정하며, HTML은 완성된 인라인 <svg>를 반환합니다.