Heatmap
TsgcHTMLComponent_Heatmap — 从单元格值或绑定数据集渲染颜色渐变 SVG 热力图网格,带有图例和行/列标签,适用于 Delphi、C++ Builder 和 .NET。
TsgcHTMLComponent_Heatmap — 从单元格值或绑定数据集渲染颜色渐变 SVG 热力图网格,带有图例和行/列标签,适用于 Delphi、C++ Builder 和 .NET。
设置行和列标签,使用 SetCell 填充单元格(或绑定数据集),然后读取 HTML 属性。
填充 RowLabels 和 ColumnLabels,为每个数据点调用 SetCell(aRow, aCol, aValue)(或绑定数据集),然后读取 HTML。
uses
sgcHTML_Component_Heatmap;
var
oHeatmap: TsgcHTMLComponent_Heatmap;
begin
oHeatmap := TsgcHTMLComponent_Heatmap.Create(nil);
try
oHeatmap.RowLabels.CommaText := 'Mon,Tue,Wed,Thu,Fri';
oHeatmap.ColumnLabels.CommaText := '9h,12h,15h,18h';
oHeatmap.ShowLegend := True;
oHeatmap.ShowValues := True;
oHeatmap.SetCell(0, 0, 12);
oHeatmap.SetCell(0, 1, 48);
oHeatmap.SetCell(1, 2, 76);
oHeatmap.SetCell(4, 3, 92);
WebModule.Response := oHeatmap.HTML; // SVG grid, min->max colour scale
finally
oHeatmap.Free;
end;
end;
// Or bind it straight to a dataset:
oHeatmap.LoadFromDataSet(qryTraffic, 'DayName', 'HourSlot', 'Visits');
// includes: sgcHTML_Component_Heatmap.hpp
TsgcHTMLComponent_Heatmap *oHeatmap = new TsgcHTMLComponent_Heatmap(NULL);
try
{
oHeatmap->RowLabels->CommaText = "Mon,Tue,Wed,Thu,Fri";
oHeatmap->ColumnLabels->CommaText = "9h,12h,15h,18h";
oHeatmap->ShowLegend = true;
oHeatmap->ShowValues = true;
oHeatmap->SetCell(0, 0, 12);
oHeatmap->SetCell(0, 1, 48);
oHeatmap->SetCell(1, 2, 76);
oHeatmap->SetCell(4, 3, 92);
String html = oHeatmap->HTML; // SVG grid, min->max colour scale
}
__finally
{
delete oHeatmap;
}
using esegece.sgcWebSockets;
var heatmap = new TsgcHTMLComponent_Heatmap();
heatmap.RowLabels.CommaText = "Mon,Tue,Wed,Thu,Fri";
heatmap.ColumnLabels.CommaText = "9h,12h,15h,18h";
heatmap.ShowLegend = true;
heatmap.ShowValues = true;
heatmap.SetCell(0, 0, 12);
heatmap.SetCell(0, 1, 48);
heatmap.SetCell(1, 2, 76);
heatmap.SetCell(4, 3, 92);
string html = heatmap.HTML; // SVG grid, min->max colour scale
您最常使用的成员。
SetCell(aRow, aCol, aValue) 写入一个值;FindCell 查找一个值,ClearData 清空 Cells 集合。
RowLabels 和 ColumnLabels 是 TStringList,用于命名网格的每一行和每一列。
MinColor/MaxColor/EmptyColor 按单元格混合;AutoMin/AutoMax 固定 MinValue/MaxValue,而不是根据数据自动缩放。
LoadFromDataSet(aDataSet, aRowField, aColField, aValueField) 直接从查询构建网格。
CellSize/CellGap/Rounded 决定单元格的形状;ShowValues/Decimals/FontSize 控制显示的数字。
ShowLegend 绘制从最小值到最大值的渐变条;ShowRowLabels/ShowColumnLabels 切换坐标轴文本的显示。