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

Side by Side Diff: third_party/flot/jquery.flot.image.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.image.js ('k') | third_party/flot/jquery.flot.min.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:{images:{show:false,alpha:1,anchor:"corner"}}}; $.plot.image={};$.plot.image.loadDataImages=function(series,options,callback){va r urls=[],points=[];var defaultShow=options.series.images.show;$.each(series,fun ction(i,s){if(!(defaultShow||s.images.show))return;if(s.data)s=s.data;$.each(s,f unction(i,p){if(typeof p[0]=="string"){urls.push(p[0]);points.push(p)}})});$.plo t.image.load(urls,function(loadedImages){$.each(points,function(i,p){var url=p[0 ];if(loadedImages[url])p[0]=loadedImages[url]});callback()})};$.plot.image.load= function(urls,callback){var missing=urls.length,loaded={};if(missing==0)callback ({});$.each(urls,function(i,url){var handler=function(){--missing;loaded[url]=th is;if(missing==0)callback(loaded)};$("<img />").load(handler).error(handler).att r("src",url)})};function drawSeries(plot,ctx,series){var plotOffset=plot.getPlot Offset();if(!series.images||!series.images.show)return;var points=series.datapoi nts.points,ps=series.datapoints.pointsize;for(var i=0;i<points.length;i+=ps){var img=points[i],x1=points[i+1],y1=points[i+2],x2=points[i+3],y2=points[i+4],xaxis =series.xaxis,yaxis=series.yaxis,tmp;if(!img||img.width<=0||img.height<=0)contin ue;if(x1>x2){tmp=x2;x2=x1;x1=tmp}if(y1>y2){tmp=y2;y2=y1;y1=tmp}if(series.images. anchor=="center"){tmp=.5*(x2-x1)/(img.width-1);x1-=tmp;x2+=tmp;tmp=.5*(y2-y1)/(i mg.height-1);y1-=tmp;y2+=tmp}if(x1==x2||y1==y2||x1>=xaxis.max||x2<=xaxis.min||y1 >=yaxis.max||y2<=yaxis.min)continue;var sx1=0,sy1=0,sx2=img.width,sy2=img.height ;if(x1<xaxis.min){sx1+=(sx2-sx1)*(xaxis.min-x1)/(x2-x1);x1=xaxis.min}if(x2>xaxis .max){sx2+=(sx2-sx1)*(xaxis.max-x2)/(x2-x1);x2=xaxis.max}if(y1<yaxis.min){sy2+=( sy1-sy2)*(yaxis.min-y1)/(y2-y1);y1=yaxis.min}if(y2>yaxis.max){sy1+=(sy1-sy2)*(ya xis.max-y2)/(y2-y1);y2=yaxis.max}x1=xaxis.p2c(x1);x2=xaxis.p2c(x2);y1=yaxis.p2c( y1);y2=yaxis.p2c(y2);if(x1>x2){tmp=x2;x2=x1;x1=tmp}if(y1>y2){tmp=y2;y2=y1;y1=tmp }tmp=ctx.globalAlpha;ctx.globalAlpha*=series.images.alpha;ctx.drawImage(img,sx1, sy1,sx2-sx1,sy2-sy1,x1+plotOffset.left,y1+plotOffset.top,x2-x1,y2-y1);ctx.global Alpha=tmp}}function processRawData(plot,series,data,datapoints){if(!series.image s.show)return;datapoints.format=[{required:true},{x:true,number:true,required:tr ue},{y:true,number:true,required:true},{x:true,number:true,required:true},{y:tru e,number:true,required:true}]}function init(plot){plot.hooks.processRawData.push (processRawData);plot.hooks.drawSeries.push(drawSeries)}$.plot.plugins.push({ini t:init,options:options,name:"image",version:"1.1"})})(jQuery);
OLDNEW
« no previous file with comments | « third_party/flot/jquery.flot.image.js ('k') | third_party/flot/jquery.flot.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698