Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(947)

Side by Side Diff: third_party/flot/jquery.flot.errorbars.min.js

Issue 1235773002: Add jquery and flot to catapult/third_party. (Closed) Base URL: git@github.com:catapult-project/catapult.git@master
Patch Set: Rebased Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/flot/jquery.flot.errorbars.js ('k') | third_party/flot/jquery.flot.fillbetween.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* Javascript plotting library for jQuery, version 0.8.3.
2
3 Copyright (c) 2007-2014 IOLA and Ole Laursen.
4 Licensed under the MIT license.
5
6 */
7 (function($){var options={series:{points:{errorbars:null,xerr:{err:"x",show:null ,asymmetric:null,upperCap:null,lowerCap:null,color:null,radius:null},yerr:{err:" y",show:null,asymmetric:null,upperCap:null,lowerCap:null,color:null,radius:null} }}};function processRawData(plot,series,data,datapoints){if(!series.points.error bars)return;var format=[{x:true,number:true,required:true},{y:true,number:true,r equired:true}];var errors=series.points.errorbars;if(errors=="x"||errors=="xy"){ if(series.points.xerr.asymmetric){format.push({x:true,number:true,required:true} );format.push({x:true,number:true,required:true})}else format.push({x:true,numbe r:true,required:true})}if(errors=="y"||errors=="xy"){if(series.points.yerr.asymm etric){format.push({y:true,number:true,required:true});format.push({y:true,numbe r:true,required:true})}else format.push({y:true,number:true,required:true})}data points.format=format}function parseErrors(series,i){var points=series.datapoints .points;var exl=null,exu=null,eyl=null,eyu=null;var xerr=series.points.xerr,yerr =series.points.yerr;var eb=series.points.errorbars;if(eb=="x"||eb=="xy"){if(xerr .asymmetric){exl=points[i+2];exu=points[i+3];if(eb=="xy")if(yerr.asymmetric){eyl =points[i+4];eyu=points[i+5]}else eyl=points[i+4]}else{exl=points[i+2];if(eb=="x y")if(yerr.asymmetric){eyl=points[i+3];eyu=points[i+4]}else eyl=points[i+3]}}els e if(eb=="y")if(yerr.asymmetric){eyl=points[i+2];eyu=points[i+3]}else eyl=points [i+2];if(exu==null)exu=exl;if(eyu==null)eyu=eyl;var errRanges=[exl,exu,eyl,eyu]; if(!xerr.show){errRanges[0]=null;errRanges[1]=null}if(!yerr.show){errRanges[2]=n ull;errRanges[3]=null}return errRanges}function drawSeriesErrors(plot,ctx,s){var points=s.datapoints.points,ps=s.datapoints.pointsize,ax=[s.xaxis,s.yaxis],radiu s=s.points.radius,err=[s.points.xerr,s.points.yerr];var invertX=false;if(ax[0].p 2c(ax[0].max)<ax[0].p2c(ax[0].min)){invertX=true;var tmp=err[0].lowerCap;err[0]. lowerCap=err[0].upperCap;err[0].upperCap=tmp}var invertY=false;if(ax[1].p2c(ax[1 ].min)<ax[1].p2c(ax[1].max)){invertY=true;var tmp=err[1].lowerCap;err[1].lowerCa p=err[1].upperCap;err[1].upperCap=tmp}for(var i=0;i<s.datapoints.points.length;i +=ps){var errRanges=parseErrors(s,i);for(var e=0;e<err.length;e++){var minmax=[a x[e].min,ax[e].max];if(errRanges[e*err.length]){var x=points[i],y=points[i+1];va r upper=[x,y][e]+errRanges[e*err.length+1],lower=[x,y][e]-errRanges[e*err.length ];if(err[e].err=="x")if(y>ax[1].max||y<ax[1].min||upper<ax[0].min||lower>ax[0].m ax)continue;if(err[e].err=="y")if(x>ax[0].max||x<ax[0].min||upper<ax[1].min||low er>ax[1].max)continue;var drawUpper=true,drawLower=true;if(upper>minmax[1]){draw Upper=false;upper=minmax[1]}if(lower<minmax[0]){drawLower=false;lower=minmax[0]} if(err[e].err=="x"&&invertX||err[e].err=="y"&&invertY){var tmp=lower;lower=upper ;upper=tmp;tmp=drawLower;drawLower=drawUpper;drawUpper=tmp;tmp=minmax[0];minmax[ 0]=minmax[1];minmax[1]=tmp}x=ax[0].p2c(x),y=ax[1].p2c(y),upper=ax[e].p2c(upper); lower=ax[e].p2c(lower);minmax[0]=ax[e].p2c(minmax[0]);minmax[1]=ax[e].p2c(minmax [1]);var lw=err[e].lineWidth?err[e].lineWidth:s.points.lineWidth,sw=s.points.sha dowSize!=null?s.points.shadowSize:s.shadowSize;if(lw>0&&sw>0){var w=sw/2;ctx.lin eWidth=w;ctx.strokeStyle="rgba(0,0,0,0.1)";drawError(ctx,err[e],x,y,upper,lower, drawUpper,drawLower,radius,w+w/2,minmax);ctx.strokeStyle="rgba(0,0,0,0.2)";drawE rror(ctx,err[e],x,y,upper,lower,drawUpper,drawLower,radius,w/2,minmax)}ctx.strok eStyle=err[e].color?err[e].color:s.color;ctx.lineWidth=lw;drawError(ctx,err[e],x ,y,upper,lower,drawUpper,drawLower,radius,0,minmax)}}}}function drawError(ctx,er r,x,y,upper,lower,drawUpper,drawLower,radius,offset,minmax){y+=offset;upper+=off set;lower+=offset;if(err.err=="x"){if(upper>x+radius)drawPath(ctx,[[upper,y],[Ma th.max(x+radius,minmax[0]),y]]);else drawUpper=false;if(lower<x-radius)drawPath( ctx,[[Math.min(x-radius,minmax[1]),y],[lower,y]]);else drawLower=false}else{if(u pper<y-radius)drawPath(ctx,[[x,upper],[x,Math.min(y-radius,minmax[0])]]);else dr awUpper=false;if(lower>y+radius)drawPath(ctx,[[x,Math.max(y+radius,minmax[1])],[ x,lower]]);else drawLower=false}radius=err.radius!=null?err.radius:radius;if(dra wUpper){if(err.upperCap=="-"){if(err.err=="x")drawPath(ctx,[[upper,y-radius],[up per,y+radius]]);else drawPath(ctx,[[x-radius,upper],[x+radius,upper]])}else if($ .isFunction(err.upperCap)){if(err.err=="x")err.upperCap(ctx,upper,y,radius);else err.upperCap(ctx,x,upper,radius)}}if(drawLower){if(err.lowerCap=="-"){if(err.er r=="x")drawPath(ctx,[[lower,y-radius],[lower,y+radius]]);else drawPath(ctx,[[x-r adius,lower],[x+radius,lower]])}else if($.isFunction(err.lowerCap)){if(err.err== "x")err.lowerCap(ctx,lower,y,radius);else err.lowerCap(ctx,x,lower,radius)}}}fun ction drawPath(ctx,pts){ctx.beginPath();ctx.moveTo(pts[0][0],pts[0][1]);for(var p=1;p<pts.length;p++)ctx.lineTo(pts[p][0],pts[p][1]);ctx.stroke()}function draw( plot,ctx){var plotOffset=plot.getPlotOffset();ctx.save();ctx.translate(plotOffse t.left,plotOffset.top);$.each(plot.getData(),function(i,s){if(s.points.errorbars &&(s.points.xerr.show||s.points.yerr.show))drawSeriesErrors(plot,ctx,s)});ctx.re store()}function init(plot){plot.hooks.processRawData.push(processRawData);plot. hooks.draw.push(draw)}$.plot.plugins.push({init:init,options:options,name:"error bars",version:"1.0"})})(jQuery);
OLDNEW
« no previous file with comments | « third_party/flot/jquery.flot.errorbars.js ('k') | third_party/flot/jquery.flot.fillbetween.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698