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

Message ListMessage List     Post MessagePost Message

  how to show lowest and highest point via tex
Posted by icasper on Feb-14-2012 21:07
Basically, I am plotting a line graph. I want to show
a. show "Low" or "high" as a text on the graph where it has lowest values within data array.
b. show the first value and last actual value as text boxes on the line chart.

Thanks.

  Re: how to show lowest and highest point via tex
Posted by Peter Kwan on Feb-15-2012 00:49
Hi icasper,

Since the data come from your code, your code should be able to determine which is/are the "lowest" and which is/are the "highest" points. Then you code can use Layer.addCustomDataLabel to add text labels to those points.

For example (in C#/Java):

//assume layer is the object representing your LineLayer
layer.addCustomDataLabel(0, arrayIndexOfLowestPoint, "Low", "Arial", 8, 0x000000).setAlignment(Chart.Bottom);

For showing the first value and last actual value, you may use the same Layer.addCustomDataLabel if the textbox is a box near the data point.

ChartDirector.TextBox t = layer.addCustomDataLabel(0, arrayIndexOfFirstValue, "{value}", "Arial", 8, 0x000000);
t.setBackground(0xccccff, 0x000000);

You may use TextBox.setAlignment to put the label at different position relative to the data point. If you are sure the first value or last actual value is near the border of the plot area (that is, there is no "NoValue" points or gaps in the line), you may also use Axis.addMark to add the text box on the axis.

Hope this can help.

Regards
Peter Kwan

  Re: how to show lowest and highest point via tex
Posted by icasper on Feb-16-2012 00:09
good, can u give me a php example for the same.
e.g.
1) I want to put a text box at the end of the line item i.e. on Y-axis put a yellow box with
last price showing.
2) put a red box on low point on my lowprice() array with the price.

Many Thanks

  Re: how to show lowest and highest point via tex
Posted by Peter Kwan on Feb-16-2012 02:13
Hi icasper,

1) I want to put a text box at the end of the line item i.e. on Y-axis put a yellow box with last price showing.

To put a box on the y-axis, you may use Axis.addMark. For example:

$lastPrice = $theClose[count($theClose) - 1];
$mark = $myChart->yAxis->addMark($lastPrice, -1, $lastPrice);
$mark->setMarkColors(Transparent, 0x000000, Transparent);
$mark->setBackground(0xffff00);

2) put a red box on low point on my lowprice() array with the price.

It is not clear exactly which low point you are referring to (eg. what happens if there are multiple points with the same lowest price, what happen if all points have the same lowest price, can there is gaps in the data, etc), so I will just use the low point as computed by the ArrayMath.minIndex library.

$a = newArrayMath($myLowData);
$lowIndex = $a->minIndex();

$t = $myLineLayer->addCustomDataLabel(0, $lowIndex, $myLowData[$lowIndex], "arial.ttf", 8, 0x000000);
$t->setAlignment(Bottom);
$t->setBackground(0xff8888);

Hope this can help.

Regards
Peter Kwan