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

Message ListMessage List     Post MessagePost Message

  Legend Border Width
Posted by Brian on Aug-12-2008 06:51
Hey Peter,
Is it possible to change the border width on a legend box?  I'm coding in PHP btw.

Thanks,
Brian

  Re: Legend Border Width
Posted by Peter Kwan on Aug-13-2008 01:57
Hi Brain,

The easiest method is to add a larger box behind the legend box. For example:

$c = new XYChart(.............);
$c->addLegend(330, 40);   //assume legend box at (330, 40)
...... create chart as usual .........

//layout the legend box to get its size
$legendBox = $c->layoutLegend();

//set legend box to using a white background
$legendBox->setBackground(0xffffff);

//draw a larger black box behind the legend box
$t = $c->addText(330 - 3, 40 - 3, "");
$t->setSize($legendBox->getWidth() + 6, $legendBox->getHeight() + 6);
$t->setBackground(0x000000);
$t->setZOrder(ChartBackZ);


Hope this can help.

Regards
Peter Kwan

  Re: Legend Border Width
Posted by Rob on Jun-27-2009 03:00
Peter,

Any way to remove the border or just make it transparent?

I am coding in vb.net

  Re: Legend Border Width
Posted by Peter Kwan on Jun-27-2009 14:10
Hi Rob,

Just set the border color to transparent. For example:

'white background, transparent border
c.getLegend().setBackground(&HFFFFFF, Chart.Transparent)

Hope this can help.

Regards
Peter Kwan

  Re: Legend Border Width
Posted by leslie on Aug-10-2009 22:20
I am also looking to make the border transparent in the following php code:

$legendObj = $c->addLegend2 (50,195,1,"",7);
$legendObj->setText("<*block,valign=top*><*block,width=145*>{label}<*/*><*block,width=65,halign=right*>\\${value|2,.}<*/*>");
$legendObj->setBackground(0x75ffffff, 0x75000000, 2);

thanks!

  Re: Legend Border Width
Posted by Peter Kwan on Aug-11-2009 00:49
Hi leslie,

The border color in your code is 0x75000000, which is semi-transparent black. To make it full transparent, please use Transparent. For example:

$legendObj->setBackground(0x75ffffff, Transparent, 2);

Hope this can help.

Regards
Peter Kwan

  Re: Legend Border Width
Posted by Colin on Apr-04-2012 01:53
Hi Peter,

I am also just trying to hide/remove the legend border or set it transparrent.  I've tried some of the examples here, none worked for me.

ChartDirector 5, PHP 5.2

Here is my add legend statment, pretty basic.
$c->addLegend(100, 45);

Thanks,
Colin

  Re: Legend Border Width
Posted by Peter Kwan on Apr-04-2012 02:20
Hi Colin,

Please change your code to:

$legendObj = $c->addLegend(100, 45);
$legendObj->setBackground(Transparent, Transparent);

If the above still cannot solve the problem, is it possible to inform me of your complete charting code. I suspect there may be another line of code that re-enables the legend border.

Regards
Peter Kwan

  Re: Legend Border Width
Posted by Colin on Apr-04-2012 02:36
Perfect.