Creating Graphs & Charts

Is there any easy ways to use PHP to create Graphs and Charts?

Or are there any open-source solutions out there which have done the heavy-lifting and provide a platform where you can build your own Graphs & Charts?

It wouldn’t be that hard to take a <div> and adjust its height and width based on values in your database, but I would think it would be murder to try and create your own axes, scales, labels, legends, etc from scratch?!

BTW, I am not interested in anything which is Proprietary or uses JavaScript.

My needs are fairly simple. I just want to create basic things like Bar Charts, Histograms, Pie Charts and so on.

Thanks,

Debbie

Why do you limit your options so much when asking questions?

There’s a good reason that Javascript has become the most popular way to create charts. If you change your mind then you should look at these:
http://www.highcharts.com/

Take a look at this: http://naku.dohcrew.com/libchart/pages/introduction/

1.) Because I associate JavaScipt with poorly planned and architected websites. It is a child’s toy in most instances.

The more JS a site has, usually the more obnoxious it is…

2.) Because I despise Corporate America, and selling my soul to companies peddling proprietary software isn’t my scene.

Almost everything I use is open-source or home-grown.

And my entire website is JavaScript-free and looks and runs as good as any that I have seen using it.

I might be more flexible on charting solutions, since that is an area which wouldn’t be an effective use of my time “rolling my own”. And yet at the same time, it is my experience that there are often solutions that meet my constraints and still deliver.

It is easy to follow the masses.

I choose something more noble in life… :wink:

Debbie

Oh my, well you seem very opinionated and I’m unlikely to change your mind.

But for anyone else stumbling across this thread, Javascript is obviously no toy and is the the biggest language on GitHub. Anyone web developer refusing to use Javascript is going to be left behind.

Dee, you should always be open to the fact that you could be wrong about these things, it’s the only way to learn.

Check this for a popular choice…

http://jpgraph.net/

Having an opinion that is different than yours doesn’t make me wrong.

And I should be commended for taking the path any new web developer should, that being…

Learn solid HTML and CSS and markup semantics skills FIRST, and then after you have a solid footing - if you so choose - branch off into other things like JavaScript, Flash, etc.

You can’t build a viable web page or website without the former…

Obviously I won’t change your mind on this topic, but I stand by my decisions.

My website is better because I am focusing on good design and features and functionality, and not on JavaScript “flash”.

And, btw, because I don’t want or need interactive graphs or charts, there is no reason why I have to use JavaScript.

Based on my limited research, it seems like there are some good choices out there which simply use PHP. (If I needed something where you could “slice and dice” data like a spreadsheet on real-time, then JavaScript might be more of a “must have”.)

Sincerely,

Debbie

Here are some promising sites I found last night…

jpgraph

pchart

ezcomponents

Debbie

I never said you were wrong because I disagreed, you were wrong to call Javascript a toy, that it was the result of poor planning and that it made sites obnoxious…
Yes, you should learn HTML, CSS and Javascript in that order - but you should learn all three! they all have their part to play.

But there’s no reason to have charts at all! Surely a table would suffice? :wink:
The point is, charts are a better way to present data a lot of the time.
A lot of time Javascript is a great choice too, your website isn’t better without it, javascript can improve what’s there.

I’m not going to commend you for entirely dismissing an integral web technology while you tout it as something noble.

I’ve found server-side charting libraries don’t give you the same level of control over the output as client-side ones do.
There’s the obvious benefits of being able to render dynamic content and respond to user interaction, you might not “require” it but it can add a lot to the user experience. The reason you are providing charts at all over a table is because of user experience.
It’s also good wherever possible to take processing off the server.

I’ve used pChart. I had to fix a couple of minor text positioning bugs (that were likely down to the fonts I was using) when I used it but it works very well. The code is a bit of a mess, but the charts it creates are very nice indeed!

The key things to understand about how I feel about JavaScript is that I am tired of…

1.) People changing the sequence FROM

Proper Design —> Thinking about Semantics —> HTML –> CSS —> (maybe) JavaScript

