57 lines
21 KiB
JavaScript
57 lines
21 KiB
JavaScript
|
/**
|
||
|
* jqPlot
|
||
|
* Pure JavaScript plotting plugin using jQuery
|
||
|
*
|
||
|
* Version: @VERSION
|
||
|
*
|
||
|
* Copyright (c) 2009-2011 Chris Leonello
|
||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||
|
* choose the license that best suits your project and use it accordingly.
|
||
|
*
|
||
|
* Although not required, the author would appreciate an email letting him
|
||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||
|
*
|
||
|
* If you are feeling kind and generous, consider supporting the project by
|
||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||
|
*
|
||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||
|
*
|
||
|
* version 2007.04.27
|
||
|
* author Ash Searle
|
||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||
|
* http://hexmen.com/js/sprintf.js
|
||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||
|
* "This code is unrestricted: you are free to use it however you like."
|
||
|
*
|
||
|
* included jsDate library by Chris Leonello:
|
||
|
*
|
||
|
* Copyright (c) 2010-2011 Chris Leonello
|
||
|
*
|
||
|
* jsDate is currently available for use in all personal or commercial projects
|
||
|
* under both the MIT and GPL version 2.0 licenses. This means that you can
|
||
|
* choose the license that best suits your project and use it accordingly.
|
||
|
*
|
||
|
* jsDate borrows many concepts and ideas from the Date Instance
|
||
|
* Methods by Ken Snyder along with some parts of Ken's actual code.
|
||
|
*
|
||
|
* Ken's origianl Date Instance Methods and copyright notice:
|
||
|
*
|
||
|
* Ken Snyder (ken d snyder at gmail dot com)
|
||
|
* 2008-09-10
|
||
|
* version 2.0.2 (http://kendsnyder.com/sandbox/date/)
|
||
|
* Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
|
||
|
*
|
||
|
* jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
|
||
|
* Larry has generously given permission to adapt his code for inclusion
|
||
|
* into jqPlot.
|
||
|
*
|
||
|
* Larry's original code can be found here:
|
||
|
*
|
||
|
* https://github.com/lsiden/export-jqplot-to-png
|
||
|
*
|
||
|
*
|
||
|
*/
|
||
|
if(!document.createElement("canvas").getContext){(function(){var ab=Math;var n=ab.round;var l=ab.sin;var A=ab.cos;var H=ab.abs;var N=ab.sqrt;var d=10;var f=d/2;var z=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];function y(){return this.context_||(this.context_=new D(this))}var t=Array.prototype.slice;function g(j,m,p){var i=t.call(arguments,2);return function(){return j.apply(m,i.concat(t.call(arguments)))}}function af(i){return String(i).replace(/&/g,"&").replace(/"/g,""")}function Y(m,j,i){if(!m.namespaces[j]){m.namespaces.add(j,i,"#default#VML")}}function R(j){Y(j,"g_vml_","urn:schemas-microsoft-com:vml");Y(j,"g_o_","urn:schemas-microsoft-com:office:office");if(!j.styleSheets.ex_canvas_){var i=j.createStyleSheet();i.owningElement.id="ex_canvas_";i.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}R(document);var e={init:function(i){var j=i||document;j.createElement("canvas");j.attachEvent("onreadystatechange",g(this.init_,this,j))},init_:function(p){var m=p.getElementsByTagName("canvas");for(var j=0;j<m.length;j++){this.initElement(m[j])}},initElement:function(j){if(!j.getContext){j.getContext=y;R(j.ownerDocument);j.innerHTML="";j.attachEvent("onpropertychange",x);j.attachEvent("onresize",W);var i=j.attributes;if(i.width&&i.width.specified){j.style.width=i.width.nodeValue+"px"}else{j.width=j.clientWidth}if(i.height&&i.height.specified){j.style.height=i.height.nodeValue+"px"}else{j.height=j.clientHeight}}return j},uninitElement:function(j){if(j.getContext){var i=j.getContext();delete i.element_;delete i.canvas;j.innerHTML="";j.context_=null;j.getContext=null;j.detachEvent("onpropertychange",x);j.detachEvent("onresize",W)}}};function x(j){var i=j.srcElement;switch(j.propertyName){case"width":i.getContext().clearRect();i.style.width=i.attributes.width.nodeValue+"px";i.firstChild.style.width=i.clientWidth+"px";break;case"height":i.getContext().clearRect();i.style.height=i.attributes.height.nodeValue+"px";i.firstChild.style.height=i.clientHeight+"px";break}}function W(j){var i=j.srcElement;if(i.firstChild){i.firstChild.style.width=i.clientWidth+"px";i.firstChild.style.height=i.clientHeight+"px"}}e.init();var k=[];for(var ae=0;ae<16;ae++){for(var ad=0;ad<16;ad++){k[ae*16+ad]=ae.toString(16)+ad.toString(16)}}function B(){return[[1,0,0],[0,1,0],[0,0,1]]}function J(p,m){var j=B();for(var i=0;i<3;i++){for(var ah=0;ah<3;ah++){var Z=0;for(var ag=0;ag<3;ag++){Z+=p[i][ag]*m[ag][ah]}j[i][ah]=Z}}return j}function v(j,i){i.fillStyle=j.fillStyle;i.lineCap=j.lineCap;i.lineJoin=j.lineJoin;i.lineWidth=j.lineWidth;i.miterLimit=j.miterLimit;i.shadowBlur=j.shadowBlur;i.shadowColor=j.shadowColor;i.shadowOffsetX=j.shadowOffsetX;i.shadowOffsetY=j.shadowOffsetY;i.strokeStyle=j.strokeStyle;i.globalAlpha=j.globalAlpha;i.font=j.font;i.textAlign=j.textAlign;i.textBaseline=j.textBaseline;i.arcScaleX_=j.arcScaleX_;i.arcScaleY_=j.arcScaleY_;i.lineScale_=j.lineScale_}var b={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khak
|