fclose($handle);
}
array_shift($count);
array_shift($matchdate);
//  echo "matchdate";
//       print_r($matchdate);
//      print_r($count);
require_once "/var/www/ChartDirector/lib/phpchartdir.php";
# Create a XYChart object of size 250 x 250 pixels
$c = new XYChart(780, 390);
# Set the plotarea at (30, 20) and of size 200 x 200 pixels
$c->setPlotArea(40, 10, 700, 290, 0xe9fae7, 0xffffff);
# Add a title to the pie chart
$c->addTitle($display_date);
# Add a line chart layer using the given data
$lineObj = $c->addLineLayer($count, 0x70e17513);
$lineObj->set3D();
$c->yAxis->setTickDensity(30);
$c->xAxis->setTickDensity(75);
# Set the labels on the x axis.
$c->xAxis->setLabels($matchdate);
# Add a title to the y axis
$c->yAxis->setTitle("Searches");
# Add a title to the x axis
$c->xAxis->setTitle("Days");
$labelsObj = $c->xAxis->setLabels($matchdate);
$labelsObj->setFontAngle(70);
$labelsObj->setFontStyle("arial.ttf");
$labelsObj->setFontSize(9);
$filename = $path . "/provider/charts/defaultimages/" . $imagename;
$c->makeChart($filename);
    if ($count < 370) {
        $format = $m_firstDayFormat;
    } else {
        $format = $m_firstMonthFormat;
    }
    $c1->xAxis->setMultiFormat(StartOfDayFilter(), $format, StartOfDayFilter(1, 0.5), $m_otherDayFormat, 1);
    $mark1 = $c1->yAxis->addMark(1, -1, "");
    $c2->xAxis->setMultiFormat(StartOfDayFilter(), $format, StartOfDayFilter(1, 0.5), $m_otherDayFormat, 1);
    $c3->xAxis->setMultiFormat(StartOfDayFilter(), $format, StartOfDayFilter(1, 0.5), $m_otherDayFormat, 1);
    $mark3 = $c3->yAxis->addMark(0, -1, "");
    // add the colouring to the area between 1 and the current plot line
    $lineLayerObj1 = $c1->addLineLayer($a_d_ratio, $c1->yZoneColor(1, 0xff3333, 0x8800), 'A/D Ratio');
    $c1->addInterLineLayer($lineLayerObj1->getLine(), $mark1->getLine(), $c1->linearGradientColor(0, 50, 0, 255, 0xffffff, 0x8800), $c1->linearGradientColor(0, 50, 0, 255, 0xffffff, 0xff0000));
    $lineLayerObj1->setXData($dates);
    $lineLayerObj2 = $c2->addLineLayer($a_d_line, -1, 'A/D Line');
    $lineLayerObj2->setXData($dates);
    $lineLayerObj3 = $c3->addLineLayer($a_d_spread, $c3->yZoneColor(0, 0xff3333, 0x8800), 'A/D Spread');
    $c3->addInterLineLayer($lineLayerObj3->getLine(), $mark3->getLine(), $c3->linearGradientColor(0, 50, 0, 255, 0xffffff, 0x8800), $c3->linearGradientColor(0, 50, 0, 255, 0xffffff, 0xff0000));
    $lineLayerObj3->setXData($dates);
    // Output the chart
    header("Content-type: image/png");
    $m->addChart(0, 0, $c1);
    $m->addChart(0, 150, $c2);
    $m->addChart(0, 300, $c3);
    print $m->makeChart2(PNG);
} else {
    return;
}
?>