Componente CandlestickChart — sgcHTML | eSeGeCe

CandlestickChart

TsgcHTMLComponent_CandlestickChart — renderiza un gráfico de velas OHLC en SVG con mechas, colores de subida/bajada y una franja de volumen opcional, en Delphi, C++ Builder y .NET.

TsgcHTMLComponent_CandlestickChart

Añade un punto OHLC por barra con AddPoint (o vincula un dataset), y luego lee la propiedad HTML.

Clase del componente

TsgcHTMLComponent_CandlestickChart

Renderiza

Gráfico OHLC SVG en línea + franja de volumen opcional (sin librería de gráficos)

Lenguajes

Delphi, C++ Builder, .NET

Añade puntos OHLC, renderízalo

Llama a AddPoint(aLabel, aOpen, aHigh, aLow, aClose, aVolume) para cada barra (o vincula un dataset), y luego lee 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

Propiedades y métodos clave

Los miembros que usarás con más frecuencia.

Puntos

AddPoint(aLabel, aOpen, aHigh, aLow, aClose, aVolume) añade una barra OHLC y devuelve el TsgcHTMLCandlestickPoint.

Vinculación a dataset

LoadFromDataSet(aDataSet, aDateField, aOpenField, aHighField, aLowField, aCloseField, aVolumeField) construye la serie desde una consulta.

Colores de las velas

UpColor/DownColor pintan el cuerpo según la dirección; WickColor sobrescribe el color de la línea máximo-mínimo.

Volumen

ShowVolume añade una franja de volumen debajo de las velas, escalada a la barra más alta.

Eje y cuadrícula

ShowAxis/ShowGrid/GridLines/FontSize/Decimals controlan el eje de precios.

Diseño y escala

Width/Height/CandleWidth dimensionan el gráfico; MinValue/MaxValue junto con AutoMin/AutoMax fijan el rango de precios.

Sigue explorando

Ayuda en líneaReferencia completa de la API y guía de uso para este componente.
Todos los componentes de sgcHTMLExplora la matriz completa de más de 80 componentes.
Descargar prueba gratuitaLa prueba de 30 días incluye los proyectos de demostración 60.HTML.
PreciosLicencias Single, Team y Site con código fuente completo.

¿Listo para empezar?

Descarga la prueba gratuita y empieza a crear interfaces web en Delphi, C++ Builder y .NET.