mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-05 00:21:29 +00:00
57 lines
168 KiB
JavaScript
57 lines
168 KiB
JavaScript
|
/**
|
||
|
* jqPlot
|
||
|
* Pure JavaScript plotting plugin using jQuery
|
||
|
*
|
||
|
* Version: 1.0.0r1095
|
||
|
*
|
||
|
* 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
|
||
|
*
|
||
|
*
|
||
|
*/
|
||
|
(function(H){var r;H.fn.emptyForce=function(){for(var ab=0,ac;(ac=H(this)[ab])!=null;ab++){if(ac.nodeType===1){H.cleanData(ac.getElementsByTagName("*"))}if(H.jqplot.use_excanvas){ac.outerHTML=""}else{while(ac.firstChild){ac.removeChild(ac.firstChild)}}ac=null}return H(this)};H.fn.removeChildForce=function(ab){while(ab.firstChild){this.removeChildForce(ab.firstChild);ab.removeChild(ab.firstChild)}};H.fn.jqplot=function(){var ab=[];var ad=[];for(var ae=0,ac=arguments.length;ae<ac;ae++){if(H.isArray(arguments[ae])){ab.push(arguments[ae])}else{if(H.isPlainObject(arguments[ae])){ad.push(arguments[ae])}}}return this.each(function(ah){var am,al,ak=H(this),ag=ab.length,af=ad.length,aj,ai;if(ah<ag){aj=ab[ah]}else{aj=ag?ab[ag-1]:null}if(ah<af){ai=ad[ah]}else{ai=af?ad[af-1]:null}am=ak.attr("id");if(am===r){am="jqplot_target_"+H.jqplot.targetCounter++;ak.attr("id",am)}al=H.jqplot(am,aj,ai);ak.data("jqplot",al)})};H.jqplot=function(ah,ae,ac){var ad=null,ab=null;if(arguments.length===3){ad=ae;ab=ac}else{if(arguments.length===2){if(H.isArray(ae)){ad=ae}else{if(H.isPlainObject(ae)){ab=ae}}}}if(ad===null&&ab!==null&&ab.data){ad=ab.data}var ag=new N();H("#"+ah).removeClass("jqplot-error");if(H.jqplot.config.catchErrors){try{ag.init(ah,ad,ab);ag.draw();ag.themeEngine.init.call(ag);return ag}catch(af){var ai=H.jqplot.config.errorMessage||af.message;H("#"+ah).append('<div class="jqplot-error-message">'+ai+"</div>");H("#"+ah).addClass("jqplot-error");document.getElementById(ah).style.background=H.jqplot.config.errorBackground;document.getElementById(ah).style.border=H.jqplot.config.errorBorder;document.getElementById(ah).style.fontFamily=H.jqplot.config.errorFontFamily;document.getElementById(ah).style.fontSize=H.jqplot.config.errorFontSize;document.getElementById(ah).style.fontStyle=H.jqplot.config.errorFontStyle;document.getElementById(ah).style.fontWeight=H.jqplot.config.errorFontWeight}}else{ag.init(ah,ad,ab);ag.draw();ag.themeEngine.init.call(ag);return ag}};H.jqplot.version="1.0.0";H.jqplot.revision="1095";H.jqplot.targetCounter=1;H.jqplot.CanvasManager=function(){if(typeof H.jqplot.CanvasManager.canvases=="undefined"){H.jqplot.CanvasManager.canvases=[];H.jqplot.CanvasManager.free=[]}var ab=[];this.getCanvas=function(){var ae;var ad=true;if(!H.jqplot.use_excanvas){for(var af=0,ac=H.jqplot.CanvasManager.canvases.length;af<ac;af++){if(H.jqplot.CanvasManager.free[af]===true){ad=false;ae=H.jqplot.CanvasManager.canvases[af];H.jqplot.CanvasManager.free[af]=false;ab.push(af);break}}}if(ad){ae=document.createElement("canvas");ab.push(H.jqplot.CanvasManager.canvases.length);H.jqplot.CanvasManager.canvases.push(ae);H.jqplot.CanvasManager.free.push(false)}return ae};this.initCanvas=function(ac){if(H.jqplot.use_excanvas){return window.G_vmlCanvasManager.initElement(ac)}return ac};this.freeAllCanvases=function(){for(var ad=0,ac=ab.length;ad<ac;ad++){this.freeCanvas(ab[ad])}ab=[]};this.freeCanvas=function(ac){if(H.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==r){window.G_vmlCanvasManager.uninitElement(H.jqplot.CanvasManager.canvases[ac]);H.jqplot.CanvasManager.canvases[ac]=null}else{var ad=H.jqplot.CanvasManager.canvases[ac];ad.getContext("2d").clearRect(0,0,ad.width,ad.height);H(ad).unbind().removeAttr("class").removeAttr("style");H(ad).css({left:"",top:"",position:""});ad.width=0;ad.height=0;H.jqplot.CanvasManager.free[ac]=true}}};H.jqplot.log=function(){if(window.console){window.console.log.apply(window.console,arguments)}};H.jqplot.config={addDomReference:false,enablePlugins:false,defaultHeight:300,defaultWidth:400,UTCAdjust:false,timezoneOffset:new Date(new Date().getTimezoneOffset()*60000),errorMessage:"",errorBackground:"",errorBorder:"",errorFontFamily:"",errorFontSize:"",errorFontStyle:"",errorFontWeight:"",catchErrors:false,defaultTickFormatString:"%.1f",defaultColors:["#4bb2c5","#EAA228","#c5b47f","#579575","#839557","#958c12","#953579","#4b5de4","#d8b83f","#ff5800","#0085cc","#c747a3","#cddf54","#FBD178","#26B4E3","#bd70c7"],defaultNegativeColors:["#498991","#C08840","#9F9274","#546D61","#646C4A","#6F6621","#6E3F5F","#4F
|