ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Need help for candlestick colors
Posted by James on Jan-31-2013 02:52
Attachments:
Hello,

I've been trying to resolve this issue and I couldn't figure out how to do.

I have attached sample image and I would like "UP" candle stick color to be white edges (white header, tail, and body edges) and black inside.

The current code is

CandleStickLayer candleLayer = financeChart.addCandleStick(Chart.Transparent, Chart.Transparent);
candleLayer.getDataSet(0).setDataColor(0xCCCCCC, Chart.SameAsMainColor);
candleLayer.getDataSet(1).setDataColor(0xC40000, Chart.SameAsMainColor);

How can I fill black inside "UP" stick?

Thank you,
2013-01-30_134519.jpg

  Re: Need help for candlestick colors
Posted by Peter Kwan on Feb-01-2013 01:02
Hi James,

There is a similiar example in:

http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=hollow+candlestick&thread=1143398629#N1269012732

For your case, in Java, you may try:

XYChart mainChart = financeChart.addMainChart(....);

CandleStickLayer candleLayer = financeChart.addCandleStick(0xCCCCCC, 0xC40000);
candleLayer.getDataSet(0).setDataColor(0xCCCCCC, Chart.SameAsMainColor);
candleLayer.getDataSet(1).setDataColor(Chart.Transparent, Chart.SameAsMainColor);

candleLayer  = mainChart.addCandleStickLayer(highData, lowData, openData, closeData);
candleLayer.getDataSet(0).setDataColor(Chart.Transparent, 0xC40000);
candleLayer.getDataSet(1).setDataColor(0x000000, 0xC40000);

Hope this can help.

Regards
Peter Kwan

  Re: Need help for candlestick colors
Posted by James on Feb-01-2013 02:31
Attachments:
Sorry, I should mention that it was C#

Thank you for your prompt assistance. I was able to modify some code and got it work.

For others who had same problem, here is code.

-------------------------------------------------------------------

int upColor = 0xCCCCCC;    // up, white
int dnColor = 0xC40000;     // down, red
int fillColor = 0x151515;      // fill

CandleStickLayer candleLayer = financeChart.addCandleStick(upColor, dnColor);
candleLayer.getDataSet(0).setDataColor(dnColor, Chart.SameAsMainColor);
candleLayer.getDataSet(1).setDataColor(Chart.Transparent, Chart.SameAsMainColor);

CandleStickLayer candleLayer2 = xychart.addCandleStickLayer(high, low, open, close);
candleLayer2.getDataSet(0).setDataColor(Chart.Transparent, upColor);
candleLayer2.getDataSet(1).setDataColor(fillColor, upColor);

I attached the result.

Again, thank you for your great support.
2013-01-31_132701.jpg

  Re: Need help for candlestick colors
Posted by James on Feb-01-2013 02:46
Attachments:
Oops, sorry... it was not correct code.

Here is the correct one

int upColor = 0xCCCCCC;    // white
int dnColor = 0xC40000;
int fillColor = 0x151515;

CandleStickLayer candleLayer = financeChart.addCandleStick(upColor, dnColor);
candleLayer.getDataSet(0).setDataColor(Chart.Transparent, Chart.SameAsMainColor);
candleLayer.getDataSet(1).setDataColor(dnColor, Chart.SameAsMainColor);

CandleStickLayer candleLayer2 = xychart.addCandleStickLayer(high, low, open, close);
candleLayer2.getDataSet(0).setDataColor(fillColor, upColor);
candleLayer2.getDataSet(1).setDataColor(Chart.Transparent, upColor);
2013-01-31_134553.jpg