The last few days I’ve been playing with Google’s Chart API. It’s much simpler than their other APIs. This is pretty close to dirt simple. My only “complaint” is that a lot of the variable names are a bit obscure. I’m unlikely to remember that chxl means chart axis labels. So I started writing a little class to help.
$chart = new googleChart($data, $title, $width, $height)
data should be an associative array
- your keys become the x axis
- your values become the y axis
title, width, and height are optional
$chart->title = ‘This is my title!’;
$chart->width = 400;
$chart->height = 400;
color is the color of the line
it must be a hex code
$chart->color = ‘ff8800′;
fill is the color of the space under the line
it must be a hex code
$chart->fill = ‘ffff80′;
then all you have to do is call
$url = $chart->getURL();
You can check out my “alpha release” here.
One of the cool new things about wp2.9 is support for post thumbnails. What this means is that you can associate an image with a post, as a thumbnail for that post.
Previously I have had to write all kinds of code to pull the first image embedded in the body of the post, resize it, and throw that into the template. For example, a “Current Projects” page. Each project on this page is a Post in the “Current Project” category. You can embed/upload an image into the body. My template then extracts the image from the body, resizes it, makes a link out of it, and displays it on the page that lists all of the Current Project Posts. I’ve done this so many times I copy/paste the code from one project to another.
WP2.9 has this post thumbnail business. Which is brilliant. You enable support for post thumbnails in your theme. Then there’s a new block on the Post edit screen where you pick an image to use as a thumbnail. You don’t upload it to the body, it’s separate and clear. Then I use two functions in my template code to check whether or not there’s a thumbnail for this post, and if so, output it.
Dirt simple. I love it. I played around with this a bit so I know how it works. I can’t wait to put it into practice.