We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Candle, priceup, pricedown

Hi,
I would like to see the code of this example:
https://www.syncfusion.com/products/chart/windows/features/Chart_Types/images/candlechart.png

It is the example "Candle Chart summarizing Stock Price for a day" that is in
https://www.syncfusion.com/products/chart/windows/features/Chart_Types/Financial_Charts.aspx

In this page it is written that "The body of the candle is often colored conditionally based on whether the open value is lower than the close value." but PriceUpColor and PriceDownColor only apply to chart types Kagi Chart, PointandFigure Chart, Renko Chart, Three Line Break Chart.

I want to create a candle serie with 2 colors: one color for the points such that the open price is bigger than the close price and one color for the other points


1 Reply

MA Manohari Syncfusion Team October 30, 2008 05:04 AM UTC

Hi Mathias,

Thanks for your interest in Syncfusion products.

It is possible to set two different colors to the CandleSeries depending on the Open and close price, by handling the PrepareStyle event of that series.

Example:

series1.PrepareStyle += new ChartPrepareStyleInfoHandler(series1_PrepareStyle);

// Customize Candle series Style

void series1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args)
{
ChartSeries candleSeries = sender as ChartSeries;
if (candleSeries.Points[args.Index].YValues[2] > candleSeries.Points[args.Index].YValues[3])
{
args.Style.Interior = new BrushInfo(Color.SteelBlue);
}
else
{
args.Style.Interior = new BrushInfo(Color.Brown);
}


I have attached a sample that illustrates the same in this link below.

http://websamples.syncfusion.com/samples/Chart.Windows/F77368/Sample1.htm

Please let me know if this meets your requirement.

Regards,
Manohari.R


Loader.
Live Chat Icon For mobile
Up arrow icon