// o---------------------------------------------------------------------------------o // | This file is part of the RGraph package - you can learn more at: | // | | // | https://www.rgraph.net/license.html | // | | // | RGraph is dual-licensed under the Open Source GPL license. That means that it's | // | free to use and there are no restrictions on what you can use RGraph for! | // | If the GPL license does not suit you however, then there's an inexpensive | // | commercial license option available. See the URL above for more details. | // o---------------------------------------------------------------------------------o // // Initialise the various objects // RGraph = window.RGraph || {isrgraph:true,isRGraph: true,rgraph:true}; // // This function has been taken out of the RGraph.common.core.js file to // enable the CSV reader to work standalone. // if (!RGraph.AJAX) RGraph.AJAX = function () { var args = RGraph.getArgs(arguments, 'url,callback'); // Mozilla, Safari, ... if (window.XMLHttpRequest) { var httpRequest = new XMLHttpRequest(); // MSIE } else if (window.ActiveXObject) { var httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } httpRequest.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { this.__user_callback__ = args.callback; this.__user_callback__(this.responseText); } } httpRequest.open('GET', args.url, true); httpRequest.send(); }; // // Use the AJAX function above to fetch a string // if (!RGraph.AJAX.getString) RGraph.AJAX.getString = function () { var args = RGraph.getArgs(arguments, 'url,callback'); RGraph.AJAX(args.url, function () { var str = String(this.responseText); args.callback(str); }); }; // This function simply creates UID. Formerly the function in // RGraph.common.core.js was being used - but now the CSV code // is now standalone, hence this function if (!RGraph.createUID) RGraph.createUID = function () { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); return v.toString(16); }); }; // // This function allows both object based arguments to functions // and also regular arguments as well. // // You can call it from inside a function like this: // // args = RGraph.HTMLTable.getArgs(arguments, 'object,id,foo,bar'); // // So you're passing it the arguments object and a comma seperated list of names // for the arguments. // // @param array args The arguments object that you get when inside a function // @param string names A comma seperated list of desired names for the arguments // eg: 'object,color,size' // if (!RGraph.getArgs) RGraph.getArgs = function (args, names) { var ret = {}; var count = 0; names = names.trim().split(/ *, */); if ( args && args[0] && args.length === 1 && typeof args[0][names[0]] !== 'undefined') { for (var i=0; i 0) { row = row.slice(0, length) // Negative length } else if (typeof length === 'number' && length < 0) { for (var i=0; i= 0) { for (var i=start; i 0) { col = col.slice(0, length) // Negative length } else if (typeof length === 'number' && length < 0) { for (var i=0; i