|
Posted by Markus on July 10, 2008, 12:56 am
Please log in for more thread options > goldre...@gmail.com wrote:
> > Hey guys,
>
> > I've been putting together a line graph in Image_Graph. And I can't
> > seem to find an answer to change the layout of few things.
>
> > Here is my graph:http://www.goldreads.com/test.png
>
> > 1) I'm trying to bold the line.
> > 2) I would also like to make the title bold...
> > 3) I want to include a text inside the graph in the right corner
>
> > I would appreciate if anyone knows the answer.
>
> > Here is my code:
>
> > <?php
>
> > require_once 'Image/Graph.php';
> > require_once 'Image/Canvas.php';
>
> > $Canvas =3D& Image_Canvas::factory('png', array('width' =3D> 172, 'heig=
ht'
> > =3D> 114, 'antialias' =3D> false));
> > $Graph =3D& Image_Graph::factory('graph', $Canvas);
> > //$Graph =3D& Image_Graph::factory('graph', array(172, 114));
>
> > $Font =3D& $Graph->addNew('ttf_font', 'Arial');
> > // set the font size to 15 pixels
> > $Font->setSize(8);
>
> > $Graph->setFont($Font);
>
> > $Graph->add(
> > =A0 =A0Image_Graph::vertical(
> > =A0 =A0 =A0 =A0 =A0 =A0 $Title =3D Image_Graph::factory('title', array(=
'Dow/Gold Ratio:
> > Daily', 9)),
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Image_Graph::vertical(
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $Plotarea =3D Image_Graph::factory(=
'plotarea'),
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $Legend =3D Image_Graph::factory('t=
itle', array('Jul
> > 08, 2008 18:16 EST', 8)),
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 90
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0),
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A010
> > =A0 =A0 =A0 =A0 )
> > );
>
> > //$Legend->setPlotarea($Plotarea);
>
> > //$Plotarea =3D& $Graph->addNew('plotarea', array('axis','axis'));
> > //$Legend->setPadding(-10);
> > //$Title->setFontColor('red');
> > $Plotarea->setPadding(2);
>
> > $Dataset =3D& Image_Graph::factory('dataset');
> > $Dataset->addPoint("06.08", 10);
> > $Dataset->addPoint("06.09", 3);
> > $Dataset->addPoint("06.11", 8);
> > $Dataset->addPoint("06.12", 5);
> > $Dataset->addPoint("06.13", 4);
> > $Dataset->addPoint("06.14", 3);
> > $Dataset->addPoint("06.17", 8);
> > $Dataset->addPoint("06.18", 5);
> > $Dataset->addPoint("06.19", 4);
>
> > $Plotarea->addNew('line_grid', false, IMAGE_GRAPH_AXIS_X);
> > $Plotarea->addNew('line_grid', false, IMAGE_GRAPH_AXIS_Y);
>
> > $Plot =3D& $Plotarea->addNew('smooth_line', array(&$Dataset));
> > $Plot->setLineColor('red');
> > $Plot->setThickness(2);
> > //$Plot->setTitle('Daily Dow/Gold Ratio');
>
> > $AxisX =3D& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
> > //$AxisX->setPadding(0);
> > //$AxisX->setLabelInterval(array("Jan","Apr","Jun"));
>
> > //$AxisX->setFontAngle('vertical');
> > $AxisX->setLabelInterval(2);
>
> > //$Graph->setPadding(10);
> > $Graph->done(array('filename' =3D> 'test.png'));
>
> > ?>
>
> Image_Graph doesn't look like it's being developed any more. =A0The last
> release was an alpha version over two years ago, there is virtual no
> documentation and it has unassigned bugs almost three years ago.
>
> I doubt anyone else is using it - and I sure wouldn't, especially for
> production code.
>
> I'd suggest you check out other packages. =A0jpgraph comes to mind, but
> I'm sure there are others.
>
> --
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D- Hide quoted text =
-
>
> - Show quoted text -
Thanks a lot Jerry, I'll look into jdgraph.
|