Version: 1.0.0
Series Colors & Candlesticks
The chart engine supports setting unique styles for wicks, borders, and candlestick bodies.
Candlestick Styling
Series colors are specified inside the widget options using chartSettings.symbol:
const chartOptions = {
symbol: 'BTCUSD',
chartSettings: {
symbol: {
showBody: true, // Toggle body fills
showBorders: true, // Toggle body outline borders
showWick: true, // Toggle wicks
bodyBull: '#26a69a', // Solid Bullish fill
bodyBear: '#ef5350', // Solid Bearish fill
borderBull: '#26a69a', // Bullish outline border
borderBear: '#ef5350', // Bearish outline border
wickBull: '#26a69a', // Bullish wick line
wickBear: '#ef5350' // Bearish wick line
}
}
};
Batch Rendering
To achieve high framerates when drawing thousands of candles, the library does not draw each candlestick individually. Instead, it aggregates paths into bulk draws:
// Example logic from charting_library.js:
ctx.strokeStyle = wickBull;
ctx.beginPath();
for (let i = startIndex; i <= endIndex; i++) {
const bar = this.bars[i];
if (bar.close >= bar.open) {
const x = this.barToX(i);
ctx.moveTo(x, yHigh);
ctx.lineTo(x, yLow);
}
}
ctx.stroke(); // Single canvas operation draws ALL bullish wicks