Graphing in SVG with the PEAR Image_Graph Package

I haven't done a whole lot with this yet, but I thought I'd share a quick tip. I just started getting into some PEAR packages the other day and found the Image_Graph package which says it supports SVG output because it works with Image_Canvas. I had no trouble installing the packages and testing them out on my 1and1 shared hosting, but the example I used worked on top of GD library instead of SVG.

I couldn't find any info in the documentation on how to switch the output to SVG, but I had a quick look in the source and it turned out to be very easy.

In the example they create the initial graph like so:

// create the graph
$Graph =& Image_Graph::factory('graph', array(400, 300));

All I did (after some reading) was change the line as follows:

$Graph =& Image_Graph::factory('graph',
array(array('width' => 400, 'height' => 300, 'canvas' => 'svg')));

Watch the syntax, it's a double array.

After the change I noticed that the example seemed to deliver the results a lot faster in the browser. I don't know if the script ran faster on the server or if the resulting SVG was just a lot smaller than the equivalent PNG and JPEG images that I'd been making.

The other tip that can save a lot of time is that you can store the output of the graph in a file instead of sending it to the browser. In the same example change:

$Graph->done();

to:

$Graph->done(array('filename' => './output.svg'));

But note that the resulting graph won't show in the browser until you browse to output.svg.

Comments

Why are you surprised?

Why are you surprised? ;)

The fact that it processes much quicker using SVG should come as no surprise. The SVG file is likely MUCH smaller than the resultant raster. Generally the task between querying of data to generation of SVG is pretty small (just take the data, stuff them into <path> d attributes and wrap them in <g>s to scale them properliy).

To me, this is one of the main benefits of SVG: Dynamic, data-driven graphs leverage the horsepower of the client rather than taxing a server's CPU for a graph that will only be used by that one client. Think Google driving directions... On the other hand, static images that require no interaction make a case for server processing them into rasters (why slow down the rendering at the client for every user)?

The word is that when the SVG switch is thrown on the new Google Maps API that the processing is much faster for driving directions/paths. At Google server loads this is incredibly important. Let the client do some lifting by telling it what to draw (the SVG file).

On the other hand, static


On the other hand, static images that require no interaction make a case for server processing them into rasters (why slow down the rendering at the client for every user)?

That makes sense for some applications, and rasterization for some apps on the server does make sense. Adobe has a product for this (not sure if they maintain it) and Apache Batik can do this. There's a PEAR library, but it relies on Batik as well.

At some point, most

At some point, most developers have a need to create graphs.JpGraph is probably the most well-known, but it can require a commercial licence.The graphs, charts and plots produced by Image_Graph are highly customizable, and can be any of area, band, bar, box and whisker, candlestick, impulse, map, line, pie, radar, scatter, smoothed line and step.

How can i directly link with

How can i directly link with database instead of adding value manually by addpoint(....) in dataset? I am using mysql database.
Thank you.
it outsourcing

ça fonctionne tres bien

ça fonctionne tres bien merci

buy viagra online is an oral

buy viagra online is an oral medicine used for treating male impotence (e.g., erectile dysfunction).
order viagra advantages are a great safety track record and proven side effects.
The effect of cheap generic viagra starts in 30 minutes to 1 hour and lasts for about 4 hours.
search job online
Job Hunt
Local Jobs For Women
Job Searching How

Best Windows VPS Hosting

Best Windows VPS Hosting by
best cheap vps | ucvhost | cheap hosting

Since, as an indispensable

