From 1653fd340c080d2caefb4c6bf1bd21a98443baa9 Mon Sep 17 00:00:00 2001 From: Ammar Yasir Date: Fri, 17 Jun 2011 01:31:31 +0530 Subject: [PATCH] Plot functionality using Hihcharts --- js/canvg/canvg.js | 304 +++++++----------------------------- js/highcharts/exporting.js | 13 +- js/highcharts/highcharts.js | 2 +- js/tbl_zoom_plot.js | 129 +++++++++++++++ tbl_zoom_select.php | 18 ++- 5 files changed, 200 insertions(+), 266 deletions(-) create mode 100644 js/tbl_zoom_plot.js diff --git a/js/canvg/canvg.js b/js/canvg/canvg.js index 7b7e963542..83c91b45fc 100644 --- a/js/canvg/canvg.js +++ b/js/canvg/canvg.js @@ -12,6 +12,7 @@ if(!window.console) { window.console.dir = function(str) {}; } +// <3 IE if(!Array.indexOf){ Array.prototype.indexOf = function(obj){ for(var i=0; i ignore mouse events // ignoreAnimation: true => ignore animations @@ -74,11 +75,7 @@ if(!Array.indexOf){ svg.opts = opts; var ctx = target.getContext('2d'); - if (typeof(s.documentElement) != 'undefined') { - // load from xml doc - svg.loadXmlDoc(ctx, s); - } - else if (s.substr(0,1) == '<') { + if (s.substr(0,1) == '<') { // load from xml string svg.loadXml(ctx, s); } @@ -92,7 +89,6 @@ if(!Array.indexOf){ var svg = { }; svg.FRAMERATE = 30; - svg.MAX_VIRTUAL_PIXELS = 30000; // globals svg.init = function(ctx) { @@ -103,7 +99,6 @@ if(!Array.indexOf){ svg.ctx = ctx; svg.ViewPort = new (function () { this.viewPorts = []; - this.Clear = function() { this.viewPorts = []; } this.SetCurrent = function(width, height) { this.viewPorts.push({ width: width, height: height }); } this.RemoveCurrent = function() { this.viewPorts.pop(); } this.Current = function() { return this.viewPorts[this.viewPorts.length - 1]; } @@ -556,7 +551,7 @@ if(!Array.indexOf){ } } - var data = svg.trim(svg.compressSpaces(v)).split(/\s(?=[a-z])/); + var data = v.split(/\s(?=[a-z])/); for (var i=0; i0 && text[i-1]!=' ' && i0 && text[i-1]!=' ' && (i == text.length-1 || text[i+1]==' ')) arabicForm = 'initial'; - if (typeof(font.glyphs[c]) != 'undefined') { - glyph = font.glyphs[c][arabicForm]; - if (glyph == null && font.glyphs[c].type == 'glyph') glyph = font.glyphs[c]; - } - } - else { - glyph = font.glyphs[c]; - } - if (glyph == null) glyph = font.missingGlyph; - return glyph; - } - this.renderChildren = function(ctx) { - var customFont = this.parent.style('font-family').Definition.getDefinition(); - if (customFont != null) { - var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize); - var fontStyle = this.parent.style('font-style').valueOrDefault(svg.Font.Parse(svg.ctx.font).fontStyle); - var text = this.getText(); - if (customFont.isRTL) text = text.split("").reverse().join(""); - - if (this.parent.style('text-anchor').value == 'middle') { - this.x = this.x - this.measureText(ctx) / 2.0; - } - - var dx = svg.ToNumberArray(this.parent.attribute('dx').value); - for (var i=0; i 0 ? node.childNodes[0].nodeValue : // element - node.text; + // TEXT ELEMENT + this.text = node.nodeType == 3 ? node.nodeValue : node.childNodes[0].nodeValue; this.getText = function() { return this.text; } @@ -2095,9 +1931,8 @@ if(!Array.indexOf){ this.base = svg.Element.ElementBase; this.base(node); - // text, or spaces then CDATA - var css = node.childNodes[0].nodeValue + (node.childNodes.length > 1 ? node.childNodes[1].nodeValue : ''); - css = css.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm, ''); // remove comments + var css = node.childNodes[0].nodeValue; + css = css.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(\/\/.*)/gm, ''); // remove comments css = svg.compressSpaces(css); // replace whitespace var cssDefs = css.split('}'); for (var i=0; i 0) { - var urlStart = srcs[s].indexOf('url'); - var urlEnd = srcs[s].indexOf(')', urlStart); - var url = srcs[s].substr(urlStart + 5, urlEnd - urlStart - 6); - var doc = svg.parseXml(svg.ajax(url)); - var fonts = doc.getElementsByTagName('font'); - for (var f=0; f @@ -143,10 +149,12 @@ if(isset($zoom_submit)) {
+
+ + - -
-
@@ -266,6 +274,8 @@ if(isset($zoom_submit)) { + +