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

Message ListMessage List     Post MessagePost Message

  draw symbol on FinanceChart
Posted by hiro on Mar-12-2015 16:20
Hello,

I would like to drawing symbol on FinanceChart.
I know that it is good way if I use the addScatterLayer. but this way can not draw several
symbols on same x axis.
please teach me how drawing several symbols on same x axis.

  Re: draw symbol on FinanceChart
Posted by Peter Kwan on Mar-13-2015 03:46
Hi hiro,

As you have mentioned, you can draw symbols using addScatterLayer. Each scatter layer
can draw multiple symbols of the same type (same shape and color). If you have more
than one types of symbols, you can use multiple scatter layers. For example, in PHP, it is
like:


# The data series for the scatter layer. The series should be the same length as
# all other series (same length as $timeStamps, $highData, $lowData, etc). We set
# the data values to NoValue so no scatter symbol will be shown.
$myData = array_pad(array(), count($timeStamps), NoValue);


# Show two symbols at x = 50 and x = 70 (x is the array index, which is the same
# index you use for timeStamps), at y = 16 and 44.
$myData[50] = 16;
$myData[70] = 44;


# Assume you want to add the symbols to the main price chart
$myMainChart = $myFinanceChart->addMainChart(.....);

# Add the scatter layer to the main price chart
$myMainChart->addScatterLayer(null, $myData, "", SquareSymbol, 11, 0xff0000,
0x000000);


Hope this can help.

Regards
Peter Kwan

  Re: draw symbol on FinanceChart
Posted by hiro on Mar-13-2015 10:36
Attachments:
Hi Peter,


Thank you for your reply.

I would like to drawing multiple one type of symbol on same x-axis. (please see attached
image file.)
in this case, there is only way to use a multiple of ScatterLayer?

example in Java;

double[] myData1 = new double[timeStamps.lengs];
double[] myData2 = new double[timeStamps.lengs];

//cut lines of setting null values

myData1[70] = 120.1;
myData2[70] = 120.8;

myMainChart = myFinanceChart.addMainChart(.....);
myMainChart.addScatterLayer(null, myData1, "", Chart.DiamondSymbol, 10, .....);
myMainChart.addScatterLayer(null, myData2, "", Chart.DiamondSymbol, 10, .....);


But this way, The more data to be drawn on the same X axis, it must be use many
ScatterLayer.
Do you have any good way?
Image.png

  Re: draw symbol on FinanceChart
Posted by Peter Kwan on Mar-14-2015 02:17
Hi hiro,

Sorry for my misunderstanding. I can see what you mean now.

For your case, you can provide both the x-coordinates and the y-coordinates to the
scatter layer. In this way, you can have multiple points at the same x-coordinate.
Because the FinanceChart may remove some leading points as "extraPoints" (the last
parameter in Finance.setData), so the code must not use the first extraPoints in the data
array. The code is like:

//assume you need 10 symbols
double[] myDataX = new double[extraPoints + 10];
double[] myDataY = new double[extraPoints + 10];

for (int i = 0; i < myDataX.length; ++i)
   myDataX[i] = myDataY[i] = Chart.NoValue;

myDataX[extraPoints] = 70;
myDataY[extraPoints] = 120.1;

myDataX[extraPoints + 1] = 70;
myDataY[extraPoints + 1] = 120.8;

myMainChart.addScatterLayer(myDataX, myDataY, "", Chart.DiamondSymbol, 10, .....);


Hope this can help.

Regards
Peter Kwan

  Re: draw symbol on FinanceChart
Posted by hiro on Mar-17-2015 08:44
Hi Peter,


Thank you for advice.
The expected results was obtained.

I am grateful to the amazing library and powerful support !!

Regards,
hiro