CandlestickChart Component — sgcHTML | eSeGeCe

CandlestickChart

TsgcHTMLComponent_CandlestickChart — render an SVG OHLC candlestick chart with wicks, up/down colours and an optional volume strip, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_CandlestickChart

Add one OHLC point per bar with AddPoint (or bind a dataset), then read the HTML property.

Component class

TsgcHTMLComponent_CandlestickChart

Renders

Inline SVG OHLC chart + optional volume strip (no chart library)

Languages

Delphi, C++ Builder, .NET

Add OHLC points, render it

Call AddPoint(aLabel, aOpen, aHigh, aLow, aClose, aVolume) for each bar (or bind a dataset), then read 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

Key properties & methods

The members you reach for most often.

Points

AddPoint(aLabel, aOpen, aHigh, aLow, aClose, aVolume) appends one OHLC bar and returns the TsgcHTMLCandlestickPoint.

Dataset binding

LoadFromDataSet(aDataSet, aDateField, aOpenField, aHighField, aLowField, aCloseField, aVolumeField) builds the series from a query.

Candle colours

UpColor/DownColor paint the body by direction; WickColor overrides the high-low line colour.

Volume

ShowVolume adds a volume strip below the candles, scaled to the highest bar.

Axis & grid

ShowAxis/ShowGrid/GridLines/FontSize/Decimals control the price axis.

Layout & scale

Width/Height/CandleWidth size the chart; MinValue/MaxValue with AutoMin/AutoMax pin the price range.

Keep exploring

Online HelpFull API reference and usage guide for this component.
All sgcHTML ComponentsBrowse the full feature matrix of 80+ components.
Download Free TrialThe 30-day trial ships the 60.HTML demo projects.
PricingSingle, Team and Site licenses with full source code.

Ready to Get Started?

Download the free trial and start building web UIs in Delphi, C++ Builder and .NET.