Wicks disappear when background is set to Black color

When I set the background color of Chart to Black, I experience the following issues:

1. The upper and lower wicks are not visible. Is there a way to set the colors for wicks for these the candles?
2. The width of candle bodies is thinner with Black background. There appears a black border around candle bodies as seen in the picture on left. This may be causing this problem. Can we set the candle border to None or transparent?

Please see the attached picture.

Attachment: Candle_Chart_Wicks_904da46f.zip

6 Replies 1 reply marked as answer

YP Yuvaraj Palanisamy Syncfusion Team March 9, 2021 06:34 AM UTC

Hi Ashok, 
 
Greetings from Syncfusion. 
 
We would like to let you know that change the CandleSeries the border with the help of Border color property of Series. Please find the code example below. 
 
CodeSnippet: 
 
ChartSeries series = new ChartSeries("series", ChartSeriesType.Candle); 
series.Style.Border.Color = Color.White; 
 
 
Output: 
 
 
For more details, please refer the below link. 
 
Regards, 
Yuvaraj. 



AS Ashok March 10, 2021 02:57 AM UTC

Setting the border on candles which are small size and in a small sized chart makes them look ugly. Please see the attached picture that compares 2 different charts: Left one generated with Syncfusion Chart and the right one with Microsoft Chart.

There must be another way to just set the color for upper and lower wicks, without having to set the border color for candle body.

Attachment: Candle_Charts_59eccebf.zip


YP Yuvaraj Palanisamy Syncfusion Team March 10, 2021 11:20 AM UTC

Hi Ashok, 
 
We have achieved your requirement “Without set border color for Candle body and Set border color for only Low an Upper wicks” with the help of series custom renderer support by using Renderer property of ChartSeries. Please find the code example below. 
 
CodeSnippet: 
ChartSeries series = new ChartSeries("series", ChartSeriesType.Candle); 
series.Style.Border.Color = Color.White; 
series.Renderer = new CustomRenderer(series); 
 
public class CustomRenderer : ChartSeriesRenderer 
    { 
       public CustomRenderer(ChartSeries series) 
            : base(series) 
        { 
        } 
 
    . . . 
} 
 
Also, we have attached the sample for your reference. Please find the sample from the below link. 
 
  
Output: 
 
 
For more details, please refer the below link. 
 
 
Regards, 
Yuvaraj. 



AS Ashok March 11, 2021 05:51 AM UTC

Thank you Yuvaraj. We are getting closer. The border does not appear on the candle body now which is good. But there are 2 issues:

1. Some of the wicks are white while others appear to be grey. See the middle candle in you sample.
2. The candle bodies have become narrower. Is there a way to increase the width of candle body?

Thanks,



AS Ashok March 12, 2021 04:38 AM UTC

The wick color shows fine when I set the to series1.Style.Border.Width = 2. I think I am okay with that. 

I did some work on the candle width. I was able to resolve it by modifying the CustomRenderer as under:

Pen border = style.GdipPen;
border.Color = interior.BackColor;      //was Color.Transparent;

I am not sure if this will be a good idea for code maintainability. Please advise.


YP Yuvaraj Palanisamy Syncfusion Team March 12, 2021 06:54 AM UTC

Hi Ashok, 
 
# Some of the wicks are white while others appear to be grey 
 
Thanks for your update. Yes, you can resolve this by using Border Width becomes 2.  
 
# The candle bodies have become narrower. Is there a way to increase the width of candle body? 
 
Yes. You can adjust the width of the candle body with the help of Spacing property of ChartControl in WinForms. Please find the below code example. 
 
ChartSeries series = new ChartSeries("series", ChartSeriesType.Candle); 
series.Style.Border.Color = Color.White; 
series.Style.Border.Width = 2f; 
series.Renderer = new CustomRenderer(series); 
this.chartControl1.Spacing = 0;  // by default Spacing is 10% 
 
# For code Maintainability use border.Color = interior.BackColor; 
 
It’s Ok. You can use border.Color = interior.BackColor in the provided workaround solution and  it does not any other element. 
 
Regards, 
Yuvaraj. 


Marked as answer
Loader.
Up arrow icon