Click here to get back home

Image_Graph line weight question

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Image_Graph line weight question goldreads 07-09-2008
Get Chitika Premium
Posted by goldreads on July 9, 2008, 12:56 am
Please log in for more thread options
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 =& Image_Canvas::factory('png', array('width' => 172, 'height'
=> 114, 'antialias' => false));
$Graph =& Image_Graph::factory('graph', $Canvas);
//$Graph =& Image_Graph::factory('graph', array(172, 114));

$Font =& $Graph->addNew('ttf_font', 'Arial');
// set the font size to 15 pixels
$Font->setSize(8);

$Graph->setFont($Font);

$Graph->add(
        Image_Graph::vertical(
                 $Title = Image_Graph::factory('title', array('Dow/Gold Ratio:
Daily', 9)),
Image_Graph::vertical(
$Plotarea = Image_Graph::factory('plotarea'),
$Legend = Image_Graph::factory('title', array('Jul
08, 2008 18:16 EST', 8)),
90
),
10
)
);


//$Legend->setPlotarea($Plotarea);

//$Plotarea =& $Graph->addNew('plotarea', array('axis','axis'));
//$Legend->setPadding(-10);
//$Title->setFontColor('red');
$Plotarea->setPadding(2);

$Dataset =& 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 =& $Plotarea->addNew('smooth_line', array(&$Dataset));
$Plot->setLineColor('red');
$Plot->setThickness(2);
//$Plot->setTitle('Daily Dow/Gold Ratio');

$AxisX =& $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' => 'test.png'));



?>

Posted by Jerry Stuckle on July 9, 2008, 6:22 am
Please log in for more thread options
goldreads@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 =& Image_Canvas::factory('png', array('width' => 172, 'height'
> => 114, 'antialias' => false));
> $Graph =& Image_Graph::factory('graph', $Canvas);
> //$Graph =& Image_Graph::factory('graph', array(172, 114));
>
> $Font =& $Graph->addNew('ttf_font', 'Arial');
> // set the font size to 15 pixels
> $Font->setSize(8);
>
> $Graph->setFont($Font);
>
> $Graph->add(
>         Image_Graph::vertical(
>                  $Title = Image_Graph::factory('title', array('Dow/Gold Ratio:
> Daily', 9)),
> Image_Graph::vertical(
> $Plotarea = Image_Graph::factory('plotarea'),
> $Legend = Image_Graph::factory('title', array('Jul
> 08, 2008 18:16 EST', 8)),
> 90
> ),
> 10
> )
> );
>
>
> //$Legend->setPlotarea($Plotarea);
>
> //$Plotarea =& $Graph->addNew('plotarea', array('axis','axis'));
> //$Legend->setPadding(-10);
> //$Title->setFontColor('red');
> $Plotarea->setPadding(2);
>
> $Dataset =& 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 =& $Plotarea->addNew('smooth_line', array(&$Dataset));
> $Plot->setLineColor('red');
> $Plot->setThickness(2);
> //$Plot->setTitle('Daily Dow/Gold Ratio');
>
> $AxisX =& $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' => 'test.png'));
>
>
>
> ?>
>

Image_Graph doesn't look like it's being developed any more. The 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. jpgraph comes to mind, but
I'm sure there are others.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================


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.

Posted by Geoff Berrow on July 10, 2008, 4:05 am
Please log in for more thread options
Message-ID:
Markus contained the following:

>Thanks a lot Jerry, I'll look into jdgraph.

Me, I'd look at jpgraph. ;-)

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011

Similar ThreadsPosted
lightest weight web server with php / mysql support June 27, 2006, 10:32 pm
Choosing a random entry in a table by "weight" May 27, 2007, 12:10 pm
Newbie Question re Line Breaks June 18, 2006, 1:04 pm
CLI ( command-line ) PHP displaying source code in-line when program is executed February 12, 2006, 9:03 am
PHP read large file line by line? October 13, 2006, 5:00 am
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you are, April 22, 2005, 5:24 pm
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you are, April 24, 2005, 7:43 pm
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you are, May 1, 2005, 12:47 pm
First and last line August 29, 2005, 7:03 am
End of line-new line February 21, 2006, 8:30 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap