jqplot-on-rails 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/jqplot-on-rails.gemspec +20 -0
- data/lib/jqplot-on-rails/version.rb +5 -0
- data/lib/jqplot-on-rails.rb +8 -0
- data/vendor/assets/javascripts/jqplot/excanvas.js +1438 -0
- data/vendor/assets/javascripts/jqplot/jquery.jqplot.js +11411 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.BezierCurveRenderer.js +314 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.BezierCurveRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.barRenderer.js +801 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.barRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.blockRenderer.js +235 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.blockRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.bubbleRenderer.js +759 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.bubbleRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js +203 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasAxisTickRenderer.js +253 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasOverlay.js +1021 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasOverlay.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasTextRenderer.js +449 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasTextRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.categoryAxisRenderer.js +679 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.categoryAxisRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.ciParser.js +116 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.ciParser.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.cursor.js +1108 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.cursor.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.dateAxisRenderer.js +741 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.dateAxisRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.donutRenderer.js +805 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.donutRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.dragable.js +225 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.dragable.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.enhancedLegendRenderer.js +305 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.funnelRenderer.js +943 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.funnelRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.highlighter.js +465 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.highlighter.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.json2.js +475 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.json2.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.logAxisRenderer.js +534 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.logAxisRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.mekkoAxisRenderer.js +611 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.mekkoAxisRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.mekkoRenderer.js +437 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.mekkoRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.meterGaugeRenderer.js +1029 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.meterGaugeRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.mobile.js +45 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.mobile.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.ohlcRenderer.js +373 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.ohlcRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.pieRenderer.js +904 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.pieRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.pointLabels.js +377 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.pointLabels.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidAxisRenderer.js +728 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidAxisRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidGridRenderer.js +429 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidGridRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidRenderer.js +514 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidRenderer.min.js +3 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.trendline.js +223 -0
- data/vendor/assets/javascripts/jqplot/plugins/jqplot.trendline.min.js +3 -0
- data/vendor/assets/stylesheets/jquery.jqplot.css +259 -0
- metadata +128 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
|
2
|
+
jsDate | (c) 2010-2013 Chris Leonello
|
|
3
|
+
*/(function(a){a.jqplot.CategoryAxisRenderer=function(b){a.jqplot.LinearAxisRenderer.call(this);this.sortMergedLabels=false};a.jqplot.CategoryAxisRenderer.prototype=new a.jqplot.LinearAxisRenderer();a.jqplot.CategoryAxisRenderer.prototype.constructor=a.jqplot.CategoryAxisRenderer;a.jqplot.CategoryAxisRenderer.prototype.init=function(e){this.groups=1;this.groupLabels=[];this._groupLabels=[];this._grouped=false;this._barsPerGroup=null;this.reverse=false;a.extend(true,this,{tickOptions:{formatString:"%d"}},e);var b=this._dataBounds;for(var f=0;f<this._series.length;f++){var g=this._series[f];if(g.groups){this.groups=g.groups}var h=g.data;for(var c=0;c<h.length;c++){if(this.name=="xaxis"||this.name=="x2axis"){if(h[c][0]<b.min||b.min==null){b.min=h[c][0]}if(h[c][0]>b.max||b.max==null){b.max=h[c][0]}}else{if(h[c][1]<b.min||b.min==null){b.min=h[c][1]}if(h[c][1]>b.max||b.max==null){b.max=h[c][1]}}}}if(this.groupLabels.length){this.groups=this.groupLabels.length}};a.jqplot.CategoryAxisRenderer.prototype.createTicks=function(){var D=this._ticks;var z=this.ticks;var F=this.name;var C=this._dataBounds;var v,A;var q,w;var d,c;var b,x;if(z.length){if(this.groups>1&&!this._grouped){var r=z.length;var p=parseInt(r/this.groups,10);var e=0;for(var x=p;x<r;x+=p){z.splice(x+e,0," ");e++}this._grouped=true}this.min=0.5;this.max=z.length+0.5;var m=this.max-this.min;this.numberTicks=2*z.length+1;for(x=0;x<z.length;x++){b=this.min+2*x*m/(this.numberTicks-1);var h=new this.tickRenderer(this.tickOptions);h.showLabel=false;h.setTick(b,this.name);this._ticks.push(h);var h=new this.tickRenderer(this.tickOptions);h.label=z[x];h.showMark=false;h.showGridline=false;h.setTick(b+0.5,this.name);this._ticks.push(h)}var h=new this.tickRenderer(this.tickOptions);h.showLabel=false;h.setTick(b+1,this.name);this._ticks.push(h)}else{if(F=="xaxis"||F=="x2axis"){v=this._plotDimensions.width}else{v=this._plotDimensions.height}if(this.min!=null&&this.max!=null&&this.numberTicks!=null){this.tickInterval=null}if(this.min!=null&&this.max!=null&&this.tickInterval!=null){if(parseInt((this.max-this.min)/this.tickInterval,10)!=(this.max-this.min)/this.tickInterval){this.tickInterval=null}}var y=[];var B=0;var q=0.5;var w,E;var f=false;for(var x=0;x<this._series.length;x++){var k=this._series[x];for(var u=0;u<k.data.length;u++){if(this.name=="xaxis"||this.name=="x2axis"){E=k.data[u][0]}else{E=k.data[u][1]}if(a.inArray(E,y)==-1){f=true;B+=1;y.push(E)}}}if(f&&this.sortMergedLabels){if(typeof y[0]=="string"){y.sort()}else{y.sort(function(j,i){return j-i})}}this.ticks=y;for(var x=0;x<this._series.length;x++){var k=this._series[x];for(var u=0;u<k.data.length;u++){if(this.name=="xaxis"||this.name=="x2axis"){E=k.data[u][0]}else{E=k.data[u][1]}var n=a.inArray(E,y)+1;if(this.name=="xaxis"||this.name=="x2axis"){k.data[u][0]=n}else{k.data[u][1]=n}}}if(this.groups>1&&!this._grouped){var r=y.length;var p=parseInt(r/this.groups,10);var e=0;for(var x=p;x<r;x+=p+1){y[x]=" "}this._grouped=true}w=B+0.5;if(this.numberTicks==null){this.numberTicks=2*B+1}var m=w-q;this.min=q;this.max=w;var o=0;var g=parseInt(3+v/10,10);var p=parseInt(B/g,10);if(this.tickInterval==null){this.tickInterval=m/(this.numberTicks-1)}for(var x=0;x<this.numberTicks;x++){b=this.min+x*this.tickInterval;var h=new this.tickRenderer(this.tickOptions);if(x/2==parseInt(x/2,10)){h.showLabel=false;h.showMark=true}else{if(p>0&&o<p){h.showLabel=false;o+=1}else{h.showLabel=true;o=0}h.label=h.formatter(h.formatString,y[(x-1)/2]);h.showMark=false;h.showGridline=false}h.setTick(b,this.name);this._ticks.push(h)}}};a.jqplot.CategoryAxisRenderer.prototype.draw=function(b,j){if(this.show){this.renderer.createTicks.call(this);var h=0;var c;if(this._elem){this._elem.emptyForce()}this._elem=this._elem||a('<div class="jqplot-axis jqplot-'+this.name+'" style="position:absolute;"></div>');if(this.name=="xaxis"||this.name=="x2axis"){this._elem.width(this._plotDimensions.width)}else{this._elem.height(this._plotDimensions.height)}this.labelOptions.axis=this.name;this._label=new this.labelRenderer(this.labelOptions);if(this._label.show){var g=this._label.draw(b,j);g.appendTo(this._elem)}var f=this._ticks;for(var e=0;e<f.length;e++){var d=f[e];if(d.showLabel&&(!d.isMinorTick||this.showMinorTicks)){var g=d.draw(b,j);g.appendTo(this._elem)}}this._groupLabels=[];for(var e=0;e<this.groupLabels.length;e++){var g=a('<div style="position:absolute;" class="jqplot-'+this.name+'-groupLabel"></div>');g.html(this.groupLabels[e]);this._groupLabels.push(g);g.appendTo(this._elem)}}return this._elem};a.jqplot.CategoryAxisRenderer.prototype.set=function(){var e=0;var m;var k=0;var f=0;var d=(this._label==null)?false:this._label.show;if(this.show){var n=this._ticks;for(var c=0;c<n.length;c++){var g=n[c];if(g.showLabel&&(!g.isMinorTick||this.showMinorTicks)){if(this.name=="xaxis"||this.name=="x2axis"){m=g._elem.outerHeight(true)}else{m=g._elem.outerWidth(true)}if(m>e){e=m}}}var j=0;for(var c=0;c<this._groupLabels.length;c++){var b=this._groupLabels[c];if(this.name=="xaxis"||this.name=="x2axis"){m=b.outerHeight(true)}else{m=b.outerWidth(true)}if(m>j){j=m}}if(d){k=this._label._elem.outerWidth(true);f=this._label._elem.outerHeight(true)}if(this.name=="xaxis"){e+=j+f;this._elem.css({height:e+"px",left:"0px",bottom:"0px"})}else{if(this.name=="x2axis"){e+=j+f;this._elem.css({height:e+"px",left:"0px",top:"0px"})}else{if(this.name=="yaxis"){e+=j+k;this._elem.css({width:e+"px",left:"0px",top:"0px"});if(d&&this._label.constructor==a.jqplot.AxisLabelRenderer){this._label._elem.css("width",k+"px")}}else{e+=j+k;this._elem.css({width:e+"px",right:"0px",top:"0px"});if(d&&this._label.constructor==a.jqplot.AxisLabelRenderer){this._label._elem.css("width",k+"px")}}}}}};a.jqplot.CategoryAxisRenderer.prototype.pack=function(e,c){var C=this._ticks;var v=this.max;var s=this.min;var n=c.max;var l=c.min;var q=(this._label==null)?false:this._label.show;var x;for(var r in e){this._elem.css(r,e[r])}this._offsets=c;var g=n-l;var k=v-s;if(!this.reverse){this.u2p=function(h){return(h-s)*g/k+l};this.p2u=function(h){return(h-l)*k/g+s};if(this.name=="xaxis"||this.name=="x2axis"){this.series_u2p=function(h){return(h-s)*g/k};this.series_p2u=function(h){return h*k/g+s}}else{this.series_u2p=function(h){return(h-v)*g/k};this.series_p2u=function(h){return h*k/g+v}}}else{this.u2p=function(h){return l+(v-h)*g/k};this.p2u=function(h){return s+(h-l)*k/g};if(this.name=="xaxis"||this.name=="x2axis"){this.series_u2p=function(h){return(v-h)*g/k};this.series_p2u=function(h){return h*k/g+v}}else{this.series_u2p=function(h){return(s-h)*g/k};this.series_p2u=function(h){return h*k/g+s}}}if(this.show){if(this.name=="xaxis"||this.name=="x2axis"){for(x=0;x<C.length;x++){var o=C[x];if(o.show&&o.showLabel){var b;if(o.constructor==a.jqplot.CanvasAxisTickRenderer&&o.angle){var A=(this.name=="xaxis")?1:-1;switch(o.labelPosition){case"auto":if(A*o.angle<0){b=-o.getWidth()+o._textRenderer.height*Math.sin(-o._textRenderer.angle)/2}else{b=-o._textRenderer.height*Math.sin(o._textRenderer.angle)/2}break;case"end":b=-o.getWidth()+o._textRenderer.height*Math.sin(-o._textRenderer.angle)/2;break;case"start":b=-o._textRenderer.height*Math.sin(o._textRenderer.angle)/2;break;case"middle":b=-o.getWidth()/2+o._textRenderer.height*Math.sin(-o._textRenderer.angle)/2;break;default:b=-o.getWidth()/2+o._textRenderer.height*Math.sin(-o._textRenderer.angle)/2;break}}else{b=-o.getWidth()/2}var D=this.u2p(o.value)+b+"px";o._elem.css("left",D);o.pack()}}var z=["bottom",0];if(q){var m=this._label._elem.outerWidth(true);this._label._elem.css("left",l+g/2-m/2+"px");if(this.name=="xaxis"){this._label._elem.css("bottom","0px");z=["bottom",this._label._elem.outerHeight(true)]}else{this._label._elem.css("top","0px");z=["top",this._label._elem.outerHeight(true)]}this._label.pack()}var d=parseInt(this._ticks.length/this.groups,10)+1;for(x=0;x<this._groupLabels.length;x++){var B=0;var f=0;for(var u=x*d;u<(x+1)*d;u++){if(u>=this._ticks.length-1){continue}if(this._ticks[u]._elem&&this._ticks[u].label!=" "){var o=this._ticks[u]._elem;var r=o.position();B+=r.left+o.outerWidth(true)/2;f++}}B=B/f;this._groupLabels[x].css({left:(B-this._groupLabels[x].outerWidth(true)/2)});this._groupLabels[x].css(z[0],z[1])}}else{for(x=0;x<C.length;x++){var o=C[x];if(o.show&&o.showLabel){var b;if(o.constructor==a.jqplot.CanvasAxisTickRenderer&&o.angle){var A=(this.name=="yaxis")?1:-1;switch(o.labelPosition){case"auto":case"end":if(A*o.angle<0){b=-o._textRenderer.height*Math.cos(-o._textRenderer.angle)/2}else{b=-o.getHeight()+o._textRenderer.height*Math.cos(o._textRenderer.angle)/2}break;case"start":if(o.angle>0){b=-o._textRenderer.height*Math.cos(-o._textRenderer.angle)/2}else{b=-o.getHeight()+o._textRenderer.height*Math.cos(o._textRenderer.angle)/2}break;case"middle":b=-o.getHeight()/2;break;default:b=-o.getHeight()/2;break}}else{b=-o.getHeight()/2}var D=this.u2p(o.value)+b+"px";o._elem.css("top",D);o.pack()}}var z=["left",0];if(q){var y=this._label._elem.outerHeight(true);this._label._elem.css("top",n-g/2-y/2+"px");if(this.name=="yaxis"){this._label._elem.css("left","0px");z=["left",this._label._elem.outerWidth(true)]}else{this._label._elem.css("right","0px");z=["right",this._label._elem.outerWidth(true)]}this._label.pack()}var d=parseInt(this._ticks.length/this.groups,10)+1;for(x=0;x<this._groupLabels.length;x++){var B=0;var f=0;for(var u=x*d;u<(x+1)*d;u++){if(u>=this._ticks.length-1){continue}if(this._ticks[u]._elem&&this._ticks[u].label!=" "){var o=this._ticks[u]._elem;var r=o.position();B+=r.top+o.outerHeight()/2;f++}}B=B/f;this._groupLabels[x].css({top:B-this._groupLabels[x].outerHeight()/2});this._groupLabels[x].css(z[0],z[1])}}}}})(jQuery);
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jqPlot
|
|
3
|
+
* Pure JavaScript plotting plugin using jQuery
|
|
4
|
+
*
|
|
5
|
+
* Version: 1.0.8
|
|
6
|
+
* Revision: 1250
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) 2009-2013 Chris Leonello
|
|
9
|
+
* jqPlot is currently available for use in all personal or commercial projects
|
|
10
|
+
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
|
11
|
+
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
|
12
|
+
* choose the license that best suits your project and use it accordingly.
|
|
13
|
+
*
|
|
14
|
+
* Although not required, the author would appreciate an email letting him
|
|
15
|
+
* know of any substantial use of jqPlot. You can reach the author at:
|
|
16
|
+
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
|
17
|
+
*
|
|
18
|
+
* If you are feeling kind and generous, consider supporting the project by
|
|
19
|
+
* making a donation at: http://www.jqplot.com/donate.php .
|
|
20
|
+
*
|
|
21
|
+
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
|
22
|
+
*
|
|
23
|
+
* version 2007.04.27
|
|
24
|
+
* author Ash Searle
|
|
25
|
+
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
|
26
|
+
* http://hexmen.com/js/sprintf.js
|
|
27
|
+
* The author (Ash Searle) has placed this code in the public domain:
|
|
28
|
+
* "This code is unrestricted: you are free to use it however you like."
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
(function($) {
|
|
32
|
+
/**
|
|
33
|
+
* Class: $.jqplot.ciParser
|
|
34
|
+
* Data Renderer function which converts a custom JSON data object into jqPlot data format.
|
|
35
|
+
* Set this as a callable on the jqplot dataRenderer plot option:
|
|
36
|
+
*
|
|
37
|
+
* > plot = $.jqplot('mychart', [data], { dataRenderer: $.jqplot.ciParser, ... });
|
|
38
|
+
*
|
|
39
|
+
* Where data is an object in JSON format or a JSON encoded string conforming to the
|
|
40
|
+
* City Index API spec.
|
|
41
|
+
*
|
|
42
|
+
* Note that calling the renderer function is handled internally by jqPlot. The
|
|
43
|
+
* user does not have to call the function. The parameters described below will
|
|
44
|
+
* automatically be passed to the ciParser function.
|
|
45
|
+
*
|
|
46
|
+
* Parameters:
|
|
47
|
+
* data - JSON encoded string or object.
|
|
48
|
+
* plot - reference to jqPlot Plot object.
|
|
49
|
+
*
|
|
50
|
+
* Returns:
|
|
51
|
+
* data array in jqPlot format.
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
$.jqplot.ciParser = function (data, plot) {
|
|
55
|
+
var ret = [],
|
|
56
|
+
line,
|
|
57
|
+
temp,
|
|
58
|
+
i, j, k, kk;
|
|
59
|
+
|
|
60
|
+
if (typeof(data) == "string") {
|
|
61
|
+
data = $.jqplot.JSON.parse(data, handleStrings);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
else if (typeof(data) == "object") {
|
|
65
|
+
for (k in data) {
|
|
66
|
+
for (i=0; i<data[k].length; i++) {
|
|
67
|
+
for (kk in data[k][i]) {
|
|
68
|
+
data[k][i][kk] = handleStrings(kk, data[k][i][kk]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
else {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// function handleStrings
|
|
79
|
+
// Checks any JSON encoded strings to see if they are
|
|
80
|
+
// encoded dates. If so, pull out the timestamp.
|
|
81
|
+
// Expects dates to be represented by js timestamps.
|
|
82
|
+
|
|
83
|
+
function handleStrings(key, value) {
|
|
84
|
+
var a;
|
|
85
|
+
if (value != null) {
|
|
86
|
+
if (value.toString().indexOf('Date') >= 0) {
|
|
87
|
+
//here we will try to extract the ticks from the Date string in the "value" fields of JSON returned data
|
|
88
|
+
a = /^\/Date\((-?[0-9]+)\)\/$/.exec(value);
|
|
89
|
+
if (a) {
|
|
90
|
+
return parseInt(a[1], 10);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return value;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
for (var prop in data) {
|
|
98
|
+
line = [];
|
|
99
|
+
temp = data[prop];
|
|
100
|
+
switch (prop) {
|
|
101
|
+
case "PriceTicks":
|
|
102
|
+
for (i=0; i<temp.length; i++) {
|
|
103
|
+
line.push([temp[i]['TickDate'], temp[i]['Price']]);
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
case "PriceBars":
|
|
107
|
+
for (i=0; i<temp.length; i++) {
|
|
108
|
+
line.push([temp[i]['BarDate'], temp[i]['Open'], temp[i]['High'], temp[i]['Low'], temp[i]['Close']]);
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
ret.push(line);
|
|
113
|
+
}
|
|
114
|
+
return ret;
|
|
115
|
+
};
|
|
116
|
+
})(jQuery);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
|
2
|
+
jsDate | (c) 2010-2013 Chris Leonello
|
|
3
|
+
*/(function(a){a.jqplot.ciParser=function(g,l){var m=[],o,n,h,f,e,c;if(typeof(g)=="string"){g=a.jqplot.JSON.parse(g,d)}else{if(typeof(g)=="object"){for(e in g){for(h=0;h<g[e].length;h++){for(c in g[e][h]){g[e][h][c]=d(c,g[e][h][c])}}}}else{return null}}function d(j,k){var i;if(k!=null){if(k.toString().indexOf("Date")>=0){i=/^\/Date\((-?[0-9]+)\)\/$/.exec(k);if(i){return parseInt(i[1],10)}}return k}}for(var b in g){o=[];n=g[b];switch(b){case"PriceTicks":for(h=0;h<n.length;h++){o.push([n[h]["TickDate"],n[h]["Price"]])}break;case"PriceBars":for(h=0;h<n.length;h++){o.push([n[h]["BarDate"],n[h]["Open"],n[h]["High"],n[h]["Low"],n[h]["Close"]])}break}m.push(o)}return m}})(jQuery);
|