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

Message ListMessage List     Post MessagePost Message

  How to customize candlestick shadow color in c++
Posted by Morning song on Apr-12-2015 22:47
Hi Peter :
    i want to customize candlestick shadow color,please give me an example in c++,thank you very much!

  Re: How to customize candlestick shadow color in c++
Posted by Peter Kwan on Apr-15-2015 04:22
Hi Morning song,

I am not sure what is the "shadow color" in your enquiry. Do you mean you would like to
have drop shadow effect for the candlesticks, or is it referring to the "fill color" of the
candlesticks (the color that fill the box in the candlesticks)?

For the fill colors, the standard examples in ChartDirector already demonstrate how to use
custom colors. For example, in the "Finance Chart (2)" sample code, the candlesticks are
using the custom colors "red" and "green" as the fill colors for up and down days. In the
sample code, the line to do this is:

c->addCandleStick(0x00ff00, 0xff0000);

You can modify the parameters 0x00ff00 and 0xff0000 to other colors to customize the
colors of the candlesticks.

Regards
Peter Kwan

  Re: How to customize candlestick shadow color in c++
Posted by Morning song on Apr-15-2015 09:00
Attachments:
I see. i mean the color of edge. i had changed the color .thank you.
another question, i want to add a legend to CandleStickLayer like the Attachments.What should I do? thank you .
QQ截图20150415085333.png

  Re: How to customize candlestick shadow color in c++
Posted by Peter Kwan on Apr-16-2015 01:16
Hi Morning,

The color axis you attached can be created by a contour layer. So for your requirement,
you can add a contour layer to the chart with no data. In this way, the contour layer will
be invisible. You can then ask the contour layer to put the color axis in the position you
want, and configure the color axis scale to your required scale.

For example, if you are using the FinanceChart object to create the candlestick layer, it is
like:

XYChart *mainChart = c->addMainChart(240);

ContourLayer *layer = mainChart->addContourLayer(DoubleArray(), DoubleArray(),
DoubleArray());
ColorAxis *axis = layer->setColorAxis(50, 30, Chart::TopLeft, 200, Chart::Right);
axis->setLinearScale(0, 100, 10);

c->addCandleStick(.............);

Hope this can help.

Regards
Peter Kwan

  Re: How to customize candlestick shadow color in c++
Posted by Morning song on Apr-16-2015 13:58
thank you Peter !
the last question.i want add a "ScatterLayer" in the finance example(c++ qtdemo).


public: ScatterLayer* addQianKunTongIndicator(XYChart* c, DoubleArray xData, DoubleArray yData, int symbol)
{
ScatterLayer *layer = c->addScatterLayer(xData,yData,"",symbol, 10);
//layer->setBorderColor(Chart::Transparent);
return layer;
}

i put m_timeStamps in xData,it does not work.which variableis xData in finance example?

  Re: How to customize candlestick shadow color in c++
Posted by Morning song on Apr-16-2015 14:45
Attachments:
this is picture
QQ截图20150416125714_副本.jpg

  Re: How to customize candlestick shadow color in c++
Posted by Peter Kwan on Apr-16-2015 23:50
Hi Morning,

You do not need the xData. Just pass in an empty array.

public: ScatterLayer* addQianKunTongIndicator(XYChart* c, DoubleArray yData, int symbol)
{
   ScatterLayer *layer = c->addScatterLayer(DoubleArray(), yData, "", symbol, 10);
   return layer;
}

Hope this can help.

Regards
Peter Kwan

  Re: How to customize candlestick shadow color in c++
Posted by Morning song on Apr-17-2015 08:43
it's work. thank you