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

Message ListMessage List     Post MessagePost Message

  setAlignment Not Working?
Posted by Bob on Apr-16-2013 02:48
Attachments:
Hello,

I am creating a bar chart (see attachment).  I was wondering if it were possible to move the aggregate labels left or right of the current position.

Here is the code I am trying.  Notice in particular the "$tb->setalignment(12);":

# Create a XYChart object of size 400 x 350 pixels.
$c = new XYChart(690, 240, brushedSilverColor(), 0x666666);
$c->setRoundedFrame(0xffffff, 20);
$c->setPlotArea(40, 55, 625, 145, -1, -1, Transparent, 0xaaaaaa);

# Add multi-color bar chart layers using the supplied data. Use bar gradient
# lighting with the light intensity from 0.75 to 2.0
$labellayer = $c->addBarLayer2(Side, 0);
$labellayer->addDataSet($rate_won_currentAR, 0xff000000);
$labellayer->addDataSet($rate_won_lastAR, 0xff000000);
$labellayer->setOverlapRatio(0.5);
$labellayer->setBorderColor(Transparent, barLighting(0.75, 2.0));
$labellayer->setBarShape(CircleShape);
$tb = $labellayer->setAggregateLabelStyle("arial.ttf", 8, 0x111111, 90);
$tb->setAlignment(12);
$labellayer->setAggregateLabelFormat("  {value|1,}%");

# Add a box-whisker layer with just the middle mark visible for the marks. Use red
# (ff0000) color for the mark, with a line width of 2 pixels and 10% horizontal gap
$markLayer = $c->addBoxWhiskerLayer(null, null, null, null, $mark_dataAR, -1, 0xff0000);
$markLayer->setLineWidth(2);
$markLayer->setDataGap(0.1);

$chartlayer = $c->addBarLayer2(Side, 0);
$chartlayer->addDataSet($rate_won_currentAR, 0x006666ff, "Current year");
$chartlayer->addDataSet($rate_won_lastAR, 0x66eebb22, "Previous year");
$chartlayer->setOverlapRatio(0.5);
$chartlayer->setBarShape(CircleShape);

# Set the label styles of all axes to 8pt Arial Bold font
$c->xAxis->setLabelStyle("arial.ttf", 8);
$c->yAxis->setLinearScale(0, 100);
$c->yAxis->setLabelStyle("arial.ttf", 8);
$c->yAxis2->setLabelStyle("arial.ttf", 8);

$legendObj = $c->addLegend(485, 0, false, '', 8);
$legendObj->setBackground(Transparent);

# Configure the labels on both axes
$c->xAxis->setLabels($labels);
$c->yAxis->setLabelFormat("{value|0,}");

Thanks for any suggestions!!
chart.png

  Re: setAlignment Not Working?
Posted by Bob on Apr-16-2013 03:07
FYI - I figured it out.

I needed to use:

$tb->setPos(-15,0);