CandlestickChart
TsgcHTMLComponent_CandlestickChart — 渲染带有影线、涨跌配色和可选成交量条的 SVG OHLC 蜡烛图,适用于 Delphi、C++ Builder 和 .NET。
TsgcHTMLComponent_CandlestickChart — 渲染带有影线、涨跌配色和可选成交量条的 SVG OHLC 蜡烛图,适用于 Delphi、C++ Builder 和 .NET。
使用 AddPoint 为每根 K 线添加一个 OHLC 数据点(或绑定数据集),然后读取 HTML 属性。
TsgcHTMLComponent_CandlestickChart
内联 SVG OHLC 图表 + 可选成交量条(无需图表库)
Delphi, C++ Builder, .NET
为每根 K 线调用 AddPoint(aLabel, aOpen, aHigh, aLow, aClose, aVolume)(或绑定数据集),然后读取 HTML。
uses
sgcHTML_Component_CandlestickChart;
var
oChart: TsgcHTMLComponent_CandlestickChart;
begin
oChart := TsgcHTMLComponent_CandlestickChart.Create(nil);
try
oChart.Width := 800;
oChart.Height := 400;
oChart.ShowVolume := True;
oChart.AddPoint('Mon', 101.2, 104.8, 100.1, 103.5, 125000);
oChart.AddPoint('Tue', 103.5, 106.0, 102.8, 105.1, 98000);
oChart.AddPoint('Wed', 105.1, 105.4, 101.0, 101.9, 154000);
WebModule.Response := oChart.HTML; // SVG candles + wicks + volume strip
finally
oChart.Free;
end;
end;
// Or bind it straight to a dataset:
oChart.LoadFromDataSet(qryOHLC, 'TradeDate', 'OpenPrice', 'HighPrice',
'LowPrice', 'ClosePrice', 'Volume');
// includes: sgcHTML_Component_CandlestickChart.hpp
TsgcHTMLComponent_CandlestickChart *oChart = new TsgcHTMLComponent_CandlestickChart(NULL);
try
{
oChart->Width = 800;
oChart->Height = 400;
oChart->ShowVolume = true;
oChart->AddPoint("Mon", 101.2, 104.8, 100.1, 103.5, 125000);
oChart->AddPoint("Tue", 103.5, 106.0, 102.8, 105.1, 98000);
oChart->AddPoint("Wed", 105.1, 105.4, 101.0, 101.9, 154000);
String html = oChart->HTML; // SVG candles + wicks + volume strip
}
__finally
{
delete oChart;
}
using esegece.sgcWebSockets;
var chart = new TsgcHTMLComponent_CandlestickChart();
chart.Width = 800;
chart.Height = 400;
chart.ShowVolume = true;
chart.AddPoint("Mon", 101.2, 104.8, 100.1, 103.5, 125000);
chart.AddPoint("Tue", 103.5, 106.0, 102.8, 105.1, 98000);
chart.AddPoint("Wed", 105.1, 105.4, 101.0, 101.9, 154000);
string html = chart.HTML; // SVG candles + wicks + volume strip
您最常使用的成员。
AddPoint(aLabel, aOpen, aHigh, aLow, aClose, aVolume) 追加一根 OHLC K 线,并返回 TsgcHTMLCandlestickPoint。
LoadFromDataSet(aDataSet, aDateField, aOpenField, aHighField, aLowField, aCloseField, aVolumeField) 直接从查询构建数据系列。
UpColor/DownColor 根据涨跌方向为实体上色;WickColor 用于覆盖最高最低影线的颜色。
ShowVolume 在 K 线下方添加一个成交量条,按最高柱进行缩放。
ShowAxis/ShowGrid/GridLines/FontSize/Decimals 控制价格坐标轴。
Width/Height/CandleWidth 设置图表尺寸;MinValue/MaxValue 与 AutoMin/AutoMax 配合可固定价格范围。