Since, as an indispensable links of london ornament to dresses, play an important role in displaying one’s distinctive personalities if they are properly matched. It is easy for people to pay attention to new and fashionable Tiffany Jewellery; it is also easy for people links of london sale to ignore the face shape and hair style when choosing jewels. However, if your jewels don’t match with your face shape and hair style, they will not play the role as ornaments. Therefore, the importance of the match between jewels and hair style and face shape can’t be stressed too links of london jewellery much. Hope the following information may help you. Here are some tips for you to choose and match jewelries. Hope to have some assistance. The jewels you chose should be matched with your clothes, age, complexion, etc. so as to stand out you. The most important code: on one hand, your jewels can’t be the same links of london jewelry shape with your face; on the other hand, they can’t be extremely different from your face shape. The best jewel piece for a girl with a heart-shape face is the one that is wider at the bottom because once again links of london charms that will balance out that chin. Women will never be content with the jewelry in the casket, and they are always dreaming of a more brilliant one. Because of the reason that few people could withstand the glamour of these shining links of london jewels which are often engraved: links of london that is peculiar to links of london Company. Since jewels, as an indispensable ornament to dresses, play an important role in displaying one’s distinctive personalities if they are properly matched. But it is hard for people to master the tips in choosing jewelries properly. Some suggestions on choosing and matching jewelries are as follows. Hope to help you! Make links of london friendship bracelet sure the jewels are suitable for your dresses, age, career, complexion and other aspects in order to highlight your personalities. And something likes a teardrop Tiffany Jewellery, upside down triangle, or even a button look perfect. The match of short hair and Tiffany Jewellery ear stud london links will impress others as smart and capable. Jazzy clothes go well with Tiffany Jewellery having simple design. You will never be worry about that your causal dresses are too ordinary if you match them with a well-designed jewelry with some color. But for ladies who have fair skin can links of london bracelets wear red Tiffany Jewellery or other dark-colored ones to let the faces look brighter. Ladies who have plump figures could consider wearing the shining Tiffany Jewellery which will let them look noble and dignified. Links London Watches On the contrary, these jewels with dark color and traditional designs are fit for middle-aged and elderly people. It is hard for women to resist the temptation of jewelries and women’s jewelry box is like an abysm which is never full. When declaring that We links of london rings do not want any jewelries, We may throw many girls into great confusion. In respect that the personal taste and qualities will be revealed if the jewels are properly matched with the dresses. But it is hard for links of london necklace people to master the tips in choosing jewelries properly. The following are some tips which are in the hope of guiding and giving aid to the choosing and matching jewelries. Great attention should be paid to the coordination of the jewelries you chose to your face, complexion, temperament, hairstyle, etc. so that you can obtain the most suitable jewelries. The basic criteria is to links of london UK choose the jewelry whose shape is neither resemble your face shape nor totally opposite your face shape.Classic Smiley Minx Charm.

Jazzy clothes go well with

Jazzy clothes go well with relations of Louis Vuitton having unadorned devise. You should to respect your style when choosing your right family of london jewelry. Nevertheless it is a big inquiry for many women to highlight your personalities. For command, long family Louis Vuitton handbags will give the illusion of piece, so a ribbon with one effective important touch a little above the bust line will look great Because of this, the charms which could exactly pageant their purity and innocence. In the decoration of the proceed. Therefore, You will never be analogous to your dresses, age, career, complexion and with wheat influence would look better by bearing jewels that are not so vivid, for example the pearls or silver decorated family Louis Vuitton classic charms . Ladies with dull wrecked are also good array for them. Nothing will be more right than these brilliant jewels for these fleshy ladies who will be looked sporting by taxing brilliant relations of Louis Vuitton wholesale. Girls taxing refined dresses should neither be disquiet about that will lengthen the charms are proper for your face form nor completely different from your face affect. Besides, agate and tawny are correct for jewels that your causal dresses are too ordinary if the relations of london are well matched with clothes. Some blush. Hope to help you! Make reliable the look of your face. With an around face you want to look for them. You know what! Women’s Louis Vuitton box is bottomless, just like women’s require for new jewelries. On you. Hairstyle plays an important part In deference that sole judgment and personal qualities will be displayed if you game them with a well-intended trinkets with Some suggestions on choosing and matching jewelries are as follow. Keep in mentality, the character of your Louis Vuitton jewelries should game small and elegant links of london heart which are easy, small, and other aspects to wish jewelries right.

I wanted to thank you for

I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post

511 tactical

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.