Posted 4 February 2020, 9:20 pm EST
Hi! Can i change color of candlestick? For example, “green” color for bullish candlesticks and “red” color for bearish candlesticks, w/o border line.
Forums Home / ComponentOne / General Discussion
Posted by: oms on 4 February 2020, 9:20 pm EST
Posted 4 February 2020, 9:20 pm EST
Hi! Can i change color of candlestick? For example, “green” color for bullish candlesticks and “red” color for bearish candlesticks, w/o border line.
Posted 5 February 2020, 4:46 pm EST - Updated 3 October 2022, 10:56 pm EST
Hi,
In order change color of candles(data points) based on saome condition(e.g. for bullish Close>Open) you can make use of Series.SymbolRendering event. In the event handler, you can set Fill/Stroke brushes for chart rendering engine as follows:
private void Series_SymbolRendering(object sender, C1.WPF.Chart.RenderSymbolEventArgs e)
{
var dataItem = e.Item as DataItem;
Brush brush = dataItem.Close > dataItem.Open ? Brushes.Green : Brushes.Red;
e.Engine.SetFill(brush);
e.Engine.SetStroke(brush);
}
Please verify the same with the attached sample.
Regards,
Basant