Exemplo n.º 1
0
    // Add a title box to the chart using 8 pts Arial Bold font, with yellow (0xffff40)
    // background and a black border (0x0)
    $textBoxObj = $c->addTitle("{$name} ({$pfid}) Performance ({$first_date} to {$last_date})", "arialbd.ttf", 8);
    $textBoxObj->setBackground(0xffff40, 0);
    // Set the y axis label format to US$nnnn
    $c->yAxis->setLabelFormat("£{value}");
    // Set the labels on the x axis.
    // Display 1 out of 2 labels on the x-axis. Show minor ticks for remaining labels.
    $m_yearFormat = "{value|yyyy}";
    $m_firstMonthFormat = "<*font=bold*>{value|mmm yy}";
    $m_otherMonthFormat = "{value|mmm}";
    $m_firstDayFormat = "<*font=bold*>{value|d mmm}";
    $m_otherDayFormat = "{value|d}";
    $m_firstHourFormat = "<*font=bold*>{value|d mmm\nh:nna}";
    $m_otherHourFormat = "{value|h:nna}";
    $m_timeLabelSpacing = 50;
    $c->xAxis->setMultiFormat(StartOfDayFilter(), $m_firstDayFormat, StartOfDayFilter(1, 0.5), $m_otherDayFormat, 1);
    // Add an stack area layer with three data sets
    $layer = $c->addAreaLayer2(Stack);
    $layer->addDataSet($holdings, 0x4040ff, "Holdings");
    $layer->addDataSet($cash_in_hand, 0xff4040, "Cash");
    $layer->setXData($dates);
    // Output the chart
    header("Content-type: image/png");
    print $c->makeChart2(PNG);
} else {
    return;
}
?>