469,950 Members | 1,522 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

Image_Graph line weight question

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'));

?>
Jul 9 '08 #1
3 2898
go*******@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.
js*******@attglobal.net
==================

Jul 9 '08 #2
On Jul 9, 3:22*am, Jerry Stuckle <jstuck...@attglobal.netwrote:
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 =& 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.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -
Thanks a lot Jerry, I'll look into jdgraph.
Jul 10 '08 #3
Message-ID:
<e6**********************************@x35g2000hsb. googlegroups.comfrom
Markus contained the following:
>Thanks a lot Jerry, I'll look into jdgraph.
Me, I'd look at jpgraph. ;-)

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Jul 10 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Greg Bryant | last post: by
9 posts views Thread by PinkBishop | last post: by
5 posts views Thread by Shawn Hamzee | last post: by
reply views Thread by Lorenzo Thurman | last post: by
11 posts views Thread by alpha.beta0 | last post: by
2 posts views Thread by Lorenzo Thurman | last post: by
reply views Thread by Lorenzo Thurman | last post: by
reply views Thread by Lorenzo Thurman | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.