Example #1
0
    $legendObj = $c->addLegend(50, 455, false, "", 8);
    $legendObj->setBackground(Transparent);
    // 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("{$symb}.{$pf_exch}: {$symb_name}\nExponential Moving Averages from {$first_date} to {$pf_working_date}", "arialbd.ttf", 12);
    // Set the y axis label format to US$nnnn
    $c->yAxis->setLabelFormat("£{value}");
    $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);
    $layer = $c->addLineLayer2();
    $layer->setXData($dates);
    $layer->addDataSet($ema_12, -1, "12 day");
    $layer->addDataSet($ema_26, -1, "26 day");
    $layer = $c->addHLOCLayer3($high, $low, $open, $close, 0x8000, 0xff0000);
    $layer->setXData($dates);
    // Output the chart
    header("Content-type: image/png");
    print $c->makeChart2(PNG);
} else {
    return;
}
?>