Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2013-12-18 07:36:15 +0400
committerThomas Steur <tsteur@users.noreply.github.com>2013-12-18 07:36:15 +0400
commit516dd93f3caec16881d8e6310469494538106f18 (patch)
tree3b699bfc53c2e1a2bccb5368f60743d2d388153b /libs
parent63bc4493cb215e2e65d8a3514d97dd213806a884 (diff)
parent9c58e9da5cccf4ca59907c1daec66b8bd284cc29 (diff)
Merge pull request #169 from piwik/fix-retina
Modify jqPlot to support retina displays.
Diffstat (limited to 'libs')
-rwxr-xr-xlibs/jqplot/build_minified_script.sh2
-rw-r--r--libs/jqplot/jqplot-custom.min.js4
-rw-r--r--libs/jqplot/jqplot.core.js18
3 files changed, 21 insertions, 3 deletions
diff --git a/libs/jqplot/build_minified_script.sh b/libs/jqplot/build_minified_script.sh
index 38584f136d..27be8ba21d 100755
--- a/libs/jqplot/build_minified_script.sh
+++ b/libs/jqplot/build_minified_script.sh
@@ -21,6 +21,6 @@ cat plugins/jqplot.categoryAxisRenderer.js >> jqplot-custom.min.js-temp
cat plugins/jqplot.canvasTextRenderer.js >> jqplot-custom.min.js-temp
cat plugins/jqplot.canvasAxisTickRenderer.js >> jqplot-custom.min.js-temp
-java -jar ../../js/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar --type js --line-break 1000 jqplot-custom.min.js-temp > jqplot-custom.min.js
+java -jar ../../js/yuicompressor-2.4.7/build/yuicompressor-2.4.7.jar --type js --line-break 1000 jqplot-custom.min.js-temp > jqplot-custom.min.js
rm ./jqplot-custom.min.js-temp
diff --git a/libs/jqplot/jqplot-custom.min.js b/libs/jqplot/jqplot-custom.min.js
index fdf696fa37..4a4fc93178 100644
--- a/libs/jqplot/jqplot-custom.min.js
+++ b/libs/jqplot/jqplot-custom.min.js
@@ -1,7 +1,7 @@
(function(e){var b;e.fn.emptyForce=function(){for(var j=0,k;(k=e(this)[j])!=null;j++){if(k.nodeType===1){e.cleanData(k.getElementsByTagName("*"))}if(e.jqplot.use_excanvas){k.outerHTML=""}else{while(k.firstChild){k.removeChild(k.firstChild)}}k=null}return e(this)};e.fn.removeChildForce=function(j){while(j.firstChild){this.removeChildForce(j.firstChild);j.removeChild(j.firstChild)}};e.fn.jqplot=function(){var j=[];var m=[];for(var n=0,k=arguments.length;n<k;n++){if(e.isArray(arguments[n])){j.push(arguments[n])}else{if(e.isPlainObject(arguments[n])){m.push(arguments[n])}}}return this.each(function(p){var u,t,s=e(this),o=j.length,l=m.length,r,q;if(p<o){r=j[p]}else{r=o?j[o-1]:null}if(p<l){q=m[p]}else{q=l?m[l-1]:null}u=s.attr("id");if(u===b){u="jqplot_target_"+e.jqplot.targetCounter++;s.attr("id",u)}t=e.jqplot(u,r,q);s.data("jqplot",t)})};e.jqplot=function(p,m,k){var l=null,j=null;if(arguments.length===3){l=m;j=k}else{if(arguments.length===2){if(e.isArray(m)){l=m}else{if(e.isPlainObject(m)){j=m
}}}}if(l===null&&j!==null&&j.data){l=j.data}var o=new h();e("#"+p).removeClass("jqplot-error");if(e.jqplot.config.catchErrors){try{o.init(p,l,j);o.draw();o.themeEngine.init.call(o);return o}catch(n){var q=e.jqplot.config.errorMessage||n.message;e("#"+p).append('<div class="jqplot-error-message">'+q+"</div>");e("#"+p).addClass("jqplot-error");document.getElementById(p).style.background=e.jqplot.config.errorBackground;document.getElementById(p).style.border=e.jqplot.config.errorBorder;document.getElementById(p).style.fontFamily=e.jqplot.config.errorFontFamily;document.getElementById(p).style.fontSize=e.jqplot.config.errorFontSize;document.getElementById(p).style.fontStyle=e.jqplot.config.errorFontStyle;document.getElementById(p).style.fontWeight=e.jqplot.config.errorFontWeight}}else{o.init(p,l,j);o.draw();o.themeEngine.init.call(o);return o}};e.jqplot.version="@VERSION";e.jqplot.revision="@REVISION";e.jqplot.targetCounter=1;e.jqplot.CanvasManager=function(){if(typeof e.jqplot.CanvasManager.canvases=="undefined"){e.jqplot.CanvasManager.canvases=[];
-e.jqplot.CanvasManager.free=[]}var j=[];this.getCanvas=function(){var n;var m=true;if(!e.jqplot.use_excanvas){for(var o=0,k=e.jqplot.CanvasManager.canvases.length;o<k;o++){if(e.jqplot.CanvasManager.free[o]===true){m=false;n=e.jqplot.CanvasManager.canvases[o];e.jqplot.CanvasManager.free[o]=false;j.push(o);break}}}if(m){n=document.createElement("canvas");j.push(e.jqplot.CanvasManager.canvases.length);e.jqplot.CanvasManager.canvases.push(n);e.jqplot.CanvasManager.free.push(false)}return n};this.initCanvas=function(k){if(e.jqplot.use_excanvas){return window.G_vmlCanvasManager.initElement(k)}return k};this.freeAllCanvases=function(){for(var m=0,k=j.length;m<k;m++){this.freeCanvas(j[m])}j=[]};this.freeCanvas=function(k){if(e.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==b){window.G_vmlCanvasManager.uninitElement(e.jqplot.CanvasManager.canvases[k]);e.jqplot.CanvasManager.canvases[k]=null}else{var l=e.jqplot.CanvasManager.canvases[k];l.getContext("2d").clearRect(0,0,l.width,l.height);
-e(l).unbind().removeAttr("class").removeAttr("style");e(l).css({left:"",top:"",position:""});l.width=0;l.height=0;e.jqplot.CanvasManager.free[k]=true}}};e.jqplot.log=function(){if(window.console){window.console.log.apply(window.console,arguments)}};e.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","#4F64B0","#A89050","#C45923","#187399","#945381","#959E5C","#C7AF7B","#478396","#907294"],dashLength:4,gapLength:4,dotGapLength:2.5,srcLocation:"jqplot/src/",pluginLocation:"jqplot/src/plugins/"};
+e.jqplot.CanvasManager.free=[]}var j=[];this.getCanvas=function(){var n;var m=true;if(!e.jqplot.use_excanvas){for(var o=0,k=e.jqplot.CanvasManager.canvases.length;o<k;o++){if(e.jqplot.CanvasManager.free[o]===true){m=false;n=e.jqplot.CanvasManager.canvases[o];e.jqplot.CanvasManager.free[o]=false;j.push(o);break}}}if(m){n=document.createElement("canvas");j.push(e.jqplot.CanvasManager.canvases.length);e.jqplot.CanvasManager.canvases.push(n);e.jqplot.CanvasManager.free.push(false)}return n};this.initCanvas=function(m){if(e.jqplot.use_excanvas){return window.G_vmlCanvasManager.initElement(m)}var l=m.getContext("2d");var n=1;if(window.devicePixelRatio>1&&(l.webkitBackingStorePixelRatio===b||l.webkitBackingStorePixelRatio<2)){n=window.devicePixelRatio}var k=m.width;var o=m.height;m.width=n*m.width;m.height=n*m.height;m.style.width=k+"px";m.style.height=o+"px";l.save();l.scale(n,n);return m};this.freeAllCanvases=function(){for(var m=0,k=j.length;m<k;m++){this.freeCanvas(j[m])}j=[]};this.freeCanvas=function(k){if(e.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==b){window.G_vmlCanvasManager.uninitElement(e.jqplot.CanvasManager.canvases[k]);
+e.jqplot.CanvasManager.canvases[k]=null}else{var l=e.jqplot.CanvasManager.canvases[k];l.getContext("2d").clearRect(0,0,l.width,l.height);e(l).unbind().removeAttr("class").removeAttr("style");e(l).css({left:"",top:"",position:""});l.width=0;l.height=0;e.jqplot.CanvasManager.free[k]=true}}};e.jqplot.log=function(){if(window.console){window.console.log.apply(window.console,arguments)}};e.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","#4F64B0","#A89050","#C45923","#187399","#945381","#959E5C","#C7AF7B","#478396","#907294"],dashLength:4,gapLength:4,dotGapLength:2.5,srcLocation:"jqplot/src/",pluginLocation:"jqplot/src/plugins/"};
e.jqplot.arrayMax=function(j){return Math.max.apply(Math,j)};e.jqplot.arrayMin=function(j){return Math.min.apply(Math,j)};e.jqplot.enablePlugins=e.jqplot.config.enablePlugins;e.jqplot.support_canvas=function(){if(typeof e.jqplot.support_canvas.result=="undefined"){e.jqplot.support_canvas.result=!!document.createElement("canvas").getContext}return e.jqplot.support_canvas.result};e.jqplot.support_canvas_text=function(){if(typeof e.jqplot.support_canvas_text.result=="undefined"){if(window.G_vmlCanvasManager!==b&&window.G_vmlCanvasManager._version>887){e.jqplot.support_canvas_text.result=true}else{e.jqplot.support_canvas_text.result=!!(document.createElement("canvas").getContext&&typeof document.createElement("canvas").getContext("2d").fillText=="function")}}return e.jqplot.support_canvas_text.result};e.jqplot.use_excanvas=((!e.support.boxModel||!e.support.objectAll||!$support.leadingWhitespace)&&!e.jqplot.support_canvas())?true:false;e.jqplot.preInitHooks=[];e.jqplot.postInitHooks=[];e.jqplot.preParseOptionsHooks=[];
e.jqplot.postParseOptionsHooks=[];e.jqplot.preDrawHooks=[];e.jqplot.postDrawHooks=[];e.jqplot.preDrawSeriesHooks=[];e.jqplot.postDrawSeriesHooks=[];e.jqplot.preDrawLegendHooks=[];e.jqplot.addLegendRowHooks=[];e.jqplot.preSeriesInitHooks=[];e.jqplot.postSeriesInitHooks=[];e.jqplot.preParseSeriesOptionsHooks=[];e.jqplot.postParseSeriesOptionsHooks=[];e.jqplot.eventListenerHooks=[];e.jqplot.preDrawSeriesShadowHooks=[];e.jqplot.postDrawSeriesShadowHooks=[];e.jqplot.ElemContainer=function(){this._elem;this._plotWidth;this._plotHeight;this._plotDimensions={height:null,width:null}};e.jqplot.ElemContainer.prototype.createElement=function(m,o,k,l,p){this._offsets=o;var j=k||"jqplot";var n=document.createElement(m);this._elem=e(n);this._elem.addClass(j);this._elem.css(l);this._elem.attr(p);n=null;return this._elem};e.jqplot.ElemContainer.prototype.getWidth=function(){if(this._elem){return this._elem.outerWidth(true)}else{return null}};e.jqplot.ElemContainer.prototype.getHeight=function(){if(this._elem){return this._elem.outerHeight(true)
}else{return null}};e.jqplot.ElemContainer.prototype.getPosition=function(){if(this._elem){return this._elem.position()}else{return{top:null,left:null,bottom:null,right:null}}};e.jqplot.ElemContainer.prototype.getTop=function(){return this.getPosition().top};e.jqplot.ElemContainer.prototype.getLeft=function(){return this.getPosition().left};e.jqplot.ElemContainer.prototype.getBottom=function(){return this._elem.css("bottom")};e.jqplot.ElemContainer.prototype.getRight=function(){return this._elem.css("right")};function g(j){e.jqplot.ElemContainer.call(this);this.name=j;this._series=[];this.show=false;this.tickRenderer=e.jqplot.AxisTickRenderer;this.tickOptions={};this.labelRenderer=e.jqplot.AxisLabelRenderer;this.labelOptions={};this.label=null;this.showLabel=true;this.min=null;this.max=null;this.autoscale=false;this.pad=1.2;this.padMax=null;this.padMin=null;this.ticks=[];this.numberTicks;this.tickInterval;this.renderer=e.jqplot.LinearAxisRenderer;this.rendererOptions={};this.showTicks=true;
diff --git a/libs/jqplot/jqplot.core.js b/libs/jqplot/jqplot.core.js
index 35a856cdd8..0c2d857bdd 100644
--- a/libs/jqplot/jqplot.core.js
+++ b/libs/jqplot/jqplot.core.js
@@ -295,6 +295,24 @@
if ($.jqplot.use_excanvas) {
return window.G_vmlCanvasManager.initElement(canvas);
}
+ var cctx = canvas.getContext('2d');
+
+ var canvasBackingScale = 1;
+ if (window.devicePixelRatio > 1 && (cctx.webkitBackingStorePixelRatio === undefined ||
+ cctx.webkitBackingStorePixelRatio < 2)) {
+ canvasBackingScale = window.devicePixelRatio;
+ }
+ var oldWidth = canvas.width;
+ var oldHeight = canvas.height;
+
+ canvas.width = canvasBackingScale * canvas.width;
+ canvas.height = canvasBackingScale * canvas.height;
+ canvas.style.width = oldWidth + 'px';
+ canvas.style.height = oldHeight + 'px';
+ cctx.save();
+
+ cctx.scale(canvasBackingScale, canvasBackingScale);
+
return canvas;
};