Click here to Skip to main content
15,896,727 members
Articles / Web Development / HTML

Creating Interactive HTML5 Graphs in PHP

Rate me:
Please Sign up or sign in to vote.
4.87/5 (14 votes)
15 May 2014CPOL6 min read 98.2K   7   30  
Achieve professional-level web-based charts in PHP without in-depth knowledge of HTML5 or JavaScript.
$(document).ready(function(){if(!$.jqplot._noCodeBlock){$("script.code").each(function(c){if($("pre.code").eq(c).length){$("pre.code").eq(c).text($(this).html())}else{var d=$('<pre class="code prettyprint brush: js"></pre>');$("div.jqplot-target").eq(c).after(d);d.text($(this).html());d=null}});$("script.common").each(function(c){$("pre.common").eq(c).text($(this).html())});var b="";if($("script.include, link.include").length>0){if($("pre.include").length==0){var a=['<div class="code prettyprint include">','<p class="text">The charts on this page depend on the following files:</p>','<pre class="include prettyprint brush: html gutter: false"></pre>',"</div>"];a=$(a.join("\n"));$("div.example-content").append(a);a=null}$("script.include").each(function(c){if(b!==""){b+="\n"}b+='<script type="text/javascript" src="'+$(this).attr("src")+'"><\/script>'});$("link.include").each(function(c){if(b!==""){b+="\n"}b+='<link rel="stylesheet" type="text/css" hrf="'+$(this).attr("href")+'" />'});$("pre.include").text(b)}else{$("pre.include").remove();$("div.include").remove()}}if(!$.jqplot.use_excanvas){$("div.jqplot-target").each(function(){var d=$(document.createElement("div"));var g=$(document.createElement("div"));var f=$(document.createElement("div"));d.append(g);d.append(f);d.addClass("jqplot-image-container");g.addClass("jqplot-image-container-header");f.addClass("jqplot-image-container-content");g.html("Right Click to Save Image As...");var e=$(document.createElement("a"));e.addClass("jqplot-image-container-close");e.html("Close");e.attr("href","#");e.click(function(){$(this).parents("div.jqplot-image-container").hide(500)});g.append(e);$(this).after(d);d.hide();d=g=f=e=null;if(!$.jqplot._noToImageButton){var c=$(document.createElement("button"));c.text("View Plot Image");c.addClass("jqplot-image-button");c.bind("click",{chart:$(this)},function(h){var j=h.data.chart.jqplotToImageElem();var i=$(this).nextAll("div.jqplot-image-container").first();i.children("div.jqplot-image-container-content").empty();i.children("div.jqplot-image-container-content").append(j);i.show(500);i=null});$(this).after(c);c.after("<br />");c=null}})}$(document).unload(function(){$("*").unbind()})});

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
He likes programming and iPod.

Comments and Discussions