最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Reports using HTML5?- Stack Overflow

programmeradmin6浏览0评论

I have a question. I have to prepare a good report module for an application in PHP and MySQL. The report should be in two forms: a graph and a normal table with text. Tables and text are simple, but the graph is what I don't know how to begin. I was thinking about HTML5 (canvas) and Javascript, but honestly I don't know if this is a good idea.

I don't know if HTML5 is rendered on all browsers in the same way. A while ago it was a problem and I didn't have time to investigate it by myself. Good tips about new elements (canvas, article, footer and so on) on different browsers (including mobile ones) would be nice.

Maybe someone had similar problem and can give a tip on how to begin?

I have a question. I have to prepare a good report module for an application in PHP and MySQL. The report should be in two forms: a graph and a normal table with text. Tables and text are simple, but the graph is what I don't know how to begin. I was thinking about HTML5 (canvas) and Javascript, but honestly I don't know if this is a good idea.

I don't know if HTML5 is rendered on all browsers in the same way. A while ago it was a problem and I didn't have time to investigate it by myself. Good tips about new elements (canvas, article, footer and so on) on different browsers (including mobile ones) would be nice.

Maybe someone had similar problem and can give a tip on how to begin?

Share Improve this question edited Jun 9, 2011 at 21:46 Earlz 64k100 gold badges313 silver badges507 bronze badges asked Jun 9, 2011 at 20:47 pawel-kuznikpawel-kuznik 4564 silver badges11 bronze badges 1
  • Is Raport a special module I don't know about or just a misspelling of report? – colinross Commented Jun 9, 2011 at 20:51
Add a ment  | 

3 Answers 3

Reset to default 3

There are lots of free javascript tools for that, for example:

jqplot

Google charts

Google charts uses canvas for canvas capable browsers and flash for other browsers (like IE).

One thing you might consider is using wkhtmltopdf to generate a PDF of whatever HTML5 you want, using the consistent Webkit rendering engine. I'd set it up like this:

  • The user clicks a link that says "generate"
  • This loads a script which runs the report (generates the data, etc.) and outputs the HTML needed to a temporary file
  • Invoke wkhtmltopdf using the temporary HTML file as input and output it to a temporary PDF
  • Read the PDF into PHP, set the headers, and output the PDF to the browser

This should create a fairly seamless experience and shouldn't take more than a few seconds to run, and since it's Webkit, you can use whatever Javascript library you want to make charts (I like flot).

Depends on your target user group. If you wan't to hit the maximum ammount of web browsers you should probably go for a flash based graph solution. Flash however is not supported on iPad and iPhone.

If you want to support iPhone/iPad and still have an interactive graph, go with Canvas - however i don't belive it's supported by Internet Explorer yet.

发布评论

评论列表(0)

  1. 暂无评论