INTO JavaScript! JavaScript! JavaScript! (and maybe some of that other stuff if there is time)

2.) People’s inability to think and plan and solve problems without JavaScript. (For example, I have built a respectable Private Message system that looks almost identical to Yahoo E-mail entirely using PHP. No JavaScript.)

3.) People focusing on superficial Bells & Whistles (e.g. JavaScript) instead of CONTENT

4.) People only see the world one way. (There was life before JavaScript and there is life after it.)

JavaScript is one tool. It is not some panacea.

Will I someday learn and use JavaScript?

Yes. After I am running a successful website and business, and I attempt to add that remaining 5-10% to my User’s experience. Never forgetting… Horse then Cart…

Debbie

How is the documentation?

What would I have to learn to start using it?

Do I need to know OOP or any special languages?

If I am going to break down and use someone else’s code-base, then I want something easy and intuitive, otherwise I might as well build my own?!

Debbie

Oh, Javascript is a “child’s toy”?

Try telling that to Google.

Javascript is a serious language that also has the best solutions to your problem.

Highcharts library is the best graphing library for the web that I’m aware of, and the amount of money they ask for their license is peanuts compared to the profits you can make by using it, and the amount of man-hours and skill that have been put into it.

Just because you don’t personally know how to use javascript properly does not mean that javascript is a “child’s toy in most instances”. Unfortunately, it’s a child’s toy to you because you don’t know what you’re talking about :slight_smile:

Good luck finding a crappy solution to your problem.

What’s wrong with having to know OOP?

The documentation is very good. There’s an example script for pretty much any kind of chart you can think of. It’s quite easy to get the hang of and all the data is fed into the charts using simple arrays-- easy to generate from queries and such.

It does use OOP but doesn’t really follow a lot of the principles, it’s really lacking on a sensible separation of concerns. It’s procedural code in objects really. It’s a bit messy, and from an idealogical point of view the code isn’t very nice in places. That said, you won’t need to touch the code much. If at all.

It is quite a large library, building a flexible charting library from scratch is a big job. If you’re just building a one off chart of a specific type then it may be worth while. But pChart and such give the ability to quickly switch between a pie chart/bar chart etc with a single line of code.

On one hand, I can’t compare it to any of the other libraries. On the other I can safely say I never felt the need to look for another one because pChart suited my needs perfectly.

I agree with this, I’m yet to dig into d3 but it seems to be gaining a lot popularity. The examples speak for themselves, it’s quite powerful.

Not necessary

The reason I responded to her like that is because she seems to me to have some of the worst personality traits you could expect from a [snip] developer: she’s [snip] overly confident to the point of sheer arrogance. I had a look at some of her other posts, and she was doing things like mocking people for using GIT (because she thought GIT = your code is available for everyone in the world to see), and complains that the tech department in her work are not up to her “standards”. She mocks Javascript as some superfluous “toy”, yet clearly doesn’t understand what Javascript actually is and how powerful it really is.

I don’t mind people who are learning and have a positive attitude, but I can’t stand [it when people go] around mocking [other] people.

That’s all :wink:

I would suggest you give jpGraph a try. I’ve used it for many large graphing projects. You can use it to make about any graph type you can think of – Line, Bar, pie, scatter, Impluse, Field, Splines, Geo Maps, Stock, Polar, Error, Balloon, Radar, Contour, and if you purchase the pro version you can also make barcodes among other graphs.

You can skin/theme each graph however you want. You have limitless control over the look and feel.

The documentation is extremely good. There are examples for every graph type, and more examples for graph variations/graph options. The API reference is very good, and the how-to reference does a good job at walking you through creating (and customizing) the different graphs step-by-step.

I’ve never encountered any real bugs in it either. I’ve never had to go edit the source code. It’s a big library, but it’s broken up into components so you can include only the functionality you need/want.

It’s actually an easy mistake to make, git is best known for github and github is best known for open-source.

But, yes, we all have plenty to learn.
So we need to remain open and not be set in our ways.

You cannot give someone more tea if their teacup is already full.