better charts than yesterday.

word.

More playing with the google chart API.

Second cut is somewhat more usable (at least for me).
Check out the “demo” (quotes, as it’s not much of a demo…)

    Limitations as it currently sits:

  • no support for lxy, venn, or scatter-plots. lxy and scatter should be available soon… I’ll go into the venn diagram stuff later…
  • scaling is in place, but kinda useless until I get axes marked correctly. That’s tops on my priority list for this.
  • Some extras still need implementation (chart background, image background, data point markers, etc.)

werd it up.

I am kinda pleased with how the code is shaping up. I haven’t had much of an opportunity in the past to play with inheritence and polymorphism in PHP (blah, blah, blah…).

Currently I have it set up where like so (in terms of inheritence):

    gChart (the base chart class)

  • gPieChart (has a simple set3D(bool) function)
  • gLineChart
  • gBarChart
    • gStackedBarChart
    • gGroupedBarChart

I will probably refactor that sometime soon. But, I’m happy with how it works currently.

I was concerned for a bit about how I would be losing the ability to change the chart type with one line of code (as I could [and did] with the first draft) by breaking chart types out into separate classes. The fact of the matter is that really, no one is very likely to be doing that anyway. So, better code at (perhaps) the sake of some usability…

My plan for next week: axes labeling, those last three chart types, and what’s left of the “extras”.

I put the latest class (gChart2.php) up on google code if anyone wants to see. I’m sure there are plenty of ugly things in there… I’m still getting used to a bunch of things.
-d.

ps.
Venn Diagrams. WTF?
according to the docs:
Supply one data set where:

* the first three values specify the relative sizes of three circles, A, B, and C
* the fourth value specifies the area of A intersecting B
* the fifth value specifies the area of B intersecting C
* the sixth value specifies the area of C intersecting A
* the seventh value specifies the area of A intersecting B intersecting C

Couple things…
Always three circles? No matter what? WTF?
The three circles are relatively sized, but the intersections are not? So nothing is to scale?
Like so: A=300, B=200, C=250, A∩B=10, B∩A=10, C∩A=0, A∩B∩C=0

…fucking nevermind.

those first three values (A, B, C) NEED to be scaled by the user. Anything over 100 will be 100. so, that example above, if those circles look equal, that’s cause they are. I should be able to have Venn Diagrams knocked out soon. UGH. Way too much time wasted trying to figure out wtf that “the relative sizes of three circles, A, B, and C” was supposed to mean.


Update: 12/9/07 21:26
Venn Diagrams are working and on that demo page.
I’m still non-plussed with the implementation. Whatever.
-d.

3 Responses to “better charts than yesterday.”

  1. Tim Says:

    kudos for your work on this. super easy worked without any fuss. I and many others I am sure will be eagerly awaiting further functionality ;)

    googling “google charts php” you are at the #3 spot so I suspect you will have many people using this code soon :P

  2. Dhaval Says:

    I have made the all classes for additional functionality. I want that to be added in the current project for Google Chart API wrapper for PHP. can you allow me to join you as a author? and send me your email address so i can communicate with you for this.

  3. Tim Says:

    certainly sir,

    tim dot vdh at gmail dot com

    Would be happy to perform some testing etc.

    Kindly

    TiM

Leave a Reply