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

Message ListMessage List     Post MessagePost Message

  perl FinanceChart - hide Legend with OHLC and other indicators
Posted by Liam on Sep-08-2010 22:21
I am trying to hide the top legend of a FinanceChart() in Perl.  Here is some partial code.  I have tried $c->getLegend()->setPos(-9999,-9999) and it does not work.  What else can I try to hide the legend.

thanks, Liam.

my $c = new FinanceChart(420);
.
. load data
.

$c->setData($timeStamps, $highData, $lowData, $openData, $closeData, $volData,
    $extraDays);

$c->addMainChart(240);
$c->addSimpleMovingAvg(13, 0x663300);
.
. more indicators
.
$c->addCandleStick(0x00ff00, 0xff0000);
$c->addVolBars(70, 0x99ff99, 0xff9999, 0x808080);

# try to hide legend - does not work

$c->getLegend()->setPos(-9999, -9999);

binmode(STDOUT);
print "Content-type: image/png\\n\\n";
print $c->makeChart2($perlchartdir::PNG);

  Re: perl FinanceChart - hide Legend with OHLC and other indicators
Posted by Peter Kwan on Sep-09-2010 00:34
Hi Liam,

There can be many charts in a FinanceChart (eg. a main price chart, plus zero or more indicator charts). If you use $c->getLegend(), ChartDirector would not know which chart you are referring to.

For your case, if you are referring to the main price chart, you may apply the code to the main price chart, like:

$m = $c->addMainChart(240);
# hide legend for the main price chart
$m->getLegend()->setPos(-9999, -9999);

Hope this can help.

Regards
Peter Kwan

  Re: perl FinanceChart - hide Legend with OHLC and other indicators
Posted by Liam on Sep-09-2010 01:12
Thanks Peter!

that did the trick,  I added
$m->yAxis()->setMargin(0,0);  as well.

Liam.



Peter Kwan wrote:

Hi Liam,

There can be many charts in a FinanceChart (eg. a main price chart, plus zero or more indicator charts). If you use $c->getLegend(), ChartDirector would not know which chart you are referring to.

For your case, if you are referring to the main price chart, you may apply the code to the main price chart, like:

$m = $c->addMainChart(240);
# hide legend for the main price chart
$m->getLegend()->setPos(-9999, -9999);

Hope this can help.

Regards
Peter Kwan