<?php
/**
 * phpaga
 *
 * This file contains the necessary routines to manage graphs and to
 * interface with the chosen graphing library.
 *
 * @author Florian Lanthaler <florian@phpaga.net>
 * @version $Id: graphs.php 838 2007-08-26 22:09:16Z florian $
 *
 * Copyright (c) 2007, Florian Lanthaler <florian@phpaga.net>
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *    * Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *
 *    * Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in
 *      the documentation and/or other materials provided with the
 *      distribution.
 *
 *    * Neither the name of Florian Lanthaler nor the names of his
 *      contributors may be used to endorse or promote products derived
 *      from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

class PhPagaGraphPieChart extends ezcGraphPieChart
{

    public function __construct( array $options = array() ) {

        $this->options = new ezcGraphPieChartOptions( $options );

        parent::__construct( $options );

         $this->palette = new PhPagaGraphPalette();

        #$this->driver = new ezcGraphGdDriver();
        #$this->options->font = 'tutorial_font.ttf';

        #$this->driver->options->supersampling = 1;
        #$this->driver->options->jpegQuality = 100;
        #$this->driver->options->imageFormat = IMG_PNG;

        if (PHPAGA_GRAPH_OPCAT_STYLE == PHPAGA_GRAPH_OPCAT_STYLE_PIE3D) {
            $this->renderer = new ezcGraphRenderer3d();
            $this->renderer->options->pieChartHeight = 15;
            $this->renderer->options->pieChartRotation = .9;

        }
        $this->renderer->options->pieChartOffset = 60;
        $this->renderer->options->pieChartGleam = .4;
        $this->renderer->options->pieChartGleamColor = '#ffffff';
        $this->renderer->options->pieChartGleamBorder = 1;

        $this->options->font->minFontSize = 8;
        $this->options->font->maxFontSize = 16;
    }
}

class PhPagaGraphBarChart extends ezcGraphBarChart
{

    public function __construct( array $options = array() ) {

        parent::__construct();

        $this->palette = new PhPagaGraphPalette();

        $this->renderer->options->legendSymbolGleam = .5;
        $this->renderer->options->legendSymbolGleamSize = .9;
        $this->renderer->options->legendSymbolGleamColor = '#ffffff';

        $this->options->font->minFontSize = 6;
        $this->options->font->maxFontSize = 16;

    }
}

class PhPagaGraphLineChart extends ezcGraphLineChart
{

    public function __construct( array $options = array() ) {

        parent::__construct();

        $this->palette = new PhPagaGraphPalette();

        $this->renderer->options->legendSymbolGleam = .5;
        $this->renderer->options->legendSymbolGleamSize = .9;
        $this->renderer->options->legendSymbolGleamColor = '#ffffff';

        $this->options->font->minFontSize = 6;
        $this->options->font->maxFontSize = 16;

    }
}

class PhPagaGraphPalette extends ezcGraphPalette
{

    protected $axisColor = '#aaaaaa';
    protected $majorGridColor = '#D3D7DF';
    protected $fontName = 'sans-serif';
    protected $fontColor = '#2E3436';
    protected $chartBackground = '#ffffff';
    protected $dataSetSymbol = array(ezcGraph::NO_SYMBOL);

    protected $dataSetColor = array(
        '#3465A4',
        '#4E9A06',
        '#CC0000',
        '#EDD400',
        '#75505B',
        '#F57900',
        '#204A87',
        '#C17D11',
        );

    public function setColors($colors) {
        $this->dataSetColor = $colors;
    }
}

class PhPagaManHoursGraphPalette extends PhPagaGraphPalette {

    protected $dataSetColor = array(
        '#9CAE8688',
        '#C90062',
        '#E05206',
        '#F0AB00',
        '#D4BA00',
        '#9C9A00',
        '#3C8A2E',
        '#006983',
        '#0098C3',
        '#21578A',
        '#55517B',
        '#4E7D5B',
    );

}

?>