!function(a,r){var i={};wp.media.coerce=function(e,t){return r.isUndefined(e[t])&&!r.isUndefined(this.defaults[t])?e[t]=this.defaults[t]:"true"===e[t]?e[t]=!0:"false"===e[t]&&(e[t]=!1),e[t]},wp.media.string={props:function(e,t){var i,n=wp.media.view.settings.defaultProps;return e=e?r.clone(e):{},t&&t.type&&(e.type=t.type),"image"===e.type&&(e=r.defaults(e||{},{align:n.align||getUserSetting("align","none"),size:n.size||getUserSetting("imgsize","medium"),url:"",classes:[]})),t&&(e.title=e.title||t.title,"file"===(n=e.link||n.link||getUserSetting("urlbutton","file"))||"embed"===n?i=t.url:"post"===n?i=t.link:"custom"===n&&(i=e.linkUrl),e.linkUrl=i||"","image"===t.type?(e.classes.push("wp-image-"+t.id),i=(n=t.sizes)&&n[e.size]?n[e.size]:t,r.extend(e,r.pick(t,"align","caption","alt"),{width:i.width,height:i.height,src:i.url,captionId:"attachment_"+t.id})):"video"===t.type||"audio"===t.type?r.extend(e,r.pick(t,"title","type","icon","mime")):(e.title=e.title||t.filename,e.rel=e.rel||"attachment wp-att-"+t.id)),e},link:function(e,t){t={tag:"a",content:(e=wp.media.string.props(e,t)).title,attrs:{href:e.linkUrl}};return e.rel&&(t.attrs.rel=e.rel),wp.html.string(t)},audio:function(e,t){return wp.media.string._audioVideo("audio",e,t)},video:function(e,t){return wp.media.string._audioVideo("video",e,t)},_audioVideo:function(e,t,i){var n,a;return"embed"===(t=wp.media.string.props(t,i)).link&&(n={},"video"===e&&(i.image&&-1===i.image.src.indexOf(i.icon)&&(n.poster=i.image.src),i.width&&(n.width=i.width),i.height)&&(n.height=i.height),a=i.filename.split(".").pop(),r.contains(wp.media.view.settings.embedExts,a))?(n[a]=i.url,wp.shortcode.string({tag:e,attrs:n})):wp.media.string.link(t)},image:function(e,t){var i,n={};return e.type="image",i=(e=wp.media.string.props(e,t)).classes||[],n.src=(r.isUndefined(t)?e:t).url,r.extend(n,r.pick(e,"width","height","alt")),e.align&&!e.caption&&i.push("align"+e.align),e.size&&i.push("size-"+e.size),n.class=r.compact(i).join(" "),t={tag:"img",attrs:n,single:!0},e.linkUrl&&(t={tag:"a",attrs:{href:e.linkUrl},content:t}),i=wp.html.string(t),e.caption&&(t={},n.width&&(t.width=n.width),e.captionId&&(t.id=e.captionId),e.align&&(t.align="align"+e.align),i=wp.shortcode.string({tag:"caption",attrs:t,content:i+" "+e.caption})),i}},wp.media.embed={coerce:wp.media.coerce,defaults:{url:"",width:"",height:""},edit:function(e,t){var i={};return t?i.url=e.replace(/<[^>]+>/g,""):(t=wp.shortcode.next("embed",e).shortcode,i=r.defaults(t.attrs.named,this.defaults),t.content&&(i.url=t.content)),wp.media({frame:"post",state:"embed",metadata:i})},shortcode:function(i){var e,n=this;return r.each(this.defaults,function(e,t){i[t]=n.coerce(i,t),e===i[t]&&delete i[t]}),e=i.url,delete i.url,new wp.shortcode({tag:"embed",attrs:i,content:e})}},wp.media.collection=function(e){var d={};return r.extend({coerce:wp.media.coerce,attachments:function(e){var i,t=e.string(),n=d[t],a=this;return delete d[t],n||(t=r.defaults(e.attrs.named,this.defaults),(n=r.pick(t,"orderby","order")).type=this.type,n.perPage=-1,void 0!==t.orderby&&(t._orderByField=t.orderby),"rand"===t.orderby&&(t._orderbyRandom=!0),t.orderby&&!/^menu_order(?: ID)?$/i.test(t.orderby)||(n.orderby="menuOrder"),t.ids?(n.post__in=t.ids.split(","),n.orderby="post__in"):t.include&&(n.post__in=t.include.split(",")),t.exclude&&(n.post__not_in=t.exclude.split(",")),n.post__in||(n.uploadedTo=t.id),i=r.omit(t,"id","ids","include","exclude","orderby","order"),r.each(this.defaults,function(e,t){i[t]=a.coerce(i,t)}),(e=wp.media.query(n))[this.tag]=new Backbone.Model(i),e)},shortcode:function(e){var t=e.props.toJSON(),i=r.pick(t,"orderby","order");return e.type&&(i.type=e.type,delete e.type),e[this.tag]&&r.extend(i,e[this.tag].toJSON()),i.ids=e.pluck("id"),t.uploadedTo&&(i.id=t.uploadedTo),delete i.orderby,i._orderbyRandom?i.orderby="rand":i._orderByField&&"rand"!==i._orderByField&&(i.orderby=i._orderByField),delete i._orderbyRandom,delete i._orderByField,i.ids&&"post__in"===i.orderby&&delete i.orderby,i=this.setDefaults(i),i=new wp.shortcode({tag:this.tag,attrs:i,type:"single"}),(t=new wp.media.model.Attachments(e.models,{props:t}))[this.tag]=e[this.tag],d[i.string()]=t,i},edit:function(e){var t,i=wp.shortcode.next(this.tag,e),n=this.defaults.id;if(i&&i.content===e)return i=i.shortcode,r.isUndefined(i.get("id"))&&!r.isUndefined(n)&&i.set("id",n),e=this.attachments(i),(t=new wp.media.model.Selection(e.models,{props:e.props.toJSON(),multiple:!0}))[this.tag]=e[this.tag],t.more().done(function(){t.props.set({query:!1}),t.unmirror(),t.props.unset("orderby")}),this.frame&&this.frame.dispose(),n=i.attrs.named.type&&"video"===i.attrs.named.type?"video-"+this.tag+"-edit":this.tag+"-edit",this.frame=wp.media({frame:"post",state:n,title:this.editTitle,editing:!0,multiple:!0,selection:t}).open(),this.frame},setDefaults:function(i){var n=this;return r.each(this.defaults,function(e,t){i[t]=n.coerce(i,t),e===i[t]&&delete i[t]}),i}},e)},wp.media._galleryDefaults={itemtag:"dl",icontag:"dt",captiontag:"dd",columns:"3",link:"post",size:"thumbnail",order:"ASC",id:wp.media.view.settings.post&&wp.media.view.settings.post.id,orderby:"menu_order ID"},wp.media.view.settings.galleryDefaults?wp.media.galleryDefaults=r.extend({},wp.media._galleryDefaults,wp.media.view.settings.galleryDefaults):wp.media.galleryDefaults=wp.media._galleryDefaults,wp.media.gallery=new wp.media.collection({tag:"gallery",type:"image",editTitle:wp.media.view.l10n.editGalleryTitle,defaults:wp.media.galleryDefaults,setDefaults:function(i){var n=this,a=!r.isEqual(wp.media.galleryDefaults,wp.media._galleryDefaults);return r.each(this.defaults,function(e,t){i[t]=n.coerce(i,t),e!==i[t]||a&&e!==wp.media._galleryDefaults[t]||delete i[t]}),i}}),wp.media.featuredImage={get:function(){return wp.media.view.settings.post.featuredImageId},set:function(e){var t=wp.media.view.settings;t.post.featuredImageId=e,wp.media.post("get-post-thumbnail-html",{post_id:t.post.id,thumbnail_id:t.post.featuredImageId,_wpnonce:t.post.nonce}).done(function(e){"0"===e?window.alert(wp.i18n.__("Could not set that as the thumbnail image. Try a different attachment.")):a(".inside","#postimagediv").html(e)})},remove:function(){wp.media.featuredImage.set(-1)},frame:function(){return this._frame?wp.media.frame=this._frame:(this._frame=wp.media({state:"featured-image",states:[new wp.media.controller.FeaturedImage,new wp.media.controller.EditImage]}),this._frame.on("toolbar:create:featured-image",function(e){this.createSelectToolbar(e,{text:wp.media.view.l10n.setFeaturedImage})},this._frame),this._frame.on("content:render:edit-image",function(){var e=this.state("featured-image").get("selection"),e=new wp.media.view.EditImage({model:e.single(),controller:this}).render();this.content.set(e),e.loadEditor()},this._frame),this._frame.state("featured-image").on("select",this.select)),this._frame},select:function(){var e=this.get("selection").single();wp.media.view.settings.post.featuredImageId&&wp.media.featuredImage.set(e?e.id:-1)},init:function(){a("#postimagediv").on("click keyup keydown","#set-post-thumbnail",function(e){("keyup"===e.type&&" "===e.key||"keydown"===e.type&&"Enter"===e.key||"click"===e.type)&&(e.preventDefault(),e.stopPropagation(),wp.media.featuredImage.frame().open())}).on("click keyup keydown","#remove-post-thumbnail",function(e){if("keyup"===e.type&&" "===e.key||"keydown"===e.type&&"Enter"===e.key||"click"===e.type)return wp.media.featuredImage.remove(),!1})}},a(wp.media.featuredImage.init),wp.media.editor={insert:function(e){var t,i=!r.isUndefined(window.tinymce),n=!r.isUndefined(window.QTags),a=this.activeEditor?window.wpActiveEditor=this.activeEditor:window.wpActiveEditor;if(window.send_to_editor)return window.send_to_editor.apply(this,arguments);if(a)i&&(t=tinymce.get(a));else if(i&&tinymce.activeEditor)t=tinymce.activeEditor,a=window.wpActiveEditor=t.id;else if(!n)return!1;if(t&&!t.isHidden()?t.execCommand ("mceInsertContent",!1,e):n?QTags.insertContent(e):document.getElementById(a).value+=e,window.tb_remove)try{window.tb_remove()}catch(e){}},add:function(e,t){var n=this.get(e);return n||((n=i[e]=wp.media(r.defaults(t||{},{frame:"post",state:"insert",title:wp.media.view.l10n.addMedia,multiple:!0}))).on("insert",function(e){var i=n.state();(e=e||i.get("selection"))&&a.when.apply(a,e.map(function(e){var t=i.display(e).toJSON();return this.send.attachment(t,e.toJSON())},this)).done(function(){wp.media.editor.insert(r.toArray(arguments).join("\n\n"))})},this),n.state("gallery-edit").on("update",function(e){this.insert(wp.media.gallery.shortcode(e).string())},this),n.state("playlist-edit").on("update",function(e){this.insert(wp.media.playlist.shortcode(e).string())},this),n.state("video-playlist-edit").on("update",function(e){this.insert(wp.media.playlist.shortcode(e).string())},this),n.state("embed").on("select",function(){var e=n.state(),t=e.get("type"),e=e.props.toJSON();e.url=e.url||"","link"===t?(r.defaults(e,{linkText:e.url,linkUrl:e.url}),this.send.link(e).done(function(e){wp.media.editor.insert(e)})):"image"===t&&(r.defaults(e,{title:e.url,linkUrl:"",align:"none",link:"none"}),"none"===e.link?e.linkUrl="":"file"===e.link&&(e.linkUrl=e.url),this.insert(wp.media.string.image(e)))},this),n.state("featured-image").on("select",wp.media.featuredImage.select),n.setState(n.options.state)),n},id:function(e){return e=e||((e=(e=window.wpActiveEditor)||r.isUndefined(window.tinymce)||!tinymce.activeEditor?e:tinymce.activeEditor.id)||"")},get:function(e){return e=this.id(e),i[e]},remove:function(e){e=this.id(e),delete i[e]},send:{attachment:function(i,e){var n,t,a=e.caption;return wp.media.view.settings.captions||delete e.caption,i=wp.media.string.props(i,e),n={id:e.id,post_content:e.description,post_excerpt:a},i.linkUrl&&(n.url=i.linkUrl),"image"===e.type?(t=wp.media.string.image(i),r.each({align:"align",size:"image-size",alt:"image_alt"},function(e,t){i[t]&&(n[e]=i[t])})):"video"===e.type?t=wp.media.string.video(i,e):"audio"===e.type?t=wp.media.string.audio(i,e):(t=wp.media.string.link(i),n.post_title=i.title),wp.media.post("send-attachment-to-editor",{nonce:wp.media.view.settings.nonce.sendToEditor,attachment:n,html:t,post_id:wp.media.view.settings.post.id})},link:function(e){return wp.media.post("send-link-to-editor",{nonce:wp.media.view.settings.nonce.sendToEditor,src:e.linkUrl,link_text:e.linkText,html:wp.media.string.link(e),post_id:wp.media.view.settings.post.id})}},open:function(e,t){var i;return t=t||{},e=this.id(e),this.activeEditor=e,(!(i=this.get(e))||i.options&&t.state!==i.options.state)&&(i=this.add(e,t)),(wp.media.frame=i).open()},init:function(){a(document.body).on("click.add-media-button",".insert-media",function(e){var t=a(e.currentTarget),i=t.data("editor"),n={frame:"post",state:"insert",title:wp.media.view.l10n.addMedia,multiple:!0};e.preventDefault(),t.hasClass("gallery")&&(n.state="gallery",n.title=wp.media.view.l10n.createGalleryTitle),wp.media.editor.open(i,n)}),(new wp.media.view.EditorUploader).render()}},r.bindAll(wp.media.editor,"open"),a(wp.media.editor.init)}(jQuery,_);
(()=>{var i={1206(e){var t=wp.media.controller.State,i=wp.media.view.l10n,i=t.extend({defaults:{id:"audio-details",toolbar:"audio-details",title:i.audioDetailsTitle,content:"audio-details",menu:"audio-details",router:!1,priority:60},initialize:function(e){this.media=e.media,t.prototype.initialize.apply(this,arguments)}});e.exports=i},5039(e){var t=wp.media.controller.State,i=wp.media.view.l10n,i=t.extend({defaults:{id:"video-details",toolbar:"video-details",title:i.videoDetailsTitle,content:"video-details",menu:"video-details",router:!1,priority:60},initialize:function(e){this.media=e.media,t.prototype.initialize.apply(this,arguments)}});e.exports=i},241(e){var t=Backbone.Model.extend({initialize:function(){this.attachment=!1},setSource:function(e){this.attachment=e,this.extension=e.get("filename").split(".").pop(),this.get("src")&&this.extension===this.get("src").split(".").pop()&&this.unset("src"),_.contains(wp.media.view.settings.embedExts,this.extension)?this.set(this.extension,this.attachment.get("url")):this.unset(this.extension)},changeAttachment:function(e){this.setSource(e),this.unset("src"),_.each(_.without(wp.media.view.settings.embedExts,this.extension),function(e){this.unset(e)},this)}});e.exports=t},3713(e){var t=wp.media.view.MediaDetails,i=t.extend({className:"audio-details",template:wp.template("audio-details"),setMedia:function(){var e=this.$(".wp-audio-shortcode");return e.find("source").length?(e.is(":hidden")&&e.show(),this.media=t.prepareSrc(e.get(0))):(e.hide(),this.media=!1),this}});e.exports=i},175(e){var t=wp.media.view.MediaFrame.MediaDetails,i=wp.media.controller.MediaLibrary,a=wp.media.view.l10n,s=t.extend({defaults:{id:"audio",url:"",menu:"audio-details",content:"audio-details",toolbar:"audio-details",type:"link",title:a.audioDetailsTitle,priority:120},initialize:function(e){e.DetailsView=wp.media.view.AudioDetails,e.cancelText=a.audioDetailsCancel,e.addText=a.audioAddSourceTitle,t.prototype.initialize.call(this,e)},bindHandlers:function(){t.prototype.bindHandlers.apply(this,arguments),this.on("toolbar:render:replace-audio",this.renderReplaceToolbar,this),this.on("toolbar:render:add-audio-source",this.renderAddSourceToolbar,this)},createStates:function(){this.states.add([new wp.media.controller.AudioDetails({media:this.media}),new i({type:"audio",id:"replace-audio",title:a.audioReplaceTitle,toolbar:"replace-audio",media:this.media,menu:"audio-details"}),new i({type:"audio",id:"add-audio-source",title:a.audioAddSourceTitle,toolbar:"add-audio-source",media:this.media,menu:!1})])}});e.exports=s},741(e){var t=wp.media.view.MediaFrame.Select,i=wp.media.view.l10n,a=t.extend({defaults:{id:"media",url:"",menu:"media-details",content:"media-details",toolbar:"media-details",type:"link",priority:120},initialize:function(e){this.DetailsView=e.DetailsView,this.cancelText=e.cancelText,this.addText=e.addText,this.media=new wp.media.model.PostMedia(e.metadata),this.options.selection=new wp.media.model.Selection(this.media.attachment,{multiple:!1}),t.prototype.initialize.apply(this,arguments)},bindHandlers:function(){var e=this.defaults.menu;t.prototype.bindHandlers.apply(this,arguments),this.on("menu:create:"+e,this.createMenu,this),this.on("content:render:"+e,this.renderDetailsContent,this),this.on("menu:render:"+e,this.renderMenu,this),this.on("toolbar:render:"+e,this.renderDetailsToolbar,this)},renderDetailsContent:function(){var e=new this.DetailsView({controller:this,model:this.state().media,attachment:this.state().media.attachment}).render();this.content.set(e)},renderMenu:function(e){var t=this.lastState(),i=t&&t.id,a=this;e.set({cancel:{text:this.cancelText,priority:20,click:function(){i?a.setState(i):a.close()}},separateCancel:new wp.media.View({className:"separator",priority:40})})},setPrimaryButton:function(e,t){this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{button:{style:"primary",text:e,priority:80,click:function(){var e=this.controller;t.call(this,e,e.state()),e.setState(e.options.state),e.reset()}}}}))},renderDetailsToolbar:function(){this.setPrimaryButton(i.update,function(e,t){e.close(),t.trigger("update",e.media.toJSON())})},renderReplaceToolbar:function(){this.setPrimaryButton(i.replace,function(e,t){var i=t.get("selection").single();e.media.changeAttachment(i),t.trigger("replace",e.media.toJSON())})},renderAddSourceToolbar:function(){this.setPrimaryButton(this.addText,function(e,t){var i=t.get("selection").single();e.media.setSource(i),t.trigger("add-source",e.media.toJSON())})}});e.exports=a},8646(e){var t=wp.media.view.MediaFrame.MediaDetails,i=wp.media.controller.MediaLibrary,a=wp.media.view.l10n,s=t.extend({defaults:{id:"video",url:"",menu:"video-details",content:"video-details",toolbar:"video-details",type:"link",title:a.videoDetailsTitle,priority:120},initialize:function(e){e.DetailsView=wp.media.view.VideoDetails,e.cancelText=a.videoDetailsCancel,e.addText=a.videoAddSourceTitle,t.prototype.initialize.call(this,e)},bindHandlers:function(){t.prototype.bindHandlers.apply(this,arguments),this.on("toolbar:render:replace-video",this.renderReplaceToolbar,this),this.on("toolbar:render:add-video-source",this.renderAddSourceToolbar,this),this.on("toolbar:render:select-poster-image",this.renderSelectPosterImageToolbar,this),this.on("toolbar:render:add-track",this.renderAddTrackToolbar,this)},createStates:function(){this.states.add([new wp.media.controller.VideoDetails({media:this.media}),new i({type:"video",id:"replace-video",title:a.videoReplaceTitle,toolbar:"replace-video",media:this.media,menu:"video-details"}),new i({type:"video",id:"add-video-source",title:a.videoAddSourceTitle,toolbar:"add-video-source",media:this.media,menu:!1}),new i({type:"image",id:"select-poster-image",title:a.videoSelectPosterImageTitle,toolbar:"select-poster-image",media:this.media,menu:"video-details"}),new i({type:"text",id:"add-track",title:a.videoAddTrackTitle,toolbar:"add-track",media:this.media,menu:"video-details"})])},renderSelectPosterImageToolbar:function(){this.setPrimaryButton(a.videoSelectPosterImageTitle,function(t,e){var i=[],a=e.get("selection").single();t.media.set("poster",a.get("url")),e.trigger("set-poster-image",t.media.toJSON()),_.each(wp.media.view.settings.embedExts,function(e){t.media.get(e)&&i.push(t.media.get(e))}),wp.ajax.send("set-attachment-thumbnail",{data:{_ajax_nonce:wp.media.view.settings.nonce.setAttachmentThumbnail,urls:i,thumbnail_id:a.get("id")}})})},renderAddTrackToolbar:function(){this.setPrimaryButton(a.videoAddTrackTitle,function(e,t){var i=t.get("selection").single(),a=e.media.get("content");-1===a.indexOf(i.get("url"))&&(a+=['<track srclang="en" label="English" kind="subtitles" src="',i.get("url"),'" />'].join(""),e.media.set("content",a)),t.trigger("add-track",e.media.toJSON())})}});e.exports=s},9467(e){var t=wp.media.view.Settings.AttachmentDisplay,i=jQuery,a=t.extend({initialize:function(){_.bindAll(this,"success"),this.players=[],this.listenTo(this.controller.states,"close",wp.media.mixin.unsetPlayers),this.on("ready",this.setPlayer),this.on("media:setting:remove",wp.media.mixin.unsetPlayers,this),this.on("media:setting:remove",this.render),this.on("media:setting:remove",this.setPlayer),t.prototype.initialize.apply(this,arguments)},events:function(){return _.extend({"click .remove-setting":"removeSetting","change .content-track":"setTracks","click .remove-track":"setTracks","click .add-media-source":"addSource"},t.prototype.events)},prepare:function(){return _.defaults({model:this.model.toJSON()},this.options)},removeSetting:function(e){var e=i(e.currentTarget).parent(),t=e.find("input").data("setting");t&&(this.model.unset(t),this.trigger("media:setting:remove",this)),e.remove()},setTracks:function(){var t="";_.each(this.$(".content-track"),function(e){t+=i(e).val()}),this.model.set("content",t),this.trigger("media:setting:remove",this)},addSource:function(e){this.controller.lastMime=i(e.currentTarget).data("mime"),this.controller.setState("add-"+this.controller.defaults.id+"-source")},loadPlayer:function(){this.players.push(new MediaElementPlayer(this.media,this.settings)),this.scriptXhr=!1},setPlayer:function(){var e;this.players.length||!this.media||this.scriptXhr||((e=this.model.get("src"))&&-1<e.indexOf("vimeo")&&!("Vimeo"in window)?this.scriptXhr=i.getScript("https://player.vimeo.com/api/player.js",_.bind(this.loadPlayer,this)):this.loadPlayer())},setMedia:function(){return this},success:function(e){var t=e.attributes.autoplay&&"false"!==e.attributes.autoplay;"flash"===e.pluginType&&t&&e.addEventListener("canplay",function(){e.play()},!1),this.mejs=e},render:function(){return t.prototype.render.apply(this,arguments),setTimeout(_.bind(function(){this.scrollToTop()},this),10),this.settings=_.defaults({success:this.success},wp.media.mixin.mejsSettings),this.setMedia()},scrollToTop:function(){this.$(".embed-media-settings").scrollTop(0)}},{instances:0,prepareSrc:function(e){var t=a.instances++;return _.each(i(e).find("source"),function(e){e.src=[e.src,-1<e.src.indexOf("?")?"&":"?","_=",t].join("")}),e}});e.exports=a},5836(e){var t=wp.media.view.MediaDetails,i=t.extend({className:"video-details",template:wp.template("video-details"),setMedia:function(){var e=this.$(".wp-video-shortcode");return e.find("source").length?(e.is(":hidden")&&e.show(),e.hasClass("youtube-video")||e.hasClass("vimeo-video")?this.media=e.get(0):this.media=t.prepareSrc(e.get(0))):(e.hide(),this.media=!1),this}});e.exports=i}},a={};function s(e){var t=a[e];return void 0!==t||(t=a[e]={exports:{}},i[e](t,t.exports,s)),t.exports}var e=wp.media,t=window._wpmejsSettings||{},o=window._wpMediaViewsL10n||{};wp.media.mixin={mejsSettings:t,removeAllPlayers:function(){if(window.mejs&&window.mejs.players)for(var e in window.mejs.players)window.mejs.players[e].pause(),this.removePlayer(window.mejs.players[e])},removePlayer:function(e){var t,i;if(e.options){for(t in e.options.features)if(e["clean"+(i=e.options.features[t])])try{e["clean"+i](e)}catch(e){}e.isDynamic||e.node.remove(),"html5"!==e.media.rendererName&&e.media.remove(),delete window.mejs.players[e.id],e.container.remove(),e.globalUnbind("resize",e.globalResizeCallback),e.globalUnbind("keydown",e.globalKeydownCallback),e.globalUnbind("click",e.globalClickCallback),delete e.media.player}},unsetPlayers:function(){this.players&&this.players.length&&(_.each(this.players,function(e){e.pause(),wp.media.mixin.removePlayer(e)}),this.players=[])}},wp.media.playlist=new wp.media.collection({tag:"playlist",editTitle:o.editPlaylistTitle,defaults:{id:wp.media.view.settings.post.id,style:"light",tracklist:!0,tracknumbers:!0,images:!0,artists:!0,type:"audio"}}),wp.media.audio={coerce:wp.media.coerce,defaults:{id:wp.media.view.settings.post.id,src:"",loop:!1,autoplay:!1,preload:"none",width:400},edit:function(e){e=wp.shortcode.next("audio",e).shortcode;return wp.media({frame:"audio",state:"audio-details",metadata:_.defaults(e.attrs.named,this.defaults)})},shortcode:function(i){var e;return _.each(this.defaults,function(e,t){i[t]=this.coerce(i,t),e===i[t]&&delete i[t]},this),e=i.content,delete i.content,new wp.shortcode({tag:"audio",attrs:i,content:e})}},wp.media.video={coerce:wp.media.coerce,defaults:{id:wp.media.view.settings.post.id,src:"",poster:"",loop:!1,autoplay:!1,preload:"metadata",content:"",width:640,height:360},edit:function(e){var e=wp.shortcode.next("video",e).shortcode,t=e.attrs.named;return t.content=e.content,wp.media({frame:"video",state:"video-details",metadata:_.defaults(t,this.defaults)})},shortcode:function(i){var e;return _.each(this.defaults,function(e,t){i[t]=this.coerce(i,t),e===i[t]&&delete i[t]},this),e=i.content,delete i.content,new wp.shortcode({tag:"video",attrs:i,content:e})}},e.model.PostMedia=s(241),e.controller.AudioDetails=s(1206),e.controller.VideoDetails=s(5039),e.view.MediaFrame.MediaDetails=s(741),e.view.MediaFrame.AudioDetails=s(175),e.view.MediaFrame.VideoDetails=s(8646),e.view.MediaDetails=s(9467),e.view.AudioDetails=s(3713),e.view.VideoDetails=s(5836)})();
/**
* Title: jqPlot Charts
*
* Pure JavaScript plotting plugin for jQuery.
*
* About: Version
*
* version: 1.0.9 
* revision: d96a669
*
* About: Copyright & License
*
* Copyright (c) 2009-2016 Chris Leonello
* jqPlot is currently available for use in all personal or commercial projects
* under both the MIT and GPL version 2.0 licenses. This means that you can
* choose the license that best suits your project and use it accordingly.
*
* See <GPL Version 2> and <MIT License> contained within this distribution for further information.
*
* The author would appreciate an email letting him know of any substantial
* use of jqPlot.  You can reach the author at: chris at jqplot dot com
* or see http://www.jqplot.com/info.php.  This is, of course, not required.
*
* If you are feeling kind and generous, consider supporting the project by
* making a donation at: http://www.jqplot.com/donate.php.
*
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
*
*     version 2007.04.27
*     author Ash Searle
*     http://hexmen.com/blog/2007/03/printf-sprintf/
*     http://hexmen.com/js/sprintf.js
*     The author (Ash Searle) has placed this code in the public domain:
*     "This code is unrestricted: you are free to use it however you like."
*
*
* About: Introduction
*
* jqPlot requires jQuery (1.4+ required for certain features). jQuery 1.4.2 is included in the distribution.
* To use jqPlot include jQuery, the jqPlot jQuery plugin, the jqPlot css file and optionally
* the excanvas script for IE support in your web page:
*
* > <!--[if lt IE 9]><script language="javascript" type="text/javascript" src="excanvas.js"></script><![endif]-->
* > <script language="javascript" type="text/javascript" src="jquery-1.4.4.min.js"></script>
* > <script language="javascript" type="text/javascript" src="jquery.jqplot.min.js"></script>
* > <link rel="stylesheet" type="text/css" href="jquery.jqplot.css" />
*
* jqPlot can be customized by overriding the defaults of any of the objects which make
* up the plot. The general usage of jqplot is:
*
* > chart=$.jqplot('targetElemId', [dataArray,...], {optionsObject});
*
* The options available to jqplot are detailed in <jqPlot Options> in the jqPlotOptions.txt file.
*
* An actual call to $.jqplot() may look like the
* examples below:
*
* > chart=$.jqplot('chartdiv',  [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]]);
*
* or
*
* > dataArray=[34,12,43,55,77];
* > chart=$.jqplot('targetElemId', [dataArray, ...], {title:'My Plot', axes:{yaxis:{min:20, max:100}}});
*
* For more inforrmation, see <jqPlot Usage>.
*
* About: Usage
*
* See <jqPlot Usage>
*
* About: Available Options
*
* See <jqPlot Options> for a list of options available thorugh the options object (not complete yet!)
*
* About: Options Usage
*
* See <Options Tutorial>
*
* About: Changes
*
* See <Change Log>
*
*/
(function($){
var undefined;
$.fn.emptyForce=function(){
for(var i=0, elem; (elem=$(this)[i])!=null; i++){
if(elem.nodeType===1){
$.cleanData(elem.getElementsByTagName("*"));
}
if($.jqplot.use_excanvas){
elem.outerHTML="";
}else{
while(elem.firstChild){
elem.removeChild(elem.firstChild);
}}
elem=null;
}
return $(this);
};
$.fn.removeChildForce=function(parent){
while(parent.firstChild){
this.removeChildForce(parent.firstChild);
parent.removeChild(parent.firstChild);
}};
$.fn.jqplot=function(){
var datas=[];
var options=[];
for (var i=0, l=arguments.length; i<l; i++){
if($.isArray(arguments[i])){
datas.push(arguments[i]);
}
else if($.isPlainObject(arguments[i])){
options.push(arguments[i]);
}}
return this.each(function(index){
var tid,
plot,
$this=$(this),
dl=datas.length,
ol=options.length,
data,
opts;
if(index < dl){
data=datas[index];
}else{
data=dl ? datas[dl-1]:null;
}
if(index < ol){
opts=options[index];
}else{
opts=ol ? options[ol-1]:null;
}
tid=$this.attr('id');
if(tid===undefined){
tid='jqplot_target_' + $.jqplot.targetCounter++;
$this.attr('id', tid);
}
plot=$.jqplot(tid, data, opts);
$this.data('jqplot', plot);
});
};
$.jqplot=function(target, data, options){
var _data=null, _options=null;
if(arguments.length===3){
_data=data;
_options=options;
}
else if(arguments.length===2){
if($.isArray(data)){
_data=data;
}
else if($.isPlainObject(data)){
_options=data;
}}
if(_data===null&&_options!==null&&_options.data){
_data=_options.data;
}
var plot=new jqPlot();
$('#'+target).removeClass('jqplot-error');
if($.jqplot.config.catchErrors){
try {
plot.init(target, _data, _options);
plot.draw();
plot.themeEngine.init.call(plot);
return plot;
}
catch(e){
var msg=$.jqplot.config.errorMessage||e.message;
$('#'+target).append('<div class="jqplot-error-message">'+msg+'</div>');
$('#'+target).addClass('jqplot-error');
document.getElementById(target).style.background=$.jqplot.config.errorBackground;
document.getElementById(target).style.border=$.jqplot.config.errorBorder;
document.getElementById(target).style.fontFamily=$.jqplot.config.errorFontFamily;
document.getElementById(target).style.fontSize=$.jqplot.config.errorFontSize;
document.getElementById(target).style.fontStyle=$.jqplot.config.errorFontStyle;
document.getElementById(target).style.fontWeight=$.jqplot.config.errorFontWeight;
}}else{
plot.init(target, _data, _options);
plot.draw();
plot.themeEngine.init.call(plot);
return plot;
}};
$.jqplot.version="1.0.9";
$.jqplot.revision="d96a669";
$.jqplot.targetCounter=1;
$.jqplot.CanvasManager=function(){
if(typeof $.jqplot.CanvasManager.canvases=='undefined'){
$.jqplot.CanvasManager.canvases=[];
$.jqplot.CanvasManager.free=[];
}
var myCanvases=[];
this.getCanvas=function(){
var canvas;
var makeNew=true;
if(!$.jqplot.use_excanvas){
for (var i=0, l=$.jqplot.CanvasManager.canvases.length; i < l; i++){
if($.jqplot.CanvasManager.free[i]===true){
makeNew=false;
canvas=$.jqplot.CanvasManager.canvases[i];
$.jqplot.CanvasManager.free[i]=false;
myCanvases.push(i);
break;
}}
}
if(makeNew){
canvas=document.createElement('canvas');
myCanvases.push($.jqplot.CanvasManager.canvases.length);
$.jqplot.CanvasManager.canvases.push(canvas);
$.jqplot.CanvasManager.free.push(false);
}
return canvas;
};
this.initCanvas=function(canvas){
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;
};
this.freeAllCanvases=function(){
for (var i=0, l=myCanvases.length; i < l; i++){
this.freeCanvas(myCanvases[i]);
}
myCanvases=[];
};
this.freeCanvas=function(idx){
if($.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){
window.G_vmlCanvasManager.uninitElement($.jqplot.CanvasManager.canvases[idx]);
$.jqplot.CanvasManager.canvases[idx]=null;
}else{
var canvas=$.jqplot.CanvasManager.canvases[idx];
canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height);
$(canvas).unbind().removeAttr('class').removeAttr('style');
$(canvas).css({left: '', top: '', position: ''});
canvas.width=0;
canvas.height=0;
$.jqplot.CanvasManager.free[idx]=true;
}};};
$.jqplot.log=function(){
if(window.console){
window.console.log.apply(window.console, arguments);
}};
$.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/'
};
$.jqplot.arrayMax=function(array){
return Math.max.apply(Math, array);
};
$.jqplot.arrayMin=function(array){
return Math.min.apply(Math, array);
};
$.jqplot.enablePlugins=$.jqplot.config.enablePlugins;
$.jqplot.support_canvas=function(){
if(typeof $.jqplot.support_canvas.result=='undefined'){
$.jqplot.support_canvas.result = !!document.createElement('canvas').getContext;
}
return $.jqplot.support_canvas.result;
};
$.jqplot.support_canvas_text=function(){
if(typeof $.jqplot.support_canvas_text.result=='undefined'){
if(window.G_vmlCanvasManager!==undefined&&window.G_vmlCanvasManager._version > 887){
$.jqplot.support_canvas_text.result=true;
}else{
$.jqplot.support_canvas_text.result = !!(document.createElement('canvas').getContext&&typeof document.createElement('canvas').getContext('2d').fillText=='function');
}}
return $.jqplot.support_canvas_text.result;
};
$.jqplot.use_excanvas=((!$.support.boxModel||!$.support.objectAll||!$support.leadingWhitespace)&&!$.jqplot.support_canvas()) ? true:false;
$.jqplot.preInitHooks=[];
$.jqplot.postInitHooks=[];
$.jqplot.preParseOptionsHooks=[];
$.jqplot.postParseOptionsHooks=[];
$.jqplot.preDrawHooks=[];
$.jqplot.postDrawHooks=[];
$.jqplot.preDrawSeriesHooks=[];
$.jqplot.postDrawSeriesHooks=[];
$.jqplot.preDrawLegendHooks=[];
$.jqplot.addLegendRowHooks=[];
$.jqplot.preSeriesInitHooks=[];
$.jqplot.postSeriesInitHooks=[];
$.jqplot.preParseSeriesOptionsHooks=[];
$.jqplot.postParseSeriesOptionsHooks=[];
$.jqplot.eventListenerHooks=[];
$.jqplot.preDrawSeriesShadowHooks=[];
$.jqplot.postDrawSeriesShadowHooks=[];
$.jqplot.ElemContainer=function(){
this._elem;
this._plotWidth;
this._plotHeight;
this._plotDimensions={height:null, width:null};};
$.jqplot.ElemContainer.prototype.createElement=function(el, offsets, clss, cssopts, attrib){
this._offsets=offsets;
var klass=clss||'jqplot';
var elem=document.createElement(el);
this._elem=$(elem);
this._elem.addClass(klass);
this._elem.css(cssopts);
this._elem.attr(attrib);
elem=null;
return this._elem;
};
$.jqplot.ElemContainer.prototype.getWidth=function(){
if(this._elem){
return this._elem.outerWidth(true);
}else{
return null;
}};
$.jqplot.ElemContainer.prototype.getHeight=function(){
if(this._elem){
return this._elem.outerHeight(true);
}else{
return null;
}};
$.jqplot.ElemContainer.prototype.getPosition=function(){
if(this._elem){
return this._elem.position();
}else{
return {top:null, left:null, bottom:null, right:null};}};
$.jqplot.ElemContainer.prototype.getTop=function(){
return this.getPosition().top;
};
$.jqplot.ElemContainer.prototype.getLeft=function(){
return this.getPosition().left;
};
$.jqplot.ElemContainer.prototype.getBottom=function(){
return this._elem.css('bottom');
};
$.jqplot.ElemContainer.prototype.getRight=function(){
return this._elem.css('right');
};
function Axis(name){
$.jqplot.ElemContainer.call(this);
this.name=name;
this._series=[];
this.show=false;
this.tickRenderer=$.jqplot.AxisTickRenderer;
this.tickOptions={};
this.labelRenderer=$.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=$.jqplot.LinearAxisRenderer;
this.rendererOptions={};
this.showTicks=true;
this.showTickMarks=true;
this.showMinorTicks=true;
this.drawMajorGridlines=true;
this.drawMinorGridlines=false;
this.drawMajorTickMarks=true;
this.drawMinorTickMarks=true;
this.useSeriesColor=false;
this.borderWidth=null;
this.borderColor=null;
this.scaleToHiddenSeries=false;
this._dataBounds={min:null, max:null};
this._intervalStats=[];
this._offsets={min:null, max:null};
this._ticks=[];
this._label=null;
this.syncTicks=null;
this.tickSpacing=75;
this._min=null;
this._max=null;
this._tickInterval=null;
this._numberTicks=null;
this.__ticks=null;
this._options={};}
Axis.prototype=new $.jqplot.ElemContainer();
Axis.prototype.constructor=Axis;
Axis.prototype.init=function(){
if($.isFunction(this.renderer)){
this.renderer=new this.renderer();
}
this.tickOptions.axis=this.name;
if(this.tickOptions.showMark==null){
this.tickOptions.showMark=this.showTicks;
}
if(this.tickOptions.showMark==null){
this.tickOptions.showMark=this.showTickMarks;
}
if(this.tickOptions.showLabel==null){
this.tickOptions.showLabel=this.showTicks;
}
if(this.label==null||this.label==''){
this.showLabel=false;
}else{
this.labelOptions.label=this.label;
}
if(this.showLabel==false){
this.labelOptions.show=false;
}
if(this.pad==0){
this.pad=1.0;
}
if(this.padMax==0){
this.padMax=1.0;
}
if(this.padMin==0){
this.padMin=1.0;
}
if(this.padMax==null){
this.padMax=(this.pad-1)/2 + 1;
}
if(this.padMin==null){
this.padMin=(this.pad-1)/2 + 1;
}
this.pad=this.padMax + this.padMin - 1;
if(this.min!=null||this.max!=null){
this.autoscale=false;
}
if(this.syncTicks==null&&this.name.indexOf('y') > -1){
this.syncTicks=true;
}
else if(this.syncTicks==null){
this.syncTicks=false;
}
this.renderer.init.call(this, this.rendererOptions);
};
Axis.prototype.draw=function(ctx, plot){
if(this.__ticks){
this.__ticks=null;
}
return this.renderer.draw.call(this, ctx, plot);
};
Axis.prototype.set=function(){
this.renderer.set.call(this);
};
Axis.prototype.pack=function(pos, offsets){
if(this.show){
this.renderer.pack.call(this, pos, offsets);
}
if(this._min==null){
this._min=this.min;
this._max=this.max;
this._tickInterval=this.tickInterval;
this._numberTicks=this.numberTicks;
this.__ticks=this._ticks;
}};
Axis.prototype.reset=function(){
this.renderer.reset.call(this);
};
Axis.prototype.resetScale=function(opts){
$.extend(true, this, {min: null, max: null, numberTicks: null, tickInterval: null, _ticks: [], ticks: []}, opts);
this.resetDataBounds();
};
Axis.prototype.resetDataBounds=function(){
var db=this._dataBounds;
db.min=null;
db.max=null;
var l, s, d;
var doforce=(this.show) ? true:false;
for (var i=0; i<this._series.length; i++){
s=this._series[i];
if(s.show||this.scaleToHiddenSeries){
d=s._plotData;
if(s._type==='line'&&s.renderer.bands.show&&this.name.charAt(0)!=='x'){
d=[[0, s.renderer.bands._min], [1, s.renderer.bands._max]];
}
var minyidx=1, maxyidx=1;
if(s._type!=null&&s._type=='ohlc'){
minyidx=3;
maxyidx=2;
}
for (var j=0, l=d.length; j<l; j++){
if(this.name=='xaxis'||this.name=='x2axis'){
if((d[j][0]!=null&&d[j][0] < db.min)||db.min==null){
db.min=d[j][0];
}
if((d[j][0]!=null&&d[j][0] > db.max)||db.max==null){
db.max=d[j][0];
}}else{
if((d[j][minyidx]!=null&&d[j][minyidx] < db.min)||db.min==null){
db.min=d[j][minyidx];
}
if((d[j][maxyidx]!=null&&d[j][maxyidx] > db.max)||db.max==null){
db.max=d[j][maxyidx];
}}
}
if(doforce&&s.renderer.constructor!==$.jqplot.BarRenderer){
doforce=false;
}
else if(doforce&&this._options.hasOwnProperty('forceTickAt0')&&this._options.forceTickAt0==false){
doforce=false;
}
else if(doforce&&s.renderer.constructor===$.jqplot.BarRenderer){
if(s.barDirection=='vertical'&&this.name!='xaxis'&&this.name!='x2axis'){
if(this._options.pad!=null||this._options.padMin!=null){
doforce=false;
}}
else if(s.barDirection=='horizontal'&&(this.name=='xaxis'||this.name=='x2axis')){
if(this._options.pad!=null||this._options.padMin!=null){
doforce=false;
}}
}}
}
if(doforce&&this.renderer.constructor===$.jqplot.LinearAxisRenderer&&db.min >=0){
this.padMin=1.0;
this.forceTickAt0=true;
}};
function Legend(options){
$.jqplot.ElemContainer.call(this);
this.show=false;
this.location='ne';
this.labels=[];
this.showLabels=true;
this.showSwatches=true;
this.placement="insideGrid";
this.xoffset=0;
this.yoffset=0;
this.border;
this.background;
this.textColor;
this.fontFamily;
this.fontSize ;
this.rowSpacing='0.5em';
this.renderer=$.jqplot.TableLegendRenderer;
this.rendererOptions={};
this.preDraw=false;
this.marginTop=null;
this.marginRight=null;
this.marginBottom=null;
this.marginLeft=null;
this.escapeHtml=false;
this._series=[];
$.extend(true, this, options);
}
Legend.prototype=new $.jqplot.ElemContainer();
Legend.prototype.constructor=Legend;
Legend.prototype.setOptions=function(options){
$.extend(true, this, options);
if(this.placement=='inside'){
this.placement='insideGrid';
}
if(this.xoffset >0){
if(this.placement=='insideGrid'){
switch (this.location){
case 'nw':
case 'w':
case 'sw':
if(this.marginLeft==null){
this.marginLeft=this.xoffset + 'px';
}
this.marginRight='0px';
break;
case 'ne':
case 'e':
case 'se':
default:
if(this.marginRight==null){
this.marginRight=this.xoffset + 'px';
}
this.marginLeft='0px';
break;
}}
else if(this.placement=='outside'){
switch (this.location){
case 'nw':
case 'w':
case 'sw':
if(this.marginRight==null){
this.marginRight=this.xoffset + 'px';
}
this.marginLeft='0px';
break;
case 'ne':
case 'e':
case 'se':
default:
if(this.marginLeft==null){
this.marginLeft=this.xoffset + 'px';
}
this.marginRight='0px';
break;
}}
this.xoffset=0;
}
if(this.yoffset >0){
if(this.placement=='outside'){
switch (this.location){
case 'sw':
case 's':
case 'se':
if(this.marginTop==null){
this.marginTop=this.yoffset + 'px';
}
this.marginBottom='0px';
break;
case 'ne':
case 'n':
case 'nw':
default:
if(this.marginBottom==null){
this.marginBottom=this.yoffset + 'px';
}
this.marginTop='0px';
break;
}}
else if(this.placement=='insideGrid'){
switch (this.location){
case 'sw':
case 's':
case 'se':
if(this.marginBottom==null){
this.marginBottom=this.yoffset + 'px';
}
this.marginTop='0px';
break;
case 'ne':
case 'n':
case 'nw':
default:
if(this.marginTop==null){
this.marginTop=this.yoffset + 'px';
}
this.marginBottom='0px';
break;
}}
this.yoffset=0;
}};
Legend.prototype.init=function(){
if($.isFunction(this.renderer)){
this.renderer=new this.renderer();
}
this.renderer.init.call(this, this.rendererOptions);
};
Legend.prototype.draw=function(offsets, plot){
for (var i=0; i<$.jqplot.preDrawLegendHooks.length; i++){
$.jqplot.preDrawLegendHooks[i].call(this, offsets);
}
return this.renderer.draw.call(this, offsets, plot);
};
Legend.prototype.pack=function(offsets){
this.renderer.pack.call(this, offsets);
};
function Title(text){
$.jqplot.ElemContainer.call(this);
this.text=text;
this.show=true;
this.fontFamily;
this.fontSize ;
this.textAlign;
this.textColor;
this.renderer=$.jqplot.DivTitleRenderer;
this.rendererOptions={};
this.escapeHtml=false;
}
Title.prototype=new $.jqplot.ElemContainer();
Title.prototype.constructor=Title;
Title.prototype.init=function(){
if($.isFunction(this.renderer)){
this.renderer=new this.renderer();
}
this.renderer.init.call(this, this.rendererOptions);
};
Title.prototype.draw=function(width){
return this.renderer.draw.call(this, width);
};
Title.prototype.pack=function(){
this.renderer.pack.call(this);
};
function Series(options){
options=options||{};
$.jqplot.ElemContainer.call(this);
this.show=true;
this.xaxis='xaxis';
this._xaxis;
this.yaxis='yaxis';
this._yaxis;
this.gridBorderWidth=2.0;
this.renderer=$.jqplot.LineRenderer;
this.rendererOptions={};
this.data=[];
this.gridData=[];
this.label='';
this.showLabel=true;
this.color;
this.negativeColor;
this.lineWidth=2.5;
this.lineJoin='round';
this.lineCap='round';
this.linePattern='solid';
this.shadow=true;
this.shadowAngle=45;
this.shadowOffset=1.25;
this.shadowDepth=3;
this.shadowAlpha='0.1';
this.breakOnNull=false;
this.markerRenderer=$.jqplot.MarkerRenderer;
this.markerOptions={};
this.showLine=true;
this.showMarker=true;
this.index;
this.fill=false;
this.fillColor;
this.fillAlpha;
this.fillAndStroke=false;
this.disableStack=false;
this._stack=false;
this.neighborThreshold=4;
this.fillToZero=false;
this.fillToValue=0;
this.fillAxis='y';
this.useNegativeColors=true;
this._stackData=[];
this._plotData=[];
this._plotValues={x:[], y:[]};
this._intervals={x:{}, y:{}};
this._prevPlotData=[];
this._prevGridData=[];
this._stackAxis='y';
this._primaryAxis='_xaxis';
this.canvas=new $.jqplot.GenericCanvas();
this.shadowCanvas=new $.jqplot.GenericCanvas();
this.plugins={};
this._sumy=0;
this._sumx=0;
this._type='';
this.step=false;
}
Series.prototype=new $.jqplot.ElemContainer();
Series.prototype.constructor=Series;
Series.prototype.init=function(index, gridbw, plot){
this.index=index;
this.gridBorderWidth=gridbw;
var d=this.data;
var temp=[], i, l;
for (i=0, l=d.length; i<l; i++){
if(! this.breakOnNull){
if(d[i]==null||d[i][0]==null||d[i][1]==null){
continue;
}else{
temp.push(d[i]);
}}else{
temp.push(d[i]);
}}
this.data=temp;
if(!this.color){
this.color=plot.colorGenerator.get(this.index);
}
if(!this.negativeColor){
this.negativeColor=plot.negativeColorGenerator.get(this.index);
}
if(!this.fillColor){
this.fillColor=this.color;
}
if(this.fillAlpha){
var comp=$.jqplot.normalize2rgb(this.fillColor);
var comp=$.jqplot.getColorComponents(comp);
this.fillColor='rgba('+comp[0]+','+comp[1]+','+comp[2]+','+this.fillAlpha+')';
}
if($.isFunction(this.renderer)){
this.renderer=new this.renderer();
}
this.renderer.init.call(this, this.rendererOptions, plot);
this.markerRenderer=new this.markerRenderer();
if(!this.markerOptions.color){
this.markerOptions.color=this.color;
}
if(this.markerOptions.show==null){
this.markerOptions.show=this.showMarker;
}
this.showMarker=this.markerOptions.show;
this.markerRenderer.init(this.markerOptions);
};
Series.prototype.draw=function(sctx, opts, plot){
var options=(opts==undefined) ? {}:opts;
sctx=(sctx==undefined) ? this.canvas._ctx:sctx;
var j, data, gridData;
for (j=0; j<$.jqplot.preDrawSeriesHooks.length; j++){
$.jqplot.preDrawSeriesHooks[j].call(this, sctx, options);
}
if(this.show){
this.renderer.setGridData.call(this, plot);
if(!options.preventJqPlotSeriesDrawTrigger){
$(sctx.canvas).trigger('jqplotSeriesDraw', [this.data, this.gridData]);
}
data=[];
if(options.data){
data=options.data;
}
else if(!this._stack){
data=this.data;
}else{
data=this._plotData;
}
gridData=options.gridData||this.renderer.makeGridData.call(this, data, plot);
if(this._type==='line'&&this.renderer.smooth&&this.renderer._smoothedData.length){
gridData=this.renderer._smoothedData;
}
this.renderer.draw.call(this, sctx, gridData, options, plot);
}
for (j=0; j<$.jqplot.postDrawSeriesHooks.length; j++){
$.jqplot.postDrawSeriesHooks[j].call(this, sctx, options, plot);
}
sctx=opts=plot=j = data=gridData=null;
};
Series.prototype.drawShadow=function(sctx, opts, plot){
var options=(opts==undefined) ? {}:opts;
sctx=(sctx==undefined) ? this.shadowCanvas._ctx:sctx;
var j, data, gridData;
for (j=0; j<$.jqplot.preDrawSeriesShadowHooks.length; j++){
$.jqplot.preDrawSeriesShadowHooks[j].call(this, sctx, options);
}
if(this.shadow){
this.renderer.setGridData.call(this, plot);
data=[];
if(options.data){
data=options.data;
}
else if(!this._stack){
data=this.data;
}else{
data=this._plotData;
}
gridData=options.gridData||this.renderer.makeGridData.call(this, data, plot);
this.renderer.drawShadow.call(this, sctx, gridData, options, plot);
}
for (j=0; j<$.jqplot.postDrawSeriesShadowHooks.length; j++){
$.jqplot.postDrawSeriesShadowHooks[j].call(this, sctx, options);
}
sctx=opts=plot=j = data=gridData=null;
};
Series.prototype.toggleDisplay=function(ev, callback){
var s, speed;
if(ev.data.series){
s=ev.data.series;
}else{
s=this;
}
if(ev.data.speed){
speed=ev.data.speed;
}
if(speed){
if(s.canvas._elem.is(':hidden')||!s.show){
s.show=true;
s.canvas._elem.removeClass('jqplot-series-hidden');
if(s.shadowCanvas._elem){
s.shadowCanvas._elem.fadeIn(speed);
}
s.canvas._elem.fadeIn(speed, callback);
s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).fadeIn(speed);
}else{
s.show=false;
s.canvas._elem.addClass('jqplot-series-hidden');
if(s.shadowCanvas._elem){
s.shadowCanvas._elem.fadeOut(speed);
}
s.canvas._elem.fadeOut(speed, callback);
s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).fadeOut(speed);
}}else{
if(s.canvas._elem.is(':hidden')||!s.show){
s.show=true;
s.canvas._elem.removeClass('jqplot-series-hidden');
if(s.shadowCanvas._elem){
s.shadowCanvas._elem.show();
}
s.canvas._elem.show(0, callback);
s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).show();
}else{
s.show=false;
s.canvas._elem.addClass('jqplot-series-hidden');
if(s.shadowCanvas._elem){
s.shadowCanvas._elem.hide();
}
s.canvas._elem.hide(0, callback);
s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).hide();
}}
};
function Grid(){
$.jqplot.ElemContainer.call(this);
this.drawGridlines=true;
this.gridLineColor='#cccccc';
this.gridLineWidth=1.0;
this.background='#fffdf6';
this.borderColor='#999999';
this.borderWidth=2.0;
this.drawBorder=true;
this.shadow=true;
this.shadowAngle=45;
this.shadowOffset=1.5;
this.shadowWidth=3;
this.shadowDepth=3;
this.shadowColor=null;
this.shadowAlpha='0.07';
this._left;
this._top;
this._right;
this._bottom;
this._width;
this._height;
this._axes=[];
this.renderer=$.jqplot.CanvasGridRenderer;
this.rendererOptions={};
this._offsets={top:null, bottom:null, left:null, right:null};}
Grid.prototype=new $.jqplot.ElemContainer();
Grid.prototype.constructor=Grid;
Grid.prototype.init=function(){
if($.isFunction(this.renderer)){
this.renderer=new this.renderer();
}
this.renderer.init.call(this, this.rendererOptions);
};
Grid.prototype.createElement=function(offsets,plot){
this._offsets=offsets;
return this.renderer.createElement.call(this, plot);
};
Grid.prototype.draw=function(){
this.renderer.draw.call(this);
};
$.jqplot.GenericCanvas=function(){
$.jqplot.ElemContainer.call(this);
this._ctx;
};
$.jqplot.GenericCanvas.prototype=new $.jqplot.ElemContainer();
$.jqplot.GenericCanvas.prototype.constructor=$.jqplot.GenericCanvas;
$.jqplot.GenericCanvas.prototype.createElement=function(offsets, clss, plotDimensions, plot){
this._offsets=offsets;
var klass='jqplot';
if(clss!=undefined){
klass=clss;
}
var elem;
elem=plot.canvasManager.getCanvas();
if(plotDimensions!=null){
this._plotDimensions=plotDimensions;
}
elem.width=this._plotDimensions.width - this._offsets.left - this._offsets.right;
elem.height=this._plotDimensions.height - this._offsets.top - this._offsets.bottom;
this._elem=$(elem);
this._elem.css({ position: 'absolute', left: this._offsets.left, top: this._offsets.top });
this._elem.addClass(klass);
elem=plot.canvasManager.initCanvas(elem);
elem=null;
return this._elem;
};
$.jqplot.GenericCanvas.prototype.setContext=function(){
this._ctx=this._elem.get(0).getContext("2d");
return this._ctx;
};
$.jqplot.GenericCanvas.prototype.resetCanvas=function(){
if(this._elem){
if($.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){
window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
}
this._elem.emptyForce();
}
this._ctx=null;
};
$.jqplot.HooksManager=function (){
this.hooks=[];
this.args=[];
};
$.jqplot.HooksManager.prototype.addOnce=function(fn, args){
args=args||[];
var havehook=false;
for (var i=0, l=this.hooks.length; i<l; i++){
if(this.hooks[i]==fn){
havehook=true;
}}
if(!havehook){
this.hooks.push(fn);
this.args.push(args);
}};
$.jqplot.HooksManager.prototype.add=function(fn, args){
args=args||[];
this.hooks.push(fn);
this.args.push(args);
};
$.jqplot.EventListenerManager=function (){
this.hooks=[];
};
$.jqplot.EventListenerManager.prototype.addOnce=function(ev, fn){
var havehook=false, h, i;
for (var i=0, l=this.hooks.length; i<l; i++){
h=this.hooks[i];
if(h[0]==ev&&h[1]==fn){
havehook=true;
}}
if(!havehook){
this.hooks.push([ev, fn]);
}};
$.jqplot.EventListenerManager.prototype.add=function(ev, fn){
this.hooks.push([ev, fn]);
};
var _axisNames=['yMidAxis', 'xaxis', 'yaxis', 'x2axis', 'y2axis', 'y3axis', 'y4axis', 'y5axis', 'y6axis', 'y7axis', 'y8axis', 'y9axis'];
function jqPlot(){
this.animate=false;
this.animateReplot=false;
this.axes={xaxis: new Axis('xaxis'), yaxis: new Axis('yaxis'), x2axis: new Axis('x2axis'), y2axis: new Axis('y2axis'), y3axis: new Axis('y3axis'), y4axis: new Axis('y4axis'), y5axis: new Axis('y5axis'), y6axis: new Axis('y6axis'), y7axis: new Axis('y7axis'), y8axis: new Axis('y8axis'), y9axis: new Axis('y9axis'), yMidAxis: new Axis('yMidAxis')};
this.baseCanvas=new $.jqplot.GenericCanvas();
this.captureRightClick=false;
this.data=[];
this.dataRenderer;
this.dataRendererOptions;
this.defaults={
axesDefaults: {},
axes: {xaxis:{}, yaxis:{}, x2axis:{}, y2axis:{}, y3axis:{}, y4axis:{}, y5axis:{}, y6axis:{}, y7axis:{}, y8axis:{}, y9axis:{}, yMidAxis:{}},
seriesDefaults: {},
series:[]
};
this.defaultAxisStart=1;
this.drawIfHidden=false;
this.eventCanvas=new $.jqplot.GenericCanvas();
this.fillBetween={
series1: null,
series2: null,
color: null,
baseSeries: 0,
fill: true
};
this.fontFamily;
this.fontSize;
this.grid=new Grid();
this.legend=new Legend();
this.noDataIndicator={
show: false,
indicator: 'Loading Data...',
axes: {
xaxis: {
min: 0,
max: 10,
tickInterval: 2,
show: true
},
yaxis: {
min: 0,
max: 12,
tickInterval: 3,
show: true
}}
};
this.negativeSeriesColors=$.jqplot.config.defaultNegativeColors;
this.options={};
this.previousSeriesStack=[];
this.plugins={};
this.series=[];
this.seriesStack=[];
this.seriesColors=$.jqplot.config.defaultColors;
this.sortData=true;
this.stackSeries=false;
this.syncXTicks=true;
this.syncYTicks=true;
this.target=null;
this.targetId=null;
this.textColor;
this.title=new Title();
this._drawCount=0;
this._sumy=0;
this._sumx=0;
this._stackData=[];
this._plotData=[];
this._width=null;
this._height=null;
this._plotDimensions={height:null, width:null};
this._gridPadding={top:null, right:null, bottom:null, left:null};
this._defaultGridPadding={top:10, right:10, bottom:23, left:10};
this._addDomReference=$.jqplot.config.addDomReference;
this.preInitHooks=new $.jqplot.HooksManager();
this.postInitHooks=new $.jqplot.HooksManager();
this.preParseOptionsHooks=new $.jqplot.HooksManager();
this.postParseOptionsHooks=new $.jqplot.HooksManager();
this.preDrawHooks=new $.jqplot.HooksManager();
this.postDrawHooks=new $.jqplot.HooksManager();
this.preDrawSeriesHooks=new $.jqplot.HooksManager();
this.postDrawSeriesHooks=new $.jqplot.HooksManager();
this.preDrawLegendHooks=new $.jqplot.HooksManager();
this.addLegendRowHooks=new $.jqplot.HooksManager();
this.preSeriesInitHooks=new $.jqplot.HooksManager();
this.postSeriesInitHooks=new $.jqplot.HooksManager();
this.preParseSeriesOptionsHooks=new $.jqplot.HooksManager();
this.postParseSeriesOptionsHooks=new $.jqplot.HooksManager();
this.eventListenerHooks=new $.jqplot.EventListenerManager();
this.preDrawSeriesShadowHooks=new $.jqplot.HooksManager();
this.postDrawSeriesShadowHooks=new $.jqplot.HooksManager();
this.colorGenerator=new $.jqplot.ColorGenerator();
this.negativeColorGenerator=new $.jqplot.ColorGenerator();
this.canvasManager=new $.jqplot.CanvasManager();
this.themeEngine=new $.jqplot.ThemeEngine();
var seriesColorsIndex=0;
this.init=function(target, data, options){
options=options||{};
for (var i=0; i<$.jqplot.preInitHooks.length; i++){
$.jqplot.preInitHooks[i].call(this, target, data, options);
}
for (var i=0; i<this.preInitHooks.hooks.length; i++){
this.preInitHooks.hooks[i].call(this, target, data, options);
}
this.targetId='#'+target;
this.target=$('#'+target);
if(this._addDomReference){
this.target.data('jqplot', this);
}
this.target.removeClass('jqplot-error');
if(!this.target.get(0)){
throw new Error("No plot target specified");
}
if(this.target.css('position')=='static'){
this.target.css('position', 'relative');
}
if(!this.target.hasClass('jqplot-target')){
this.target.addClass('jqplot-target');
}
if(!this.target.height()){
var h;
if(options&&options.height){
h=parseInt(options.height, 10);
}
else if(this.target.attr('data-height')){
h=parseInt(this.target.attr('data-height'), 10);
}else{
h=parseInt($.jqplot.config.defaultHeight, 10);
}
this._height=h;
this.target.css('height', h+'px');
}else{
this._height=h = this.target.height();
}
if(!this.target.width()){
var w;
if(options&&options.width){
w=parseInt(options.width, 10);
}
else if(this.target.attr('data-width')){
w=parseInt(this.target.attr('data-width'), 10);
}else{
w=parseInt($.jqplot.config.defaultWidth, 10);
}
this._width=w;
this.target.css('width', w+'px');
}else{
this._width=w = this.target.width();
}
for (var i=0, l=_axisNames.length; i<l; i++){
this.axes[_axisNames[i]]=new Axis(_axisNames[i]);
}
this._plotDimensions.height=this._height;
this._plotDimensions.width=this._width;
this.grid._plotDimensions=this._plotDimensions;
this.title._plotDimensions=this._plotDimensions;
this.baseCanvas._plotDimensions=this._plotDimensions;
this.eventCanvas._plotDimensions=this._plotDimensions;
this.legend._plotDimensions=this._plotDimensions;
if(this._height <=0||this._width <=0||!this._height||!this._width){
throw new Error("Canvas dimension not set");
}
if(options.dataRenderer&&$.isFunction(options.dataRenderer)){
if(options.dataRendererOptions){
this.dataRendererOptions=options.dataRendererOptions;
}
this.dataRenderer=options.dataRenderer;
data=this.dataRenderer(data, this, this.dataRendererOptions);
}
if(options.noDataIndicator&&$.isPlainObject(options.noDataIndicator)){
$.extend(true, this.noDataIndicator, options.noDataIndicator);
}
if(data==null||$.isArray(data)==false||data.length==0||$.isArray(data[0])==false||data[0].length==0){
if(this.noDataIndicator.show==false){
throw new Error("No data specified");
}else{
for (var ax in this.noDataIndicator.axes){
for (var prop in this.noDataIndicator.axes[ax]){
this.axes[ax][prop]=this.noDataIndicator.axes[ax][prop];
}}
this.postDrawHooks.add(function(){
var eh=this.eventCanvas.getHeight();
var ew=this.eventCanvas.getWidth();
var temp=$('<div class="jqplot-noData-container" style="position:absolute;"></div>');
this.target.append(temp);
temp.height(eh);
temp.width(ew);
temp.css('top', this.eventCanvas._offsets.top);
temp.css('left', this.eventCanvas._offsets.left);
var temp2=$('<div class="jqplot-noData-contents" style="text-align:center; position:relative; margin-left:auto; margin-right:auto;"></div>');
temp.append(temp2);
temp2.html(this.noDataIndicator.indicator);
var th=temp2.height();
var tw=temp2.width();
temp2.height(th);
temp2.width(tw);
temp2.css('top', (eh - th)/2 + 'px');
});
}}
this.data=$.extend(true, [], data);
this.parseOptions(options);
if(this.textColor){
this.target.css('color', this.textColor);
}
if(this.fontFamily){
this.target.css('font-family', this.fontFamily);
}
if(this.fontSize){
this.target.css('font-size', this.fontSize);
}
this.title.init();
this.legend.init();
this._sumy=0;
this._sumx=0;
this.computePlotData();
for (var i=0; i<this.series.length; i++){
this.seriesStack.push(i);
this.previousSeriesStack.push(i);
this.series[i].shadowCanvas._plotDimensions=this._plotDimensions;
this.series[i].canvas._plotDimensions=this._plotDimensions;
for (var j=0; j<$.jqplot.preSeriesInitHooks.length; j++){
$.jqplot.preSeriesInitHooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this);
}
for (var j=0; j<this.preSeriesInitHooks.hooks.length; j++){
this.preSeriesInitHooks.hooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this);
}
this.series[i]._plotDimensions=this._plotDimensions;
this.series[i].init(i, this.grid.borderWidth, this);
for (var j=0; j<$.jqplot.postSeriesInitHooks.length; j++){
$.jqplot.postSeriesInitHooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this);
}
for (var j=0; j<this.postSeriesInitHooks.hooks.length; j++){
this.postSeriesInitHooks.hooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this);
}
this._sumy +=this.series[i]._sumy;
this._sumx +=this.series[i]._sumx;
}
var name,
axis;
for (var i=0, l=_axisNames.length; i<l; i++){
name=_axisNames[i];
axis=this.axes[name];
axis._plotDimensions=this._plotDimensions;
axis.init();
if(this.axes[name].borderColor==null){
if(name.charAt(0)!=='x'&&axis.useSeriesColor===true&&axis.show){
axis.borderColor=axis._series[0].color;
}else{
axis.borderColor=this.grid.borderColor;
}}
}
if(this.sortData){
sortData(this.series);
}
this.grid.init();
this.grid._axes=this.axes;
this.legend._series=this.series;
for (var i=0; i<$.jqplot.postInitHooks.length; i++){
$.jqplot.postInitHooks[i].call(this, target, this.data, options);
}
for (var i=0; i<this.postInitHooks.hooks.length; i++){
this.postInitHooks.hooks[i].call(this, target, this.data, options);
}};
this.resetAxesScale=function(axes, options){
var opts=options||{};
var ax=axes||this.axes;
if(ax===true){
ax=this.axes;
}
if($.isArray(ax)){
for (var i=0; i < ax.length; i++){
this.axes[ax[i]].resetScale(opts[ax[i]]);
}}
else if(typeof(ax)==='object'){
for (var name in ax){
this.axes[name].resetScale(opts[name]);
}}
};
this.reInitialize=function (data, opts){
var options=$.extend(true, {}, this.options, opts);
var target=this.targetId.substr(1);
var tdata=(data==null) ? this.data:data;
for (var i=0; i<$.jqplot.preInitHooks.length; i++){
$.jqplot.preInitHooks[i].call(this, target, tdata, options);
}
for (var i=0; i<this.preInitHooks.hooks.length; i++){
this.preInitHooks.hooks[i].call(this, target, tdata, options);
}
this._height=this.target.height();
this._width=this.target.width();
if(this._height <=0||this._width <=0||!this._height||!this._width){
throw new Error("Target dimension not set");
}
this._plotDimensions.height=this._height;
this._plotDimensions.width=this._width;
this.grid._plotDimensions=this._plotDimensions;
this.title._plotDimensions=this._plotDimensions;
this.baseCanvas._plotDimensions=this._plotDimensions;
this.eventCanvas._plotDimensions=this._plotDimensions;
this.legend._plotDimensions=this._plotDimensions;
var name,
t,
j,
axis;
for (var i=0, l=_axisNames.length; i<l; i++){
name=_axisNames[i];
axis=this.axes[name];
t=axis._ticks;
for (var j=0, tlen=t.length; j < tlen; j++){
var el=t[j]._elem;
if(el){
if($.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){
window.G_vmlCanvasManager.uninitElement(el.get(0));
}
el.emptyForce();
el=null;
t._elem=null;
}}
t=null;
delete axis.ticks;
delete axis._ticks;
this.axes[name]=new Axis(name);
this.axes[name]._plotWidth=this._width;
this.axes[name]._plotHeight=this._height;
}
if(data){
if(options.dataRenderer&&$.isFunction(options.dataRenderer)){
if(options.dataRendererOptions){
this.dataRendererOptions=options.dataRendererOptions;
}
this.dataRenderer=options.dataRenderer;
data=this.dataRenderer(data, this, this.dataRendererOptions);
}
this.data=$.extend(true, [], data);
}
if(opts){
this.parseOptions(options);
}
this.title._plotWidth=this._width;
if(this.textColor){
this.target.css('color', this.textColor);
}
if(this.fontFamily){
this.target.css('font-family', this.fontFamily);
}
if(this.fontSize){
this.target.css('font-size', this.fontSize);
}
this.title.init();
this.legend.init();
this._sumy=0;
this._sumx=0;
this.seriesStack=[];
this.previousSeriesStack=[];
this.computePlotData();
for (var i=0, l=this.series.length; i<l; i++){
this.seriesStack.push(i);
this.previousSeriesStack.push(i);
this.series[i].shadowCanvas._plotDimensions=this._plotDimensions;
this.series[i].canvas._plotDimensions=this._plotDimensions;
for (var j=0; j<$.jqplot.preSeriesInitHooks.length; j++){
$.jqplot.preSeriesInitHooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this);
}
for (var j=0; j<this.preSeriesInitHooks.hooks.length; j++){
this.preSeriesInitHooks.hooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this);
}
this.series[i]._plotDimensions=this._plotDimensions;
this.series[i].init(i, this.grid.borderWidth, this);
for (var j=0; j<$.jqplot.postSeriesInitHooks.length; j++){
$.jqplot.postSeriesInitHooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this);
}
for (var j=0; j<this.postSeriesInitHooks.hooks.length; j++){
this.postSeriesInitHooks.hooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this);
}
this._sumy +=this.series[i]._sumy;
this._sumx +=this.series[i]._sumx;
}
for (var i=0, l=_axisNames.length; i<l; i++){
name=_axisNames[i];
axis=this.axes[name];
axis._plotDimensions=this._plotDimensions;
axis.init();
if(axis.borderColor==null){
if(name.charAt(0)!=='x'&&axis.useSeriesColor===true&&axis.show){
axis.borderColor=axis._series[0].color;
}else{
axis.borderColor=this.grid.borderColor;
}}
}
if(this.sortData){
sortData(this.series);
}
this.grid.init();
this.grid._axes=this.axes;
this.legend._series=this.series;
for (var i=0, l=$.jqplot.postInitHooks.length; i<l; i++){
$.jqplot.postInitHooks[i].call(this, target, this.data, options);
}
for (var i=0, l=this.postInitHooks.hooks.length; i<l; i++){
this.postInitHooks.hooks[i].call(this, target, this.data, options);
}};
this.quickInit=function (){
this._height=this.target.height();
this._width=this.target.width();
if(this._height <=0||this._width <=0||!this._height||!this._width){
throw new Error("Target dimension not set");
}
this._plotDimensions.height=this._height;
this._plotDimensions.width=this._width;
this.grid._plotDimensions=this._plotDimensions;
this.title._plotDimensions=this._plotDimensions;
this.baseCanvas._plotDimensions=this._plotDimensions;
this.eventCanvas._plotDimensions=this._plotDimensions;
this.legend._plotDimensions=this._plotDimensions;
for (var n in this.axes){
this.axes[n]._plotWidth=this._width;
this.axes[n]._plotHeight=this._height;
}
this.title._plotWidth=this._width;
if(this.textColor){
this.target.css('color', this.textColor);
}
if(this.fontFamily){
this.target.css('font-family', this.fontFamily);
}
if(this.fontSize){
this.target.css('font-size', this.fontSize);
}
this._sumy=0;
this._sumx=0;
this.computePlotData();
for (var i=0; i<this.series.length; i++){
if(this.series[i]._type==='line'&&this.series[i].renderer.bands.show){
this.series[i].renderer.initBands.call(this.series[i], this.series[i].renderer.options, this);
}
this.series[i]._plotDimensions=this._plotDimensions;
this.series[i].canvas._plotDimensions=this._plotDimensions;
this._sumy +=this.series[i]._sumy;
this._sumx +=this.series[i]._sumx;
}
var name;
for (var j=0; j<12; j++){
name=_axisNames[j];
var t=this.axes[name]._ticks;
for (var i=0; i < t.length; i++){
var el=t[i]._elem;
if(el){
if($.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){
window.G_vmlCanvasManager.uninitElement(el.get(0));
}
el.emptyForce();
el=null;
t._elem=null;
}}
t=null;
this.axes[name]._plotDimensions=this._plotDimensions;
this.axes[name]._ticks=[];
}
if(this.sortData){
sortData(this.series);
}
this.grid._axes=this.axes;
this.legend._series=this.series;
};
function sortData(series){
var d, sd, pd, ppd, ret;
for (var i=0; i<series.length; i++){
var check;
var bat=[series[i].data, series[i]._stackData, series[i]._plotData, series[i]._prevPlotData];
for (var n=0; n<4; n++){
check=true;
d=bat[n];
if(series[i]._stackAxis=='x'){
for (var j=0; j < d.length; j++){
if(typeof(d[j][1])!="number"){
check=false;
break;
}}
if(check){
d.sort(function(a,b){ return a[1] - b[1]; });
}}else{
for (var j=0; j < d.length; j++){
if(typeof(d[j][0])!="number"){
check=false;
break;
}}
if(check){
d.sort(function(a,b){ return a[0] - b[0]; });
}}
}}
}
this.computePlotData=function(){
this._plotData=[];
this._stackData=[];
var series,
index,
l;
for (index=0, l=this.series.length; index<l; index++){
series=this.series[index];
this._plotData.push([]);
this._stackData.push([]);
var cd=series.data;
this._plotData[index]=$.extend(true, [], cd);
this._stackData[index]=$.extend(true, [], cd);
series._plotData=this._plotData[index];
series._stackData=this._stackData[index];
var plotValues={x:[], y:[]};
if(this.stackSeries&&!series.disableStack){
series._stack=true;
var sidx=(series._stackAxis==='x') ? 0:1;
for (var k=0, cdl=cd.length; k<cdl; k++){
var temp=cd[k][sidx];
if(temp==null){
temp=0;
}
this._plotData[index][k][sidx]=temp;
this._stackData[index][k][sidx]=temp;
if(index > 0){
for (var j=index; j--;){
var prevval=this._plotData[j][k][sidx];
if(temp * prevval >=0){
this._plotData[index][k][sidx] +=prevval;
this._stackData[index][k][sidx] +=prevval;
break;
}}
}}
}else{
for (var i=0; i<series.data.length; i++){
plotValues.x.push(series.data[i][0]);
plotValues.y.push(series.data[i][1]);
}
this._stackData.push(series.data);
this.series[index]._stackData=series.data;
this._plotData.push(series.data);
series._plotData=series.data;
series._plotValues=plotValues;
}
if(index>0){
series._prevPlotData=this.series[index-1]._plotData;
}
series._sumy=0;
series._sumx=0;
for (i=series.data.length-1; i>-1; i--){
series._sumy +=series.data[i][1];
series._sumx +=series.data[i][0];
}}
};
this.populatePlotData=function(series, index){
this._plotData=[];
this._stackData=[];
series._stackData=[];
series._plotData=[];
var plotValues={x:[], y:[]};
if(this.stackSeries&&!series.disableStack){
series._stack=true;
var sidx=(series._stackAxis==='x') ? 0:1;
var temp=$.extend(true, [], series.data);
var plotdata=$.extend(true, [], series.data);
var tempx, tempy, dval, stackval, comparator;
for (var j=0; j<index; j++){
var cd=this.series[j].data;
for (var k=0; k<cd.length; k++){
dval=cd[k];
tempx=(dval[0]!=null) ? dval[0]:0;
tempy=(dval[1]!=null) ? dval[1]:0;
temp[k][0] +=tempx;
temp[k][1] +=tempy;
stackval=(sidx) ? tempy:tempx;
if(series.data[k][sidx] * stackval >=0){
plotdata[k][sidx] +=stackval;
}}
}
for (var i=0; i<plotdata.length; i++){
plotValues.x.push(plotdata[i][0]);
plotValues.y.push(plotdata[i][1]);
}
this._plotData.push(plotdata);
this._stackData.push(temp);
series._stackData=temp;
series._plotData=plotdata;
series._plotValues=plotValues;
}else{
for (var i=0; i<series.data.length; i++){
plotValues.x.push(series.data[i][0]);
plotValues.y.push(series.data[i][1]);
}
this._stackData.push(series.data);
this.series[index]._stackData=series.data;
this._plotData.push(series.data);
series._plotData=series.data;
series._plotValues=plotValues;
}
if(index>0){
series._prevPlotData=this.series[index-1]._plotData;
}
series._sumy=0;
series._sumx=0;
for (i=series.data.length-1; i>-1; i--){
series._sumy +=series.data[i][1];
series._sumx +=series.data[i][0];
}};
this.getNextSeriesColor=(function(t){
var idx=0;
var sc=t.seriesColors;
return function (){
if(idx < sc.length){
return sc[idx++];
}else{
idx=0;
return sc[idx++];
}};})(this);
this.parseOptions=function(options){
for (var i=0; i<this.preParseOptionsHooks.hooks.length; i++){
this.preParseOptionsHooks.hooks[i].call(this, options);
}
for (var i=0; i<$.jqplot.preParseOptionsHooks.length; i++){
$.jqplot.preParseOptionsHooks[i].call(this, options);
}
this.options=$.extend(true, {}, this.defaults, options);
var opts=this.options;
this.animate=opts.animate;
this.animateReplot=opts.animateReplot;
this.stackSeries=opts.stackSeries;
if($.isPlainObject(opts.fillBetween)){
var temp=['series1', 'series2', 'color', 'baseSeries', 'fill'],
tempi;
for (var i=0, l=temp.length; i<l; i++){
tempi=temp[i];
if(opts.fillBetween[tempi]!=null){
this.fillBetween[tempi]=opts.fillBetween[tempi];
}}
}
if(opts.seriesColors){
this.seriesColors=opts.seriesColors;
}
if(opts.negativeSeriesColors){
this.negativeSeriesColors=opts.negativeSeriesColors;
}
if(opts.captureRightClick){
this.captureRightClick=opts.captureRightClick;
}
this.defaultAxisStart=(options&&options.defaultAxisStart!=null) ? options.defaultAxisStart:this.defaultAxisStart;
this.colorGenerator.setColors(this.seriesColors);
this.negativeColorGenerator.setColors(this.negativeSeriesColors);
$.extend(true, this._gridPadding, opts.gridPadding);
this.sortData=(opts.sortData!=null) ? opts.sortData:this.sortData;
for (var i=0; i<12; i++){
var n=_axisNames[i];
var axis=this.axes[n];
axis._options=$.extend(true, {}, opts.axesDefaults, opts.axes[n]);
$.extend(true, axis, opts.axesDefaults, opts.axes[n]);
axis._plotWidth=this._width;
axis._plotHeight=this._height;
}
var normalizeData=function(data, dir, start){
var temp=[];
var i, l;
dir=dir||'vertical';
if(!$.isArray(data[0])){
for (i=0, l=data.length; i<l; i++){
if(dir=='vertical'){
temp.push([start + i, data[i]]);
}else{
temp.push([data[i], start+i]);
}}
}else{
$.extend(true, temp, data);
}
return temp;
};
var colorIndex=0;
this.series=[];
for (var i=0; i<this.data.length; i++){
var sopts=$.extend(true, {index: i}, {seriesColors:this.seriesColors, negativeSeriesColors:this.negativeSeriesColors}, this.options.seriesDefaults, this.options.series[i], {rendererOptions:{animation:{show: this.animate}}});
var temp=new Series(sopts);
for (var j=0; j<$.jqplot.preParseSeriesOptionsHooks.length; j++){
$.jqplot.preParseSeriesOptionsHooks[j].call(temp, this.options.seriesDefaults, this.options.series[i]);
}
for (var j=0; j<this.preParseSeriesOptionsHooks.hooks.length; j++){
this.preParseSeriesOptionsHooks.hooks[j].call(temp, this.options.seriesDefaults, this.options.series[i]);
}
$.extend(true, temp, sopts);
var dir='vertical';
if(temp.renderer===$.jqplot.BarRenderer&&temp.rendererOptions&&temp.rendererOptions.barDirection=='horizontal'){
dir='horizontal';
temp._stackAxis='x';
temp._primaryAxis='_yaxis';
}
temp.data=normalizeData(this.data[i], dir, this.defaultAxisStart);
switch (temp.xaxis){
case 'xaxis':
temp._xaxis=this.axes.xaxis;
break;
case 'x2axis':
temp._xaxis=this.axes.x2axis;
break;
default:
break;
}
temp._yaxis=this.axes[temp.yaxis];
temp._xaxis._series.push(temp);
temp._yaxis._series.push(temp);
if(temp.show){
temp._xaxis.show=true;
temp._yaxis.show=true;
}else{
if(temp._xaxis.scaleToHiddenSeries){
temp._xaxis.show=true;
}
if(temp._yaxis.scaleToHiddenSeries){
temp._yaxis.show=true;
}}
if(!temp.label){
temp.label='Series '+ (i+1).toString();
}
this.series.push(temp);
for (var j=0; j<$.jqplot.postParseSeriesOptionsHooks.length; j++){
$.jqplot.postParseSeriesOptionsHooks[j].call(this.series[i], this.options.seriesDefaults, this.options.series[i]);
}
for (var j=0; j<this.postParseSeriesOptionsHooks.hooks.length; j++){
this.postParseSeriesOptionsHooks.hooks[j].call(this.series[i], this.options.seriesDefaults, this.options.series[i]);
}}
$.extend(true, this.grid, this.options.grid);
for (var i=0, l=_axisNames.length; i<l; i++){
var n=_axisNames[i];
var axis=this.axes[n];
if(axis.borderWidth==null){
axis.borderWidth=this.grid.borderWidth;
}}
if(typeof this.options.title=='string'){
this.title.text=this.options.title;
}
else if(typeof this.options.title=='object'){
$.extend(true, this.title, this.options.title);
}
this.title._plotWidth=this._width;
this.legend.setOptions(this.options.legend);
for (var i=0; i<$.jqplot.postParseOptionsHooks.length; i++){
$.jqplot.postParseOptionsHooks[i].call(this, options);
}
for (var i=0; i<this.postParseOptionsHooks.hooks.length; i++){
this.postParseOptionsHooks.hooks[i].call(this, options);
}};
this.destroy=function(){
this.canvasManager.freeAllCanvases();
if(this.eventCanvas&&this.eventCanvas._elem){
this.eventCanvas._elem.unbind();
}
this.target.empty();
this.target[0].innerHTML='';
};
this.replot=function(options){
var opts=options||{};
var data=opts.data||null;
var clear=(opts.clear===false) ? false:true;
var resetAxes=opts.resetAxes||false;
delete opts.data;
delete opts.clear;
delete opts.resetAxes;
this.target.trigger('jqplotPreReplot');
if(clear){
this.destroy();
}
if(data||!$.isEmptyObject(opts)){
this.reInitialize(data, opts);
}else{
this.quickInit();
}
if(resetAxes){
this.resetAxesScale(resetAxes, opts.axes);
}
this.draw();
this.target.trigger('jqplotPostReplot');
};
this.redraw=function(clear){
clear=(clear!=null) ? clear:true;
this.target.trigger('jqplotPreRedraw');
if(clear){
this.canvasManager.freeAllCanvases();
this.eventCanvas._elem.unbind();
this.target.empty();
}
for (var ax in this.axes){
this.axes[ax]._ticks=[];
}
this.computePlotData();
this._sumy=0;
this._sumx=0;
for (var i=0, tsl=this.series.length; i<tsl; i++){
this._sumy +=this.series[i]._sumy;
this._sumx +=this.series[i]._sumx;
}
this.draw();
this.target.trigger('jqplotPostRedraw');
};
this.draw=function(){
if(this.drawIfHidden||this.target.is(':visible')){
this.target.trigger('jqplotPreDraw');
var i,
j,
l,
tempseries;
for (i=0, l=$.jqplot.preDrawHooks.length; i<l; i++){
$.jqplot.preDrawHooks[i].call(this);
}
for (i=0, l=this.preDrawHooks.hooks.length; i<l; i++){
this.preDrawHooks.hooks[i].apply(this, this.preDrawSeriesHooks.args[i]);
}
this.target.append(this.baseCanvas.createElement({left:0, right:0, top:0, bottom:0}, 'jqplot-base-canvas', null, this));
this.baseCanvas.setContext();
this.target.append(this.title.draw());
this.title.pack({top:0, left:0});
var legendElem=this.legend.draw({}, this);
var gridPadding={top:0, left:0, bottom:0, right:0};
if(this.legend.placement=="outsideGrid"){
this.target.append(legendElem);
switch (this.legend.location){
case 'n':
gridPadding.top +=this.legend.getHeight();
break;
case 's':
gridPadding.bottom +=this.legend.getHeight();
break;
case 'ne':
case 'e':
case 'se':
gridPadding.right +=this.legend.getWidth();
break;
case 'nw':
case 'w':
case 'sw':
gridPadding.left +=this.legend.getWidth();
break;
default:
gridPadding.right +=this.legend.getWidth();
break;
}
legendElem=legendElem.detach();
}
var ax=this.axes;
var name;
for (i=0; i<12; i++){
name=_axisNames[i];
this.target.append(ax[name].draw(this.baseCanvas._ctx, this));
ax[name].set();
}
if(ax.yaxis.show){
gridPadding.left +=ax.yaxis.getWidth();
}
var ra=['y2axis', 'y3axis', 'y4axis', 'y5axis', 'y6axis', 'y7axis', 'y8axis', 'y9axis'];
var rapad=[0, 0, 0, 0, 0, 0, 0, 0];
var gpr=0;
var n;
for (n=0; n<8; n++){
if(ax[ra[n]].show){
gpr +=ax[ra[n]].getWidth();
rapad[n]=gpr;
}}
gridPadding.right +=gpr;
if(ax.x2axis.show){
gridPadding.top +=ax.x2axis.getHeight();
}
if(this.title.show){
gridPadding.top +=this.title.getHeight();
}
if(ax.xaxis.show){
gridPadding.bottom +=ax.xaxis.getHeight();
}
if(this.options.gridDimensions&&$.isPlainObject(this.options.gridDimensions)){
var gdw=parseInt(this.options.gridDimensions.width, 10)||0;
var gdh=parseInt(this.options.gridDimensions.height, 10)||0;
var widthAdj=(this._width - gridPadding.left - gridPadding.right - gdw)/2;
var heightAdj=(this._height - gridPadding.top - gridPadding.bottom - gdh)/2;
if(heightAdj >=0&&widthAdj >=0){
gridPadding.top +=heightAdj;
gridPadding.bottom +=heightAdj;
gridPadding.left +=widthAdj;
gridPadding.right +=widthAdj;
}}
var arr=['top', 'bottom', 'left', 'right'];
for (var n in arr){
if(this._gridPadding[arr[n]]==null&&gridPadding[arr[n]] > 0){
this._gridPadding[arr[n]]=gridPadding[arr[n]];
}
else if(this._gridPadding[arr[n]]==null){
this._gridPadding[arr[n]]=this._defaultGridPadding[arr[n]];
}}
var legendPadding=this._gridPadding;
if(this.legend.placement==='outsideGrid'){
legendPadding={top:this.title.getHeight(), left: 0, right: 0, bottom: 0};
if(this.legend.location==='s'){
legendPadding.left=this._gridPadding.left;
legendPadding.right=this._gridPadding.right;
}}
ax.xaxis.pack({position:'absolute', bottom:this._gridPadding.bottom - ax.xaxis.getHeight(), left:0, width:this._width}, {min:this._gridPadding.left, max:this._width - this._gridPadding.right});
ax.yaxis.pack({position:'absolute', top:0, left:this._gridPadding.left - ax.yaxis.getWidth(), height:this._height}, {min:this._height - this._gridPadding.bottom, max: this._gridPadding.top});
ax.x2axis.pack({position:'absolute', top:this._gridPadding.top - ax.x2axis.getHeight(), left:0, width:this._width}, {min:this._gridPadding.left, max:this._width - this._gridPadding.right});
for (i=8; i>0; i--){
ax[ra[i-1]].pack({position:'absolute', top:0, right:this._gridPadding.right - rapad[i-1]}, {min:this._height - this._gridPadding.bottom, max: this._gridPadding.top});
}
var ltemp=(this._width - this._gridPadding.left - this._gridPadding.right)/2.0 + this._gridPadding.left - ax.yMidAxis.getWidth()/2.0;
ax.yMidAxis.pack({position:'absolute', top:0, left:ltemp, zIndex:9, textAlign: 'center'}, {min:this._height - this._gridPadding.bottom, max: this._gridPadding.top});
this.target.append(this.grid.createElement(this._gridPadding, this));
this.grid.draw();
var series=this.series;
var seriesLength=series.length;
for (i=0, l=seriesLength; i<l; i++){
j=this.seriesStack[i];
this.target.append(series[j].shadowCanvas.createElement(this._gridPadding, 'jqplot-series-shadowCanvas', null, this));
series[j].shadowCanvas.setContext();
series[j].shadowCanvas._elem.data('seriesIndex', j);
}
for (i=0, l=seriesLength; i<l; i++){
j=this.seriesStack[i];
this.target.append(series[j].canvas.createElement(this._gridPadding, 'jqplot-series-canvas', null, this));
series[j].canvas.setContext();
series[j].canvas._elem.data('seriesIndex', j);
}
this.target.append(this.eventCanvas.createElement(this._gridPadding, 'jqplot-event-canvas', null, this));
this.eventCanvas.setContext();
this.eventCanvas._ctx.fillStyle='rgba(0,0,0,0)';
this.eventCanvas._ctx.fillRect(0,0,this.eventCanvas._ctx.canvas.width, this.eventCanvas._ctx.canvas.height);
this.bindCustomEvents();
if(this.legend.preDraw){
this.eventCanvas._elem.before(legendElem);
this.legend.pack(legendPadding);
if(this.legend._elem){
this.drawSeries({legendInfo:{location:this.legend.location, placement:this.legend.placement, width:this.legend.getWidth(), height:this.legend.getHeight(), xoffset:this.legend.xoffset, yoffset:this.legend.yoffset}});
}else{
this.drawSeries();
}}else{
this.drawSeries();
if(seriesLength){
$(series[seriesLength-1].canvas._elem).after(legendElem);
}
this.legend.pack(legendPadding);
}
for (var i=0, l=$.jqplot.eventListenerHooks.length; i<l; i++){
this.eventCanvas._elem.bind($.jqplot.eventListenerHooks[i][0], {plot:this}, $.jqplot.eventListenerHooks[i][1]);
}
for (var i=0, l=this.eventListenerHooks.hooks.length; i<l; i++){
this.eventCanvas._elem.bind(this.eventListenerHooks.hooks[i][0], {plot:this}, this.eventListenerHooks.hooks[i][1]);
}
var fb=this.fillBetween;
if(typeof fb.series1=='number'){
if(fb.fill&&fb.series1!==fb.series2&&fb.series1<seriesLength&&fb.series2<seriesLength&&series[fb.series1]._type==="line"&&series[fb.series2]._type==="line")
this.doFillBetweenLines();
}else{
if(fb.series1!=null&&fb.series2!=null){
var doFb=false;
if(fb.series1.length===fb.series2.length){
var tempSeries1=0;
var tempSeries2=0;
for(var cnt=0; cnt < fb.series1.length; cnt++){
tempSeries1=fb.series1[cnt];
tempSeries2=fb.series2[cnt];
if(tempSeries1!==tempSeries2&&tempSeries1<seriesLength&&tempSeries2<seriesLength&&series[tempSeries1]._type==="line"&&series[tempSeries2]._type==="line"){
doFb=true;
}else{
doFb=false;
break;
}}
}
if(fb.fill&&doFb){
this.doFillBetweenLines();
}}
}
for (var i=0, l=$.jqplot.postDrawHooks.length; i<l; i++){
$.jqplot.postDrawHooks[i].call(this);
}
for (var i=0, l=this.postDrawHooks.hooks.length; i<l; i++){
this.postDrawHooks.hooks[i].apply(this, this.postDrawHooks.args[i]);
}
if(this.target.is(':visible')){
this._drawCount +=1;
}
var temps,
tempr,
sel,
_els;
for (i=0, l=seriesLength; i<l; i++){
temps=series[i];
tempr=temps.renderer;
sel='.jqplot-point-label.jqplot-series-'+i;
if(tempr.animation&&tempr.animation._supported&&tempr.animation.show&&(this._drawCount < 2||this.animateReplot)){
_els=this.target.find(sel);
_els.stop(true, true).hide();
temps.canvas._elem.stop(true, true).hide();
temps.shadowCanvas._elem.stop(true, true).hide();
temps.canvas._elem.jqplotEffect('blind', {mode: 'show', direction: tempr.animation.direction}, tempr.animation.speed);
temps.shadowCanvas._elem.jqplotEffect('blind', {mode: 'show', direction: tempr.animation.direction}, tempr.animation.speed);
_els.fadeIn(tempr.animation.speed*0.8);
}}
_els=null;
this.target.trigger('jqplotPostDraw', [this]);
}};
jqPlot.prototype.doFillBetweenLines=function (){
var fb=this.fillBetween;
var series=this.series;
var sid1=fb.series1;
var sid2=fb.series2;
var id1=0, id2=0;
function fill(id1, id2){
var series1=series[id1];
var series2=series[id2];
if(series2.renderer.smooth)
var tempgd=series2.renderer._smoothedData.slice(0).reverse();
else
var tempgd=series2.gridData.slice(0).reverse();
if(series1.renderer.smooth)
var gd=series1.renderer._smoothedData.concat(tempgd);
else
var gd=series1.gridData.concat(tempgd);
var color=fb.color!==null ? fb.color:series[sid1].fillColor;
var baseSeries=fb.baseSeries!==null ? fb.baseSeries:id1;
var sr =
series[baseSeries].renderer.shapeRenderer;
var opts =
{
fillStyle:color,
fill:true,
closePath:true
};
sr.draw(series1.shadowCanvas._ctx, gd, opts)
}
if(typeof sid1=='number'&&typeof sid2=='number'){
id1=sid1 < sid2 ? sid1:sid2;
id2=sid2 > sid1 ? sid2:sid1;
fill(id1, id2);
}else{
for(var cnt=0; cnt < sid1.length ; cnt++){
id1=sid1[cnt] < sid2[cnt] ? sid1[cnt]:sid2[cnt];
id2=sid2[cnt] > sid1[cnt] ? sid2[cnt]:sid1[cnt];
fill(id1, id2);
}}
};
this.bindCustomEvents=function(){
this.eventCanvas._elem.bind('click', {plot:this}, this.onClick);
this.eventCanvas._elem.bind('dblclick', {plot:this}, this.onDblClick);
this.eventCanvas._elem.bind('mousedown', {plot:this}, this.onMouseDown);
this.eventCanvas._elem.bind('mousemove', {plot:this}, this.onMouseMove);
this.eventCanvas._elem.bind('mouseenter', {plot:this}, this.onMouseEnter);
this.eventCanvas._elem.bind('mouseleave', {plot:this}, this.onMouseLeave);
if(this.captureRightClick){
this.eventCanvas._elem.bind('mouseup', {plot:this}, this.onRightClick);
this.eventCanvas._elem.get(0).oncontextmenu=function(){
return false;
};}else{
this.eventCanvas._elem.bind('mouseup', {plot:this}, this.onMouseUp);
}};
function getEventPosition(ev){
var plot=ev.data.plot;
var go=plot.eventCanvas._elem.offset();
var gridPos={x:ev.pageX - go.left, y:ev.pageY - go.top};
var dataPos={xaxis:null, yaxis:null, x2axis:null, y2axis:null, y3axis:null, y4axis:null, y5axis:null, y6axis:null, y7axis:null, y8axis:null, y9axis:null, yMidAxis:null};
var an=['xaxis', 'yaxis', 'x2axis', 'y2axis', 'y3axis', 'y4axis', 'y5axis', 'y6axis', 'y7axis', 'y8axis', 'y9axis', 'yMidAxis'];
var ax=plot.axes;
var n, axis;
for (n=11; n>0; n--){
axis=an[n-1];
if(ax[axis].show){
dataPos[axis]=ax[axis].series_p2u(gridPos[axis.charAt(0)]);
}}
return {offsets:go, gridPos:gridPos, dataPos:dataPos};}
function checkIntersection(gridpos, plot){
var series=plot.series;
var i, j, k, s, r, x, y, theta, sm, sa, minang, maxang;
var d0, d, p, pp, points, bw, hp;
var threshold, t;
for (k=plot.seriesStack.length-1; k>=0; k--){
i=plot.seriesStack[k];
s=series[i];
hp=s._highlightThreshold;
switch (s.renderer.constructor){
case $.jqplot.BarRenderer:
x=gridpos.x;
y=gridpos.y;
for (j=0; j<s._barPoints.length; j++){
points=s._barPoints[j];
p=s.gridData[j];
if(x>points[0][0]&&x<points[2][0]&&(y>points[2][1]&&y<points[0][1]||y<points[2][1]&&y>points[0][1])){
return {seriesIndex:s.index, pointIndex:j, gridData:p, data:s.data[j], points:s._barPoints[j]};}}
break;
case $.jqplot.PyramidRenderer:
x=gridpos.x;
y=gridpos.y;
for (j=0; j<s._barPoints.length; j++){
points=s._barPoints[j];
p=s.gridData[j];
if(x > points[0][0] + hp[0][0]&&x < points[2][0] + hp[2][0]&&y > points[2][1]&&y < points[0][1]){
return {seriesIndex:s.index, pointIndex:j, gridData:p, data:s.data[j], points:s._barPoints[j]};}}
break;
case $.jqplot.DonutRenderer:
sa=s.startAngle/180*Math.PI;
x=gridpos.x - s._center[0];
y=gridpos.y - s._center[1];
r=Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
if(x > 0&&-y >=0){
theta=2*Math.PI - Math.atan(-y/x);
}
else if(x > 0&&-y < 0){
theta=-Math.atan(-y/x);
}
else if(x < 0){
theta=Math.PI - Math.atan(-y/x);
}
else if(x==0&&-y > 0){
theta=3*Math.PI/2;
}
else if(x==0&&-y < 0){
theta=Math.PI/2;
}
else if(x==0&&y==0){
theta=0;
}
if(sa){
theta -=sa;
if(theta < 0){
theta +=2*Math.PI;
}
else if(theta > 2*Math.PI){
theta -=2*Math.PI;
}}
sm=s.sliceMargin/180*Math.PI;
if(r < s._radius&&r > s._innerRadius){
for (j=0; j<s.gridData.length; j++){
minang=(j>0) ? s.gridData[j-1][1]+sm:sm;
maxang=s.gridData[j][1];
if(theta > minang&&theta < maxang){
return {seriesIndex:s.index, pointIndex:j, gridData:[gridpos.x,gridpos.y], data:s.data[j]};}}
}
break;
case $.jqplot.PieRenderer:
sa=s.startAngle/180*Math.PI;
x=gridpos.x - s._center[0];
y=gridpos.y - s._center[1];
r=Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
if(x > 0&&-y >=0){
theta=2*Math.PI - Math.atan(-y/x);
}
else if(x > 0&&-y < 0){
theta=-Math.atan(-y/x);
}
else if(x < 0){
theta=Math.PI - Math.atan(-y/x);
}
else if(x==0&&-y > 0){
theta=3*Math.PI/2;
}
else if(x==0&&-y < 0){
theta=Math.PI/2;
}
else if(x==0&&y==0){
theta=0;
}
if(sa){
theta -=sa;
if(theta < 0){
theta +=2*Math.PI;
}
else if(theta > 2*Math.PI){
theta -=2*Math.PI;
}}
sm=s.sliceMargin/180*Math.PI;
if(r < s._radius){
for (j=0; j<s.gridData.length; j++){
minang=(j>0) ? s.gridData[j-1][1]+sm:sm;
maxang=s.gridData[j][1];
if(theta > minang&&theta < maxang){
return {seriesIndex:s.index, pointIndex:j, gridData:[gridpos.x,gridpos.y], data:s.data[j]};}}
}
break;
case $.jqplot.BubbleRenderer:
x=gridpos.x;
y=gridpos.y;
var ret=null;
if(s.show){
for (var j=0; j<s.gridData.length; j++){
p=s.gridData[j];
d=Math.sqrt((x-p[0]) * (x-p[0]) + (y-p[1]) * (y-p[1]));
if(d <=p[2]&&(d <=d0||d0==null)){
d0=d;
ret={seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};}}
if(ret!=null){
return ret;
}}
break;
case $.jqplot.FunnelRenderer:
x=gridpos.x;
y=gridpos.y;
var v=s._vertices,
vfirst=v[0],
vlast=v[v.length-1],
lex,
rex,
cv;
function findedge (l, p1 , p2){
var m=(p1[1] - p2[1])/(p1[0] - p2[0]);
var b=p1[1] - m*p1[0];
var y=l + p1[1];
return [(y - b)/m, y];
}
lex=findedge(y, vfirst[0], vlast[3]);
rex=findedge(y, vfirst[1], vlast[2]);
for (j=0; j<v.length; j++){
cv=v[j];
if(y >=cv[0][1]&&y <=cv[3][1]&&x >=lex[0]&&x <=rex[0]){
return {seriesIndex:s.index, pointIndex:j, gridData:null, data:s.data[j]};}}
break;
case $.jqplot.LineRenderer:
x=gridpos.x;
y=gridpos.y;
r=s.renderer;
if(s.show){
if((s.fill||(s.renderer.bands.show&&s.renderer.bands.fill))&&(!plot.plugins.highlighter||!plot.plugins.highlighter.show)){
var inside=false;
if(x>s._boundingBox[0][0]&&x<s._boundingBox[1][0]&&y>s._boundingBox[1][1]&&y<s._boundingBox[0][1]){
var numPoints=s._areaPoints.length;
var ii;
var j=numPoints-1;
for(var ii=0; ii < numPoints; ii++){
var vertex1=[s._areaPoints[ii][0], s._areaPoints[ii][1]];
var vertex2=[s._areaPoints[j][0], s._areaPoints[j][1]];
if(vertex1[1] < y&&vertex2[1] >=y||vertex2[1] < y&&vertex1[1] >=y){
if(vertex1[0] + (y - vertex1[1]) / (vertex2[1] - vertex1[1]) * (vertex2[0] - vertex1[0]) < x){
inside = !inside;
}}
j=ii;
}}
if(inside){
return {seriesIndex:i, pointIndex:null, gridData:s.gridData, data:s.data, points:s._areaPoints};}
break;
}else{
t=s.markerRenderer.size/2+s.neighborThreshold;
threshold=(t > 0) ? t:0;
for (var j=0; j<s.gridData.length; j++){
p=s.gridData[j];
if(r.constructor==$.jqplot.OHLCRenderer){
if(r.candleStick){
var yp=s._yaxis.series_u2p;
if(x >=p[0]-r._bodyWidth/2&&x <=p[0]+r._bodyWidth/2&&y >=yp(s.data[j][2])&&y <=yp(s.data[j][3])){
return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};}}
else if(!r.hlc){
var yp=s._yaxis.series_u2p;
if(x >=p[0]-r._tickLength&&x <=p[0]+r._tickLength&&y >=yp(s.data[j][2])&&y <=yp(s.data[j][3])){
return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};}}else{
var yp=s._yaxis.series_u2p;
if(x >=p[0]-r._tickLength&&x <=p[0]+r._tickLength&&y >=yp(s.data[j][1])&&y <=yp(s.data[j][2])){
return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};}}
}
else if(p[0]!=null&&p[1]!=null){
d=Math.sqrt((x-p[0]) * (x-p[0]) + (y-p[1]) * (y-p[1]));
if(d <=threshold&&(d <=d0||d0==null)){
d0=d;
return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};}}
}}
}
break;
default:
x=gridpos.x;
y=gridpos.y;
r=s.renderer;
if(s.show){
t=s.markerRenderer.size/2+s.neighborThreshold;
threshold=(t > 0) ? t:0;
for (var j=0; j<s.gridData.length; j++){
p=s.gridData[j];
if(r.constructor==$.jqplot.OHLCRenderer){
if(r.candleStick){
var yp=s._yaxis.series_u2p;
if(x >=p[0]-r._bodyWidth/2&&x <=p[0]+r._bodyWidth/2&&y >=yp(s.data[j][2])&&y <=yp(s.data[j][3])){
return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};}}
else if(!r.hlc){
var yp=s._yaxis.series_u2p;
if(x >=p[0]-r._tickLength&&x <=p[0]+r._tickLength&&y >=yp(s.data[j][2])&&y <=yp(s.data[j][3])){
return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};}}else{
var yp=s._yaxis.series_u2p;
if(x >=p[0]-r._tickLength&&x <=p[0]+r._tickLength&&y >=yp(s.data[j][1])&&y <=yp(s.data[j][2])){
return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};}}
}else{
d=Math.sqrt((x-p[0]) * (x-p[0]) + (y-p[1]) * (y-p[1]));
if(d <=threshold&&(d <=d0||d0==null)){
d0=d;
return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};}}
}}
break;
}}
return null;
}
this.onClick=function(ev){
var positions=getEventPosition(ev);
var p=ev.data.plot;
var neighbor=checkIntersection(positions.gridPos, p);
var evt=$.Event('jqplotClick');
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
$(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]);
};
this.onDblClick=function(ev){
var positions=getEventPosition(ev);
var p=ev.data.plot;
var neighbor=checkIntersection(positions.gridPos, p);
var evt=$.Event('jqplotDblClick');
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
$(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]);
};
this.onMouseDown=function(ev){
var positions=getEventPosition(ev);
var p=ev.data.plot;
var neighbor=checkIntersection(positions.gridPos, p);
var evt=$.Event('jqplotMouseDown');
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
$(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]);
};
this.onMouseUp=function(ev){
var positions=getEventPosition(ev);
var evt=$.Event('jqplotMouseUp');
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
$(this).trigger(evt, [positions.gridPos, positions.dataPos, null, ev.data.plot]);
};
this.onRightClick=function(ev){
var positions=getEventPosition(ev);
var p=ev.data.plot;
var neighbor=checkIntersection(positions.gridPos, p);
if(p.captureRightClick){
if(ev.which==3){
var evt=$.Event('jqplotRightClick');
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
$(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]);
}else{
var evt=$.Event('jqplotMouseUp');
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
$(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]);
}}
};
this.onMouseMove=function(ev){
var positions=getEventPosition(ev);
var p=ev.data.plot;
var neighbor=checkIntersection(positions.gridPos, p);
var evt=$.Event('jqplotMouseMove');
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
$(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]);
};
this.onMouseEnter=function(ev){
var positions=getEventPosition(ev);
var p=ev.data.plot;
var evt=$.Event('jqplotMouseEnter');
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
evt.relatedTarget=ev.relatedTarget;
$(this).trigger(evt, [positions.gridPos, positions.dataPos, null, p]);
};
this.onMouseLeave=function(ev){
var positions=getEventPosition(ev);
var p=ev.data.plot;
var evt=$.Event('jqplotMouseLeave');
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
evt.relatedTarget=ev.relatedTarget;
$(this).trigger(evt, [positions.gridPos, positions.dataPos, null, p]);
};
this.drawSeries=function(options, idx){
var i, series, ctx;
idx=(typeof(options)==="number"&&idx==null) ? options:idx;
options=(typeof(options)==="object") ? options:{};
if(idx!=undefined){
series=this.series[idx];
ctx=series.shadowCanvas._ctx;
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
series.drawShadow(ctx, options, this);
ctx=series.canvas._ctx;
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
series.draw(ctx, options, this);
if(series.renderer.constructor==$.jqplot.BezierCurveRenderer){
if(idx < this.series.length - 1){
this.drawSeries(idx+1);
}}
}else{
for (i=0; i<this.series.length; i++){
series=this.series[i];
ctx=series.shadowCanvas._ctx;
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
series.drawShadow(ctx, options, this);
ctx=series.canvas._ctx;
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
series.draw(ctx, options, this);
}}
options=idx=i = series=ctx=null;
};
this.moveSeriesToFront=function (idx){
idx=parseInt(idx, 10);
var stackIndex=$.inArray(idx, this.seriesStack);
if(stackIndex==-1){
return;
}
if(stackIndex==this.seriesStack.length -1){
this.previousSeriesStack=this.seriesStack.slice(0);
return;
}
var opidx=this.seriesStack[this.seriesStack.length -1];
var serelem=this.series[idx].canvas._elem.detach();
var shadelem=this.series[idx].shadowCanvas._elem.detach();
this.series[opidx].shadowCanvas._elem.after(shadelem);
this.series[opidx].canvas._elem.after(serelem);
this.previousSeriesStack=this.seriesStack.slice(0);
this.seriesStack.splice(stackIndex, 1);
this.seriesStack.push(idx);
};
this.moveSeriesToBack=function (idx){
idx=parseInt(idx, 10);
var stackIndex=$.inArray(idx, this.seriesStack);
if(stackIndex==0||stackIndex==-1){
return;
}
var opidx=this.seriesStack[0];
var serelem=this.series[idx].canvas._elem.detach();
var shadelem=this.series[idx].shadowCanvas._elem.detach();
this.series[opidx].shadowCanvas._elem.before(shadelem);
this.series[opidx].canvas._elem.before(serelem);
this.previousSeriesStack=this.seriesStack.slice(0);
this.seriesStack.splice(stackIndex, 1);
this.seriesStack.unshift(idx);
};
this.restorePreviousSeriesOrder=function (){
var i, j, serelem, shadelem, temp, move, keep;
if(this.seriesStack==this.previousSeriesStack){
return;
}
for (i=1; i<this.previousSeriesStack.length; i++){
move=this.previousSeriesStack[i];
keep=this.previousSeriesStack[i-1];
serelem=this.series[move].canvas._elem.detach();
shadelem=this.series[move].shadowCanvas._elem.detach();
this.series[keep].shadowCanvas._elem.after(shadelem);
this.series[keep].canvas._elem.after(serelem);
}
temp=this.seriesStack.slice(0);
this.seriesStack=this.previousSeriesStack.slice(0);
this.previousSeriesStack=temp;
};
this.restoreOriginalSeriesOrder=function (){
var i, j, arr=[], serelem, shadelem;
for (i=0; i<this.series.length; i++){
arr.push(i);
}
if(this.seriesStack==arr){
return;
}
this.previousSeriesStack=this.seriesStack.slice(0);
this.seriesStack=arr;
for (i=1; i<this.seriesStack.length; i++){
serelem=this.series[i].canvas._elem.detach();
shadelem=this.series[i].shadowCanvas._elem.detach();
this.series[i-1].shadowCanvas._elem.after(shadelem);
this.series[i-1].canvas._elem.after(serelem);
}};
this.activateTheme=function (name){
this.themeEngine.activate(this, name);
};}
$.jqplot.computeHighlightColors=function(colors){
var ret;
if($.isArray(colors)){
ret=[];
for (var i=0; i<colors.length; i++){
var rgba=$.jqplot.getColorComponents(colors[i]);
var newrgb=[rgba[0], rgba[1], rgba[2]];
var sum=newrgb[0] + newrgb[1] + newrgb[2];
for (var j=0; j<3; j++){
newrgb[j]=(sum > 660) ?  newrgb[j] * 0.85:0.73 * newrgb[j] + 90;
newrgb[j]=parseInt(newrgb[j], 10);
(newrgb[j] > 255) ? 255:newrgb[j];
}
newrgb[3]=0.3 + 0.35 * rgba[3];
ret.push('rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+newrgb[3]+')');
}}else{
var rgba=$.jqplot.getColorComponents(colors);
var newrgb=[rgba[0], rgba[1], rgba[2]];
var sum=newrgb[0] + newrgb[1] + newrgb[2];
for (var j=0; j<3; j++){
newrgb[j]=(sum > 660) ?  newrgb[j] * 0.85:0.73 * newrgb[j] + 90;
newrgb[j]=parseInt(newrgb[j], 10);
(newrgb[j] > 255) ? 255:newrgb[j];
}
newrgb[3]=0.3 + 0.35 * rgba[3];
ret='rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+newrgb[3]+')';
}
return ret;
};
$.jqplot.ColorGenerator=function(colors){
colors=colors||$.jqplot.config.defaultColors;
var idx=0;
this.next=function (){
if(idx < colors.length){
return colors[idx++];
}else{
idx=0;
return colors[idx++];
}};
this.previous=function (){
if(idx > 0){
return colors[idx--];
}else{
idx=colors.length-1;
return colors[idx];
}};
this.get=function(i){
var idx=i - colors.length * Math.floor(i/colors.length);
return colors[idx];
};
this.setColors=function(c){
colors=c;
};
this.reset=function(){
idx=0;
};
this.getIndex=function(){
return idx;
};
this.setIndex=function(index){
idx=index;
};};
$.jqplot.hex2rgb=function(h, a){
h=h.replace('#', '');
if(h.length==3){
h=h.charAt(0)+h.charAt(0)+h.charAt(1)+h.charAt(1)+h.charAt(2)+h.charAt(2);
}
var rgb;
rgb='rgba('+parseInt(h.slice(0,2), 16)+', '+parseInt(h.slice(2,4), 16)+', '+parseInt(h.slice(4,6), 16);
if(a){
rgb +=', '+a;
}
rgb +=')';
return rgb;
};
$.jqplot.rgb2hex=function(s){
var pat=/rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *(?:, *[0-9.]*)?\)/;
var m=s.match(pat);
var h='#';
for (var i=1; i<4; i++){
var temp;
if(m[i].search(/%/)!=-1){
temp=parseInt(255*m[i]/100, 10).toString(16);
if(temp.length==1){
temp='0'+temp;
}}else{
temp=parseInt(m[i], 10).toString(16);
if(temp.length==1){
temp='0'+temp;
}}
h +=temp;
}
return h;
};
$.jqplot.normalize2rgb=function(s, a){
if(s.search(/^ *rgba?\(/)!=-1){
return s;
}
else if(s.search(/^ *#?[0-9a-fA-F]?[0-9a-fA-F]/)!=-1){
return $.jqplot.hex2rgb(s, a);
}else{
throw new Error('Invalid color spec');
}};
$.jqplot.getColorComponents=function(s){
s=$.jqplot.colorKeywordMap[s]||s;
var rgb=$.jqplot.normalize2rgb(s);
var pat=/rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *,? *([0-9.]* *)?\)/;
var m=rgb.match(pat);
var ret=[];
for (var i=1; i<4; i++){
if(m[i].search(/%/)!=-1){
ret[i-1]=parseInt(255*m[i]/100, 10);
}else{
ret[i-1]=parseInt(m[i], 10);
}}
ret[3]=parseFloat(m[4]) ? parseFloat(m[4]):1.0;
return ret;
};
$.jqplot.colorKeywordMap={
aliceblue: 'rgb(240, 248, 255)',
antiquewhite: 'rgb(250, 235, 215)',
aqua: 'rgb(0, 255, 255)',
aquamarine: 'rgb(127, 255, 212)',
azure: 'rgb(240, 255, 255)',
beige: 'rgb(245, 245, 220)',
bisque: 'rgb(255, 228, 196)',
black: 'rgb(0, 0, 0)',
blanchedalmond: 'rgb(255, 235, 205)',
blue: 'rgb(0, 0, 255)',
blueviolet: 'rgb(138, 43, 226)',
brown: 'rgb(165, 42, 42)',
burlywood: 'rgb(222, 184, 135)',
cadetblue: 'rgb(95, 158, 160)',
chartreuse: 'rgb(127, 255, 0)',
chocolate: 'rgb(210, 105, 30)',
coral: 'rgb(255, 127, 80)',
cornflowerblue: 'rgb(100, 149, 237)',
cornsilk: 'rgb(255, 248, 220)',
crimson: 'rgb(220, 20, 60)',
cyan: 'rgb(0, 255, 255)',
darkblue: 'rgb(0, 0, 139)',
darkcyan: 'rgb(0, 139, 139)',
darkgoldenrod: 'rgb(184, 134, 11)',
darkgray: 'rgb(169, 169, 169)',
darkgreen: 'rgb(0, 100, 0)',
darkgrey: 'rgb(169, 169, 169)',
darkkhaki: 'rgb(189, 183, 107)',
darkmagenta: 'rgb(139, 0, 139)',
darkolivegreen: 'rgb(85, 107, 47)',
darkorange: 'rgb(255, 140, 0)',
darkorchid: 'rgb(153, 50, 204)',
darkred: 'rgb(139, 0, 0)',
darksalmon: 'rgb(233, 150, 122)',
darkseagreen: 'rgb(143, 188, 143)',
darkslateblue: 'rgb(72, 61, 139)',
darkslategray: 'rgb(47, 79, 79)',
darkslategrey: 'rgb(47, 79, 79)',
darkturquoise: 'rgb(0, 206, 209)',
darkviolet: 'rgb(148, 0, 211)',
deeppink: 'rgb(255, 20, 147)',
deepskyblue: 'rgb(0, 191, 255)',
dimgray: 'rgb(105, 105, 105)',
dimgrey: 'rgb(105, 105, 105)',
dodgerblue: 'rgb(30, 144, 255)',
firebrick: 'rgb(178, 34, 34)',
floralwhite: 'rgb(255, 250, 240)',
forestgreen: 'rgb(34, 139, 34)',
fuchsia: 'rgb(255, 0, 255)',
gainsboro: 'rgb(220, 220, 220)',
ghostwhite: 'rgb(248, 248, 255)',
gold: 'rgb(255, 215, 0)',
goldenrod: 'rgb(218, 165, 32)',
gray: 'rgb(128, 128, 128)',
grey: 'rgb(128, 128, 128)',
green: 'rgb(0, 128, 0)',
greenyellow: 'rgb(173, 255, 47)',
honeydew: 'rgb(240, 255, 240)',
hotpink: 'rgb(255, 105, 180)',
indianred: 'rgb(205, 92, 92)',
indigo: 'rgb(75, 0, 130)',
ivory: 'rgb(255, 255, 240)',
khaki: 'rgb(240, 230, 140)',
lavender: 'rgb(230, 230, 250)',
lavenderblush: 'rgb(255, 240, 245)',
lawngreen: 'rgb(124, 252, 0)',
lemonchiffon: 'rgb(255, 250, 205)',
lightblue: 'rgb(173, 216, 230)',
lightcoral: 'rgb(240, 128, 128)',
lightcyan: 'rgb(224, 255, 255)',
lightgoldenrodyellow: 'rgb(250, 250, 210)',
lightgray: 'rgb(211, 211, 211)',
lightgreen: 'rgb(144, 238, 144)',
lightgrey: 'rgb(211, 211, 211)',
lightpink: 'rgb(255, 182, 193)',
lightsalmon: 'rgb(255, 160, 122)',
lightseagreen: 'rgb(32, 178, 170)',
lightskyblue: 'rgb(135, 206, 250)',
lightslategray: 'rgb(119, 136, 153)',
lightslategrey: 'rgb(119, 136, 153)',
lightsteelblue: 'rgb(176, 196, 222)',
lightyellow: 'rgb(255, 255, 224)',
lime: 'rgb(0, 255, 0)',
limegreen: 'rgb(50, 205, 50)',
linen: 'rgb(250, 240, 230)',
magenta: 'rgb(255, 0, 255)',
maroon: 'rgb(128, 0, 0)',
mediumaquamarine: 'rgb(102, 205, 170)',
mediumblue: 'rgb(0, 0, 205)',
mediumorchid: 'rgb(186, 85, 211)',
mediumpurple: 'rgb(147, 112, 219)',
mediumseagreen: 'rgb(60, 179, 113)',
mediumslateblue: 'rgb(123, 104, 238)',
mediumspringgreen: 'rgb(0, 250, 154)',
mediumturquoise: 'rgb(72, 209, 204)',
mediumvioletred: 'rgb(199, 21, 133)',
midnightblue: 'rgb(25, 25, 112)',
mintcream: 'rgb(245, 255, 250)',
mistyrose: 'rgb(255, 228, 225)',
moccasin: 'rgb(255, 228, 181)',
navajowhite: 'rgb(255, 222, 173)',
navy: 'rgb(0, 0, 128)',
oldlace: 'rgb(253, 245, 230)',
olive: 'rgb(128, 128, 0)',
olivedrab: 'rgb(107, 142, 35)',
orange: 'rgb(255, 165, 0)',
orangered: 'rgb(255, 69, 0)',
orchid: 'rgb(218, 112, 214)',
palegoldenrod: 'rgb(238, 232, 170)',
palegreen: 'rgb(152, 251, 152)',
paleturquoise: 'rgb(175, 238, 238)',
palevioletred: 'rgb(219, 112, 147)',
papayawhip: 'rgb(255, 239, 213)',
peachpuff: 'rgb(255, 218, 185)',
peru: 'rgb(205, 133, 63)',
pink: 'rgb(255, 192, 203)',
plum: 'rgb(221, 160, 221)',
powderblue: 'rgb(176, 224, 230)',
purple: 'rgb(128, 0, 128)',
red: 'rgb(255, 0, 0)',
rosybrown: 'rgb(188, 143, 143)',
royalblue: 'rgb(65, 105, 225)',
saddlebrown: 'rgb(139, 69, 19)',
salmon: 'rgb(250, 128, 114)',
sandybrown: 'rgb(244, 164, 96)',
seagreen: 'rgb(46, 139, 87)',
seashell: 'rgb(255, 245, 238)',
sienna: 'rgb(160, 82, 45)',
silver: 'rgb(192, 192, 192)',
skyblue: 'rgb(135, 206, 235)',
slateblue: 'rgb(106, 90, 205)',
slategray: 'rgb(112, 128, 144)',
slategrey: 'rgb(112, 128, 144)',
snow: 'rgb(255, 250, 250)',
springgreen: 'rgb(0, 255, 127)',
steelblue: 'rgb(70, 130, 180)',
tan: 'rgb(210, 180, 140)',
teal: 'rgb(0, 128, 128)',
thistle: 'rgb(216, 191, 216)',
tomato: 'rgb(255, 99, 71)',
turquoise: 'rgb(64, 224, 208)',
violet: 'rgb(238, 130, 238)',
wheat: 'rgb(245, 222, 179)',
white: 'rgb(255, 255, 255)',
whitesmoke: 'rgb(245, 245, 245)',
yellow: 'rgb(255, 255, 0)',
yellowgreen: 'rgb(154, 205, 50)'
};
$.jqplot.AxisLabelRenderer=function(options){
$.jqplot.ElemContainer.call(this);
this.axis;
this.show=true;
this.label='';
this.fontFamily=null;
this.fontSize=null;
this.textColor=null;
this._elem;
this.escapeHTML=false;
$.extend(true, this, options);
};
$.jqplot.AxisLabelRenderer.prototype=new $.jqplot.ElemContainer();
$.jqplot.AxisLabelRenderer.prototype.constructor=$.jqplot.AxisLabelRenderer;
$.jqplot.AxisLabelRenderer.prototype.init=function(options){
$.extend(true, this, options);
};
$.jqplot.AxisLabelRenderer.prototype.draw=function(ctx, plot){
if(this._elem){
this._elem.emptyForce();
this._elem=null;
}
this._elem=$('<div style="position:absolute;" class="jqplot-'+this.axis+'-label"></div>');
if(Number(this.label)){
this._elem.css('white-space', 'nowrap');
}
if(!this.escapeHTML){
this._elem.html(this.label);
}else{
this._elem.text(this.label);
}
if(this.fontFamily){
this._elem.css('font-family', this.fontFamily);
}
if(this.fontSize){
this._elem.css('font-size', this.fontSize);
}
if(this.textColor){
this._elem.css('color', this.textColor);
}
return this._elem;
};
$.jqplot.AxisLabelRenderer.prototype.pack=function(){
};
$.jqplot.AxisTickRenderer=function(options){
$.jqplot.ElemContainer.call(this);
this.mark='outside';
this.axis;
this.showMark=true;
this.showGridline=true;
this.isMinorTick=false;
this.size=4;
this.markSize=6;
this.show=true;
this.showLabel=true;
this.label=null;
this.value=null;
this._styles={};
this.formatter=$.jqplot.DefaultTickFormatter;
this.prefix='';
this.suffix='';
this.formatString='';
this.fontFamily;
this.fontSize;
this.textColor;
this.escapeHTML=false;
this._elem;
this._breakTick=false;
$.extend(true, this, options);
};
$.jqplot.AxisTickRenderer.prototype.init=function(options){
$.extend(true, this, options);
};
$.jqplot.AxisTickRenderer.prototype=new $.jqplot.ElemContainer();
$.jqplot.AxisTickRenderer.prototype.constructor=$.jqplot.AxisTickRenderer;
$.jqplot.AxisTickRenderer.prototype.setTick=function(value, axisName, isMinor){
this.value=value;
this.axis=axisName;
if(isMinor){
this.isMinorTick=true;
}
return this;
};
$.jqplot.AxisTickRenderer.prototype.draw=function(){
if(this.label===null){
this.label=this.prefix + this.formatter(this.formatString, this.value) + this.suffix;
}
var style={position: 'absolute'};
if(Number(this.label)){
style['whitSpace']='nowrap';
}
if(this._elem){
this._elem.emptyForce();
this._elem=null;
}
this._elem=$(document.createElement('div'));
this._elem.addClass("jqplot-"+this.axis+"-tick");
if(!this.escapeHTML){
this._elem.html(this.label);
}else{
this._elem.text(this.label);
}
this._elem.css(style);
for (var s in this._styles){
this._elem.css(s, this._styles[s]);
}
if(this.fontFamily){
this._elem.css('font-family', this.fontFamily);
}
if(this.fontSize){
this._elem.css('font-size', this.fontSize);
}
if(this.textColor){
this._elem.css('color', this.textColor);
}
if(this._breakTick){
this._elem.addClass('jqplot-breakTick');
}
return this._elem;
};
$.jqplot.DefaultTickFormatter=function (format, val){
if(typeof val=='number'){
if(!format){
format=$.jqplot.config.defaultTickFormatString;
}
return $.jqplot.sprintf(format, val);
}else{
return String(val);
}};
$.jqplot.PercentTickFormatter=function (format, val){
if(typeof val=='number'){
val=100 * val;
if(!format){
format=$.jqplot.config.defaultTickFormatString;
}
return $.jqplot.sprintf(format, val);
}else{
return String(val);
}};
$.jqplot.AxisTickRenderer.prototype.pack=function(){
};
$.jqplot.CanvasGridRenderer=function(){
this.shadowRenderer=new $.jqplot.ShadowRenderer();
};
$.jqplot.CanvasGridRenderer.prototype.init=function(options){
this._ctx;
$.extend(true, this, options);
var sopts={lineJoin:'miter', lineCap:'round', fill:false, isarc:false, angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, depth:this.shadowDepth, lineWidth:this.shadowWidth, closePath:false, strokeStyle:this.shadowColor};
this.renderer.shadowRenderer.init(sopts);
};
$.jqplot.CanvasGridRenderer.prototype.createElement=function(plot){
var elem;
if(this._elem){
if($.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){
elem=this._elem.get(0);
window.G_vmlCanvasManager.uninitElement(elem);
elem=null;
}
this._elem.emptyForce();
this._elem=null;
}
elem=plot.canvasManager.getCanvas();
var w=this._plotDimensions.width;
var h=this._plotDimensions.height;
elem.width=w;
elem.height=h;
this._elem=$(elem);
this._elem.addClass('jqplot-grid-canvas');
this._elem.css({ position: 'absolute', left: 0, top: 0 });
elem=plot.canvasManager.initCanvas(elem);
this._top=this._offsets.top;
this._bottom=h - this._offsets.bottom;
this._left=this._offsets.left;
this._right=w - this._offsets.right;
this._width=this._right - this._left;
this._height=this._bottom - this._top;
elem=null;
return this._elem;
};
$.jqplot.CanvasGridRenderer.prototype.draw=function(){
this._ctx=this._elem.get(0).getContext("2d");
var ctx=this._ctx;
var axes=this._axes;
ctx.save();
ctx.clearRect(0, 0, this._plotDimensions.width, this._plotDimensions.height);
ctx.fillStyle=this.backgroundColor||this.background;
ctx.fillRect(this._left, this._top, this._width, this._height);
ctx.save();
ctx.lineJoin='miter';
ctx.lineCap='butt';
ctx.lineWidth=this.gridLineWidth;
ctx.strokeStyle=this.gridLineColor;
var b, e, s, m;
var ax=['xaxis', 'yaxis', 'x2axis', 'y2axis'];
for (var i=4; i>0; i--){
var name=ax[i-1];
var axis=axes[name];
var ticks=axis._ticks;
var numticks=ticks.length;
if(axis.show){
if(axis.drawBaseline){
var bopts={};
if(axis.baselineWidth!==null){
bopts.lineWidth=axis.baselineWidth;
}
if(axis.baselineColor!==null){
bopts.strokeStyle=axis.baselineColor;
}
switch (name){
case 'xaxis':
drawLine (this._left, this._bottom, this._right, this._bottom, bopts);
break;
case 'yaxis':
drawLine (this._left, this._bottom, this._left, this._top, bopts);
break;
case 'x2axis':
drawLine (this._left, this._bottom, this._right, this._bottom, bopts);
break;
case 'y2axis':
drawLine (this._right, this._bottom, this._right, this._top, bopts);
break;
}}
for (var j=numticks; j>0; j--){
var t=ticks[j-1];
if(t.show){
var pos=Math.round(axis.u2p(t.value)) + 0.5;
switch (name){
case 'xaxis':
if(t.showGridline&&this.drawGridlines&&((!t.isMinorTick&&axis.drawMajorGridlines)||(t.isMinorTick&&axis.drawMinorGridlines))){
drawLine(pos, this._top, pos, this._bottom);
}
if(t.showMark&&t.mark&&((!t.isMinorTick&&axis.drawMajorTickMarks)||(t.isMinorTick&&axis.drawMinorTickMarks))){
s=t.markSize;
m=t.mark;
var pos=Math.round(axis.u2p(t.value)) + 0.5;
switch (m){
case 'outside':
b=this._bottom;
e=this._bottom+s;
break;
case 'inside':
b=this._bottom-s;
e=this._bottom;
break;
case 'cross':
b=this._bottom-s;
e=this._bottom+s;
break;
default:
b=this._bottom;
e=this._bottom+s;
break;
}
if(this.shadow){
this.renderer.shadowRenderer.draw(ctx, [[pos,b],[pos,e]], {lineCap:'butt', lineWidth:this.gridLineWidth, offset:this.gridLineWidth*0.75, depth:2, fill:false, closePath:false});
}
drawLine(pos, b, pos, e);
}
break;
case 'yaxis':
if(t.showGridline&&this.drawGridlines&&((!t.isMinorTick&&axis.drawMajorGridlines)||(t.isMinorTick&&axis.drawMinorGridlines))){
drawLine(this._right, pos, this._left, pos);
}
if(t.showMark&&t.mark&&((!t.isMinorTick&&axis.drawMajorTickMarks)||(t.isMinorTick&&axis.drawMinorTickMarks))){
s=t.markSize;
m=t.mark;
var pos=Math.round(axis.u2p(t.value)) + 0.5;
switch (m){
case 'outside':
b=this._left-s;
e=this._left;
break;
case 'inside':
b=this._left;
e=this._left+s;
break;
case 'cross':
b=this._left-s;
e=this._left+s;
break;
default:
b=this._left-s;
e=this._left;
break;
}
if(this.shadow){
this.renderer.shadowRenderer.draw(ctx, [[b, pos], [e, pos]], {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
}
drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
}
break;
case 'x2axis':
if(t.showGridline&&this.drawGridlines&&((!t.isMinorTick&&axis.drawMajorGridlines)||(t.isMinorTick&&axis.drawMinorGridlines))){
drawLine(pos, this._bottom, pos, this._top);
}
if(t.showMark&&t.mark&&((!t.isMinorTick&&axis.drawMajorTickMarks)||(t.isMinorTick&&axis.drawMinorTickMarks))){
s=t.markSize;
m=t.mark;
var pos=Math.round(axis.u2p(t.value)) + 0.5;
switch (m){
case 'outside':
b=this._top-s;
e=this._top;
break;
case 'inside':
b=this._top;
e=this._top+s;
break;
case 'cross':
b=this._top-s;
e=this._top+s;
break;
default:
b=this._top-s;
e=this._top;
break;
}
if(this.shadow){
this.renderer.shadowRenderer.draw(ctx, [[pos,b],[pos,e]], {lineCap:'butt', lineWidth:this.gridLineWidth, offset:this.gridLineWidth*0.75, depth:2, fill:false, closePath:false});
}
drawLine(pos, b, pos, e);
}
break;
case 'y2axis':
if(t.showGridline&&this.drawGridlines&&((!t.isMinorTick&&axis.drawMajorGridlines)||(t.isMinorTick&&axis.drawMinorGridlines))){
drawLine(this._left, pos, this._right, pos);
}
if(t.showMark&&t.mark&&((!t.isMinorTick&&axis.drawMajorTickMarks)||(t.isMinorTick&&axis.drawMinorTickMarks))){
s=t.markSize;
m=t.mark;
var pos=Math.round(axis.u2p(t.value)) + 0.5;
switch (m){
case 'outside':
b=this._right;
e=this._right+s;
break;
case 'inside':
b=this._right-s;
e=this._right;
break;
case 'cross':
b=this._right-s;
e=this._right+s;
break;
default:
b=this._right;
e=this._right+s;
break;
}
if(this.shadow){
this.renderer.shadowRenderer.draw(ctx, [[b, pos], [e, pos]], {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
}
drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
}
break;
default:
break;
}}
}
t=null;
}
axis=null;
ticks=null;
}
ax=['y3axis', 'y4axis', 'y5axis', 'y6axis', 'y7axis', 'y8axis', 'y9axis', 'yMidAxis'];
for (var i=7; i>0; i--){
var axis=axes[ax[i-1]];
var ticks=axis._ticks;
if(axis.show){
var tn=ticks[axis.numberTicks-1];
var t0=ticks[0];
var left=axis.getLeft();
var points=[[left, tn.getTop() + tn.getHeight()/2], [left, t0.getTop() + t0.getHeight()/2 + 1.0]];
if(this.shadow){
this.renderer.shadowRenderer.draw(ctx, points, {lineCap:'butt', fill:false, closePath:false});
}
drawLine(points[0][0], points[0][1], points[1][0], points[1][1], {lineCap:'butt', strokeStyle:axis.borderColor, lineWidth:axis.borderWidth});
for (var j=ticks.length; j>0; j--){
var t=ticks[j-1];
s=t.markSize;
m=t.mark;
var pos=Math.round(axis.u2p(t.value)) + 0.5;
if(t.showMark&&t.mark){
switch (m){
case 'outside':
b=left;
e=left+s;
break;
case 'inside':
b=left-s;
e=left;
break;
case 'cross':
b=left-s;
e=left+s;
break;
default:
b=left;
e=left+s;
break;
}
points=[[b,pos], [e,pos]];
if(this.shadow){
this.renderer.shadowRenderer.draw(ctx, points, {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
}
drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
}
t=null;
}
t0=null;
}
axis=null;
ticks=null;
}
ctx.restore();
function drawLine(bx, by, ex, ey, opts){
ctx.save();
opts=opts||{};
if(opts.lineWidth==null||opts.lineWidth!=0){
$.extend(true, ctx, opts);
ctx.beginPath();
ctx.moveTo(bx, by);
ctx.lineTo(ex, ey);
ctx.stroke();
ctx.restore();
}}
if(this.shadow){
var points=[[this._left, this._bottom], [this._right, this._bottom], [this._right, this._top]];
this.renderer.shadowRenderer.draw(ctx, points);
}
if(this.borderWidth!=0&&this.drawBorder){
drawLine (this._left, this._top, this._right, this._top, {lineCap:'round', strokeStyle:axes.x2axis.borderColor, lineWidth:axes.x2axis.borderWidth});
drawLine (this._right, this._top, this._right, this._bottom, {lineCap:'round', strokeStyle:axes.y2axis.borderColor, lineWidth:axes.y2axis.borderWidth});
drawLine (this._right, this._bottom, this._left, this._bottom, {lineCap:'round', strokeStyle:axes.xaxis.borderColor, lineWidth:axes.xaxis.borderWidth});
drawLine (this._left, this._bottom, this._left, this._top, {lineCap:'round', strokeStyle:axes.yaxis.borderColor, lineWidth:axes.yaxis.borderWidth});
}
ctx.restore();
ctx=null;
axes=null;
};
$.jqplot.DivTitleRenderer=function(){
};
$.jqplot.DivTitleRenderer.prototype.init=function(options){
$.extend(true, this, options);
};
$.jqplot.DivTitleRenderer.prototype.draw=function(){
if(this._elem){
this._elem.emptyForce();
this._elem=null;
}
var r=this.renderer;
var elem=document.createElement('div');
this._elem=$(elem);
this._elem.addClass('jqplot-title');
if(!this.text){
this.show=false;
this._elem.height(0);
this._elem.width(0);
}
else if(this.text){
var color;
if(this.color){
color=this.color;
}
else if(this.textColor){
color=this.textColor;
}
var styles={position:'absolute', top:'0px', left:'0px'};
if(this._plotWidth){
styles['width']=this._plotWidth+'px';
}
if(this.fontSize){
styles['fontSize']=this.fontSize;
}
if(typeof this.textAlign==='string'){
styles['textAlign']=this.textAlign;
}else{
styles['textAlign']='center';
}
if(color){
styles['color']=color;
}
if(this.paddingBottom){
styles['paddingBottom']=this.paddingBottom;
}
if(this.fontFamily){
styles['fontFamily']=this.fontFamily;
}
this._elem.css(styles);
if(this.escapeHtml){
this._elem.text(this.text);
}else{
this._elem.html(this.text);
}}
elem=null;
return this._elem;
};
$.jqplot.DivTitleRenderer.prototype.pack=function(){
};
var dotlen=0.1;
$.jqplot.LinePattern=function (ctx, pattern){
var defaultLinePatterns={
dotted: [ dotlen, $.jqplot.config.dotGapLength ],
dashed: [ $.jqplot.config.dashLength, $.jqplot.config.gapLength ],
solid: null
};
if(typeof pattern==='string'){
if(pattern[0]==='.'||pattern[0]==='-'){
var s=pattern;
pattern=[];
for (var i=0, imax=s.length; i<imax; i++){
if(s[i]==='.'){
pattern.push(dotlen);
}
else if(s[i]==='-'){
pattern.push($.jqplot.config.dashLength);
}else{
continue;
}
pattern.push($.jqplot.config.gapLength);
}}else{
pattern=defaultLinePatterns[pattern];
}}
if(!(pattern&&pattern.length)){
return ctx;
}
var patternIndex=0;
var patternDistance=pattern[0];
var px=0;
var py=0;
var pathx0=0;
var pathy0=0;
var moveTo=function (x, y){
ctx.moveTo(x, y);
px=x;
py=y;
pathx0=x;
pathy0=y;
};
var lineTo=function (x, y){
var scale=ctx.lineWidth;
var dx=x - px;
var dy=y - py;
var dist=Math.sqrt(dx*dx+dy*dy);
if((dist > 0)&&(scale > 0)){
dx /=dist;
dy /=dist;
while (true){
var dp=scale * patternDistance;
if(dp < dist){
px +=dp * dx;
py +=dp * dy;
if((patternIndex & 1)==0){
ctx.lineTo(px, py);
}else{
ctx.moveTo(px, py);
}
dist -=dp;
patternIndex++;
if(patternIndex >=pattern.length){
patternIndex=0;
}
patternDistance=pattern[patternIndex];
}else{
px=x;
py=y;
if((patternIndex & 1)==0){
ctx.lineTo(px, py);
}else{
ctx.moveTo(px, py);
}
patternDistance -=dist / scale;
break;
}}
}};
var beginPath=function (){
ctx.beginPath();
};
var closePath=function (){
lineTo(pathx0, pathy0);
};
return {
moveTo: moveTo,
lineTo: lineTo,
beginPath: beginPath,
closePath: closePath
};};
$.jqplot.LineRenderer=function(){
this.shapeRenderer=new $.jqplot.ShapeRenderer();
this.shadowRenderer=new $.jqplot.ShadowRenderer();
};
$.jqplot.LineRenderer.prototype.init=function(options, plot){
options=options||{};
this._type='line';
this.renderer.animation={
show: false,
direction: 'left',
speed: 2500,
_supported: true
};
this.renderer.smooth=false;
this.renderer.tension=null;
this.renderer.constrainSmoothing=true;
this.renderer._smoothedData=[];
this.renderer._smoothedPlotData=[];
this.renderer._hiBandGridData=[];
this.renderer._lowBandGridData=[];
this.renderer._hiBandSmoothedData=[];
this.renderer._lowBandSmoothedData=[];
this.renderer.bandData=[];
this.renderer.bands={
show: false,
hiData: [],
lowData: [],
color: this.color,
showLines: false,
fill: true,
fillColor: null,
_min: null,
_max: null,
interval: '3%'
};
var lopts={highlightMouseOver: options.highlightMouseOver, highlightMouseDown: options.highlightMouseDown, highlightColor: options.highlightColor};
delete (options.highlightMouseOver);
delete (options.highlightMouseDown);
delete (options.highlightColor);
$.extend(true, this.renderer, options);
this.renderer.options=options;
if(this.renderer.bandData.length > 1&&(!options.bands||options.bands.show==null)){
this.renderer.bands.show=true;
}
else if(options.bands&&options.bands.show==null&&options.bands.interval!=null){
this.renderer.bands.show=true;
}
if(this.fill){
this.renderer.bands.show=false;
}
if(this.renderer.bands.show){
this.renderer.initBands.call(this, this.renderer.options, plot);
}
if(this._stack){
this.renderer.smooth=false;
}
var opts={lineJoin:this.lineJoin, lineCap:this.lineCap, fill:this.fill, isarc:false, strokeStyle:this.color, fillStyle:this.fillColor, lineWidth:this.lineWidth, linePattern:this.linePattern, closePath:this.fill};
this.renderer.shapeRenderer.init(opts);
var shadow_offset=options.shadowOffset;
if(shadow_offset==null){
if(this.lineWidth > 2.5){
shadow_offset=1.25 * (1 + (Math.atan((this.lineWidth/2.5))/0.785398163 - 1)*0.6);
}else{
shadow_offset=1.25 * Math.atan((this.lineWidth/2.5))/0.785398163;
}}
var sopts={lineJoin:this.lineJoin, lineCap:this.lineCap, fill:this.fill, isarc:false, angle:this.shadowAngle, offset:shadow_offset, alpha:this.shadowAlpha, depth:this.shadowDepth, lineWidth:this.lineWidth, linePattern:this.linePattern, closePath:this.fill};
this.renderer.shadowRenderer.init(sopts);
this._areaPoints=[];
this._boundingBox=[[],[]];
if(!this.isTrendline&&this.fill||this.renderer.bands.show){
this.highlightMouseOver=true;
this.highlightMouseDown=false;
this.highlightColor=null;
if(lopts.highlightMouseDown&&lopts.highlightMouseOver==null){
lopts.highlightMouseOver=false;
}
$.extend(true, this, {highlightMouseOver: lopts.highlightMouseOver, highlightMouseDown: lopts.highlightMouseDown, highlightColor: lopts.highlightColor});
if(!this.highlightColor){
var fc=(this.renderer.bands.show) ? this.renderer.bands.fillColor:this.fillColor;
this.highlightColor=$.jqplot.computeHighlightColors(fc);
}
if(this.highlighter){
this.highlighter.show=false;
}}
if(!this.isTrendline&&plot){
plot.plugins.lineRenderer={};
plot.postInitHooks.addOnce(postInit);
plot.postDrawHooks.addOnce(postPlotDraw);
plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
}};
$.jqplot.LineRenderer.prototype.initBands=function(options, plot){
var bd=options.bandData||[];
var bands=this.renderer.bands;
bands.hiData=[];
bands.lowData=[];
var data=this.data;
bands._max=null;
bands._min=null;
if(bd.length==2){
if($.isArray(bd[0][0])){
var p;
var bdminidx=0, bdmaxidx=0;
for (var i=0, l=bd[0].length; i<l; i++){
p=bd[0][i];
if((p[1]!=null&&p[1] > bands._max)||bands._max==null){
bands._max=p[1];
}
if((p[1]!=null&&p[1] < bands._min)||bands._min==null){
bands._min=p[1];
}}
for (var i=0, l=bd[1].length; i<l; i++){
p=bd[1][i];
if((p[1]!=null&&p[1] > bands._max)||bands._max==null){
bands._max=p[1];
bdmaxidx=1;
}
if((p[1]!=null&&p[1] < bands._min)||bands._min==null){
bands._min=p[1];
bdminidx=1;
}}
if(bdmaxidx===bdminidx){
bands.show=false;
}
bands.hiData=bd[bdmaxidx];
bands.lowData=bd[bdminidx];
}
else if(bd[0].length===data.length&&bd[1].length===data.length){
var hi=(bd[0][0] > bd[1][0]) ? 0:1;
var low=(hi) ? 0:1;
for (var i=0, l=data.length; i < l; i++){
bands.hiData.push([data[i][0], bd[hi][i]]);
bands.lowData.push([data[i][0], bd[low][i]]);
}}else{
bands.show=false;
}}
else if(bd.length > 2&&!$.isArray(bd[0][0])){
var hi=(bd[0][0] > bd[0][1]) ? 0:1;
var low=(hi) ? 0:1;
for (var i=0, l=bd.length; i<l; i++){
bands.hiData.push([data[i][0], bd[i][hi]]);
bands.lowData.push([data[i][0], bd[i][low]]);
}}else{
var intrv=bands.interval;
var a=null;
var b=null;
var afunc=null;
var bfunc=null;
if($.isArray(intrv)){
a=intrv[0];
b=intrv[1];
}else{
a=intrv;
}
if(isNaN(a)){
if(a.charAt(a.length - 1)==='%'){
afunc='multiply';
a=parseFloat(a)/100 + 1;
}}else{
a=parseFloat(a);
afunc='add';
}
if(b!==null&&isNaN(b)){
if(b.charAt(b.length - 1)==='%'){
bfunc='multiply';
b=parseFloat(b)/100 + 1;
}}
else if(b!==null){
b=parseFloat(b);
bfunc='add';
}
if(a!==null){
if(b===null){
b=-a;
bfunc=afunc;
if(bfunc==='multiply'){
b +=2;
}}
if(a < b){
var temp=a;
a=b;
b=temp;
temp=afunc;
afunc=bfunc;
bfunc=temp;
}
for (var i=0, l=data.length; i < l; i++){
switch (afunc){
case 'add':
bands.hiData.push([data[i][0], data[i][1] + a]);
break;
case 'multiply':
bands.hiData.push([data[i][0], data[i][1] * a]);
break;
}
switch (bfunc){
case 'add':
bands.lowData.push([data[i][0], data[i][1] + b]);
break;
case 'multiply':
bands.lowData.push([data[i][0], data[i][1] * b]);
break;
}}
}else{
bands.show=false;
}}
var hd=bands.hiData;
var ld=bands.lowData;
for (var i=0, l=hd.length; i<l; i++){
if((hd[i][1]!=null&&hd[i][1] > bands._max)||bands._max==null){
bands._max=hd[i][1];
}}
for (var i=0, l=ld.length; i<l; i++){
if((ld[i][1]!=null&&ld[i][1] < bands._min)||bands._min==null){
bands._min=ld[i][1];
}}
if(bands.fillColor===null){
var c=$.jqplot.getColorComponents(bands.color);
c[3]=c[3] * 0.5;
bands.fillColor='rgba(' + c[0] +', '+ c[1] +', '+ c[2] +', '+ c[3] + ')';
}};
function getSteps (d, f){
return (3.4182054+f) * Math.pow(d, -0.3534992);
}
function computeSteps (d1, d2){
var s=Math.sqrt(Math.pow((d2[0]- d1[0]), 2) + Math.pow ((d2[1] - d1[1]), 2));
return 5.7648 * Math.log(s) + 7.4456;
}
function tanh (x){
var a=(Math.exp(2*x) - 1) / (Math.exp(2*x) + 1);
return a;
}
function computeConstrainedSmoothedData (gd){
var smooth=this.renderer.smooth;
var dim=this.canvas.getWidth();
var xp=this._xaxis.series_p2u;
var yp=this._yaxis.series_p2u;
var steps=null;
var _steps=null;
var dist=gd.length/dim;
var _smoothedData=[];
var _smoothedPlotData=[];
if(!isNaN(parseFloat(smooth))){
steps=parseFloat(smooth);
}else{
steps=getSteps(dist, 0.5);
}
var yy=[];
var xx=[];
for (var i=0, l=gd.length; i<l; i++){
yy.push(gd[i][1]);
xx.push(gd[i][0]);
}
function dxx(x1, x0){
if(x1 - x0==0){
return Math.pow(10,10);
}else{
return x1 - x0;
}}
var A, B, C, D;
var nmax=gd.length - 1;
for (var num=1, gdl=gd.length; num<gdl; num++){
var gxx=[];
var ggxx=[];
for (var j=0; j < 2; j++){
var i=num - 1 + j;
if(i==0||i==nmax){
gxx[j]=Math.pow(10, 10);
}
else if(yy[i+1] - yy[i]==0||yy[i] - yy[i-1]==0){
gxx[j]=0;
}
else if(((xx[i+1] - xx[i]) / (yy[i+1] - yy[i]) + (xx[i] - xx[i-1]) / (yy[i] - yy[i-1]))==0){
gxx[j]=0;
}
else if((yy[i+1] - yy[i]) * (yy[i] - yy[i-1]) < 0){
gxx[j]=0;
}else{
gxx[j]=2 / (dxx(xx[i + 1], xx[i]) / (yy[i + 1] - yy[i]) + dxx(xx[i], xx[i - 1]) / (yy[i] - yy[i - 1]));
}}
if(num==1){
gxx[0]=3 / 2 * (yy[1] - yy[0]) / dxx(xx[1], xx[0]) - gxx[1] / 2;
}
else if(num==nmax){
gxx[1]=3 / 2 * (yy[nmax] - yy[nmax - 1]) / dxx(xx[nmax], xx[nmax - 1]) - gxx[0] / 2;
}
ggxx[0]=-2 * (gxx[1] + 2 * gxx[0]) / dxx(xx[num], xx[num - 1]) + 6 * (yy[num] - yy[num - 1]) / Math.pow(dxx(xx[num], xx[num - 1]), 2);
ggxx[1]=2 * (2 * gxx[1] + gxx[0]) / dxx(xx[num], xx[num - 1]) - 6 * (yy[num] - yy[num - 1]) / Math.pow(dxx(xx[num], xx[num - 1]), 2);
D=1 / 6 * (ggxx[1] - ggxx[0]) / dxx(xx[num], xx[num - 1]);
C=1 / 2 * (xx[num] * ggxx[0] - xx[num - 1] * ggxx[1]) / dxx(xx[num], xx[num - 1]);
B=(yy[num] - yy[num - 1] - C * (Math.pow(xx[num], 2) - Math.pow(xx[num - 1], 2)) - D * (Math.pow(xx[num], 3) - Math.pow(xx[num - 1], 3))) / dxx(xx[num], xx[num - 1]);
A=yy[num - 1] - B * xx[num - 1] - C * Math.pow(xx[num - 1], 2) - D * Math.pow(xx[num - 1], 3);
var increment=(xx[num] - xx[num - 1]) / steps;
var temp, tempx;
for (var j=0, l=steps; j < l; j++){
temp=[];
tempx=xx[num - 1] + j * increment;
temp.push(tempx);
temp.push(A + B * tempx + C * Math.pow(tempx, 2) + D * Math.pow(tempx, 3));
_smoothedData.push(temp);
_smoothedPlotData.push([xp(temp[0]), yp(temp[1])]);
}}
_smoothedData.push(gd[i]);
_smoothedPlotData.push([xp(gd[i][0]), yp(gd[i][1])]);
return [_smoothedData, _smoothedPlotData];
}
function computeHermiteSmoothedData (gd){
var smooth=this.renderer.smooth;
var tension=this.renderer.tension;
var dim=this.canvas.getWidth();
var xp=this._xaxis.series_p2u;
var yp=this._yaxis.series_p2u;
var steps=null;
var _steps=null;
var a=null;
var a1=null;
var a2=null;
var slope=null;
var slope2=null;
var temp=null;
var t, s, h1, h2, h3, h4;
var TiX, TiY, Ti1X, Ti1Y;
var pX, pY, p;
var sd=[];
var spd=[];
var dist=gd.length/dim;
var min, max, stretch, scale, shift;
var _smoothedData=[];
var _smoothedPlotData=[];
if(!isNaN(parseFloat(smooth))){
steps=parseFloat(smooth);
}else{
steps=getSteps(dist, 0.5);
}
if(!isNaN(parseFloat(tension))){
tension=parseFloat(tension);
}
for (var i=0, l=gd.length-1; i < l; i++){
if(tension===null){
slope=Math.abs((gd[i+1][1] - gd[i][1]) / (gd[i+1][0] - gd[i][0]));
min=0.3;
max=0.6;
stretch=(max - min)/2.0;
scale=2.5;
shift=-1.4;
temp=slope/scale + shift;
a1=stretch * tanh(temp) - stretch * tanh(shift) + min;
if(i > 0){
slope2=Math.abs((gd[i][1] - gd[i-1][1]) / (gd[i][0] - gd[i-1][0]));
}
temp=slope2/scale + shift;
a2=stretch * tanh(temp) - stretch * tanh(shift) + min;
a=(a1 + a2)/2.0;
}else{
a=tension;
}
for (t=0; t < steps; t++){
s=t / steps;
h1=(1 + 2*s)*Math.pow((1-s),2);
h2=s*Math.pow((1-s),2);
h3=Math.pow(s,2)*(3-2*s);
h4=Math.pow(s,2)*(s-1);
if(gd[i-1]){
TiX=a * (gd[i+1][0] - gd[i-1][0]);
TiY=a * (gd[i+1][1] - gd[i-1][1]);
}else{
TiX=a * (gd[i+1][0] - gd[i][0]);
TiY=a * (gd[i+1][1] - gd[i][1]);
}
if(gd[i+2]){
Ti1X=a * (gd[i+2][0] - gd[i][0]);
Ti1Y=a * (gd[i+2][1] - gd[i][1]);
}else{
Ti1X=a * (gd[i+1][0] - gd[i][0]);
Ti1Y=a * (gd[i+1][1] - gd[i][1]);
}
pX=h1*gd[i][0] + h3*gd[i+1][0] + h2*TiX + h4*Ti1X;
pY=h1*gd[i][1] + h3*gd[i+1][1] + h2*TiY + h4*Ti1Y;
p=[pX, pY];
_smoothedData.push(p);
_smoothedPlotData.push([xp(pX), yp(pY)]);
}}
_smoothedData.push(gd[l]);
_smoothedPlotData.push([xp(gd[l][0]), yp(gd[l][1])]);
return [_smoothedData, _smoothedPlotData];
}
$.jqplot.LineRenderer.prototype.setGridData=function(plot){
var xp=this._xaxis.series_u2p;
var yp=this._yaxis.series_u2p;
var data=this._plotData;
var pdata=this._prevPlotData;
this.gridData=[];
this._prevGridData=[];
this.renderer._smoothedData=[];
this.renderer._smoothedPlotData=[];
this.renderer._hiBandGridData=[];
this.renderer._lowBandGridData=[];
this.renderer._hiBandSmoothedData=[];
this.renderer._lowBandSmoothedData=[];
var bands=this.renderer.bands;
var hasNull=false;
for (var i=0, l=data.length; i < l; i++){
if(data[i][0]!=null&&data[i][1]!=null){
this.gridData.push([xp.call(this._xaxis, data[i][0]), yp.call(this._yaxis, data[i][1])]);
}
else if(data[i][0]==null){
hasNull=true;
this.gridData.push([null, yp.call(this._yaxis, data[i][1])]);
}
else if(data[i][1]==null){
hasNull=true;
this.gridData.push([xp.call(this._xaxis, data[i][0]), null]);
}
if(pdata[i]!=null&&pdata[i][0]!=null&&pdata[i][1]!=null){
this._prevGridData.push([xp.call(this._xaxis, pdata[i][0]), yp.call(this._yaxis, pdata[i][1])]);
}
else if(pdata[i]!=null&&pdata[i][0]==null){
this._prevGridData.push([null, yp.call(this._yaxis, pdata[i][1])]);
}
else if(pdata[i]!=null&&pdata[i][0]!=null&&pdata[i][1]==null){
this._prevGridData.push([xp.call(this._xaxis, pdata[i][0]), null]);
}}
if(hasNull){
this.renderer.smooth=false;
if(this._type==='line'){
bands.show=false;
}}
if(this._type==='line'&&bands.show){
for (var i=0, l=bands.hiData.length; i<l; i++){
this.renderer._hiBandGridData.push([xp.call(this._xaxis, bands.hiData[i][0]), yp.call(this._yaxis, bands.hiData[i][1])]);
}
for (var i=0, l=bands.lowData.length; i<l; i++){
this.renderer._lowBandGridData.push([xp.call(this._xaxis, bands.lowData[i][0]), yp.call(this._yaxis, bands.lowData[i][1])]);
}}
if(this._type==='line'&&this.renderer.smooth&&this.gridData.length > 2){
var ret;
if(this.renderer.constrainSmoothing){
ret=computeConstrainedSmoothedData.call(this, this.gridData);
this.renderer._smoothedData=ret[0];
this.renderer._smoothedPlotData=ret[1];
if(bands.show){
ret=computeConstrainedSmoothedData.call(this, this.renderer._hiBandGridData);
this.renderer._hiBandSmoothedData=ret[0];
ret=computeConstrainedSmoothedData.call(this, this.renderer._lowBandGridData);
this.renderer._lowBandSmoothedData=ret[0];
}
ret=null;
}else{
ret=computeHermiteSmoothedData.call(this, this.gridData);
this.renderer._smoothedData=ret[0];
this.renderer._smoothedPlotData=ret[1];
if(bands.show){
ret=computeHermiteSmoothedData.call(this, this.renderer._hiBandGridData);
this.renderer._hiBandSmoothedData=ret[0];
ret=computeHermiteSmoothedData.call(this, this.renderer._lowBandGridData);
this.renderer._lowBandSmoothedData=ret[0];
}
ret=null;
}}
};
$.jqplot.LineRenderer.prototype.makeGridData=function(data, plot){
var xp=this._xaxis.series_u2p;
var yp=this._yaxis.series_u2p;
var gd=[];
var pgd=[];
this.renderer._smoothedData=[];
this.renderer._smoothedPlotData=[];
this.renderer._hiBandGridData=[];
this.renderer._lowBandGridData=[];
this.renderer._hiBandSmoothedData=[];
this.renderer._lowBandSmoothedData=[];
var bands=this.renderer.bands;
var hasNull=false;
for (var i=0; i<data.length; i++){
if(data[i][0]!=null&&data[i][1]!=null){
if(this.step&&i>0){
gd.push([xp.call(this._xaxis, data[i][0]), yp.call(this._yaxis, data[i-1][1])]);
}
gd.push([xp.call(this._xaxis, data[i][0]), yp.call(this._yaxis, data[i][1])]);
}
else if(data[i][0]==null){
hasNull=true;
gd.push([null, yp.call(this._yaxis, data[i][1])]);
}
else if(data[i][1]==null){
hasNull=true;
gd.push([xp.call(this._xaxis, data[i][0]), null]);
}}
if(hasNull){
this.renderer.smooth=false;
if(this._type==='line'){
bands.show=false;
}}
if(this._type==='line'&&bands.show){
for (var i=0, l=bands.hiData.length; i<l; i++){
this.renderer._hiBandGridData.push([xp.call(this._xaxis, bands.hiData[i][0]), yp.call(this._yaxis, bands.hiData[i][1])]);
}
for (var i=0, l=bands.lowData.length; i<l; i++){
this.renderer._lowBandGridData.push([xp.call(this._xaxis, bands.lowData[i][0]), yp.call(this._yaxis, bands.lowData[i][1])]);
}}
if(this._type==='line'&&this.renderer.smooth&&gd.length > 2){
var ret;
if(this.renderer.constrainSmoothing){
ret=computeConstrainedSmoothedData.call(this, gd);
this.renderer._smoothedData=ret[0];
this.renderer._smoothedPlotData=ret[1];
if(bands.show){
ret=computeConstrainedSmoothedData.call(this, this.renderer._hiBandGridData);
this.renderer._hiBandSmoothedData=ret[0];
ret=computeConstrainedSmoothedData.call(this, this.renderer._lowBandGridData);
this.renderer._lowBandSmoothedData=ret[0];
}
ret=null;
}else{
ret=computeHermiteSmoothedData.call(this, gd);
this.renderer._smoothedData=ret[0];
this.renderer._smoothedPlotData=ret[1];
if(bands.show){
ret=computeHermiteSmoothedData.call(this, this.renderer._hiBandGridData);
this.renderer._hiBandSmoothedData=ret[0];
ret=computeHermiteSmoothedData.call(this, this.renderer._lowBandGridData);
this.renderer._lowBandSmoothedData=ret[0];
}
ret=null;
}}
return gd;
};
$.jqplot.LineRenderer.prototype.draw=function(ctx, gd, options, plot){
var i;
var opts=$.extend(true, {}, options);
var shadow=(opts.shadow!=undefined) ? opts.shadow:this.shadow;
var showLine=(opts.showLine!=undefined) ? opts.showLine:this.showLine;
var fill=(opts.fill!=undefined) ? opts.fill:this.fill;
var fillAndStroke=(opts.fillAndStroke!=undefined) ? opts.fillAndStroke:this.fillAndStroke;
var xmin, ymin, xmax, ymax;
ctx.save();
if(gd.length){
if(showLine){
if(fill){
if(this.fillToZero){
var negativeColor=this.negativeColor;
if(! this.useNegativeColors){
negativeColor=opts.fillStyle;
}
var isnegative=false;
var posfs=opts.fillStyle;
if(fillAndStroke){
var fasgd=gd.slice(0);
}
if(this.index==0||!this._stack){
var tempgd=[];
var pd=(this.renderer.smooth) ? this.renderer._smoothedPlotData:this._plotData;
this._areaPoints=[];
var pyzero=this._yaxis.series_u2p(this.fillToValue);
var pxzero=this._xaxis.series_u2p(this.fillToValue);
opts.closePath=true;
if(this.fillAxis=='y'){
tempgd.push([gd[0][0], pyzero]);
this._areaPoints.push([gd[0][0], pyzero]);
for (var i=0; i<gd.length-1; i++){
tempgd.push(gd[i]);
this._areaPoints.push(gd[i]);
if(pd[i][1] * pd[i+1][1] <=0){
if(pd[i][1] < 0){
isnegative=true;
opts.fillStyle=negativeColor;
}else{
isnegative=false;
opts.fillStyle=posfs;
}
var xintercept=gd[i][0] + (gd[i+1][0] - gd[i][0]) * (pyzero-gd[i][1])/(gd[i+1][1] - gd[i][1]);
tempgd.push([xintercept, pyzero]);
this._areaPoints.push([xintercept, pyzero]);
if(shadow){
this.renderer.shadowRenderer.draw(ctx, tempgd, opts);
}
this.renderer.shapeRenderer.draw(ctx, tempgd, opts);
tempgd=[[xintercept, pyzero]];
}}
if(pd[gd.length-1][1] < 0){
isnegative=true;
opts.fillStyle=negativeColor;
}else{
isnegative=false;
opts.fillStyle=posfs;
}
tempgd.push(gd[gd.length-1]);
this._areaPoints.push(gd[gd.length-1]);
tempgd.push([gd[gd.length-1][0], pyzero]);
this._areaPoints.push([gd[gd.length-1][0], pyzero]);
}
if(shadow){
this.renderer.shadowRenderer.draw(ctx, tempgd, opts);
}
this.renderer.shapeRenderer.draw(ctx, tempgd, opts);
}else{
var prev=this._prevGridData;
for (var i=prev.length; i>0; i--){
gd.push(prev[i-1]);
}
if(shadow){
this.renderer.shadowRenderer.draw(ctx, gd, opts);
}
this._areaPoints=gd;
this.renderer.shapeRenderer.draw(ctx, gd, opts);
}}else{
if(fillAndStroke){
var fasgd=gd.slice(0);
}
if(this.index==0||!this._stack){
var gridymin=ctx.canvas.height;
gd.unshift([gd[0][0], gridymin]);
var len=gd.length;
gd.push([gd[len - 1][0], gridymin]);
}else{
var prev=this._prevGridData;
for (var i=prev.length; i>0; i--){
gd.push(prev[i-1]);
}}
this._areaPoints=gd;
if(shadow){
this.renderer.shadowRenderer.draw(ctx, gd, opts);
}
this.renderer.shapeRenderer.draw(ctx, gd, opts);
}
if(fillAndStroke){
var fasopts=$.extend(true, {}, opts, {fill:false, closePath:false});
this.renderer.shapeRenderer.draw(ctx, fasgd, fasopts);
if(this.markerRenderer.show){
if(this.renderer.smooth){
fasgd=this.gridData;
}
for (i=0; i<fasgd.length; i++){
this.markerRenderer.draw(fasgd[i][0], fasgd[i][1], ctx, opts.markerOptions);
}}
}}else{
if(this.renderer.bands.show){
var bdat;
var bopts=$.extend(true, {}, opts);
if(this.renderer.bands.showLines){
bdat=(this.renderer.smooth) ? this.renderer._hiBandSmoothedData:this.renderer._hiBandGridData;
this.renderer.shapeRenderer.draw(ctx, bdat, opts);
bdat=(this.renderer.smooth) ? this.renderer._lowBandSmoothedData:this.renderer._lowBandGridData;
this.renderer.shapeRenderer.draw(ctx, bdat, bopts);
}
if(this.renderer.bands.fill){
if(this.renderer.smooth){
bdat=this.renderer._hiBandSmoothedData.concat(this.renderer._lowBandSmoothedData.reverse());
}else{
bdat=this.renderer._hiBandGridData.concat(this.renderer._lowBandGridData.reverse());
}
this._areaPoints=bdat;
bopts.closePath=true;
bopts.fill=true;
bopts.fillStyle=this.renderer.bands.fillColor;
this.renderer.shapeRenderer.draw(ctx, bdat, bopts);
}}
if(shadow){
this.renderer.shadowRenderer.draw(ctx, gd, opts);
}
this.renderer.shapeRenderer.draw(ctx, gd, opts);
}}
var xmin=xmax=ymin=ymax=null;
for (i=0; i<this._areaPoints.length; i++){
var p=this._areaPoints[i];
if(xmin > p[0]||xmin==null){
xmin=p[0];
}
if(ymax < p[1]||ymax==null){
ymax=p[1];
}
if(xmax < p[0]||xmax==null){
xmax=p[0];
}
if(ymin > p[1]||ymin==null){
ymin=p[1];
}}
if(this.type==='line'&&this.renderer.bands.show){
ymax=this._yaxis.series_u2p(this.renderer.bands._min);
ymin=this._yaxis.series_u2p(this.renderer.bands._max);
}
this._boundingBox=[[xmin, ymax], [xmax, ymin]];
if(this.markerRenderer.show&&!fill){
if(this.renderer.smooth){
gd=this.gridData;
}
for (i=0; i<gd.length; i++){
if(gd[i][0]!=null&&gd[i][1]!=null){
this.markerRenderer.draw(gd[i][0], gd[i][1], ctx, opts.markerOptions);
}}
}}
ctx.restore();
};
$.jqplot.LineRenderer.prototype.drawShadow=function(ctx, gd, options){
};
function postInit(target, data, options){
for (var i=0; i<this.series.length; i++){
if(this.series[i].renderer.constructor==$.jqplot.LineRenderer){
if(this.series[i].highlightMouseOver){
this.series[i].highlightMouseDown=false;
}}
}}
function postPlotDraw(){
if(this.plugins.lineRenderer&&this.plugins.lineRenderer.highlightCanvas){
this.plugins.lineRenderer.highlightCanvas.resetCanvas();
this.plugins.lineRenderer.highlightCanvas=null;
}
this.plugins.lineRenderer.highlightedSeriesIndex=null;
this.plugins.lineRenderer.highlightCanvas=new $.jqplot.GenericCanvas();
this.eventCanvas._elem.before(this.plugins.lineRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-lineRenderer-highlight-canvas', this._plotDimensions, this));
this.plugins.lineRenderer.highlightCanvas.setContext();
this.eventCanvas._elem.bind('mouseleave', {plot:this}, function (ev){ unhighlight(ev.data.plot); });
}
function highlight (plot, sidx, pidx, points){
var s=plot.series[sidx];
var canvas=plot.plugins.lineRenderer.highlightCanvas;
canvas._ctx.clearRect(0,0,canvas._ctx.canvas.width, canvas._ctx.canvas.height);
s._highlightedPoint=pidx;
plot.plugins.lineRenderer.highlightedSeriesIndex=sidx;
var opts={fillStyle: s.highlightColor};
if(s.type==='line'&&s.renderer.bands.show){
opts.fill=true;
opts.closePath=true;
}
s.renderer.shapeRenderer.draw(canvas._ctx, points, opts);
canvas=null;
}
function unhighlight (plot){
var canvas=plot.plugins.lineRenderer.highlightCanvas;
canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
for (var i=0; i<plot.series.length; i++){
plot.series[i]._highlightedPoint=null;
}
plot.plugins.lineRenderer.highlightedSeriesIndex=null;
plot.target.trigger('jqplotDataUnhighlight');
canvas=null;
}
function handleMove(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
var evt1=jQuery.Event('jqplotDataMouseOver');
evt1.pageX=ev.pageX;
evt1.pageY=ev.pageY;
plot.target.trigger(evt1, ins);
if(plot.series[ins[0]].highlightMouseOver&&!(ins[0]==plot.plugins.lineRenderer.highlightedSeriesIndex)){
var evt=jQuery.Event('jqplotDataHighlight');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
plot.target.trigger(evt, ins);
highlight (plot, neighbor.seriesIndex, neighbor.pointIndex, neighbor.points);
}}
else if(neighbor==null){
unhighlight (plot);
}}
function handleMouseDown(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
if(plot.series[ins[0]].highlightMouseDown&&!(ins[0]==plot.plugins.lineRenderer.highlightedSeriesIndex)){
var evt=jQuery.Event('jqplotDataHighlight');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
plot.target.trigger(evt, ins);
highlight (plot, neighbor.seriesIndex, neighbor.pointIndex, neighbor.points);
}}
else if(neighbor==null){
unhighlight (plot);
}}
function handleMouseUp(ev, gridpos, datapos, neighbor, plot){
var idx=plot.plugins.lineRenderer.highlightedSeriesIndex;
if(idx!=null&&plot.series[idx].highlightMouseDown){
unhighlight(plot);
}}
function handleClick(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
var evt=jQuery.Event('jqplotDataClick');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
plot.target.trigger(evt, ins);
}}
function handleRightClick(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
var idx=plot.plugins.lineRenderer.highlightedSeriesIndex;
if(idx!=null&&plot.series[idx].highlightMouseDown){
unhighlight(plot);
}
var evt=jQuery.Event('jqplotDataRightClick');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
plot.target.trigger(evt, ins);
}}
$.jqplot.LinearAxisRenderer=function(){
};
$.jqplot.LinearAxisRenderer.prototype.init=function(options){
this.breakPoints=null;
this.breakTickLabel="&asymp;";
this.drawBaseline=true;
this.baselineWidth=null;
this.baselineColor=null;
this.forceTickAt0=false;
this.forceTickAt100=false;
this.tickInset=0;
this.minorTicks=0;
this.alignTicks=false;
this._autoFormatString='';
this._overrideFormatString=false;
this._scalefact=1.0;
$.extend(true, this, options);
if(this.breakPoints){
if(!$.isArray(this.breakPoints)){
this.breakPoints=null;
}
else if(this.breakPoints.length < 2||this.breakPoints[1] <=this.breakPoints[0]){
this.breakPoints=null;
}}
if(this.numberTicks!=null&&this.numberTicks < 2){
this.numberTicks=2;
}
this.resetDataBounds();
};
$.jqplot.LinearAxisRenderer.prototype.draw=function(ctx, plot){
if(this.show){
this.renderer.createTicks.call(this, plot);
var dim=0;
var temp;
if(this._elem){
this._elem.emptyForce();
this._elem=null;
}
this._elem=$(document.createElement('div'));
this._elem.addClass('jqplot-axis jqplot-'+this.name);
this._elem.css('position', 'absolute');
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 elem=this._label.draw(ctx, plot);
elem.appendTo(this._elem);
elem=null;
}
var t=this._ticks;
var tick;
for (var i=0; i<t.length; i++){
tick=t[i];
if(tick.show&&tick.showLabel&&(!tick.isMinorTick||this.showMinorTicks)){
this._elem.append(tick.draw(ctx, plot));
}}
tick=null;
t=null;
}
return this._elem;
};
$.jqplot.LinearAxisRenderer.prototype.reset=function(){
this.min=this._options.min;
this.max=this._options.max;
this.tickInterval=this._options.tickInterval;
this.numberTicks=this._options.numberTicks;
this._autoFormatString='';
if(this._overrideFormatString&&this.tickOptions&&this.tickOptions.formatString){
this.tickOptions.formatString='';
}};
$.jqplot.LinearAxisRenderer.prototype.set=function(){
var dim=0;
var temp;
var w=0;
var h=0;
var lshow=(this._label==null) ? false:this._label.show;
if(this.show){
var t=this._ticks;
var tick;
for (var i=0; i<t.length; i++){
tick=t[i];
if(!tick._breakTick&&tick.show&&tick.showLabel&&(!tick.isMinorTick||this.showMinorTicks)){
if(this.name=='xaxis'||this.name=='x2axis'){
temp=tick._elem.outerHeight(true);
}else{
temp=tick._elem.outerWidth(true);
}
if(temp > dim){
dim=temp;
}}
}
tick=null;
t=null;
if(lshow){
w=this._label._elem.outerWidth(true);
h=this._label._elem.outerHeight(true);
}
if(this.name=='xaxis'){
dim=dim + h;
this._elem.css({'height':dim+'px', left:'0px', bottom:'0px'});
}
else if(this.name=='x2axis'){
dim=dim + h;
this._elem.css({'height':dim+'px', left:'0px', top:'0px'});
}
else if(this.name=='yaxis'){
dim=dim + w;
this._elem.css({'width':dim+'px', left:'0px', top:'0px'});
if(lshow&&this._label.constructor==$.jqplot.AxisLabelRenderer){
this._label._elem.css('width', w+'px');
}}else{
dim=dim + w;
this._elem.css({'width':dim+'px', right:'0px', top:'0px'});
if(lshow&&this._label.constructor==$.jqplot.AxisLabelRenderer){
this._label._elem.css('width', w+'px');
}}
}};
$.jqplot.LinearAxisRenderer.prototype.createTicks=function(plot){
var ticks=this._ticks;
var userTicks=this.ticks;
var name=this.name;
var db=this._dataBounds;
var dim=(this.name.charAt(0)==='x') ? this._plotDimensions.width:this._plotDimensions.height;
var interval;
var min, max;
var pos1, pos2;
var tt, i;
var userMin=this.min;
var userMax=this.max;
var userNT=this.numberTicks;
var userTI=this.tickInterval;
var threshold=30;
this._scalefact=(Math.max(dim, threshold+1) - threshold)/300.0;
if(userTicks.length){
for (i=0; i<userTicks.length; i++){
var ut=userTicks[i];
var t=new this.tickRenderer(this.tickOptions);
if($.isArray(ut)){
t.value=ut[0];
if(this.breakPoints){
if(ut[0]==this.breakPoints[0]){
t.label=this.breakTickLabel;
t._breakTick=true;
t.showGridline=false;
t.showMark=false;
}
else if(ut[0] > this.breakPoints[0]&&ut[0] <=this.breakPoints[1]){
t.show=false;
t.showGridline=false;
t.label=ut[1];
}else{
t.label=ut[1];
}}else{
t.label=ut[1];
}
t.setTick(ut[0], this.name);
this._ticks.push(t);
}
else if($.isPlainObject(ut)){
$.extend(true, t, ut);
t.axis=this.name;
this._ticks.push(t);
}else{
t.value=ut;
if(this.breakPoints){
if(ut==this.breakPoints[0]){
t.label=this.breakTickLabel;
t._breakTick=true;
t.showGridline=false;
t.showMark=false;
}
else if(ut > this.breakPoints[0]&&ut <=this.breakPoints[1]){
t.show=false;
t.showGridline=false;
}}
t.setTick(ut, this.name);
this._ticks.push(t);
}}
this.numberTicks=userTicks.length;
this.min=this._ticks[0].value;
this.max=this._ticks[this.numberTicks-1].value;
this.tickInterval=(this.max - this.min) / (this.numberTicks - 1);
}else{
if(name=='xaxis'||name=='x2axis'){
dim=this._plotDimensions.width;
}else{
dim=this._plotDimensions.height;
}
var _numberTicks=this.numberTicks;
if(this.alignTicks){
if(this.name==='x2axis'&&plot.axes.xaxis.show){
_numberTicks=plot.axes.xaxis.numberTicks;
}
else if(this.name.charAt(0)==='y'&&this.name!=='yaxis'&&this.name!=='yMidAxis'&&plot.axes.yaxis.show){
_numberTicks=plot.axes.yaxis.numberTicks;
}}
min=((this.min!=null) ? this.min:db.min);
max=((this.max!=null) ? this.max:db.max);
var range=max - min;
var rmin, rmax;
var temp;
if(this.tickOptions==null||!this.tickOptions.formatString){
this._overrideFormatString=true;
}
if(this.min==null||this.max==null&&this.tickInterval==null&&!this.autoscale){
if(this.forceTickAt0){
if(min > 0){
min=0;
}
if(max < 0){
max=0;
}}
if(this.forceTickAt100){
if(min > 100){
min=100;
}
if(max < 100){
max=100;
}}
var keepMin=false,
keepMax=false;
if(this.min!=null){
keepMin=true;
}
else if(this.max!=null){
keepMax=true;
}
var ret=$.jqplot.LinearTickGenerator(min, max, this._scalefact, _numberTicks, keepMin, keepMax);
var tumin=(this.min!=null) ? min:min + range*(this.padMin - 1);
var tumax=(this.max!=null) ? max:max - range*(this.padMax - 1);
if(min <tumin||max > tumax){
tumin=(this.min!=null) ? min:min - range*(this.padMin - 1);
tumax=(this.max!=null) ? max:max + range*(this.padMax - 1);
ret=$.jqplot.LinearTickGenerator(tumin, tumax, this._scalefact, _numberTicks, keepMin, keepMax);
}
this.min=ret[0];
this.max=ret[1];
this.numberTicks=ret[2];
this._autoFormatString=ret[3];
this.tickInterval=ret[4];
}else{
if(min==max){
var adj=0.05;
if(min > 0){
adj=Math.max(Math.log(min)/Math.LN10, 0.05);
}
min -=adj;
max +=adj;
}
if(this.autoscale&&this.min==null&&this.max==null){
var rrange, ti, margin;
var forceMinZero=false;
var forceZeroLine=false;
var intervals={min:null, max:null, average:null, stddev:null};
for (var i=0; i<this._series.length; i++){
var s=this._series[i];
var faname=(s.fillAxis=='x') ? s._xaxis.name:s._yaxis.name;
if(this.name==faname){
var vals=s._plotValues[s.fillAxis];
var vmin=vals[0];
var vmax=vals[0];
for (var j=1; j<vals.length; j++){
if(vals[j] < vmin){
vmin=vals[j];
}
else if(vals[j] > vmax){
vmax=vals[j];
}}
var dp=(vmax - vmin) / vmax;
if(s.renderer.constructor==$.jqplot.BarRenderer){
if(vmin >=0&&(s.fillToZero||dp > 0.1)){
forceMinZero=true;
}else{
forceMinZero=false;
if(s.fill&&s.fillToZero&&vmin < 0&&vmax > 0){
forceZeroLine=true;
}else{
forceZeroLine=false;
}}
}
else if(s.fill){
if(vmin >=0&&(s.fillToZero||dp > 0.1)){
forceMinZero=true;
}
else if(vmin < 0&&vmax > 0&&s.fillToZero){
forceMinZero=false;
forceZeroLine=true;
}else{
forceMinZero=false;
forceZeroLine=false;
}}
else if(vmin < 0){
forceMinZero=false;
}}
}
if(forceMinZero){
this.numberTicks=2 + Math.ceil((dim-(this.tickSpacing-1))/this.tickSpacing);
this.min=0;
userMin=0;
ti=max/(this.numberTicks-1);
temp=Math.pow(10, Math.abs(Math.floor(Math.log(ti)/Math.LN10)));
if(ti/temp==parseInt(ti/temp, 10)){
ti +=temp;
}
this.tickInterval=Math.ceil(ti/temp) * temp;
this.max=this.tickInterval * (this.numberTicks - 1);
}
else if(forceZeroLine){
this.numberTicks=2 + Math.ceil((dim-(this.tickSpacing-1))/this.tickSpacing);
var ntmin=Math.ceil(Math.abs(min)/range*(this.numberTicks-1));
var ntmax=this.numberTicks - 1  - ntmin;
ti=Math.max(Math.abs(min/ntmin), Math.abs(max/ntmax));
temp=Math.pow(10, Math.abs(Math.floor(Math.log(ti)/Math.LN10)));
this.tickInterval=Math.ceil(ti/temp) * temp;
this.max=this.tickInterval * ntmax;
this.min=-this.tickInterval * ntmin;
}else{
if(this.numberTicks==null){
if(this.tickInterval){
this.numberTicks=3 + Math.ceil(range / this.tickInterval);
}else{
this.numberTicks=2 + Math.ceil((dim-(this.tickSpacing-1))/this.tickSpacing);
}}
if(this.tickInterval==null){
ti=range/(this.numberTicks - 1);
if(ti < 1){
temp=Math.pow(10, Math.abs(Math.floor(Math.log(ti)/Math.LN10)));
}else{
temp=1;
}
this.tickInterval=Math.ceil(ti*temp*this.pad)/temp;
}else{
temp=1 / this.tickInterval;
}
rrange=this.tickInterval * (this.numberTicks - 1);
margin=(rrange - range)/2;
if(this.min==null){
this.min=Math.floor(temp*(min-margin))/temp;
}
if(this.max==null){
this.max=this.min + rrange;
}}
var sf=$.jqplot.getSignificantFigures(this.tickInterval);
var fstr;
if(sf.digitsLeft >=sf.significantDigits){
fstr='%d';
}else{
var temp=Math.max(0, 5 - sf.digitsLeft);
temp=Math.min(temp, sf.digitsRight);
fstr='%.'+ temp + 'f';
}
this._autoFormatString=fstr;
}else{
rmin=(this.min!=null) ? this.min:min - range*(this.padMin - 1);
rmax=(this.max!=null) ? this.max:max + range*(this.padMax - 1);
range=rmax - rmin;
if(this.numberTicks==null){
if(this.tickInterval!=null){
this.numberTicks=Math.ceil((rmax - rmin)/this.tickInterval)+1;
}
else if(dim > 100){
this.numberTicks=parseInt(3+(dim-100)/75, 10);
}else{
this.numberTicks=2;
}}
if(this.tickInterval==null){
this.tickInterval=range / (this.numberTicks-1);
}
if(this.max==null){
rmax=rmin + this.tickInterval*(this.numberTicks - 1);
}
if(this.min==null){
rmin=rmax - this.tickInterval*(this.numberTicks - 1);
}
var sf=$.jqplot.getSignificantFigures(this.tickInterval);
var fstr;
if(sf.digitsLeft >=sf.significantDigits){
fstr='%d';
}else{
var temp=Math.max(0, 5 - sf.digitsLeft);
temp=Math.min(temp, sf.digitsRight);
fstr='%.'+ temp + 'f';
}
this._autoFormatString=fstr;
this.min=rmin;
this.max=rmax;
}
if(this.renderer.constructor==$.jqplot.LinearAxisRenderer&&this._autoFormatString==''){
range=this.max - this.min;
var temptick=new this.tickRenderer(this.tickOptions);
var fs=temptick.formatString||$.jqplot.config.defaultTickFormatString;
var fs=fs.match($.jqplot.sprintf.regex)[0];
var precision=0;
if(fs){
if(fs.search(/[fFeEgGpP]/) > -1){
var m=fs.match(/\%\.(\d{0,})?[eEfFgGpP]/);
if(m){
precision=parseInt(m[1], 10);
}else{
precision=6;
}}
else if(fs.search(/[di]/) > -1){
precision=0;
}
var fact=Math.pow(10, -precision);
if(this.tickInterval < fact){
if(userNT==null&&userTI==null){
this.tickInterval=fact;
if(userMax==null&&userMin==null){
this.min=Math.floor(this._dataBounds.min/fact) * fact;
if(this.min==this._dataBounds.min){
this.min=this._dataBounds.min - this.tickInterval;
}
this.max=Math.ceil(this._dataBounds.max/fact) * fact;
if(this.max==this._dataBounds.max){
this.max=this._dataBounds.max + this.tickInterval;
}
var n=(this.max - this.min)/this.tickInterval;
n=n.toFixed(11);
n=Math.ceil(n);
this.numberTicks=n + 1;
}
else if(userMax==null){
var n=(this._dataBounds.max - this.min) / this.tickInterval;
n=n.toFixed(11);
this.numberTicks=Math.ceil(n) + 2;
this.max=this.min + this.tickInterval * (this.numberTicks-1);
}
else if(userMin==null){
var n=(this.max - this._dataBounds.min) / this.tickInterval;
n=n.toFixed(11);
this.numberTicks=Math.ceil(n) + 2;
this.min=this.max - this.tickInterval * (this.numberTicks-1);
}else{
this.numberTicks=Math.ceil((userMax - userMin)/this.tickInterval) + 1;
this.min=Math.floor(userMin*Math.pow(10, precision))/Math.pow(10, precision);
this.max=Math.ceil(userMax*Math.pow(10, precision))/Math.pow(10, precision);
this.numberTicks=Math.ceil((this.max - this.min)/this.tickInterval) + 1;
}}
}}
}}
if(this._overrideFormatString&&this._autoFormatString!=''){
this.tickOptions=this.tickOptions||{};
this.tickOptions.formatString=this._autoFormatString;
}
var t, to;
for (var i=0; i<this.numberTicks; i++){
tt=this.min + i * this.tickInterval;
t=new this.tickRenderer(this.tickOptions);
t.setTick(tt, this.name);
this._ticks.push(t);
if(i < this.numberTicks - 1){
for (var j=0; j<this.minorTicks; j++){
tt +=this.tickInterval/(this.minorTicks+1);
to=$.extend(true, {}, this.tickOptions, {name:this.name, value:tt, label:'', isMinorTick:true});
t=new this.tickRenderer(to);
this._ticks.push(t);
}}
t=null;
}}
if(this.tickInset){
this.min=this.min - this.tickInset * this.tickInterval;
this.max=this.max + this.tickInset * this.tickInterval;
}
ticks=null;
};
$.jqplot.LinearAxisRenderer.prototype.resetTickValues=function(opts){
if($.isArray(opts)&&opts.length==this._ticks.length){
var t;
for (var i=0; i<opts.length; i++){
t=this._ticks[i];
t.value=opts[i];
t.label=t.formatter(t.formatString, opts[i]);
t.label=t.prefix + t.label;
t._elem.html(t.label);
}
t=null;
this.min=$.jqplot.arrayMin(opts);
this.max=$.jqplot.arrayMax(opts);
this.pack();
}};
$.jqplot.LinearAxisRenderer.prototype.pack=function(pos, offsets){
pos=pos||{};
offsets=offsets||this._offsets;
var ticks=this._ticks;
var max=this.max;
var min=this.min;
var offmax=offsets.max;
var offmin=offsets.min;
var lshow=(this._label==null) ? false:this._label.show;
for (var p in pos){
this._elem.css(p, pos[p]);
}
this._offsets=offsets;
var pixellength=offmax - offmin;
var unitlength=max - min;
if(this.breakPoints){
unitlength=unitlength - this.breakPoints[1] + this.breakPoints[0];
this.p2u=function(p){
return (p - offmin) * unitlength / pixellength + min;
};
this.u2p=function(u){
if(u > this.breakPoints[0]&&u < this.breakPoints[1]){
u=this.breakPoints[0];
}
if(u <=this.breakPoints[0]){
return (u - min) * pixellength / unitlength + offmin;
}else{
return (u - this.breakPoints[1] + this.breakPoints[0] - min) * pixellength / unitlength + offmin;
}};
if(this.name.charAt(0)=='x'){
this.series_u2p=function(u){
if(u > this.breakPoints[0]&&u < this.breakPoints[1]){
u=this.breakPoints[0];
}
if(u <=this.breakPoints[0]){
return (u - min) * pixellength / unitlength;
}else{
return (u - this.breakPoints[1] + this.breakPoints[0] - min) * pixellength / unitlength;
}};
this.series_p2u=function(p){
return p * unitlength / pixellength + min;
};}else{
this.series_u2p=function(u){
if(u > this.breakPoints[0]&&u < this.breakPoints[1]){
u=this.breakPoints[0];
}
if(u >=this.breakPoints[1]){
return (u - max) * pixellength / unitlength;
}else{
return (u + this.breakPoints[1] - this.breakPoints[0] - max) * pixellength / unitlength;
}};
this.series_p2u=function(p){
return p * unitlength / pixellength + max;
};}}else{
this.p2u=function(p){
return (p - offmin) * unitlength / pixellength + min;
};
this.u2p=function(u){
return (u - min) * pixellength / unitlength + offmin;
};
if(this.name=='xaxis'||this.name=='x2axis'){
this.series_u2p=function(u){
return (u - min) * pixellength / unitlength;
};
this.series_p2u=function(p){
return p * unitlength / pixellength + min;
};}else{
this.series_u2p=function(u){
return (u - max) * pixellength / unitlength;
};
this.series_p2u=function(p){
return p * unitlength / pixellength + max;
};}}
if(this.show){
if(this.name=='xaxis'||this.name=='x2axis'){
for (var i=0; i<ticks.length; i++){
var t=ticks[i];
if(t.show&&t.showLabel){
var shim;
if(t.constructor==$.jqplot.CanvasAxisTickRenderer&&t.angle){
var temp=(this.name=='xaxis') ? 1:-1;
switch (t.labelPosition){
case 'auto':
if(temp * t.angle < 0){
shim=-t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
}else{
shim=-t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
}
break;
case 'end':
shim=-t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
break;
case 'start':
shim=-t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
break;
case 'middle':
shim=-t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
break;
default:
shim=-t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
break;
}}else{
shim=-t.getWidth()/2;
}
var val=this.u2p(t.value) + shim + 'px';
t._elem.css('left', val);
t.pack();
}}
if(lshow){
var w=this._label._elem.outerWidth(true);
this._label._elem.css('left', offmin + pixellength/2 - w/2 + 'px');
if(this.name=='xaxis'){
this._label._elem.css('bottom', '0px');
}else{
this._label._elem.css('top', '0px');
}
this._label.pack();
}}else{
for (var i=0; i<ticks.length; i++){
var t=ticks[i];
if(t.show&&t.showLabel){
var shim;
if(t.constructor==$.jqplot.CanvasAxisTickRenderer&&t.angle){
var temp=(this.name=='yaxis') ? 1:-1;
switch (t.labelPosition){
case 'auto':
case 'end':
if(temp * t.angle < 0){
shim=-t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
}else{
shim=-t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
}
break;
case 'start':
if(t.angle > 0){
shim=-t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
}else{
shim=-t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
}
break;
case 'middle':
shim=-t.getHeight()/2;
break;
default:
shim=-t.getHeight()/2;
break;
}}else{
shim=-t.getHeight()/2;
}
var val=this.u2p(t.value) + shim + 'px';
t._elem.css('top', val);
t.pack();
}}
if(lshow){
var h=this._label._elem.outerHeight(true);
this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
if(this.name=='yaxis'){
this._label._elem.css('left', '0px');
}else{
this._label._elem.css('right', '0px');
}
this._label.pack();
}}
}
ticks=null;
};
function bestFormatString (interval){
var fstr;
interval=Math.abs(interval);
if(interval >=10){
fstr='%d';
}
else if(interval > 1){
if(interval===parseInt(interval, 10)){
fstr='%d';
}else{
fstr='%.1f';
}}else{
var expv=-Math.floor(Math.log(interval)/Math.LN10);
fstr='%.' + expv + 'f';
}
return fstr;
}
var _factors=[0.1, 0.2, 0.3, 0.4, 0.5, 0.8, 1, 2, 3, 4, 5];
var _getLowerFactor=function(f){
var i=_factors.indexOf(f);
if(i > 0){
return _factors[i-1];
}else{
return _factors[_factors.length - 1] / 100;
}};
var _getHigherFactor=function(f){
var i=_factors.indexOf(f);
if(i < _factors.length-1){
return _factors[i+1];
}else{
return _factors[0] * 100;
}};
function bestConstrainedInterval(min, max, nttarget){
var low=Math.floor(nttarget/2);
var hi=Math.ceil(nttarget*1.5);
var badness=Number.MAX_VALUE;
var r=(max - min);
var temp;
var sd;
var bestNT;
var gsf=$.jqplot.getSignificantFigures;
var fsd;
var fs;
var currentNT;
var bestPrec;
for (var i=0, l=hi-low+1; i<l; i++){
currentNT=low + i;
temp=r/(currentNT-1);
sd=gsf(temp);
temp=Math.abs(nttarget - currentNT) + sd.digitsRight;
if(temp < badness){
badness=temp;
bestNT=currentNT;
bestPrec=sd.digitsRight;
}
else if(temp===badness){
if(sd.digitsRight < bestPrec){
bestNT=currentNT;
bestPrec=sd.digitsRight;
}}
}
fsd=Math.max(bestPrec, Math.max(gsf(min).digitsRight, gsf(max).digitsRight));
if(fsd===0){
fs='%d';
}else{
fs='%.' + fsd + 'f';
}
temp=r / (bestNT - 1);
return [min, max, bestNT, fs, temp];
}
function bestInterval(range, numberTicks){
numberTicks=numberTicks||7;
var minimum=range / (numberTicks - 1);
var magnitude=Math.pow(10, Math.floor(Math.log(minimum) / Math.LN10));
var residual=minimum / magnitude;
var interval;
if(magnitude < 1){
if(residual > 5){
interval=10 * magnitude;
}
else if(residual > 2){
interval=5 * magnitude;
}
else if(residual > 1){
interval=2 * magnitude;
}else{
interval=magnitude;
}}else{
if(residual > 5){
interval=10 * magnitude;
}
else if(residual > 4){
interval=5 * magnitude;
}
else if(residual > 3){
interval=4 * magnitude;
}
else if(residual > 2){
interval=3 * magnitude;
}
else if(residual > 1){
interval=2 * magnitude;
}else{
interval=magnitude;
}}
return interval;
}
function bestLinearInterval(range, scalefact){
scalefact=scalefact||1;
var expv=Math.floor(Math.log(range)/Math.LN10);
var magnitude=Math.pow(10, expv);
var f=range / magnitude;
var fact;
f=f/scalefact;
if(f<=0.38){
fact=0.1;
}
else if(f<=1.6){
fact=0.2;
}
else if(f<=4.0){
fact=0.5;
}
else if(f<=8.0){
fact=1.0;
}
else if(f<=16.0){
fact=2;
}else{
fact=5;
}
return fact*magnitude;
}
function bestLinearComponents(range, scalefact){
var expv=Math.floor(Math.log(range)/Math.LN10);
var magnitude=Math.pow(10, expv);
var f=range / magnitude;
var interval;
var fact;
f=f/scalefact;
if(f<=0.38){
fact=0.1;
}
else if(f<=1.6){
fact=0.2;
}
else if(f<=4.0){
fact=0.5;
}
else if(f<=8.0){
fact=1.0;
}
else if(f<=16.0){
fact=2;
}else{
fact=5;
}
interval=fact * magnitude;
return [interval, fact, magnitude];
}
$.jqplot.LinearTickGenerator=function(axis_min, axis_max, scalefact, numberTicks, keepMin, keepMax){
keepMin=(keepMin===null) ? false:keepMin;
keepMax=(keepMax===null||keepMin) ? false:keepMax;
if(axis_min===axis_max){
axis_max=(axis_max) ? 0:1;
}
scalefact=scalefact||1.0;
if(axis_max < axis_min){
var a=axis_max;
axis_max=axis_min;
axis_min=a;
}
var r=[];
var ss=bestLinearInterval(axis_max - axis_min, scalefact);
var gsf=$.jqplot.getSignificantFigures;
if(numberTicks==null){
if(!keepMin&&!keepMax){
r[0]=Math.floor(axis_min / ss) * ss;
r[1]=Math.ceil(axis_max / ss) * ss;
r[2]=Math.round((r[1]-r[0])/ss+1.0);
r[3]=bestFormatString(ss);
r[4]=ss;
}
else if(keepMin){
r[0]=axis_min;
r[2]=Math.ceil((axis_max - axis_min) / ss + 1.0);
r[1]=axis_min + (r[2] - 1) * ss;
var digitsMin=gsf(axis_min).digitsRight;
var digitsSS=gsf(ss).digitsRight;
if(digitsMin < digitsSS){
r[3]=bestFormatString(ss);
}else{
r[3]='%.' + digitsMin + 'f';
}
r[4]=ss;
}
else if(keepMax){
r[1]=axis_max;
r[2]=Math.ceil((axis_max - axis_min) / ss + 1.0);
r[0]=axis_max - (r[2] - 1) * ss;
var digitsMax=gsf(axis_max).digitsRight;
var digitsSS=gsf(ss).digitsRight;
if(digitsMax < digitsSS){
r[3]=bestFormatString(ss);
}else{
r[3]='%.' + digitsMax + 'f';
}
r[4]=ss;
}}else{
var tempr=[];
tempr[0]=Math.floor(axis_min / ss) * ss;
tempr[1]=Math.ceil(axis_max / ss) * ss;
tempr[2]=Math.round((tempr[1]-tempr[0])/ss+1.0);
tempr[3]=bestFormatString(ss);
tempr[4]=ss;
if(tempr[2]===numberTicks){
r=tempr;
}else{
var newti=bestInterval(tempr[1] - tempr[0], numberTicks);
r[0]=tempr[0];
r[2]=numberTicks;
r[4]=newti;
r[3]=bestFormatString(newti);
r[1]=r[0] + (r[2] - 1) * r[4];
}}
return r;
};
$.jqplot.LinearTickGenerator.bestLinearInterval=bestLinearInterval;
$.jqplot.LinearTickGenerator.bestInterval=bestInterval;
$.jqplot.LinearTickGenerator.bestLinearComponents=bestLinearComponents;
$.jqplot.LinearTickGenerator.bestConstrainedInterval=bestConstrainedInterval;
$.jqplot.MarkerRenderer=function(options){
this.show=true;
this.style='filledCircle';
this.lineWidth=2;
this.size=9.0;
this.color='#666666';
this.shadow=true;
this.shadowAngle=45;
this.shadowOffset=1;
this.shadowDepth=3;
this.shadowAlpha='0.07';
this.shadowRenderer=new $.jqplot.ShadowRenderer();
this.shapeRenderer=new $.jqplot.ShapeRenderer();
$.extend(true, this, options);
};
$.jqplot.MarkerRenderer.prototype.init=function(options){
$.extend(true, this, options);
var sdopt={angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, lineWidth:this.lineWidth, depth:this.shadowDepth, closePath:true};
if(this.style.indexOf('filled')!=-1){
sdopt.fill=true;
}
if(this.style.indexOf('ircle')!=-1){
sdopt.isarc=true;
sdopt.closePath=false;
}
this.shadowRenderer.init(sdopt);
var shopt={fill:false, isarc:false, strokeStyle:this.color, fillStyle:this.color, lineWidth:this.lineWidth, closePath:true};
if(this.style.indexOf('filled')!=-1){
shopt.fill=true;
}
if(this.style.indexOf('ircle')!=-1){
shopt.isarc=true;
shopt.closePath=false;
}
this.shapeRenderer.init(shopt);
};
$.jqplot.MarkerRenderer.prototype.drawDiamond=function(x, y, ctx, fill, options){
var stretch=1.2;
var dx=this.size/2/stretch;
var dy=this.size/2*stretch;
var points=[[x-dx, y], [x, y+dy], [x+dx, y], [x, y-dy]];
if(this.shadow){
this.shadowRenderer.draw(ctx, points);
}
this.shapeRenderer.draw(ctx, points, options);
};
$.jqplot.MarkerRenderer.prototype.drawPlus=function(x, y, ctx, fill, options){
var stretch=1.0;
var dx=this.size/2*stretch;
var dy=this.size/2*stretch;
var points1=[[x, y-dy], [x, y+dy]];
var points2=[[x+dx, y], [x-dx, y]];
var opts=$.extend(true, {}, this.options, {closePath:false});
if(this.shadow){
this.shadowRenderer.draw(ctx, points1, {closePath:false});
this.shadowRenderer.draw(ctx, points2, {closePath:false});
}
this.shapeRenderer.draw(ctx, points1, opts);
this.shapeRenderer.draw(ctx, points2, opts);
};
$.jqplot.MarkerRenderer.prototype.drawX=function(x, y, ctx, fill, options){
var stretch=1.0;
var dx=this.size/2*stretch;
var dy=this.size/2*stretch;
var opts=$.extend(true, {}, this.options, {closePath:false});
var points1=[[x-dx, y-dy], [x+dx, y+dy]];
var points2=[[x-dx, y+dy], [x+dx, y-dy]];
if(this.shadow){
this.shadowRenderer.draw(ctx, points1, {closePath:false});
this.shadowRenderer.draw(ctx, points2, {closePath:false});
}
this.shapeRenderer.draw(ctx, points1, opts);
this.shapeRenderer.draw(ctx, points2, opts);
};
$.jqplot.MarkerRenderer.prototype.drawDash=function(x, y, ctx, fill, options){
var stretch=1.0;
var dx=this.size/2*stretch;
var dy=this.size/2*stretch;
var points=[[x-dx, y], [x+dx, y]];
if(this.shadow){
this.shadowRenderer.draw(ctx, points);
}
this.shapeRenderer.draw(ctx, points, options);
};
$.jqplot.MarkerRenderer.prototype.drawLine=function(p1, p2, ctx, fill, options){
var points=[p1, p2];
if(this.shadow){
this.shadowRenderer.draw(ctx, points);
}
this.shapeRenderer.draw(ctx, points, options);
};
$.jqplot.MarkerRenderer.prototype.drawSquare=function(x, y, ctx, fill, options){
var stretch=1.0;
var dx=this.size/2/stretch;
var dy=this.size/2*stretch;
var points=[[x-dx, y-dy], [x-dx, y+dy], [x+dx, y+dy], [x+dx, y-dy]];
if(this.shadow){
this.shadowRenderer.draw(ctx, points);
}
this.shapeRenderer.draw(ctx, points, options);
};
$.jqplot.MarkerRenderer.prototype.drawCircle=function(x, y, ctx, fill, options){
var radius=this.size/2;
var end=2*Math.PI;
var points=[x, y, radius, 0, end, true];
if(this.shadow){
this.shadowRenderer.draw(ctx, points);
}
this.shapeRenderer.draw(ctx, points, options);
};
$.jqplot.MarkerRenderer.prototype.draw=function(x, y, ctx, options){
options=options||{};
if(options.show==null||options.show!=false){
if(options.color&&!options.fillStyle){
options.fillStyle=options.color;
}
if(options.color&&!options.strokeStyle){
options.strokeStyle=options.color;
}
switch (this.style){
case 'diamond':
this.drawDiamond(x,y,ctx, false, options);
break;
case 'filledDiamond':
this.drawDiamond(x,y,ctx, true, options);
break;
case 'circle':
this.drawCircle(x,y,ctx, false, options);
break;
case 'filledCircle':
this.drawCircle(x,y,ctx, true, options);
break;
case 'square':
this.drawSquare(x,y,ctx, false, options);
break;
case 'filledSquare':
this.drawSquare(x,y,ctx, true, options);
break;
case 'x':
this.drawX(x,y,ctx, true, options);
break;
case 'plus':
this.drawPlus(x,y,ctx, true, options);
break;
case 'dash':
this.drawDash(x,y,ctx, true, options);
break;
case 'line':
this.drawLine(x, y, ctx, false, options);
break;
default:
this.drawDiamond(x,y,ctx, false, options);
break;
}}
};
$.jqplot.ShadowRenderer=function(options){
this.angle=45;
this.offset=1;
this.alpha=0.07;
this.lineWidth=1.5;
this.lineJoin='miter';
this.lineCap='round';
this.closePath=false;
this.fill=false;
this.depth=3;
this.strokeStyle='rgba(0,0,0,0.1)';
this.isarc=false;
$.extend(true, this, options);
};
$.jqplot.ShadowRenderer.prototype.init=function(options){
$.extend(true, this, options);
};
$.jqplot.ShadowRenderer.prototype.draw=function(ctx, points, options){
ctx.save();
var opts=(options!=null) ? options:{};
var fill=(opts.fill!=null) ? opts.fill:this.fill;
var fillRect=(opts.fillRect!=null) ? opts.fillRect:this.fillRect;
var closePath=(opts.closePath!=null) ? opts.closePath:this.closePath;
var offset=(opts.offset!=null) ? opts.offset:this.offset;
var alpha=(opts.alpha!=null) ? opts.alpha:this.alpha;
var depth=(opts.depth!=null) ? opts.depth:this.depth;
var isarc=(opts.isarc!=null) ? opts.isarc:this.isarc;
var linePattern=(opts.linePattern!=null) ? opts.linePattern:this.linePattern;
ctx.lineWidth=(opts.lineWidth!=null) ? opts.lineWidth:this.lineWidth;
ctx.lineJoin=(opts.lineJoin!=null) ? opts.lineJoin:this.lineJoin;
ctx.lineCap=(opts.lineCap!=null) ? opts.lineCap:this.lineCap;
ctx.strokeStyle=opts.strokeStyle||this.strokeStyle||'rgba(0,0,0,'+alpha+')';
ctx.fillStyle=opts.fillStyle||this.fillStyle||'rgba(0,0,0,'+alpha+')';
for (var j=0; j<depth; j++){
var ctxPattern=$.jqplot.LinePattern(ctx, linePattern);
ctx.translate(Math.cos(this.angle*Math.PI/180)*offset, Math.sin(this.angle*Math.PI/180)*offset);
ctxPattern.beginPath();
if(isarc){
ctx.arc(points[0], points[1], points[2], points[3], points[4], true);
}
else if(fillRect){
if(fillRect){
ctx.fillRect(points[0], points[1], points[2], points[3]);
}}
else if(points&&points.length){
var move=true;
for (var i=0; i<points.length; i++){
if(points[i][0]!=null&&points[i][1]!=null){
if(move){
ctxPattern.moveTo(points[i][0], points[i][1]);
move=false;
}else{
ctxPattern.lineTo(points[i][0], points[i][1]);
}}else{
move=true;
}}
}
if(closePath){
ctxPattern.closePath();
}
if(fill){
ctx.fill();
}else{
ctx.stroke();
}}
ctx.restore();
};
$.jqplot.ShapeRenderer=function(options){
this.lineWidth=1.5;
this.linePattern='solid';
this.lineJoin='miter';
this.lineCap='round';
this.closePath=false;
this.fill=false;
this.isarc=false;
this.fillRect=false;
this.strokeRect=false;
this.clearRect=false;
this.strokeStyle='#999999';
this.fillStyle='#999999';
$.extend(true, this, options);
};
$.jqplot.ShapeRenderer.prototype.init=function(options){
$.extend(true, this, options);
};
$.jqplot.ShapeRenderer.prototype.draw=function(ctx, points, options){
ctx.save();
var opts=(options!=null) ? options:{};
var fill=(opts.fill!=null) ? opts.fill:this.fill;
var closePath=(opts.closePath!=null) ? opts.closePath:this.closePath;
var fillRect=(opts.fillRect!=null) ? opts.fillRect:this.fillRect;
var strokeRect=(opts.strokeRect!=null) ? opts.strokeRect:this.strokeRect;
var clearRect=(opts.clearRect!=null) ? opts.clearRect:this.clearRect;
var isarc=(opts.isarc!=null) ? opts.isarc:this.isarc;
var linePattern=(opts.linePattern!=null) ? opts.linePattern:this.linePattern;
var ctxPattern=$.jqplot.LinePattern(ctx, linePattern);
ctx.lineWidth=opts.lineWidth||this.lineWidth;
ctx.lineJoin=opts.lineJoin||this.lineJoin;
ctx.lineCap=opts.lineCap||this.lineCap;
ctx.strokeStyle=(opts.strokeStyle||opts.color)||this.strokeStyle;
ctx.fillStyle=opts.fillStyle||this.fillStyle;
ctx.beginPath();
if(isarc){
ctx.arc(points[0], points[1], points[2], points[3], points[4], true);
if(closePath){
ctx.closePath();
}
if(fill){
ctx.fill();
}else{
ctx.stroke();
}
ctx.restore();
return;
}
else if(clearRect){
ctx.clearRect(points[0], points[1], points[2], points[3]);
ctx.restore();
return;
}
else if(fillRect||strokeRect){
if(fillRect){
ctx.fillRect(points[0], points[1], points[2], points[3]);
}
if(strokeRect){
ctx.strokeRect(points[0], points[1], points[2], points[3]);
ctx.restore();
return;
}}
else if(points&&points.length){
var move=true;
for (var i=0; i<points.length; i++){
if(points[i][0]!=null&&points[i][1]!=null){
if(move){
ctxPattern.moveTo(points[i][0], points[i][1]);
move=false;
}else{
ctxPattern.lineTo(points[i][0], points[i][1]);
}}else{
move=true;
}}
if(closePath){
ctxPattern.closePath();
}
if(fill){
ctx.fill();
}else{
ctx.stroke();
}}
ctx.restore();
};
$.jqplot.TableLegendRenderer=function(){
};
$.jqplot.TableLegendRenderer.prototype.init=function(options){
$.extend(true, this, options);
};
$.jqplot.TableLegendRenderer.prototype.addrow=function (label, color, pad, reverse){
var rs=(pad) ? this.rowSpacing+'px':'0px';
var tr;
var td;
var elem;
var div0;
var div1;
elem=document.createElement('tr');
tr=$(elem);
tr.addClass('jqplot-table-legend');
elem=null;
if(reverse){
tr.prependTo(this._elem);
}else{
tr.appendTo(this._elem);
}
if(this.showSwatches){
td=$(document.createElement('td'));
td.addClass('jqplot-table-legend jqplot-table-legend-swatch');
td.css({textAlign: 'center', paddingTop: rs});
div0=$(document.createElement('div'));
div0.addClass('jqplot-table-legend-swatch-outline');
div1=$(document.createElement('div'));
div1.addClass('jqplot-table-legend-swatch');
div1.css({backgroundColor: color, borderColor: color});
tr.append(td.append(div0.append(div1)));
}
if(this.showLabels){
td=$(document.createElement('td'));
td.addClass('jqplot-table-legend jqplot-table-legend-label');
td.css('paddingTop', rs);
tr.append(td);
if(this.escapeHtml){
td.text(label);
}else{
td.html(label);
}}
td=null;
div0=null;
div1=null;
tr=null;
elem=null;
};
$.jqplot.TableLegendRenderer.prototype.draw=function(){
if(this._elem){
this._elem.emptyForce();
this._elem=null;
}
if(this.show){
var series=this._series;
var elem=document.createElement('table');
this._elem=$(elem);
this._elem.addClass('jqplot-table-legend');
var ss={position:'absolute'};
if(this.background){
ss['background']=this.background;
}
if(this.border){
ss['border']=this.border;
}
if(this.fontSize){
ss['fontSize']=this.fontSize;
}
if(this.fontFamily){
ss['fontFamily']=this.fontFamily;
}
if(this.textColor){
ss['textColor']=this.textColor;
}
if(this.marginTop!=null){
ss['marginTop']=this.marginTop;
}
if(this.marginBottom!=null){
ss['marginBottom']=this.marginBottom;
}
if(this.marginLeft!=null){
ss['marginLeft']=this.marginLeft;
}
if(this.marginRight!=null){
ss['marginRight']=this.marginRight;
}
var pad=false,
reverse=false,
s;
for (var i=0; i< series.length; i++){
s=series[i];
if(s._stack||s.renderer.constructor==$.jqplot.BezierCurveRenderer){
reverse=true;
}
if(s.show&&s.showLabel){
var lt=this.labels[i]||s.label.toString();
if(lt){
var color=s.color;
if(reverse&&i < series.length - 1){
pad=true;
}
else if(reverse&&i==series.length - 1){
pad=false;
}
this.renderer.addrow.call(this, lt, color, pad, reverse);
pad=true;
}
for (var j=0; j<$.jqplot.addLegendRowHooks.length; j++){
var item=$.jqplot.addLegendRowHooks[j].call(this, s);
if(item){
this.renderer.addrow.call(this, item.label, item.color, pad);
pad=true;
}}
lt=null;
}}
}
return this._elem;
};
$.jqplot.TableLegendRenderer.prototype.pack=function(offsets){
if(this.show){
if(this.placement=='insideGrid'){
switch (this.location){
case 'nw':
var a=offsets.left;
var b=offsets.top;
this._elem.css('left', a);
this._elem.css('top', b);
break;
case 'n':
var a=(offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
var b=offsets.top;
this._elem.css('left', a);
this._elem.css('top', b);
break;
case 'ne':
var a=offsets.right;
var b=offsets.top;
this._elem.css({right:a, top:b});
break;
case 'e':
var a=offsets.right;
var b=(offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
this._elem.css({right:a, top:b});
break;
case 'se':
var a=offsets.right;
var b=offsets.bottom;
this._elem.css({right:a, bottom:b});
break;
case 's':
var a=(offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
var b=offsets.bottom;
this._elem.css({left:a, bottom:b});
break;
case 'sw':
var a=offsets.left;
var b=offsets.bottom;
this._elem.css({left:a, bottom:b});
break;
case 'w':
var a=offsets.left;
var b=(offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
this._elem.css({left:a, top:b});
break;
default:
var a=offsets.right;
var b=offsets.bottom;
this._elem.css({right:a, bottom:b});
break;
}}
else if(this.placement=='outside'){
switch (this.location){
case 'nw':
var a=this._plotDimensions.width - offsets.left;
var b=offsets.top;
this._elem.css('right', a);
this._elem.css('top', b);
break;
case 'n':
var a=(offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
var b=this._plotDimensions.height - offsets.top;
this._elem.css('left', a);
this._elem.css('bottom', b);
break;
case 'ne':
var a=this._plotDimensions.width - offsets.right;
var b=offsets.top;
this._elem.css({left:a, top:b});
break;
case 'e':
var a=this._plotDimensions.width - offsets.right;
var b=(offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
this._elem.css({left:a, top:b});
break;
case 'se':
var a=this._plotDimensions.width - offsets.right;
var b=offsets.bottom;
this._elem.css({left:a, bottom:b});
break;
case 's':
var a=(offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
var b=this._plotDimensions.height - offsets.bottom;
this._elem.css({left:a, top:b});
break;
case 'sw':
var a=this._plotDimensions.width - offsets.left;
var b=offsets.bottom;
this._elem.css({right:a, bottom:b});
break;
case 'w':
var a=this._plotDimensions.width - offsets.left;
var b=(offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
this._elem.css({right:a, top:b});
break;
default:
var a=offsets.right;
var b=offsets.bottom;
this._elem.css({right:a, bottom:b});
break;
}}else{
switch (this.location){
case 'nw':
this._elem.css({left:0, top:offsets.top});
break;
case 'n':
var a=(offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
this._elem.css({left: a, top:offsets.top});
break;
case 'ne':
this._elem.css({right:0, top:offsets.top});
break;
case 'e':
var b=(offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
this._elem.css({right:offsets.right, top:b});
break;
case 'se':
this._elem.css({right:offsets.right, bottom:offsets.bottom});
break;
case 's':
var a=(offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
this._elem.css({left: a, bottom:offsets.bottom});
break;
case 'sw':
this._elem.css({left:offsets.left, bottom:offsets.bottom});
break;
case 'w':
var b=(offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
this._elem.css({left:offsets.left, top:b});
break;
default:
this._elem.css({right:offsets.right, bottom:offsets.bottom});
break;
}}
}};
$.jqplot.ThemeEngine=function(){
this.themes={};
this.activeTheme=null;
};
$.jqplot.ThemeEngine.prototype.init=function(){
var th=new $.jqplot.Theme({_name:'Default'});
var n, i, nn;
for (n in th.target){
if(n=="textColor"){
th.target[n]=this.target.css('color');
}else{
th.target[n]=this.target.css(n);
}}
if(this.title.show&&this.title._elem){
for (n in th.title){
if(n=="textColor"){
th.title[n]=this.title._elem.css('color');
}else{
th.title[n]=this.title._elem.css(n);
}}
}
for (n in th.grid){
th.grid[n]=this.grid[n];
}
if(th.grid.backgroundColor==null&&this.grid.background!=null){
th.grid.backgroundColor=this.grid.background;
}
if(this.legend.show&&this.legend._elem){
for (n in th.legend){
if(n=='textColor'){
th.legend[n]=this.legend._elem.css('color');
}else{
th.legend[n]=this.legend._elem.css(n);
}}
}
var s;
for (i=0; i<this.series.length; i++){
s=this.series[i];
if(s.renderer.constructor==$.jqplot.LineRenderer){
th.series.push(new LineSeriesProperties());
}
else if(s.renderer.constructor==$.jqplot.BarRenderer){
th.series.push(new BarSeriesProperties());
}
else if(s.renderer.constructor==$.jqplot.PieRenderer){
th.series.push(new PieSeriesProperties());
}
else if(s.renderer.constructor==$.jqplot.DonutRenderer){
th.series.push(new DonutSeriesProperties());
}
else if(s.renderer.constructor==$.jqplot.FunnelRenderer){
th.series.push(new FunnelSeriesProperties());
}
else if(s.renderer.constructor==$.jqplot.MeterGaugeRenderer){
th.series.push(new MeterSeriesProperties());
}else{
th.series.push({});
}
for (n in th.series[i]){
th.series[i][n]=s[n];
}}
var a, ax;
for (n in this.axes){
ax=this.axes[n];
a=th.axes[n]=new AxisProperties();
a.borderColor=ax.borderColor;
a.borderWidth=ax.borderWidth;
if(ax._ticks&&ax._ticks[0]){
for (nn in a.ticks){
if(ax._ticks[0].hasOwnProperty(nn)){
a.ticks[nn]=ax._ticks[0][nn];
}
else if(ax._ticks[0]._elem){
a.ticks[nn]=ax._ticks[0]._elem.css(nn);
}}
}
if(ax._label&&ax._label.show){
for (nn in a.label){
if(ax._label[nn]){
a.label[nn]=ax._label[nn];
}
else if(ax._label._elem){
if(nn=='textColor'){
a.label[nn]=ax._label._elem.css('color');
}else{
a.label[nn]=ax._label._elem.css(nn);
}}
}}
}
this.themeEngine._add(th);
this.themeEngine.activeTheme=this.themeEngine.themes[th._name];
};
$.jqplot.ThemeEngine.prototype.get=function(name){
if(!name){
return this.activeTheme;
}else{
return this.themes[name];
}};
function numericalOrder(a,b){ return a-b; }
$.jqplot.ThemeEngine.prototype.getThemeNames=function(){
var tn=[];
for (var n in this.themes){
tn.push(n);
}
return tn.sort(numericalOrder);
};
$.jqplot.ThemeEngine.prototype.getThemes=function(){
var tn=[];
var themes=[];
for (var n in this.themes){
tn.push(n);
}
tn.sort(numericalOrder);
for (var i=0; i<tn.length; i++){
themes.push(this.themes[tn[i]]);
}
return themes;
};
$.jqplot.ThemeEngine.prototype.activate=function(plot, name){
var redrawPlot=false;
if(!name&&this.activeTheme&&this.activeTheme._name){
name=this.activeTheme._name;
}
if(!this.themes.hasOwnProperty(name)){
throw new Error("No theme of that name");
}else{
var th=this.themes[name];
this.activeTheme=th;
var val, checkBorderColor=false, checkBorderWidth=false;
var arr=['xaxis', 'x2axis', 'yaxis', 'y2axis'];
for (i=0; i<arr.length; i++){
var ax=arr[i];
if(th.axesStyles.borderColor!=null){
plot.axes[ax].borderColor=th.axesStyles.borderColor;
}
if(th.axesStyles.borderWidth!=null){
plot.axes[ax].borderWidth=th.axesStyles.borderWidth;
}}
for (var axname in plot.axes){
var axis=plot.axes[axname];
if(axis.show){
var thaxis=th.axes[axname]||{};
var thaxstyle=th.axesStyles;
var thax=$.jqplot.extend(true, {}, thaxis, thaxstyle);
val=(th.axesStyles.borderColor!=null) ? th.axesStyles.borderColor:thax.borderColor;
if(thax.borderColor!=null){
axis.borderColor=thax.borderColor;
redrawPlot=true;
}
val=(th.axesStyles.borderWidth!=null) ? th.axesStyles.borderWidth:thax.borderWidth;
if(thax.borderWidth!=null){
axis.borderWidth=thax.borderWidth;
redrawPlot=true;
}
if(axis._ticks&&axis._ticks[0]){
for (var nn in thax.ticks){
val=thax.ticks[nn];
if(val!=null){
axis.tickOptions[nn]=val;
axis._ticks=[];
redrawPlot=true;
}}
}
if(axis._label&&axis._label.show){
for (var nn in thax.label){
val=thax.label[nn];
if(val!=null){
axis.labelOptions[nn]=val;
redrawPlot=true;
}}
}}
}
for (var n in th.grid){
if(th.grid[n]!=null){
plot.grid[n]=th.grid[n];
}}
if(!redrawPlot){
plot.grid.draw();
}
if(plot.legend.show){
for (n in th.legend){
if(th.legend[n]!=null){
plot.legend[n]=th.legend[n];
}}
}
if(plot.title.show){
for (n in th.title){
if(th.title[n]!=null){
plot.title[n]=th.title[n];
}}
}
var i;
for (i=0; i<th.series.length; i++){
var opts={};
var redrawSeries=false;
for (n in th.series[i]){
val=(th.seriesStyles[n]!=null) ? th.seriesStyles[n]:th.series[i][n];
if(val!=null){
opts[n]=val;
if(n=='color'){
plot.series[i].renderer.shapeRenderer.fillStyle=val;
plot.series[i].renderer.shapeRenderer.strokeStyle=val;
plot.series[i][n]=val;
}
else if((n=='lineWidth')||(n=='linePattern')){
plot.series[i].renderer.shapeRenderer[n]=val;
plot.series[i][n]=val;
}
else if(n=='markerOptions'){
merge (plot.series[i].markerOptions, val);
merge (plot.series[i].markerRenderer, val);
}else{
plot.series[i][n]=val;
}
redrawPlot=true;
}}
}
if(redrawPlot){
plot.target.empty();
plot.draw();
}
for (n in th.target){
if(th.target[n]!=null){
plot.target.css(n, th.target[n]);
}}
}};
$.jqplot.ThemeEngine.prototype._add=function(theme, name){
if(name){
theme._name=name;
}
if(!theme._name){
theme._name=Date.parse(new Date());
}
if(!this.themes.hasOwnProperty(theme._name)){
this.themes[theme._name]=theme;
}else{
throw new Error("jqplot.ThemeEngine Error: Theme already in use");
}};
$.jqplot.ThemeEngine.prototype.remove=function(name){
if(name=='Default'){
return false;
}
return delete this.themes[name];
};
$.jqplot.ThemeEngine.prototype.newTheme=function(name, obj){
if(typeof(name)=='object'){
obj=obj||name;
name=null;
}
if(obj&&obj._name){
name=obj._name;
}else{
name=name||Date.parse(new Date());
}
var th=this.copy(this.themes['Default']._name, name);
$.jqplot.extend(th, obj);
return th;
};
function clone(obj){
if(obj==null||typeof(obj)!='object'){
return obj;
}
var temp=new obj.constructor();
for(var key in obj){
temp[key]=clone(obj[key]);
}
return temp;
}
$.jqplot.clone=clone;
function merge(obj1, obj2){
if(obj2==null||typeof(obj2)!='object'){
return;
}
for (var key in obj2){
if(key=='highlightColors'){
obj1[key]=clone(obj2[key]);
}
if(obj2[key]!=null&&typeof(obj2[key])=='object'){
if(!obj1.hasOwnProperty(key)){
obj1[key]={};}
merge(obj1[key], obj2[key]);
}else{
obj1[key]=obj2[key];
}}
}
$.jqplot.merge=merge;
$.jqplot.extend=function(){
var target=arguments[0]||{}, i=1, length=arguments.length, deep=false, options;
if(typeof target==="boolean"){
deep=target;
target=arguments[1]||{};
i=2;
}
if(typeof target!=="object"&&!toString.call(target)==="[object Function]"){
target={};}
for(; i < length; i++){
if((options=arguments[ i ])!=null){
for(var name in options){
var src=target[ name ], copy=options[ name ];
if(target===copy){
continue;
}
if(deep&&copy&&typeof copy==="object"&&!copy.nodeType){
target[ name ]=$.jqplot.extend(deep,
src||(copy.length!=null ? [ ]:{ })
, copy);
}
else if(copy!==undefined){
target[ name ]=copy;
}}
}}
return target;
};
$.jqplot.ThemeEngine.prototype.rename=function (oldName, newName){
if(oldName=='Default'||newName=='Default'){
throw new Error ("jqplot.ThemeEngine Error: Cannot rename from/to Default");
}
if(this.themes.hasOwnProperty(newName)){
throw new Error ("jqplot.ThemeEngine Error: New name already in use.");
}
else if(this.themes.hasOwnProperty(oldName)){
var th=this.copy (oldName, newName);
this.remove(oldName);
return th;
}
throw new Error("jqplot.ThemeEngine Error: Old name or new name invalid");
};
$.jqplot.ThemeEngine.prototype.copy=function (sourceName, targetName, obj){
if(targetName=='Default'){
throw new Error ("jqplot.ThemeEngine Error: Cannot copy over Default theme");
}
if(!this.themes.hasOwnProperty(sourceName)){
var s="jqplot.ThemeEngine Error: Source name invalid";
throw new Error(s);
}
if(this.themes.hasOwnProperty(targetName)){
var s="jqplot.ThemeEngine Error: Target name invalid";
throw new Error(s);
}else{
var th=clone(this.themes[sourceName]);
th._name=targetName;
$.jqplot.extend(true, th, obj);
this._add(th);
return th;
}};
$.jqplot.Theme=function(name, obj){
if(typeof(name)=='object'){
obj=obj||name;
name=null;
}
name=name||Date.parse(new Date());
this._name=name;
this.target={
backgroundColor: null
};
this.legend={
textColor: null,
fontFamily: null,
fontSize: null,
border: null,
background: null
};
this.title={
textColor: null,
fontFamily: null,
fontSize: null,
textAlign: null
};
this.seriesStyles={};
this.series=[];
this.grid={
drawGridlines: null,
gridLineColor: null,
gridLineWidth: null,
backgroundColor: null,
borderColor: null,
borderWidth: null,
shadow: null
};
this.axesStyles={label:{}, ticks:{}};
this.axes={};
if(typeof(obj)=='string'){
this._name=obj;
}
else if(typeof(obj)=='object'){
$.jqplot.extend(true, this, obj);
}};
var AxisProperties=function(){
this.borderColor=null;
this.borderWidth=null;
this.ticks=new AxisTicks();
this.label=new AxisLabel();
};
var AxisTicks=function(){
this.show=null;
this.showGridline=null;
this.showLabel=null;
this.showMark=null;
this.size=null;
this.textColor=null;
this.whiteSpace=null;
this.fontSize=null;
this.fontFamily=null;
};
var AxisLabel=function(){
this.textColor=null;
this.whiteSpace=null;
this.fontSize=null;
this.fontFamily=null;
this.fontWeight=null;
};
var LineSeriesProperties=function(){
this.color=null;
this.lineWidth=null;
this.linePattern=null;
this.shadow=null;
this.fillColor=null;
this.showMarker=null;
this.markerOptions=new MarkerOptions();
};
var MarkerOptions=function(){
this.show=null;
this.style=null;
this.lineWidth=null;
this.size=null;
this.color=null;
this.shadow=null;
};
var BarSeriesProperties=function(){
this.color=null;
this.seriesColors=null;
this.lineWidth=null;
this.shadow=null;
this.barPadding=null;
this.barMargin=null;
this.barWidth=null;
this.highlightColors=null;
};
var PieSeriesProperties=function(){
this.seriesColors=null;
this.padding=null;
this.sliceMargin=null;
this.fill=null;
this.shadow=null;
this.startAngle=null;
this.lineWidth=null;
this.highlightColors=null;
};
var DonutSeriesProperties=function(){
this.seriesColors=null;
this.padding=null;
this.sliceMargin=null;
this.fill=null;
this.shadow=null;
this.startAngle=null;
this.lineWidth=null;
this.innerDiameter=null;
this.thickness=null;
this.ringMargin=null;
this.highlightColors=null;
};
var FunnelSeriesProperties=function(){
this.color=null;
this.lineWidth=null;
this.shadow=null;
this.padding=null;
this.sectionMargin=null;
this.seriesColors=null;
this.highlightColors=null;
};
var MeterSeriesProperties=function(){
this.padding=null;
this.backgroundColor=null;
this.ringColor=null;
this.tickColor=null;
this.ringWidth=null;
this.intervalColors=null;
this.intervalInnerRadius=null;
this.intervalOuterRadius=null;
this.hubRadius=null;
this.needleThickness=null;
this.needlePad=null;
};
$.fn.jqplotChildText=function(){
return $(this).contents().filter(function(){
return this.nodeType==3;
}).text();
};
$.fn.jqplotGetComputedFontStyle=function(){
var css=window.getComputedStyle ?  window.getComputedStyle(this[0], ""):this[0].currentStyle;
var attrs=css['font-style'] ? ['font-style', 'font-weight', 'font-size', 'font-family']:['fontStyle', 'fontWeight', 'fontSize', 'fontFamily'];
var style=[];
for (var i=0 ; i < attrs.length; ++i){
var attr=String(css[attrs[i]]);
if(attr&&attr!='normal'){
style.push(attr);
}}
return style.join(' ');
};
$.fn.jqplotToImageCanvas=function(options){
options=options||{};
var x_offset=(options.x_offset==null) ? 0:options.x_offset;
var y_offset=(options.y_offset==null) ? 0:options.y_offset;
var backgroundColor=(options.backgroundColor==null) ? 'rgb(255,255,255)':options.backgroundColor;
if($(this).width()==0||$(this).height()==0){
return null;
}
if($.jqplot.use_excanvas){
return null;
}
var newCanvas=document.createElement("canvas");
var h=$(this).outerHeight(true);
var w=$(this).outerWidth(true);
var offs=$(this).offset();
var plotleft=offs.left;
var plottop=offs.top;
var transx=0, transy=0;
var clses=['jqplot-table-legend', 'jqplot-xaxis-tick', 'jqplot-x2axis-tick', 'jqplot-yaxis-tick', 'jqplot-y2axis-tick', 'jqplot-y3axis-tick',
'jqplot-y4axis-tick', 'jqplot-y5axis-tick', 'jqplot-y6axis-tick', 'jqplot-y7axis-tick', 'jqplot-y8axis-tick', 'jqplot-y9axis-tick',
'jqplot-xaxis-label', 'jqplot-x2axis-label', 'jqplot-yaxis-label', 'jqplot-y2axis-label', 'jqplot-y3axis-label', 'jqplot-y4axis-label',
'jqplot-y5axis-label', 'jqplot-y6axis-label', 'jqplot-y7axis-label', 'jqplot-y8axis-label', 'jqplot-y9axis-label' ];
var temptop, templeft, tempbottom, tempright;
for (var i=0; i < clses.length; i++){
$(this).find('.'+clses[i]).each(function(){
temptop=$(this).offset().top - plottop;
templeft=$(this).offset().left - plotleft;
tempright=templeft + $(this).outerWidth(true) + transx;
tempbottom=temptop + $(this).outerHeight(true) + transy;
if(templeft < -transx){
w=w - transx - templeft;
transx=-templeft;
}
if(temptop < -transy){
h=h - transy - temptop;
transy=- temptop;
}
if(tempright > w){
w=tempright;
}
if(tempbottom > h){
h=tempbottom;
}});
}
newCanvas.width=w + Number(x_offset);
newCanvas.height=h + Number(y_offset);
var newContext=newCanvas.getContext("2d");
newContext.save();
newContext.fillStyle=backgroundColor;
newContext.fillRect(0,0, newCanvas.width, newCanvas.height);
newContext.restore();
newContext.translate(transx, transy);
newContext.textAlign='left';
newContext.textBaseline='top';
function getLineheight(el){
var lineheight=parseInt($(el).css('line-height'), 10);
if(isNaN(lineheight)){
lineheight=parseInt($(el).css('font-size'), 10) * 1.2;
}
return lineheight;
}
function writeWrappedText (el, context, text, left, top, canvasWidth){
var lineheight=getLineheight(el);
var tagwidth=$(el).innerWidth();
var tagheight=$(el).innerHeight();
var words=text.split(/\s+/);
var wl=words.length;
var w='';
var breaks=[];
var temptop=top;
var templeft=left;
for (var i=0; i<wl; i++){
w +=words[i];
if(context.measureText(w).width > tagwidth&&w.length > words[i].length){
breaks.push(i);
w='';
i--;
}}
if(breaks.length===0){
if($(el).css('textAlign')==='center'){
templeft=left + (canvasWidth - context.measureText(w).width)/2  - transx;
}
context.fillText(text, templeft, top);
}else{
w=words.slice(0, breaks[0]).join(' ');
if($(el).css('textAlign')==='center'){
templeft=left + (canvasWidth - context.measureText(w).width)/2  - transx;
}
context.fillText(w, templeft, temptop);
temptop +=lineheight;
for (var i=1, l=breaks.length; i<l; i++){
w=words.slice(breaks[i-1], breaks[i]).join(' ');
if($(el).css('textAlign')==='center'){
templeft=left + (canvasWidth - context.measureText(w).width)/2  - transx;
}
context.fillText(w, templeft, temptop);
temptop +=lineheight;
}
w=words.slice(breaks[i-1], words.length).join(' ');
if($(el).css('textAlign')==='center'){
templeft=left + (canvasWidth - context.measureText(w).width)/2  - transx;
}
context.fillText(w, templeft, temptop);
}}
function _jqpToImage(el, x_offset, y_offset){
var tagname=el.tagName.toLowerCase();
var p=$(el).position();
var css=window.getComputedStyle ?  window.getComputedStyle(el, ""):el.currentStyle;
var left=x_offset + p.left + parseInt(css.marginLeft, 10) + parseInt(css.borderLeftWidth, 10) + parseInt(css.paddingLeft, 10);
var top=y_offset + p.top + parseInt(css.marginTop, 10) + parseInt(css.borderTopWidth, 10)+ parseInt(css.paddingTop, 10);
var w=newCanvas.width;
if((tagname=='div'||tagname=='span')&&!$(el).hasClass('jqplot-highlighter-tooltip')){
$(el).children().each(function(){
_jqpToImage(this, left, top);
});
var text=$(el).jqplotChildText();
if(text){
newContext.font=$(el).jqplotGetComputedFontStyle();
newContext.fillStyle=$(el).css('color');
writeWrappedText(el, newContext, text, left, top, w);
}}
else if(tagname==='table'&&$(el).hasClass('jqplot-table-legend')){
newContext.strokeStyle=$(el).css('border-top-color');
newContext.fillStyle=$(el).css('background-color');
newContext.fillRect(left, top, $(el).innerWidth(), $(el).innerHeight());
if(parseInt($(el).css('border-top-width'), 10) > 0){
newContext.strokeRect(left, top, $(el).innerWidth(), $(el).innerHeight());
}
$(el).find('div.jqplot-table-legend-swatch-outline').each(function(){
var elem=$(this);
newContext.strokeStyle=elem.css('border-top-color');
var l=left + elem.position().left;
var t=top + elem.position().top;
newContext.strokeRect(l, t, elem.innerWidth(), elem.innerHeight());
l +=parseInt(elem.css('padding-left'), 10);
t +=parseInt(elem.css('padding-top'), 10);
var h=elem.innerHeight() - 2 * parseInt(elem.css('padding-top'), 10);
var w=elem.innerWidth() - 2 * parseInt(elem.css('padding-left'), 10);
var swatch=elem.children('div.jqplot-table-legend-swatch');
newContext.fillStyle=swatch.css('background-color');
newContext.fillRect(l, t, w, h);
});
$(el).find('td.jqplot-table-legend-label').each(function(){
var elem=$(this);
var l=left + elem.position().left;
var t=top + elem.position().top + parseInt(elem.css('padding-top'), 10);
newContext.font=elem.jqplotGetComputedFontStyle();
newContext.fillStyle=elem.css('color');
writeWrappedText(elem, newContext, elem.text(), l, t, w);
});
var elem=null;
}
else if(tagname=='canvas'){
newContext.drawImage(el, left, top);
}}
$(this).children().each(function(){
_jqpToImage(this, x_offset, y_offset);
});
return newCanvas;
};
$.fn.jqplotToImageStr=function(options){
var imgCanvas=$(this).jqplotToImageCanvas(options);
if(imgCanvas){
return imgCanvas.toDataURL("image/png");
}else{
return null;
}};
$.fn.jqplotToImageElem=function(options){
var elem=document.createElement("img");
var str=$(this).jqplotToImageStr(options);
elem.src=str;
return elem;
};
$.fn.jqplotToImageElemStr=function(options){
var str='<img src='+$(this).jqplotToImageStr(options)+' />';
return str;
};
$.fn.jqplotSaveImage=function(){
var imgData=$(this).jqplotToImageStr({});
if(imgData){
window.location.href=imgData.replace("image/png", "image/octet-stream");
}};
$.fn.jqplotViewImage=function(){
var imgStr=$(this).jqplotToImageElemStr({});
var imgData=$(this).jqplotToImageStr({});
if(imgStr){
var w=window.open('');
w.document.open("image/png");
w.document.write(imgStr);
w.document.close();
w=null;
}};
var jsDate=function (){
this.syntax=jsDate.config.syntax;
this._type="jsDate";
this.proxy=new Date();
this.options={};
this.locale=jsDate.regional.getLocale();
this.formatString='';
this.defaultCentury=jsDate.config.defaultCentury;
switch(arguments.length){
case 0:
break;
case 1:
if(get_type(arguments[0])=="[object Object]"&&arguments[0]._type!="jsDate"){
var opts=this.options=arguments[0];
this.syntax=opts.syntax||this.syntax;
this.defaultCentury=opts.defaultCentury||this.defaultCentury;
this.proxy=jsDate.createDate(opts.date);
}else{
this.proxy=jsDate.createDate(arguments[0]);
}
break;
default:
var a=[];
for(var i=0; i<arguments.length; i++){
a.push(arguments[i]);
}
this.proxy=new Date();
this.proxy.setFullYear.apply(this.proxy, a.slice(0,3));
if(a.slice(3).length){
this.proxy.setHours.apply(this.proxy, a.slice(3));
}
break;
}};
jsDate.config={
defaultLocale: 'en',
syntax: 'perl',
defaultCentury: 1900
};
jsDate.prototype.add=function(number, unit){
var factor=multipliers[unit]||multipliers.day;
if(typeof factor=='number'){
this.proxy.setTime(this.proxy.getTime() + (factor * number));
}else{
factor.add(this, number);
}
return this;
};
jsDate.prototype.clone=function(){
return new jsDate(this.proxy.getTime());
};
jsDate.prototype.getUtcOffset=function(){
return this.proxy.getTimezoneOffset() * 60000;
};
jsDate.prototype.diff=function(dateObj, unit, allowDecimal){
dateObj=new jsDate(dateObj);
if(dateObj===null){
return null;
}
var factor=multipliers[unit]||multipliers.day;
if(typeof factor=='number'){
var unitDiff=(this.proxy.getTime() - dateObj.proxy.getTime()) / factor;
}else{
var unitDiff=factor.diff(this.proxy, dateObj.proxy);
}
return (allowDecimal ? unitDiff:Math[unitDiff > 0 ? 'floor':'ceil'](unitDiff));
};
jsDate.prototype.getAbbrDayName=function(){
return jsDate.regional[this.locale]["dayNamesShort"][this.proxy.getDay()];
};
jsDate.prototype.getAbbrMonthName=function(){
return jsDate.regional[this.locale]["monthNamesShort"][this.proxy.getMonth()];
};
jsDate.prototype.getAMPM=function(){
return this.proxy.getHours() >=12 ? 'PM':'AM';
};
jsDate.prototype.getAmPm=function(){
return this.proxy.getHours() >=12 ? 'pm':'am';
};
jsDate.prototype.getCentury=function(){
return parseInt(this.proxy.getFullYear()/100, 10);
};
jsDate.prototype.getDate=function(){
return this.proxy.getDate();
};
jsDate.prototype.getDay=function(){
return this.proxy.getDay();
};
jsDate.prototype.getDayOfWeek=function(){
var dow=this.proxy.getDay();
return dow===0?7:dow;
};
jsDate.prototype.getDayOfYear=function(){
var d=this.proxy;
var ms=d - new Date('' + d.getFullYear() + '/1/1 GMT');
ms +=d.getTimezoneOffset()*60000;
d=null;
return parseInt(ms/60000/60/24, 10)+1;
};
jsDate.prototype.getDayName=function(){
return jsDate.regional[this.locale]["dayNames"][this.proxy.getDay()];
};
jsDate.prototype.getFullWeekOfYear=function(){
var d=this.proxy;
var doy=this.getDayOfYear();
var rdow=6-d.getDay();
var woy=parseInt((doy+rdow)/7, 10);
return woy;
};
jsDate.prototype.getFullYear=function(){
return this.proxy.getFullYear();
};
jsDate.prototype.getGmtOffset=function(){
var hours=this.proxy.getTimezoneOffset() / 60;
var prefix=hours < 0 ? '+':'-';
hours=Math.abs(hours);
return prefix + addZeros(Math.floor(hours), 2) + ':' + addZeros((hours % 1) * 60, 2);
};
jsDate.prototype.getHours=function(){
return this.proxy.getHours();
};
jsDate.prototype.getHours12=function(){
var hours=this.proxy.getHours();
return hours > 12 ? hours - 12:(hours==0 ? 12:hours);
};
jsDate.prototype.getIsoWeek=function(){
var d=this.proxy;
var woy=this.getWeekOfYear();
var dow1_1=(new Date('' + d.getFullYear() + '/1/1')).getDay();
var idow=woy + (dow1_1 > 4||dow1_1 <=1 ? 0:1);
if(idow==53&&(new Date('' + d.getFullYear() + '/12/31')).getDay() < 4){
idow=1;
}
else if(idow===0){
d=new jsDate(new Date('' + (d.getFullYear()-1) + '/12/31'));
idow=d.getIsoWeek();
}
d=null;
return idow;
};
jsDate.prototype.getMilliseconds=function(){
return this.proxy.getMilliseconds();
};
jsDate.prototype.getMinutes=function(){
return this.proxy.getMinutes();
};
jsDate.prototype.getMonth=function(){
return this.proxy.getMonth();
};
jsDate.prototype.getMonthName=function(){
return jsDate.regional[this.locale]["monthNames"][this.proxy.getMonth()];
};
jsDate.prototype.getMonthNumber=function(){
return this.proxy.getMonth() + 1;
};
jsDate.prototype.getSeconds=function(){
return this.proxy.getSeconds();
};
jsDate.prototype.getShortYear=function(){
return this.proxy.getYear() % 100;
};
jsDate.prototype.getTime=function(){
return this.proxy.getTime();
};
jsDate.prototype.getTimezoneAbbr=function(){
return this.proxy.toString().replace(/^.*\(([^)]+)\)$/, '$1');
};
jsDate.prototype.getTimezoneName=function(){
var match=/(?:\((.+)\)$| ([A-Z]{3}))/.exec(this.toString());
return match[1]||match[2]||'GMT' + this.getGmtOffset();
};
jsDate.prototype.getTimezoneOffset=function(){
return this.proxy.getTimezoneOffset();
};
jsDate.prototype.getWeekOfYear=function(){
var doy=this.getDayOfYear();
var rdow=7 - this.getDayOfWeek();
var woy=parseInt((doy+rdow)/7, 10);
return woy;
};
jsDate.prototype.getUnix=function(){
return Math.round(this.proxy.getTime() / 1000, 0);
};
jsDate.prototype.getYear=function(){
return this.proxy.getYear();
};
jsDate.prototype.next=function(unit){
unit=unit||'day';
return this.clone().add(1, unit);
};
jsDate.prototype.set=function(){
switch(arguments.length){
case 0:
this.proxy=new Date();
break;
case 1:
if(get_type(arguments[0])=="[object Object]"&&arguments[0]._type!="jsDate"){
var opts=this.options=arguments[0];
this.syntax=opts.syntax||this.syntax;
this.defaultCentury=opts.defaultCentury||this.defaultCentury;
this.proxy=jsDate.createDate(opts.date);
}else{
this.proxy=jsDate.createDate(arguments[0]);
}
break;
default:
var a=[];
for(var i=0; i<arguments.length; i++){
a.push(arguments[i]);
}
this.proxy=new Date();
this.proxy.setFullYear.apply(this.proxy, a.slice(0,3));
if(a.slice(3).length){
this.proxy.setHours.apply(this.proxy, a.slice(3));
}
break;
}
return this;
};
jsDate.prototype.setDate=function(n){
this.proxy.setDate(n);
return this;
};
jsDate.prototype.setFullYear=function(){
this.proxy.setFullYear.apply(this.proxy, arguments);
return this;
};
jsDate.prototype.setHours=function(){
this.proxy.setHours.apply(this.proxy, arguments);
return this;
};
jsDate.prototype.setMilliseconds=function(n){
this.proxy.setMilliseconds(n);
return this;
};
jsDate.prototype.setMinutes=function(){
this.proxy.setMinutes.apply(this.proxy, arguments);
return this;
};
jsDate.prototype.setMonth=function(){
this.proxy.setMonth.apply(this.proxy, arguments);
return this;
};
jsDate.prototype.setSeconds=function(){
this.proxy.setSeconds.apply(this.proxy, arguments);
return this;
};
jsDate.prototype.setTime=function(n){
this.proxy.setTime(n);
return this;
};
jsDate.prototype.setYear=function(){
this.proxy.setYear.apply(this.proxy, arguments);
return this;
};
jsDate.prototype.strftime=function(formatString){
formatString=formatString||this.formatString||jsDate.regional[this.locale]['formatString'];
return jsDate.strftime(this, formatString, this.syntax);
};
jsDate.prototype.toString=function(){
return this.proxy.toString();
};
jsDate.prototype.toYmdInt=function(){
return (this.proxy.getFullYear() * 10000) + (this.getMonthNumber() * 100) + this.proxy.getDate();
};
/**
* @namespace Holds localizations for month/day names.
* <p>jsDate attempts to detect locale when loaded and defaults to 'en'.
* If a localization is detected which is not available, jsDate defaults to 'en'.
* Additional localizations can be added after jsDate loads.  After adding a localization,
* call the jsDate.regional.getLocale() method.  Currently, en, fr and de are defined.</p>
*
* <p>Localizations must be an object and have the following properties defined:  monthNames, monthNamesShort, dayNames, dayNamesShort and Localizations are added like:</p>
* <pre class="code">
* jsDate.regional['en']={
* monthNames:'January February March April May June July August September October November December'.split(' '),
* monthNamesShort:'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' '),
* dayNames:'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'.split(' '),
* dayNamesShort:'Sun Mon Tue Wed Thu Fri Sat'.split(' ')
* };
* </pre>
* <p>After adding localizations, call <code>jsDate.regional.getLocale();</code> to update the locale setting with the
* new localizations.</p>
*/
jsDate.regional={
'en': {
monthNames: ['January','February','March','April','May','June','July','August','September','October','November','December'],
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun','Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'fr': {
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun','Jul','Aoû','Sep','Oct','Nov','Déc'],
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'de': {
monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],
monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'],
dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'es': {
monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio', 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun', 'Jul','Ago','Sep','Oct','Nov','Dic'],
dayNames: ['Domingo','Lunes','Martes','Mi&eacute;rcoles','Jueves','Viernes','S&aacute;bado'],
dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'ru': {
monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн','Июл','Авг','Сен','Окт','Ноя','Дек'],
dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'ar': {
monthNames: ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'آذار', 'حزيران','تموز', 'آب', 'أيلول',   'تشرين الأول', 'تشرين الثاني', 'كانون الأول'],
monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],
dayNames: ['السبت', 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة'],
dayNamesShort: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'pt': {
monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],
dayNames: ['Domingo','Segunda-feira','Ter&ccedil;a-feira','Quarta-feira','Quinta-feira','Sexta-feira','S&aacute;bado'],
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','S&aacute;b'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'pt-BR': {
monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho', 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],
dayNames: ['Domingo','Segunda-feira','Ter&ccedil;a-feira','Quarta-feira','Quinta-feira','Sexta-feira','S&aacute;bado'],
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','S&aacute;b'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'pl': {
monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec','Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'],
monthNamesShort: ['Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze','Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'],
dayNames: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
dayNamesShort: ['Ni', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'Sb'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'nl': {
monthNames: ['Januari','Februari','Maart','April','Mei','Juni','July','Augustus','September','Oktober','November','December'],
monthNamesShort: ['Jan','Feb','Mar','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Dec'],
dayNames:','['Zondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag'],
dayNamesShort: ['Zo','Ma','Di','Wo','Do','Vr','Za'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'sv': {
monthNames: ['januari','februari','mars','april','maj','juni','juli','augusti','september','oktober','november','december'],
monthNamesShort: ['jan','feb','mar','apr','maj','jun','jul','aug','sep','okt','nov','dec'],
dayNames: ['söndag','måndag','tisdag','onsdag','torsdag','fredag','lördag'],
dayNamesShort: ['sön','mån','tis','ons','tor','fre','lör'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'it': {
monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'],
dayNames: ['Domenica','Lunedi','Martedi','Mercoledi','Giovedi','Venerdi','Sabato'],
dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'],
formatString: '%d-%m-%Y %H:%M:%S'
}};
jsDate.regional['en-US']=jsDate.regional['en-GB']=jsDate.regional['en'];
jsDate.regional.getLocale=function (){
var l=jsDate.config.defaultLocale;
if(document&&document.getElementsByTagName('html')&&document.getElementsByTagName('html')[0].lang){
l=document.getElementsByTagName('html')[0].lang;
if(!jsDate.regional.hasOwnProperty(l)){
l=jsDate.config.defaultLocale;
}}
return l;
};
var day=24 * 60 * 60 * 1000;
var addZeros=function(num, digits){
num=String(num);
var i=digits - num.length;
var s=String(Math.pow(10, i)).slice(1);
return s.concat(num);
};
var multipliers={
millisecond: 1,
second: 1000,
minute: 60 * 1000,
hour: 60 * 60 * 1000,
day: day,
week: 7 * day,
month: {
add: function(d, number){
multipliers.year.add(d, Math[number > 0 ? 'floor':'ceil'](number / 12));
var prevMonth=d.getMonth() + (number % 12);
if(prevMonth==12){
prevMonth=0;
d.setYear(d.getFullYear() + 1);
}else if(prevMonth==-1){
prevMonth=11;
d.setYear(d.getFullYear() - 1);
}
d.setMonth(prevMonth);
},
diff: function(d1, d2){
var diffYears=d1.getFullYear() - d2.getFullYear();
var diffMonths=d1.getMonth() - d2.getMonth() + (diffYears * 12);
var diffDays=d1.getDate() - d2.getDate();
return diffMonths + (diffDays / 30);
}},
year: {
add: function(d, number){
d.setYear(d.getFullYear() + Math[number > 0 ? 'floor':'ceil'](number));
},
diff: function(d1, d2){
return multipliers.month.diff(d1, d2) / 12;
}}
};
for (var unit in multipliers){
if(unit.substring(unit.length - 1)!='s'){
multipliers[unit + 's']=multipliers[unit];
}}
var format=function(d, code, syntax){
if(jsDate.formats[syntax]["shortcuts"][code]){
return jsDate.strftime(d, jsDate.formats[syntax]["shortcuts"][code], syntax);
}else{
var getter=(jsDate.formats[syntax]["codes"][code]||'').split('.');
var nbr=d['get' + getter[0]] ? d['get' + getter[0]]():'';
if(getter[1]){
nbr=addZeros(nbr, getter[1]);
}
return nbr;
}};
jsDate.strftime=function(d, formatString, syntax, locale){
var syn='perl';
var loc=jsDate.regional.getLocale();
if(syntax&&jsDate.formats.hasOwnProperty(syntax)){
syn=syntax;
}
else if(syntax&&jsDate.regional.hasOwnProperty(syntax)){
loc=syntax;
}
if(locale&&jsDate.formats.hasOwnProperty(locale)){
syn=locale;
}
else if(locale&&jsDate.regional.hasOwnProperty(locale)){
loc=locale;
}
if(get_type(d)!="[object Object]"||d._type!="jsDate"){
d=new jsDate(d);
d.locale=loc;
}
if(!formatString){
formatString=d.formatString||jsDate.regional[loc]['formatString'];
}
var source=formatString||'%Y-%m-%d',
result='',
match;
while (source.length > 0){
if(match=source.match(jsDate.formats[syn].codes.matcher)){
result +=source.slice(0, match.index);
result +=(match[1]||'') + format(d, match[2], syn);
source=source.slice(match.index + match[0].length);
}else{
result +=source;
source='';
}}
return result;
};
jsDate.formats={
ISO:'%Y-%m-%dT%H:%M:%S.%N%G',
SQL:'%Y-%m-%d %H:%M:%S'
};
jsDate.formats.perl={
codes: {
matcher: /()%(#?(%|[a-z]))/i,
Y: 'FullYear',
y: 'ShortYear.2',
m: 'MonthNumber.2',
'#m': 'MonthNumber',
B: 'MonthName',
b: 'AbbrMonthName',
d: 'Date.2',
'#d': 'Date',
e: 'Date',
A: 'DayName',
a: 'AbbrDayName',
w: 'Day',
H: 'Hours.2',
'#H': 'Hours',
I: 'Hours12.2',
'#I': 'Hours12',
p: 'AMPM',
M: 'Minutes.2',
'#M': 'Minutes',
S: 'Seconds.2',
'#S': 'Seconds',
s: 'Unix',
N: 'Milliseconds.3',
'#N': 'Milliseconds',
O: 'TimezoneOffset',
Z: 'TimezoneName',
G: 'GmtOffset'
},
shortcuts: {
F: '%Y-%m-%d',
T: '%H:%M:%S',
X: '%H:%M:%S',
x: '%m/%d/%y',
D: '%m/%d/%y',
'#c': '%a %b %e %H:%M:%S %Y',
v: '%e-%b-%Y',
R: '%H:%M',
r: '%I:%M:%S %p',
t: '\t',
n: '\n',
'%': '%'
}};
jsDate.formats.php={
codes: {
matcher: /()%((%|[a-z]))/i,
a: 'AbbrDayName',
A: 'DayName',
d: 'Date.2',
e: 'Date',
j: 'DayOfYear.3',
u: 'DayOfWeek',
w: 'Day',
U: 'FullWeekOfYear.2',
V: 'IsoWeek.2',
W: 'WeekOfYear.2',
b: 'AbbrMonthName',
B: 'MonthName',
m: 'MonthNumber.2',
h: 'AbbrMonthName',
C: 'Century.2',
y: 'ShortYear.2',
Y: 'FullYear',
H: 'Hours.2',
I: 'Hours12.2',
l: 'Hours12',
p: 'AMPM',
P: 'AmPm',
M: 'Minutes.2',
S: 'Seconds.2',
s: 'Unix',
O: 'TimezoneOffset',
z: 'GmtOffset',
Z: 'TimezoneAbbr'
},
shortcuts: {
D: '%m/%d/%y',
F: '%Y-%m-%d',
T: '%H:%M:%S',
X: '%H:%M:%S',
x: '%m/%d/%y',
R: '%H:%M',
r: '%I:%M:%S %p',
t: '\t',
n: '\n',
'%': '%'
}};
jsDate.createDate=function(date){
if(date==null){
return new Date();
}
if(date instanceof Date){
return date;
}
if(typeof date=='number'){
return new Date(date);
}
var parsable=String(date).replace(/^\s*(.+)\s*$/g, '$1');
parsable=parsable.replace(/^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,4})/, "$1/$2/$3");
parsable=parsable.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{4})/i, "$1 $2 $3");
var match=parsable.match(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i);
if(match&&match.length > 3){
var m3=parseFloat(match[3]);
var ny=jsDate.config.defaultCentury + m3;
ny=String(ny);
parsable=parsable.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i, match[1] +' '+ match[2] +' '+ ny);
}
match=parsable.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})[^0-9]/);
function h1(parsable, match){
var m1=parseFloat(match[1]);
var m2=parseFloat(match[2]);
var m3=parseFloat(match[3]);
var cent=jsDate.config.defaultCentury;
var ny, nd, nm, str;
if(m1 > 31){
nd=m3;
nm=m2;
ny=cent + m1;
}else{
nd=m2;
nm=m1;
ny=cent + m3;
}
str=nm+'/'+nd+'/'+ny;
return  parsable.replace(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})/, str);
}
if(match&&match.length > 3){
parsable=h1(parsable, match);
}
var match=parsable.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})$/);
if(match&&match.length > 3){
parsable=h1(parsable, match);
}
var i=0;
var length=jsDate.matchers.length;
var pattern,
ms,
current=parsable,
obj;
while (i < length){
ms=Date.parse(current);
if(!isNaN(ms)){
return new Date(ms);
}
pattern=jsDate.matchers[i];
if(typeof pattern=='function'){
obj=pattern.call(jsDate, current);
if(obj instanceof Date){
return obj;
}}else{
current=parsable.replace(pattern[0], pattern[1]);
}
i++;
}
return NaN;
};
jsDate.daysInMonth=function(year, month){
if(month==2){
return new Date(year, 1, 29).getDate()==29 ? 29:28;
}
return [undefined,31,undefined,31,30,31,30,31,31,30,31,30,31][month];
};
jsDate.matchers=[
[/(3[01]|[0-2]\d)\s*\.\s*(1[0-2]|0\d)\s*\.\s*([1-9]\d{3})/, '$2/$1/$3'],
[/([1-9]\d{3})\s*-\s*(1[0-2]|0\d)\s*-\s*(3[01]|[0-2]\d)/, '$2/$3/$1'],
function(str){
var match=str.match(/^(?:(.+)\s+)?([012]?\d)(?:\s*\:\s*(\d\d))?(?:\s*\:\s*(\d\d(\.\d*)?))?\s*(am|pm)?\s*$/i);
if(match){
if(match[1]){
var d=this.createDate(match[1]);
if(isNaN(d)){
return;
}}else{
var d=new Date();
d.setMilliseconds(0);
}
var hour=parseFloat(match[2]);
if(match[6]){
hour=match[6].toLowerCase()=='am' ? (hour==12 ? 0:hour):(hour==12 ? 12:hour + 12);
}
d.setHours(hour, parseInt(match[3]||0, 10), parseInt(match[4]||0, 10), ((parseFloat(match[5]||0))||0)*1000);
return d;
}else{
return str;
}},
function(str){
var match=str.match(/^(?:(.+))[T|\s+]([012]\d)(?:\:(\d\d))(?:\:(\d\d))(?:\.\d+)([\+\-]\d\d\:\d\d)$/i);
if(match){
if(match[1]){
var d=this.createDate(match[1]);
if(isNaN(d)){
return;
}}else{
var d=new Date();
d.setMilliseconds(0);
}
var hour=parseFloat(match[2]);
d.setHours(hour, parseInt(match[3], 10), parseInt(match[4], 10), parseFloat(match[5])*1000);
return d;
}else{
return str;
}},
function(str){
var match=str.match(/^([0-3]?\d)\s*[-\/.\s]{1}\s*([a-zA-Z]{3,9})\s*[-\/.\s]{1}\s*([0-3]?\d)$/);
if(match){
var d=new Date();
var cent=jsDate.config.defaultCentury;
var m1=parseFloat(match[1]);
var m3=parseFloat(match[3]);
var ny, nd, nm;
if(m1 > 31){
nd=m3;
ny=cent + m1;
}else{
nd=m1;
ny=cent + m3;
}
var nm=inArray(match[2], jsDate.regional[jsDate.regional.getLocale()]["monthNamesShort"]);
if(nm==-1){
nm=inArray(match[2], jsDate.regional[jsDate.regional.getLocale()]["monthNames"]);
}
d.setFullYear(ny, nm, nd);
d.setHours(0,0,0,0);
return d;
}else{
return str;
}}
];
function inArray(elem, array){
if(array.indexOf){
return array.indexOf(elem);
}
for(var i=0, length=array.length; i < length; i++){
if(array[ i ]===elem){
return i;
}}
return -1;
}
function get_type(thing){
if(thing===null) return "[object Null]";
return Object.prototype.toString.call(thing);
}
$.jsDate=jsDate;
$.jqplot.sprintf=function(){
function pad(str, len, chr, leftJustify){
var padding=(str.length >=len) ? '':Array(1 + len - str.length >>> 0).join(chr);
return leftJustify ? str + padding:padding + str;
}
function thousand_separate(value){
var value_str=new String(value);
for (var i=10; i>0; i--){
if(value_str==(value_str=value_str.replace(/^(\d+)(\d{3})/, "$1"+$.jqplot.sprintf.thousandsSeparator+"$2"))) break;
}
return value_str;
}
function justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace){
var diff=minWidth - value.length;
if(diff > 0){
var spchar=' ';
if(htmlSpace){ spchar='&nbsp;'; }
if(leftJustify||!zeroPad){
value=pad(value, minWidth, spchar, leftJustify);
}else{
value=value.slice(0, prefix.length) + pad('', diff, '0', true) + value.slice(prefix.length);
}}
return value;
}
function formatBaseX(value, base, prefix, leftJustify, minWidth, precision, zeroPad, htmlSpace){
var number=value >>> 0;
prefix=prefix&&number&&{'2': '0b', '8': '0', '16': '0x'}[base]||'';
value=prefix + pad(number.toString(base), precision||0, '0', false);
return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace);
}
function formatString(value, leftJustify, minWidth, precision, zeroPad, htmlSpace){
if(precision!=null){
value=value.slice(0, precision);
}
return justify(value, '', leftJustify, minWidth, zeroPad, htmlSpace);
}
var a=arguments, i=0, format=a[i++];
return format.replace($.jqplot.sprintf.regex, function(substring, valueIndex, flags, minWidth, _, precision, type){
if(substring=='%%'){ return '%'; }
var leftJustify=false, positivePrefix='', zeroPad=false, prefixBaseX=false, htmlSpace=false, thousandSeparation=false;
for (var j=0; flags&&j < flags.length; j++) switch (flags.charAt(j)){
case ' ': positivePrefix=' '; break;
case '+': positivePrefix='+'; break;
case '-': leftJustify=true; break;
case '0': zeroPad=true; break;
case '#': prefixBaseX=true; break;
case '&': htmlSpace=true; break;
case '\'': thousandSeparation=true; break;
}
if(!minWidth){
minWidth=0;
}
else if(minWidth=='*'){
minWidth=+a[i++];
}
else if(minWidth.charAt(0)=='*'){
minWidth=+a[minWidth.slice(1, -1)];
}else{
minWidth=+minWidth;
}
if(minWidth < 0){
minWidth=-minWidth;
leftJustify=true;
}
if(!isFinite(minWidth)){
throw new Error('$.jqplot.sprintf: (minimum-)width must be finite');
}
if(!precision){
precision='fFeE'.indexOf(type) > -1 ? 6:(type=='d') ? 0:void(0);
}
else if(precision=='*'){
precision=+a[i++];
}
else if(precision.charAt(0)=='*'){
precision=+a[precision.slice(1, -1)];
}else{
precision=+precision;
}
var value=valueIndex ? a[valueIndex.slice(0, -1)]:a[i++];
switch (type){
case 's': {
if(value==null){
return '';
}
return formatString(String(value), leftJustify, minWidth, precision, zeroPad, htmlSpace);
}
case 'c': return formatString(String.fromCharCode(+value), leftJustify, minWidth, precision, zeroPad, htmlSpace);
case 'b': return formatBaseX(value, 2, prefixBaseX, leftJustify, minWidth, precision, zeroPad,htmlSpace);
case 'o': return formatBaseX(value, 8, prefixBaseX, leftJustify, minWidth, precision, zeroPad, htmlSpace);
case 'x': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad, htmlSpace);
case 'X': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad, htmlSpace).toUpperCase();
case 'u': return formatBaseX(value, 10, prefixBaseX, leftJustify, minWidth, precision, zeroPad, htmlSpace);
case 'i': {
var number=parseInt(+value, 10);
if(isNaN(number)){
return '';
}
var prefix=number < 0 ? '-':positivePrefix;
var number_str=thousandSeparation ? thousand_separate(String(Math.abs(number))): String(Math.abs(number));
value=prefix + pad(number_str, precision, '0', false);
return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace);
}
case 'd': {
var number=Math.round(+value);
if(isNaN(number)){
return '';
}
var prefix=number < 0 ? '-':positivePrefix;
var number_str=thousandSeparation ? thousand_separate(String(Math.abs(number))): String(Math.abs(number));
value=prefix + pad(number_str, precision, '0', false);
return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace);
}
case 'e':
case 'E':
case 'f':
case 'F':
case 'g':
case 'G':
{
var number=+value;
if(isNaN(number)){
return '';
}
var prefix=number < 0 ? '-':positivePrefix;
var method=['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())];
var textTransform=['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2];
var number_str=Math.abs(number)[method](precision);
var parts=number_str.toString().split('.');
parts[0]=thousandSeparation ? thousand_separate(parts[0]):parts[0];
number_str=parts.join($.jqplot.sprintf.decimalMark);
value=prefix + number_str;
var justified=justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace)[textTransform]();
return justified;
}
case 'p':
case 'P':
{
var number=+value;
if(isNaN(number)){
return '';
}
var prefix=number < 0 ? '-':positivePrefix;
var parts=String(Number(Math.abs(number)).toExponential()).split(/e|E/);
var sd=(parts[0].indexOf('.')!=-1) ? parts[0].length - 1:String(number).length;
var zeros=(parts[1] < 0) ? -parts[1] - 1:0;
if(Math.abs(number) < 1){
if(sd + zeros  <=precision){
value=prefix + Math.abs(number).toPrecision(sd);
}else{
if(sd  <=precision - 1){
value=prefix + Math.abs(number).toExponential(sd-1);
}else{
value=prefix + Math.abs(number).toExponential(precision-1);
}}
}else{
var prec=(sd <=precision) ? sd:precision;
value=prefix + Math.abs(number).toPrecision(prec);
}
var textTransform=['toString', 'toUpperCase']['pP'.indexOf(type) % 2];
return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace)[textTransform]();
}
case 'n': return '';
default: return substring;
}});
};
$.jqplot.sprintf.thousandsSeparator=',';
$.jqplot.sprintf.decimalMark='.';
$.jqplot.sprintf.regex=/%%|%(\d+\$)?([-+#0&\' ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([nAscboxXuidfegpEGP])/g;
$.jqplot.getSignificantFigures=function(number){
var parts=String(Number(Math.abs(number)).toExponential()).split(/e|E/);
var sd=(parts[0].indexOf('.')!=-1) ? parts[0].length - 1:parts[0].length;
var zeros=(parts[1] < 0) ? -parts[1] - 1:0;
var expn=parseInt(parts[1], 10);
var dleft=(expn + 1 > 0) ? expn + 1:0;
var dright=(sd <=dleft) ? 0:sd - expn - 1;
return {significantDigits: sd, digitsLeft: dleft, digitsRight: dright, zeros: zeros, exponent: expn} ;
};
$.jqplot.getPrecision=function(number){
return $.jqplot.getSignificantFigures(number).digitsRight;
};
var backCompat=$.uiBackCompat!==false;
$.jqplot.effects={
effect: {}};
var dataSpace="jqplot.storage.";
$.extend($.jqplot.effects, {
version: "1.9pre",
save: function(element, set){
for(var i=0; i < set.length; i++){
if(set[ i ]!==null){
element.data(dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ]);
}}
},
restore: function(element, set){
for(var i=0; i < set.length; i++){
if(set[ i ]!==null){
element.css(set[ i ], element.data(dataSpace + set[ i ]) );
}}
},
setMode: function(el, mode){
if(mode==="toggle"){
mode=el.is(":hidden") ? "show":"hide";
}
return mode;
},
createWrapper: function(element){
if(element.parent().is(".ui-effects-wrapper")){
return element.parent();
}
var props={
width: element.outerWidth(true),
height: element.outerHeight(true),
"float": element.css("float")
},
wrapper=$("<div></div>")
.addClass("ui-effects-wrapper")
.css({
fontSize: "100%",
background: "transparent",
border: "none",
margin: 0,
padding: 0
}),
size={
width: element.width(),
height: element.height()
},
active=document.activeElement;
element.wrap(wrapper);
if(element[ 0 ]===active||$.contains(element[ 0 ], active) ){
$(active).focus();
}
wrapper=element.parent();
if(element.css("position")==="static"){
wrapper.css({ position: "relative" });
element.css({ position: "relative" });
}else{
$.extend(props, {
position: element.css("position"),
zIndex: element.css("z-index")
});
$.each([ "top", "left", "bottom", "right" ], function(i, pos){
props[ pos ]=element.css(pos);
if(isNaN(parseInt(props[ pos ], 10) )){
props[ pos ]="auto";
}});
element.css({
position: "relative",
top: 0,
left: 0,
right: "auto",
bottom: "auto"
});
}
element.css(size);
return wrapper.css(props).show();
},
removeWrapper: function(element){
var active=document.activeElement;
if(element.parent().is(".ui-effects-wrapper") ){
element.parent().replaceWith(element);
if(element[ 0 ]===active||$.contains(element[ 0 ], active) ){
$(active).focus();
}}
return element;
}});
function _normalizeArguments(effect, options, speed, callback){
if($.isPlainObject(effect) ){
return effect;
}
effect={ effect: effect };
if(options===undefined){
options={};}
if($.isFunction(options) ){
callback=options;
speed=null;
options={};}
if($.type(options)==="number"||$.fx.speeds[ options ]){
callback=speed;
speed=options;
options={};}
if($.isFunction(speed) ){
callback=speed;
speed=null;
}
if(options){
$.extend(effect, options);
}
speed=speed||options.duration;
effect.duration=$.fx.off ? 0:typeof speed==="number"
? speed:speed in $.fx.speeds ? $.fx.speeds[ speed ]:$.fx.speeds._default;
effect.complete=callback||options.complete;
return effect;
}
function standardSpeed(speed){
if(!speed||typeof speed==="number"||$.fx.speeds[ speed ]){
return true;
}
if(typeof speed==="string"&&!$.jqplot.effects.effect[ speed ]){
if(backCompat&&$.jqplot.effects[ speed ]){
return false;
}
return true;
}
return false;
}
$.fn.extend({
jqplotEffect: function(effect, options, speed, callback){
var args=_normalizeArguments.apply(this, arguments),
mode=args.mode,
queue=args.queue,
effectMethod=$.jqplot.effects.effect[ args.effect ],
oldEffectMethod = !effectMethod&&backCompat&&$.jqplot.effects[ args.effect ];
if($.fx.off||!(effectMethod||oldEffectMethod) ){
if(mode){
return this[ mode ](args.duration, args.complete);
}else{
return this.each(function(){
if(args.complete){
args.complete.call(this);
}});
}}
function run(next){
var elem=$(this),
complete=args.complete,
mode=args.mode;
function done(){
if($.isFunction(complete) ){
complete.call(elem[0]);
}
if($.isFunction(next) ){
next();
}}
if(elem.is(":hidden") ? mode==="hide":mode==="show"){
done();
}else{
effectMethod.call(elem[0], args, done);
}}
if(effectMethod){
return queue===false ? this.each(run):this.queue(queue||"fx", run);
}else{
return oldEffectMethod.call(this, {
options: args,
duration: args.duration,
callback: args.complete,
mode: args.mode
});
}}
});
var rvertical=/up|down|vertical/,
rpositivemotion=/up|left|vertical|horizontal/;
$.jqplot.effects.effect.blind=function(o, done){
var el=$(this),
props=[ "position", "top", "bottom", "left", "right", "height", "width" ],
mode=$.jqplot.effects.setMode(el, o.mode||"hide"),
direction=o.direction||"up",
vertical=rvertical.test(direction),
ref=vertical ? "height":"width",
ref2=vertical ? "top":"left",
motion=rpositivemotion.test(direction),
animation={},
show=mode==="show",
wrapper, distance, top;
if(el.parent().is(".ui-effects-wrapper") ){
$.jqplot.effects.save(el.parent(), props);
}else{
$.jqplot.effects.save(el, props);
}
el.show();
top=parseInt(el.css('top'), 10);
wrapper=$.jqplot.effects.createWrapper(el).css({
overflow: "hidden"
});
distance=vertical ? wrapper[ ref ]() + top:wrapper[ ref ]();
animation[ ref ]=show ? String(distance):'0';
if(!motion){
el
.css(vertical ? "bottom":"right", 0)
.css(vertical ? "top":"left", "")
.css({ position: "absolute" });
animation[ ref2 ]=show ? '0':String(distance);
}
if(show){
wrapper.css(ref, 0);
if(! motion){
wrapper.css(ref2, distance);
}}
wrapper.animate(animation, {
duration: o.duration,
easing: o.easing,
queue: false,
complete: function(){
if(mode==="hide"){
el.hide();
}
$.jqplot.effects.restore(el, props);
$.jqplot.effects.removeWrapper(el);
done();
}});
};})(jQuery);
(function($){
$.jqplot.Cursor=function(options){
this.style='crosshair';
this.previousCursor='auto';
this.show=$.jqplot.config.enablePlugins;
this.showTooltip=true;
this.followMouse=false;
this.tooltipLocation='se';
this.tooltipOffset=6;
this.showTooltipGridPosition=false;
this.showTooltipUnitPosition=true;
this.showTooltipDataPosition=false;
this.tooltipFormatString='%.4P, %.4P';
this.useAxesFormatters=true;
this.tooltipAxisGroups=[];
this.zoom=false;
this.zoomProxy=false;
this.zoomTarget=false;
this.looseZoom=true;
this.clickReset=false;
this.dblClickReset=true;
this.showVerticalLine=false;
this.showHorizontalLine=false;
this.constrainZoomTo='none';
this.shapeRenderer=new $.jqplot.ShapeRenderer();
this._zoom={start:[], end:[], started: false, zooming:false, isZoomed:false, axes:{start:{}, end:{}}, gridpos:{}, datapos:{}};
this._tooltipElem;
this.zoomCanvas;
this.cursorCanvas;
this.intersectionThreshold=2;
this.showCursorLegend=false;
this.cursorLegendFormatString=$.jqplot.Cursor.cursorLegendFormatString;
this._oldHandlers={onselectstart: null, ondrag: null, onmousedown: null};
this.constrainOutsideZoom=true;
this.showTooltipOutsideZoom=false;
this.onGrid=false;
$.extend(true, this, options);
};
$.jqplot.Cursor.cursorLegendFormatString='%s x:%s, y:%s';
$.jqplot.Cursor.init=function (target, data, opts){
var options=opts||{};
this.plugins.cursor=new $.jqplot.Cursor(options.cursor);
var c=this.plugins.cursor;
if(c.show){
$.jqplot.eventListenerHooks.push(['jqplotMouseEnter', handleMouseEnter]);
$.jqplot.eventListenerHooks.push(['jqplotMouseLeave', handleMouseLeave]);
$.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMouseMove]);
if(c.showCursorLegend){
opts.legend=opts.legend||{};
opts.legend.renderer=$.jqplot.CursorLegendRenderer;
opts.legend.formatString=this.plugins.cursor.cursorLegendFormatString;
opts.legend.show=true;
}
if(c.zoom){
$.jqplot.eventListenerHooks.push(['jqplotMouseDown', handleMouseDown]);
if(c.clickReset){
$.jqplot.eventListenerHooks.push(['jqplotClick', handleClick]);
}
if(c.dblClickReset){
$.jqplot.eventListenerHooks.push(['jqplotDblClick', handleDblClick]);
}}
this.resetZoom=function(){
var axes=this.axes;
if(!c.zoomProxy){
for (var ax in axes){
axes[ax].reset();
axes[ax]._ticks=[];
if(c._zoom.axes[ax]!==undefined){
axes[ax]._autoFormatString=c._zoom.axes[ax].tickFormatString;
}}
this.redraw();
}else{
var ctx=this.plugins.cursor.zoomCanvas._ctx;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
ctx=null;
}
this.plugins.cursor._zoom.isZoomed=false;
this.target.trigger('jqplotResetZoom', [this, this.plugins.cursor]);
};
if(c.showTooltipDataPosition){
c.showTooltipUnitPosition=false;
c.showTooltipGridPosition=false;
if(options.cursor.tooltipFormatString==undefined){
c.tooltipFormatString=$.jqplot.Cursor.cursorLegendFormatString;
}}
}};
$.jqplot.Cursor.postDraw=function(){
var c=this.plugins.cursor;
if(c.zoomCanvas){
c.zoomCanvas.resetCanvas();
c.zoomCanvas=null;
}
if(c.cursorCanvas){
c.cursorCanvas.resetCanvas();
c.cursorCanvas=null;
}
if(c._tooltipElem){
c._tooltipElem.emptyForce();
c._tooltipElem=null;
}
if(c.zoom){
c.zoomCanvas=new $.jqplot.GenericCanvas();
this.eventCanvas._elem.before(c.zoomCanvas.createElement(this._gridPadding, 'jqplot-zoom-canvas', this._plotDimensions, this));
c.zoomCanvas.setContext();
}
var elem=document.createElement('div');
c._tooltipElem=$(elem);
elem=null;
c._tooltipElem.addClass('jqplot-cursor-tooltip');
c._tooltipElem.css({position:'absolute', display:'none'});
if(c.zoomCanvas){
c.zoomCanvas._elem.before(c._tooltipElem);
}else{
this.eventCanvas._elem.before(c._tooltipElem);
}
if(c.showVerticalLine||c.showHorizontalLine){
c.cursorCanvas=new $.jqplot.GenericCanvas();
this.eventCanvas._elem.before(c.cursorCanvas.createElement(this._gridPadding, 'jqplot-cursor-canvas', this._plotDimensions, this));
c.cursorCanvas.setContext();
}
if(c.showTooltipUnitPosition){
if(c.tooltipAxisGroups.length===0){
var series=this.series;
var s;
var temp=[];
for (var i=0; i<series.length; i++){
s=series[i];
var ax=s.xaxis+','+s.yaxis;
if($.inArray(ax, temp)==-1){
temp.push(ax);
}}
for (var i=0; i<temp.length; i++){
c.tooltipAxisGroups.push(temp[i].split(','));
}}
}};
$.jqplot.Cursor.zoomProxy=function(targetPlot, controllerPlot){
var tc=targetPlot.plugins.cursor;
var cc=controllerPlot.plugins.cursor;
tc.zoomTarget=true;
tc.zoom=true;
tc.style='auto';
tc.dblClickReset=false;
cc.zoom=true;
cc.zoomProxy=true;
controllerPlot.target.bind('jqplotZoom', plotZoom);
controllerPlot.target.bind('jqplotResetZoom', plotReset);
function plotZoom(ev, gridpos, datapos, plot, cursor){
tc.doZoom(gridpos, datapos, targetPlot, cursor);
}
function plotReset(ev, plot, cursor){
targetPlot.resetZoom();
}};
$.jqplot.Cursor.prototype.resetZoom=function(plot, cursor){
var axes=plot.axes;
var cax=cursor._zoom.axes;
if(!plot.plugins.cursor.zoomProxy&&cursor._zoom.isZoomed){
for (var ax in axes){
axes[ax].reset();
axes[ax]._ticks=[];
axes[ax]._autoFormatString=cax[ax].tickFormatString;
}
plot.redraw();
cursor._zoom.isZoomed=false;
}else{
var ctx=cursor.zoomCanvas._ctx;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
ctx=null;
}
plot.target.trigger('jqplotResetZoom', [plot, cursor]);
};
$.jqplot.Cursor.resetZoom=function(plot){
plot.resetZoom();
};
$.jqplot.Cursor.prototype.doZoom=function (gridpos, datapos, plot, cursor){
var c=cursor;
var axes=plot.axes;
var zaxes=c._zoom.axes;
var start=zaxes.start;
var end=zaxes.end;
var min, max, dp, span,
newmin, newmax, curax, _numberTicks, ret;
var ctx=plot.plugins.cursor.zoomCanvas._ctx;
if((c.constrainZoomTo=='none'&&Math.abs(gridpos.x - c._zoom.start[0]) > 6&&Math.abs(gridpos.y - c._zoom.start[1]) > 6)||(c.constrainZoomTo=='x'&&Math.abs(gridpos.x - c._zoom.start[0]) > 6)||(c.constrainZoomTo=='y'&&Math.abs(gridpos.y - c._zoom.start[1]) > 6)){
if(!plot.plugins.cursor.zoomProxy){
for (var ax in datapos){
if(c._zoom.axes[ax]==undefined){
c._zoom.axes[ax]={};
c._zoom.axes[ax].numberTicks=axes[ax].numberTicks;
c._zoom.axes[ax].tickInterval=axes[ax].tickInterval;
c._zoom.axes[ax].daTickInterval=axes[ax].daTickInterval;
c._zoom.axes[ax].min=axes[ax].min;
c._zoom.axes[ax].max=axes[ax].max;
c._zoom.axes[ax].tickFormatString=(axes[ax].tickOptions!=null) ? axes[ax].tickOptions.formatString:'';
}
if((c.constrainZoomTo=='none')||(c.constrainZoomTo=='x'&&ax.charAt(0)=='x')||(c.constrainZoomTo=='y'&&ax.charAt(0)=='y')){
dp=datapos[ax];
if(dp!=null){
if(dp > start[ax]){
newmin=start[ax];
newmax=dp;
}else{
span=start[ax] - dp;
newmin=dp;
newmax=start[ax];
}
curax=axes[ax];
_numberTicks=null;
if(curax.alignTicks){
if(curax.name==='x2axis'&&plot.axes.xaxis.show){
_numberTicks=plot.axes.xaxis.numberTicks;
}
else if(curax.name.charAt(0)==='y'&&curax.name!=='yaxis'&&curax.name!=='yMidAxis'&&plot.axes.yaxis.show){
_numberTicks=plot.axes.yaxis.numberTicks;
}}
if(this.looseZoom&&(axes[ax].renderer.constructor===$.jqplot.LinearAxisRenderer||axes[ax].renderer.constructor===$.jqplot.LogAxisRenderer)){
ret=$.jqplot.LinearTickGenerator(newmin, newmax, curax._scalefact, _numberTicks);
if(axes[ax].tickInset&&ret[0] < axes[ax].min + axes[ax].tickInset * axes[ax].tickInterval){
ret[0] +=ret[4];
ret[2] -=1;
}
if(axes[ax].tickInset&&ret[1] > axes[ax].max - axes[ax].tickInset * axes[ax].tickInterval){
ret[1] -=ret[4];
ret[2] -=1;
}
if(axes[ax].renderer.constructor===$.jqplot.LogAxisRenderer&&ret[0] < axes[ax].min){
ret[0] +=ret[4];
ret[2] -=1;
}
axes[ax].min=ret[0];
axes[ax].max=ret[1];
axes[ax]._autoFormatString=ret[3];
axes[ax].numberTicks=ret[2];
axes[ax].tickInterval=ret[4];
axes[ax].daTickInterval=[ret[4]/1000, 'seconds'];
}else{
axes[ax].min=newmin;
axes[ax].max=newmax;
axes[ax].tickInterval=null;
axes[ax].numberTicks=null;
axes[ax].daTickInterval=null;
}
axes[ax]._ticks=[];
}}
}
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
plot.redraw();
c._zoom.isZoomed=true;
ctx=null;
}
plot.target.trigger('jqplotZoom', [gridpos, datapos, plot, cursor]);
}};
$.jqplot.preInitHooks.push($.jqplot.Cursor.init);
$.jqplot.postDrawHooks.push($.jqplot.Cursor.postDraw);
function updateTooltip(gridpos, datapos, plot){
var c=plot.plugins.cursor;
var s='';
var addbr=false;
if(c.showTooltipGridPosition){
s=gridpos.x+', '+gridpos.y;
addbr=true;
}
if(c.showTooltipUnitPosition){
var g;
for (var i=0; i<c.tooltipAxisGroups.length; i++){
g=c.tooltipAxisGroups[i];
if(addbr){
s +='<br />';
}
if(c.useAxesFormatters){
for (var j=0; j<g.length; j++){
if(j){
s +=', ';
}
var af=plot.axes[g[j]]._ticks[0].formatter;
var afstr=plot.axes[g[j]]._ticks[0].formatString;
s +=af(afstr, datapos[g[j]]);
}}else{
s +=$.jqplot.sprintf(c.tooltipFormatString, datapos[g[0]], datapos[g[1]]);
}
addbr=true;
}}
if(c.showTooltipDataPosition){
var series=plot.series;
var ret=getIntersectingPoints(plot, gridpos.x, gridpos.y);
var addbr=false;
for (var i=0; i< series.length; i++){
if(series[i].show){
var idx=series[i].index;
var label=series[i].label.toString();
var cellid=$.inArray(idx, ret.indices);
var sx=undefined;
var sy=undefined;
if(cellid!=-1){
var data=ret.data[cellid].data;
if(c.useAxesFormatters){
var xf=series[i]._xaxis._ticks[0].formatter;
var yf=series[i]._yaxis._ticks[0].formatter;
var xfstr=series[i]._xaxis._ticks[0].formatString;
var yfstr=series[i]._yaxis._ticks[0].formatString;
sx=xf(xfstr, data[0]);
sy=yf(yfstr, data[1]);
}else{
sx=data[0];
sy=data[1];
}
if(addbr){
s +='<br />';
}
s +=$.jqplot.sprintf(c.tooltipFormatString, label, sx, sy);
addbr=true;
}}
}}
c._tooltipElem.html(s);
}
function moveLine(gridpos, plot){
var c=plot.plugins.cursor;
var ctx=c.cursorCanvas._ctx;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
if(c.showVerticalLine){
c.shapeRenderer.draw(ctx, [[gridpos.x, 0], [gridpos.x, ctx.canvas.height]]);
}
if(c.showHorizontalLine){
c.shapeRenderer.draw(ctx, [[0, gridpos.y], [ctx.canvas.width, gridpos.y]]);
}
var ret=getIntersectingPoints(plot, gridpos.x, gridpos.y);
if(c.showCursorLegend){
var cells=$(plot.targetId + ' td.jqplot-cursor-legend-label');
for (var i=0; i<cells.length; i++){
var idx=$(cells[i]).data('seriesIndex');
var series=plot.series[idx];
var label=series.label.toString();
var cellid=$.inArray(idx, ret.indices);
var sx=undefined;
var sy=undefined;
if(cellid!=-1){
var data=ret.data[cellid].data;
if(c.useAxesFormatters){
var xf=series._xaxis._ticks[0].formatter;
var yf=series._yaxis._ticks[0].formatter;
var xfstr=series._xaxis._ticks[0].formatString;
var yfstr=series._yaxis._ticks[0].formatString;
sx=xf(xfstr, data[0]);
sy=yf(yfstr, data[1]);
}else{
sx=data[0];
sy=data[1];
}}
if(plot.legend.escapeHtml){
$(cells[i]).text($.jqplot.sprintf(c.cursorLegendFormatString, label, sx, sy));
}else{
$(cells[i]).html($.jqplot.sprintf(c.cursorLegendFormatString, label, sx, sy));
}}
}
ctx=null;
}
function getIntersectingPoints(plot, x, y){
var ret={indices:[], data:[]};
var s, i, d0, d, j, r, p;
var threshold;
var c=plot.plugins.cursor;
for (var i=0; i<plot.series.length; i++){
s=plot.series[i];
r=s.renderer;
if(s.show){
threshold=c.intersectionThreshold;
if(s.showMarker){
threshold +=s.markerRenderer.size/2;
}
for (var j=0; j<s.gridData.length; j++){
p=s.gridData[j];
if(c.showVerticalLine){
if(Math.abs(x-p[0]) <=threshold){
ret.indices.push(i);
ret.data.push({seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]});
}}
}}
}
return ret;
}
function moveTooltip(gridpos, plot){
var c=plot.plugins.cursor;
var elem=c._tooltipElem;
switch (c.tooltipLocation){
case 'nw':
var x=gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - c.tooltipOffset;
var y=gridpos.y + plot._gridPadding.top - c.tooltipOffset - elem.outerHeight(true);
break;
case 'n':
var x=gridpos.x + plot._gridPadding.left - elem.outerWidth(true)/2;
var y=gridpos.y + plot._gridPadding.top - c.tooltipOffset - elem.outerHeight(true);
break;
case 'ne':
var x=gridpos.x + plot._gridPadding.left + c.tooltipOffset;
var y=gridpos.y + plot._gridPadding.top - c.tooltipOffset - elem.outerHeight(true);
break;
case 'e':
var x=gridpos.x + plot._gridPadding.left + c.tooltipOffset;
var y=gridpos.y + plot._gridPadding.top - elem.outerHeight(true)/2;
break;
case 'se':
var x=gridpos.x + plot._gridPadding.left + c.tooltipOffset;
var y=gridpos.y + plot._gridPadding.top + c.tooltipOffset;
break;
case 's':
var x=gridpos.x + plot._gridPadding.left - elem.outerWidth(true)/2;
var y=gridpos.y + plot._gridPadding.top + c.tooltipOffset;
break;
case 'sw':
var x=gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - c.tooltipOffset;
var y=gridpos.y + plot._gridPadding.top + c.tooltipOffset;
break;
case 'w':
var x=gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - c.tooltipOffset;
var y=gridpos.y + plot._gridPadding.top - elem.outerHeight(true)/2;
break;
default:
var x=gridpos.x + plot._gridPadding.left + c.tooltipOffset;
var y=gridpos.y + plot._gridPadding.top + c.tooltipOffset;
break;
}
elem.css('left', x);
elem.css('top', y);
elem=null;
}
function positionTooltip(plot){
var grid=plot._gridPadding;
var c=plot.plugins.cursor;
var elem=c._tooltipElem;
switch (c.tooltipLocation){
case 'nw':
var a=grid.left + c.tooltipOffset;
var b=grid.top + c.tooltipOffset;
elem.css('left', a);
elem.css('top', b);
break;
case 'n':
var a=(grid.left + (plot._plotDimensions.width - grid.right))/2 - elem.outerWidth(true)/2;
var b=grid.top + c.tooltipOffset;
elem.css('left', a);
elem.css('top', b);
break;
case 'ne':
var a=grid.right + c.tooltipOffset;
var b=grid.top + c.tooltipOffset;
elem.css({right:a, top:b});
break;
case 'e':
var a=grid.right + c.tooltipOffset;
var b=(grid.top + (plot._plotDimensions.height - grid.bottom))/2 - elem.outerHeight(true)/2;
elem.css({right:a, top:b});
break;
case 'se':
var a=grid.right + c.tooltipOffset;
var b=grid.bottom + c.tooltipOffset;
elem.css({right:a, bottom:b});
break;
case 's':
var a=(grid.left + (plot._plotDimensions.width - grid.right))/2 - elem.outerWidth(true)/2;
var b=grid.bottom + c.tooltipOffset;
elem.css({left:a, bottom:b});
break;
case 'sw':
var a=grid.left + c.tooltipOffset;
var b=grid.bottom + c.tooltipOffset;
elem.css({left:a, bottom:b});
break;
case 'w':
var a=grid.left + c.tooltipOffset;
var b=(grid.top + (plot._plotDimensions.height - grid.bottom))/2 - elem.outerHeight(true)/2;
elem.css({left:a, top:b});
break;
default:
var a=grid.right - c.tooltipOffset;
var b=grid.bottom + c.tooltipOffset;
elem.css({right:a, bottom:b});
break;
}
elem=null;
}
function handleClick (ev, gridpos, datapos, neighbor, plot){
ev.preventDefault();
ev.stopImmediatePropagation();
var c=plot.plugins.cursor;
if(c.clickReset){
c.resetZoom(plot, c);
}
var sel=window.getSelection;
if(document.selection&&document.selection.empty){
document.selection.empty();
}
else if(sel&&!sel().isCollapsed){
sel().collapse();
}
return false;
}
function handleDblClick (ev, gridpos, datapos, neighbor, plot){
ev.preventDefault();
ev.stopImmediatePropagation();
var c=plot.plugins.cursor;
if(c.dblClickReset){
c.resetZoom(plot, c);
}
var sel=window.getSelection;
if(document.selection&&document.selection.empty){
document.selection.empty();
}
else if(sel&&!sel().isCollapsed){
sel().collapse();
}
return false;
}
function handleMouseLeave(ev, gridpos, datapos, neighbor, plot){
var c=plot.plugins.cursor;
c.onGrid=false;
if(c.show){
$(ev.target).css('cursor', c.previousCursor);
if(c.showTooltip&&!(c._zoom.zooming&&c.showTooltipOutsideZoom&&!c.constrainOutsideZoom)){
c._tooltipElem.empty();
c._tooltipElem.hide();
}
if(c.zoom){
c._zoom.gridpos=gridpos;
c._zoom.datapos=datapos;
}
if(c.showVerticalLine||c.showHorizontalLine){
var ctx=c.cursorCanvas._ctx;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
ctx=null;
}
if(c.showCursorLegend){
var cells=$(plot.targetId + ' td.jqplot-cursor-legend-label');
for (var i=0; i<cells.length; i++){
var idx=$(cells[i]).data('seriesIndex');
var series=plot.series[idx];
var label=series.label.toString();
if(plot.legend.escapeHtml){
$(cells[i]).text($.jqplot.sprintf(c.cursorLegendFormatString, label, undefined, undefined));
}else{
$(cells[i]).html($.jqplot.sprintf(c.cursorLegendFormatString, label, undefined, undefined));
}}
}}
}
function handleMouseEnter(ev, gridpos, datapos, neighbor, plot){
var c=plot.plugins.cursor;
c.onGrid=true;
if(c.show){
c.previousCursor=ev.target.style.cursor;
ev.target.style.cursor=c.style;
if(c.showTooltip){
updateTooltip(gridpos, datapos, plot);
if(c.followMouse){
moveTooltip(gridpos, plot);
}else{
positionTooltip(plot);
}
c._tooltipElem.show();
}
if(c.showVerticalLine||c.showHorizontalLine){
moveLine(gridpos, plot);
}}
}
function handleMouseMove(ev, gridpos, datapos, neighbor, plot){
var c=plot.plugins.cursor;
if(c.show){
if(c.showTooltip){
updateTooltip(gridpos, datapos, plot);
if(c.followMouse){
moveTooltip(gridpos, plot);
}}
if(c.showVerticalLine||c.showHorizontalLine){
moveLine(gridpos, plot);
}}
}
function getEventPosition(ev){
var plot=ev.data.plot;
var go=plot.eventCanvas._elem.offset();
var gridPos={x:ev.pageX - go.left, y:ev.pageY - go.top};
var dataPos={xaxis:null, yaxis:null, x2axis:null, y2axis:null, y3axis:null, y4axis:null, y5axis:null, y6axis:null, y7axis:null, y8axis:null, y9axis:null, yMidAxis:null};
var an=['xaxis', 'yaxis', 'x2axis', 'y2axis', 'y3axis', 'y4axis', 'y5axis', 'y6axis', 'y7axis', 'y8axis', 'y9axis', 'yMidAxis'];
var ax=plot.axes;
var n, axis;
for (n=11; n>0; n--){
axis=an[n-1];
if(ax[axis].show){
dataPos[axis]=ax[axis].series_p2u(gridPos[axis.charAt(0)]);
}}
return {offsets:go, gridPos:gridPos, dataPos:dataPos};}
function handleZoomMove(ev){
var plot=ev.data.plot;
var c=plot.plugins.cursor;
if(c.show&&c.zoom&&c._zoom.started&&!c.zoomTarget){
ev.preventDefault();
var ctx=c.zoomCanvas._ctx;
var positions=getEventPosition(ev);
var gridpos=positions.gridPos;
var datapos=positions.dataPos;
c._zoom.gridpos=gridpos;
c._zoom.datapos=datapos;
c._zoom.zooming=true;
var xpos=gridpos.x;
var ypos=gridpos.y;
var height=ctx.canvas.height;
var width=ctx.canvas.width;
if(c.showTooltip&&!c.onGrid&&c.showTooltipOutsideZoom){
updateTooltip(gridpos, datapos, plot);
if(c.followMouse){
moveTooltip(gridpos, plot);
}}
if(c.constrainZoomTo=='x'){
c._zoom.end=[xpos, height];
}
else if(c.constrainZoomTo=='y'){
c._zoom.end=[width, ypos];
}else{
c._zoom.end=[xpos, ypos];
}
var sel=window.getSelection;
if(document.selection&&document.selection.empty){
document.selection.empty();
}
else if(sel&&!sel().isCollapsed){
sel().collapse();
}
drawZoomBox.call(c);
ctx=null;
}}
function handleMouseDown(ev, gridpos, datapos, neighbor, plot){
var c=plot.plugins.cursor;
if(plot.plugins.mobile){
$(document).one('vmouseup.jqplot_cursor', {plot:plot}, handleMouseUp);
}else{
$(document).one('mouseup.jqplot_cursor', {plot:plot}, handleMouseUp);
}
var axes=plot.axes;
if(document.onselectstart!=undefined){
c._oldHandlers.onselectstart=document.onselectstart;
document.onselectstart=function (){ return false; };}
if(document.ondrag!=undefined){
c._oldHandlers.ondrag=document.ondrag;
document.ondrag=function (){ return false; };}
if(document.onmousedown!=undefined){
c._oldHandlers.onmousedown=document.onmousedown;
document.onmousedown=function (){ return false; };}
if(c.zoom){
if(!c.zoomProxy){
var ctx=c.zoomCanvas._ctx;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
ctx=null;
}
if(c.constrainZoomTo=='x'){
c._zoom.start=[gridpos.x, 0];
}
else if(c.constrainZoomTo=='y'){
c._zoom.start=[0, gridpos.y];
}else{
c._zoom.start=[gridpos.x, gridpos.y];
}
c._zoom.started=true;
for (var ax in datapos){
c._zoom.axes.start[ax]=datapos[ax];
}
if(plot.plugins.mobile){
$(document).bind('vmousemove.jqplotCursor', {plot:plot}, handleZoomMove);
}else{
$(document).bind('mousemove.jqplotCursor', {plot:plot}, handleZoomMove);
}}
}
function handleMouseUp(ev){
var plot=ev.data.plot;
var c=plot.plugins.cursor;
if(c.zoom&&c._zoom.zooming&&!c.zoomTarget){
var xpos=c._zoom.gridpos.x;
var ypos=c._zoom.gridpos.y;
var datapos=c._zoom.datapos;
var height=c.zoomCanvas._ctx.canvas.height;
var width=c.zoomCanvas._ctx.canvas.width;
var axes=plot.axes;
if(c.constrainOutsideZoom&&!c.onGrid){
if(xpos < 0){ xpos=0; }
else if(xpos > width){ xpos=width; }
if(ypos < 0){ ypos=0; }
else if(ypos > height){ ypos=height; }
for (var axis in datapos){
if(datapos[axis]){
if(axis.charAt(0)=='x'){
datapos[axis]=axes[axis].series_p2u(xpos);
}else{
datapos[axis]=axes[axis].series_p2u(ypos);
}}
}}
if(c.constrainZoomTo=='x'){
ypos=height;
}
else if(c.constrainZoomTo=='y'){
xpos=width;
}
c._zoom.end=[xpos, ypos];
c._zoom.gridpos={x:xpos, y:ypos};
c.doZoom(c._zoom.gridpos, datapos, plot, c);
}
c._zoom.started=false;
c._zoom.zooming=false;
$(document).unbind('mousemove.jqplotCursor', handleZoomMove);
if(document.onselectstart!=undefined&&c._oldHandlers.onselectstart!=null){
document.onselectstart=c._oldHandlers.onselectstart;
c._oldHandlers.onselectstart=null;
}
if(document.ondrag!=undefined&&c._oldHandlers.ondrag!=null){
document.ondrag=c._oldHandlers.ondrag;
c._oldHandlers.ondrag=null;
}
if(document.onmousedown!=undefined&&c._oldHandlers.onmousedown!=null){
document.onmousedown=c._oldHandlers.onmousedown;
c._oldHandlers.onmousedown=null;
}}
function drawZoomBox(){
var start=this._zoom.start;
var end=this._zoom.end;
var ctx=this.zoomCanvas._ctx;
var l, t, h, w;
if(end[0] > start[0]){
l=start[0];
w=end[0] - start[0];
}else{
l=end[0];
w=start[0] - end[0];
}
if(end[1] > start[1]){
t=start[1];
h=end[1] - start[1];
}else{
t=end[1];
h=start[1] - end[1];
}
ctx.fillStyle='rgba(0,0,0,0.2)';
ctx.strokeStyle='#999999';
ctx.lineWidth=1.0;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
ctx.fillRect(0,0,ctx.canvas.width, ctx.canvas.height);
ctx.clearRect(l, t, w, h);
ctx.strokeRect(l,t,w,h);
ctx=null;
}
$.jqplot.CursorLegendRenderer=function(options){
$.jqplot.TableLegendRenderer.call(this, options);
this.formatString='%s';
};
$.jqplot.CursorLegendRenderer.prototype=new $.jqplot.TableLegendRenderer();
$.jqplot.CursorLegendRenderer.prototype.constructor=$.jqplot.CursorLegendRenderer;
$.jqplot.CursorLegendRenderer.prototype.draw=function(){
if(this._elem){
this._elem.emptyForce();
this._elem=null;
}
if(this.show){
var series=this._series, s;
var elem=document.createElement('table');
this._elem=$(elem);
elem=null;
this._elem.addClass('jqplot-legend jqplot-cursor-legend');
this._elem.css('position', 'absolute');
var pad=false;
for (var i=0; i< series.length; i++){
s=series[i];
if(s.show&&s.showLabel){
var lt=$.jqplot.sprintf(this.formatString, s.label.toString());
if(lt){
var color=s.color;
if(s._stack&&!s.fill){
color='';
}
addrow.call(this, lt, color, pad, i);
pad=true;
}
for (var j=0; j<$.jqplot.addLegendRowHooks.length; j++){
var item=$.jqplot.addLegendRowHooks[j].call(this, s);
if(item){
addrow.call(this, item.label, item.color, pad);
pad=true;
}}
}}
series=s = null;
delete series;
delete s;
}
function addrow(label, color, pad, idx){
var rs=(pad) ? this.rowSpacing:'0';
var tr=$('<tr class="jqplot-legend jqplot-cursor-legend"></tr>').appendTo(this._elem);
tr.data('seriesIndex', idx);
$('<td class="jqplot-legend jqplot-cursor-legend-swatch" style="padding-top:'+rs+';">'+
'<div style="border:1px solid #cccccc;padding:0.2em;">'+
'<div class="jqplot-cursor-legend-swatch" style="background-color:'+color+';"></div>'+
'</div></td>').appendTo(tr);
var td=$('<td class="jqplot-legend jqplot-cursor-legend-label" style="vertical-align:middle;padding-top:'+rs+';"></td>');
td.appendTo(tr);
td.data('seriesIndex', idx);
if(this.escapeHtml){
td.text(label);
}else{
td.html(label);
}
tr=null;
td=null;
}
return this._elem;
};})(jQuery);
(function($){
$.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMove]);
/**
* Class: $.jqplot.Highlighter
* Plugin which will highlight data points when they are moused over.
*
* To use this plugin, include the js
* file in your source:
*
* > <script type="text/javascript" src="plugins/jqplot.highlighter.js"></script>
*
* A tooltip providing information about the data point is enabled by default.
* To disable the tooltip, set "showTooltip" to false.
*
* You can control what data is displayed in the tooltip with various
* options.  The "tooltipAxes" option controls whether the x, y or both
* data values are displayed.
*
* Some chart types (e.g. hi-low-close) have more than one y value per
* data point. To display the additional values in the tooltip, set the
* "yvalues" option to the desired number of y values present (3 for a hlc chart).
*
* By default, data values will be formatted with the same formatting
* specifiers as used to format the axis ticks.  A custom format code
* can be supplied with the tooltipFormatString option.  This will apply
* to all values in the tooltip.
*
* For more complete control, the "formatString" option can be set.  This
* Allows conplete control over tooltip formatting.  Values are passed to
* the format string in an order determined by the "tooltipAxes" and "yvalues"
* options.  So, if you have a hi-low-close chart and you just want to display
* the hi-low-close values in the tooltip, you could set a formatString like:
*
* > highlighter: {
* >     tooltipAxes: 'y',
* >     yvalues: 3,
* >     formatString:'<table class="jqplot-highlighter">
* >         <tr><td>hi:</td><td>%s</td></tr>
* >         <tr><td>low:</td><td>%s</td></tr>
* >         <tr><td>close:</td><td>%s</td></tr></table>'
* > }
*
*/
$.jqplot.Highlighter=function(options){
this.show=$.jqplot.config.enablePlugins;
this.markerRenderer=new $.jqplot.MarkerRenderer({shadow:false});
this.showMarker=true;
this.lineWidthAdjust=2.5;
this.sizeAdjust=5;
this.showTooltip=true;
this.tooltipLocation='nw';
this.fadeTooltip=true;
this.tooltipFadeSpeed="fast";
this.tooltipOffset=2;
this.tooltipAxes='both';
this.tooltipSeparator=', ';
this.tooltipContentEditor=null;
this.useAxesFormatters=true;
this.tooltipFormatString='%.5P';
this.formatString=null;
this.yvalues=1;
this.bringSeriesToFront=false;
this._tooltipElem;
this.isHighlighting=false;
this.currentNeighbor=null;
$.extend(true, this, options);
};
var locations=['nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w'];
var locationIndicies={'nw':0, 'n':1, 'ne':2, 'e':3, 'se':4, 's':5, 'sw':6, 'w':7};
var oppositeLocations=['se', 's', 'sw', 'w', 'nw', 'n', 'ne', 'e'];
var mirrorLocations=['ne', 'n', 'nw', 'w', 'sw', 's', 'se', 'e'];
$.jqplot.Highlighter.init=function (target, data, opts){
var options=opts||{};
this.plugins.highlighter=new $.jqplot.Highlighter(options.highlighter);
};
$.jqplot.Highlighter.parseOptions=function (defaults, options){
this.showHighlight=true;
};
$.jqplot.Highlighter.postPlotDraw=function(){
if(this.plugins.highlighter&&this.plugins.highlighter.highlightCanvas){
this.plugins.highlighter.highlightCanvas.resetCanvas();
this.plugins.highlighter.highlightCanvas=null;
}
if(this.plugins.highlighter&&this.plugins.highlighter._tooltipElem){
this.plugins.highlighter._tooltipElem.emptyForce();
this.plugins.highlighter._tooltipElem=null;
}
this.plugins.highlighter.highlightCanvas=new $.jqplot.GenericCanvas();
this.eventCanvas._elem.before(this.plugins.highlighter.highlightCanvas.createElement(this._gridPadding, 'jqplot-highlight-canvas', this._plotDimensions, this));
this.plugins.highlighter.highlightCanvas.setContext();
var elem=document.createElement('div');
this.plugins.highlighter._tooltipElem=$(elem);
elem=null;
this.plugins.highlighter._tooltipElem.addClass('jqplot-highlighter-tooltip');
this.plugins.highlighter._tooltipElem.css({position:'absolute', display:'none'});
this.eventCanvas._elem.before(this.plugins.highlighter._tooltipElem);
};
$.jqplot.preInitHooks.push($.jqplot.Highlighter.init);
$.jqplot.preParseSeriesOptionsHooks.push($.jqplot.Highlighter.parseOptions);
$.jqplot.postDrawHooks.push($.jqplot.Highlighter.postPlotDraw);
function draw(plot, neighbor){
var hl=plot.plugins.highlighter;
var s=plot.series[neighbor.seriesIndex];
var smr=s.markerRenderer;
var mr=hl.markerRenderer;
mr.style=smr.style;
mr.lineWidth=smr.lineWidth + hl.lineWidthAdjust;
mr.size=smr.size + hl.sizeAdjust;
var rgba=$.jqplot.getColorComponents(smr.color);
var newrgb=[rgba[0], rgba[1], rgba[2]];
var alpha=(rgba[3] >=0.6) ? rgba[3]*0.6:rgba[3]*(2-rgba[3]);
mr.color='rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+alpha+')';
mr.init();
mr.draw(s.gridData[neighbor.pointIndex][0], s.gridData[neighbor.pointIndex][1], hl.highlightCanvas._ctx);
}
function showTooltip(plot, series, neighbor){
var hl=plot.plugins.highlighter;
var elem=hl._tooltipElem;
var serieshl=series.highlighter||{};
var opts=$.extend(true, {}, hl, serieshl);
if(opts.useAxesFormatters){
var xf=series._xaxis._ticks[0].formatter;
var yf=series._yaxis._ticks[0].formatter;
var xfstr=series._xaxis._ticks[0].formatString;
var yfstr=series._yaxis._ticks[0].formatString;
var str;
var xstr=xf(xfstr, neighbor.data[0]);
var ystrs=[];
for (var i=1; i<opts.yvalues+1; i++){
ystrs.push(yf(yfstr, neighbor.data[i]));
}
if(typeof opts.formatString==='string'){
switch (opts.tooltipAxes){
case 'both':
case 'xy':
ystrs.unshift(xstr);
ystrs.unshift(opts.formatString);
str=$.jqplot.sprintf.apply($.jqplot.sprintf, ystrs);
break;
case 'yx':
ystrs.push(xstr);
ystrs.unshift(opts.formatString);
str=$.jqplot.sprintf.apply($.jqplot.sprintf, ystrs);
break;
case 'x':
str=$.jqplot.sprintf.apply($.jqplot.sprintf, [opts.formatString, xstr]);
break;
case 'y':
ystrs.unshift(opts.formatString);
str=$.jqplot.sprintf.apply($.jqplot.sprintf, ystrs);
break;
default:
ystrs.unshift(xstr);
ystrs.unshift(opts.formatString);
str=$.jqplot.sprintf.apply($.jqplot.sprintf, ystrs);
break;
}}else{
switch (opts.tooltipAxes){
case 'both':
case 'xy':
str=xstr;
for (var i=0; i<ystrs.length; i++){
str +=opts.tooltipSeparator + ystrs[i];
}
break;
case 'yx':
str='';
for (var i=0; i<ystrs.length; i++){
str +=ystrs[i] + opts.tooltipSeparator;
}
str +=xstr;
break;
case 'x':
str=xstr;
break;
case 'y':
str=ystrs.join(opts.tooltipSeparator);
break;
default:
str=xstr;
for (var i=0; i<ystrs.length; i++){
str +=opts.tooltipSeparator + ystrs[i];
}
break;
}}
}else{
var str;
if(typeof opts.formatString==='string'){
str=$.jqplot.sprintf.apply($.jqplot.sprintf, [opts.formatString].concat(neighbor.data));
}else{
if(opts.tooltipAxes=='both'||opts.tooltipAxes=='xy'){
str=$.jqplot.sprintf(opts.tooltipFormatString, neighbor.data[0]) + opts.tooltipSeparator + $.jqplot.sprintf(opts.tooltipFormatString, neighbor.data[1]);
}
else if(opts.tooltipAxes=='yx'){
str=$.jqplot.sprintf(opts.tooltipFormatString, neighbor.data[1]) + opts.tooltipSeparator + $.jqplot.sprintf(opts.tooltipFormatString, neighbor.data[0]);
}
else if(opts.tooltipAxes=='x'){
str=$.jqplot.sprintf(opts.tooltipFormatString, neighbor.data[0]);
}
else if(opts.tooltipAxes=='y'){
str=$.jqplot.sprintf(opts.tooltipFormatString, neighbor.data[1]);
}}
}
if($.isFunction(opts.tooltipContentEditor)){
str=opts.tooltipContentEditor(str, neighbor.seriesIndex, neighbor.pointIndex, plot);
}
elem.html(str);
var gridpos={x:neighbor.gridData[0], y:neighbor.gridData[1]};
var ms=0;
var fact=0.707;
if(series.markerRenderer.show==true){
ms=(series.markerRenderer.size + opts.sizeAdjust)/2;
}
var loc=locations;
var locCode=loc[locationIndicies[opts.tooltipLocation]];
if(gridpos.x < (plot._width/2)&&locCode.indexOf("w")!==-1){
loc=mirrorLocations;
}else if(gridpos.x > (plot._width/2)&&locCode.indexOf("e")!==-1){
loc=mirrorLocations;
}else if(series.fillToZero&&series.fill&&neighbor.data[1] < 0){
loc=oppositeLocations;
}
switch (loc[locationIndicies[opts.tooltipLocation]]){
case 'nw':
var x=gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - opts.tooltipOffset - fact * ms;
var y=gridpos.y + plot._gridPadding.top - opts.tooltipOffset - elem.outerHeight(true) - fact * ms;
break;
case 'n':
var x=gridpos.x + plot._gridPadding.left - elem.outerWidth(true)/2;
var y=gridpos.y + plot._gridPadding.top - opts.tooltipOffset - elem.outerHeight(true) - ms;
break;
case 'ne':
var x=gridpos.x + plot._gridPadding.left + opts.tooltipOffset + fact * ms;
var y=gridpos.y + plot._gridPadding.top - opts.tooltipOffset - elem.outerHeight(true) - fact * ms;
break;
case 'e':
var x=gridpos.x + plot._gridPadding.left + opts.tooltipOffset + ms;
var y=gridpos.y + plot._gridPadding.top - elem.outerHeight(true)/2;
break;
case 'se':
var x=gridpos.x + plot._gridPadding.left + opts.tooltipOffset + fact * ms;
var y=gridpos.y + plot._gridPadding.top + opts.tooltipOffset + fact * ms;
break;
case 's':
var x=gridpos.x + plot._gridPadding.left - elem.outerWidth(true)/2;
var y=gridpos.y + plot._gridPadding.top + opts.tooltipOffset + ms;
break;
case 'sw':
var x=gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - opts.tooltipOffset - fact * ms;
var y=gridpos.y + plot._gridPadding.top + opts.tooltipOffset + fact * ms;
break;
case 'w':
var x=gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - opts.tooltipOffset - ms;
var y=gridpos.y + plot._gridPadding.top - elem.outerHeight(true)/2;
break;
default:
var x=gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - opts.tooltipOffset - fact * ms;
var y=gridpos.y + plot._gridPadding.top - opts.tooltipOffset - elem.outerHeight(true) - fact * ms;
break;
}
elem.css('left', x);
elem.css('top', y);
if(opts.fadeTooltip){
elem.stop(true,true).fadeIn(opts.tooltipFadeSpeed);
}else{
elem.show();
}
elem=null;
}
function handleMove(ev, gridpos, datapos, neighbor, plot){
var hl=plot.plugins.highlighter;
var c=plot.plugins.cursor;
if(hl.show){
if(neighbor==null&&hl.isHighlighting){
var evt=jQuery.Event('jqplotHighlighterUnhighlight');
plot.target.trigger(evt);
var ctx=hl.highlightCanvas._ctx;
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
if(hl.fadeTooltip){
hl._tooltipElem.fadeOut(hl.tooltipFadeSpeed);
}else{
hl._tooltipElem.hide();
}
if(hl.bringSeriesToFront){
plot.restorePreviousSeriesOrder();
}
hl.isHighlighting=false;
hl.currentNeighbor=null;
ctx=null;
}
else if(neighbor!=null&&plot.series[neighbor.seriesIndex].showHighlight&&!hl.isHighlighting){
var evt=jQuery.Event('jqplotHighlighterHighlight');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data, plot];
plot.target.trigger(evt, ins);
hl.isHighlighting=true;
hl.currentNeighbor=neighbor;
if(hl.showMarker){
draw(plot, neighbor);
}
if(plot.series[neighbor.seriesIndex].show&&hl.showTooltip&&(!c||!c._zoom.started)){
showTooltip(plot, plot.series[neighbor.seriesIndex], neighbor);
}
if(hl.bringSeriesToFront){
plot.moveSeriesToFront(neighbor.seriesIndex);
}}
else if(neighbor!=null&&hl.isHighlighting&&hl.currentNeighbor!=neighbor){
if(plot.series[neighbor.seriesIndex].showHighlight){
var ctx=hl.highlightCanvas._ctx;
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
hl.isHighlighting=true;
hl.currentNeighbor=neighbor;
if(hl.showMarker){
draw(plot, neighbor);
}
if(plot.series[neighbor.seriesIndex].show&&hl.showTooltip&&(!c||!c._zoom.started)){
showTooltip(plot, plot.series[neighbor.seriesIndex], neighbor);
}
if(hl.bringSeriesToFront){
plot.moveSeriesToFront(neighbor.seriesIndex);
}}
}}
}})(jQuery);
(function($){
$.jqplot.CanvasAxisTickRenderer=function(options){
this.mark='outside';
this.showMark=true;
this.showGridline=true;
this.isMinorTick=false;
this.angle=0;
this.markSize=4;
this.show=true;
this.showLabel=true;
this.labelPosition='auto';
this.label='';
this.value=null;
this._styles={};
this.formatter=$.jqplot.DefaultTickFormatter;
this.formatString='';
this.prefix='';
this.fontFamily='"Trebuchet MS", Arial, Helvetica, sans-serif';
this.fontSize='10pt';
this.fontWeight='normal';
this.fontStretch=1.0;
this.textColor='#666666';
this.enableFontSupport=true;
this.pt2px=null;
this._elem;
this._ctx;
this._plotWidth;
this._plotHeight;
this._plotDimensions={height:null, width:null};
$.extend(true, this, options);
var ropts={fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily};
if(this.pt2px){
ropts.pt2px=this.pt2px;
}
if(this.enableFontSupport){
if($.jqplot.support_canvas_text()){
this._textRenderer=new $.jqplot.CanvasFontRenderer(ropts);
}else{
this._textRenderer=new $.jqplot.CanvasTextRenderer(ropts);
}}else{
this._textRenderer=new $.jqplot.CanvasTextRenderer(ropts);
}};
$.jqplot.CanvasAxisTickRenderer.prototype.init=function(options){
$.extend(true, this, options);
this._textRenderer.init({fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily});
};
$.jqplot.CanvasAxisTickRenderer.prototype.getWidth=function(ctx){
if(this._elem){
return this._elem.outerWidth(true);
}else{
var tr=this._textRenderer;
var l=tr.getWidth(ctx);
var h=tr.getHeight(ctx);
var w=Math.abs(Math.sin(tr.angle)*h) + Math.abs(Math.cos(tr.angle)*l);
return w;
}};
$.jqplot.CanvasAxisTickRenderer.prototype.getHeight=function(ctx){
if(this._elem){
return this._elem.outerHeight(true);
}else{
var tr=this._textRenderer;
var l=tr.getWidth(ctx);
var h=tr.getHeight(ctx);
var w=Math.abs(Math.cos(tr.angle)*h) + Math.abs(Math.sin(tr.angle)*l);
return w;
}};
$.jqplot.CanvasAxisTickRenderer.prototype.getTop=function(ctx){
if(this._elem){
return this._elem.position().top;
}else{
return null;
}};
$.jqplot.CanvasAxisTickRenderer.prototype.getAngleRad=function(){
var a=this.angle * Math.PI/180;
return a;
};
$.jqplot.CanvasAxisTickRenderer.prototype.setTick=function(value, axisName, isMinor){
this.value=value;
if(isMinor){
this.isMinorTick=true;
}
return this;
};
$.jqplot.CanvasAxisTickRenderer.prototype.draw=function(ctx, plot){
if(!this.label){
this.label=this.prefix + this.formatter(this.formatString, this.value);
}
if(this._elem){
if($.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){
window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
}
this._elem.emptyForce();
this._elem=null;
}
var elem=plot.canvasManager.getCanvas();
this._textRenderer.setText(this.label, ctx);
var w=this.getWidth(ctx);
var h=this.getHeight(ctx);
elem.width=w;
elem.height=h;
elem.style.width=w;
elem.style.height=h;
elem.style.textAlign='left';
elem.style.position='absolute';
elem=plot.canvasManager.initCanvas(elem);
this._elem=$(elem);
this._elem.css(this._styles);
this._elem.addClass('jqplot-'+this.axis+'-tick');
elem=null;
return this._elem;
};
$.jqplot.CanvasAxisTickRenderer.prototype.pack=function(){
this._textRenderer.draw(this._elem.get(0).getContext("2d"), this.label);
};})(jQuery);
(function($){
/**
* Class: $.jqplot.DateAxisRenderer
* A plugin for a jqPlot to render an axis as a series of date values.
* This renderer has no options beyond those supplied by the <Axis> class.
* It supplies its own tick formatter, so the tickOptions.formatter option
* should not be overridden.
*
* Thanks to Ken Synder for his enhanced Date instance methods which are
* included with this code <http://kendsnyder.com/sandbox/date/>.
*
* To use this renderer, include the plugin in your source
* > <script type="text/javascript" language="javascript" src="plugins/jqplot.dateAxisRenderer.js"></script>
*
* and supply the appropriate options to your plot
*
* > {axes:{xaxis:{renderer:$.jqplot.DateAxisRenderer}}}
*
* Dates can be passed into the axis in almost any recognizable value and
* will be parsed.  They will be rendered on the axis in the format
* specified by tickOptions.formatString.  e.g. tickOptions.formatString='%Y-%m-%d'.
*
* Accecptable format codes
* are:
*
* > Code    Result                  Description
* >==Years==* > %Y      2008                Four-digit year
* > %y      08                  Two-digit year
* >==Months==* > %m      09                  Two-digit month
* > %#m     9                   One or two-digit month
* > %B      September           Full month name
* > %b      Sep                 Abbreviated month name
* >==Days==* > %d      05                  Two-digit day of month
* > %#d     5                   One or two-digit day of month
* > %e      5                   One or two-digit day of month
* > %A      Sunday              Full name of the day of the week
* > %a      Sun                 Abbreviated name of the day of the week
* > %w      0                   Number of the day of the week (0=Sunday, 6=Saturday)
* > %o      th                  The ordinal suffix string following the day of the month
* >==Hours==* > %H      23                  Hours in 24-hour format (two digits)
* > %#H     3                   Hours in 24-hour integer format (one or two digits)
* > %I      11                  Hours in 12-hour format (two digits)
* > %#I     3                   Hours in 12-hour integer format (one or two digits)
* > %p      PM                  AM or PM
* >==Minutes==* > %M      09                  Minutes (two digits)
* > %#M     9                   Minutes (one or two digits)
* >==Seconds==* > %S      02                  Seconds (two digits)
* > %#S     2                   Seconds (one or two digits)
* > %s      1206567625723       Unix timestamp (Seconds past 1970-01-01 00:00:00)
* >==Milliseconds==* > %N      008                 Milliseconds (three digits)
* > %#N     8                   Milliseconds (one to three digits)
* >==Timezone==* > %O      360                 difference in minutes between local time and GMT
* > %Z      Mountain Standard Time  Name of timezone as reported by browser
* > %G      -06:00              Hours and minutes between GMT
* >==Shortcuts==* > %F      2008-03-26          %Y-%m-%d
* > %T      05:06:30            %H:%M:%S
* > %X      05:06:30            %H:%M:%S
* > %x      03/26/08            %m/%d/%y
* > %D      03/26/08            %m/%d/%y
* > %#c     Wed Mar 26 15:31:00 2008  %a %b %e %H:%M:%S %Y
* > %v      3-Sep-2008          %e-%b-%Y
* > %R      15:31               %H:%M
* > %r      3:31:00 PM          %I:%M:%S %p
* >==Characters==* > %n      \n                  Newline
* > %t      \t                  Tab
* > %%      %                   Percent Symbol
*/
$.jqplot.DateAxisRenderer=function(){
$.jqplot.LinearAxisRenderer.call(this);
this.date=new $.jsDate();
};
var second=1000;
var minute=60 * second;
var hour=60 * minute;
var day=24 * hour;
var week=7 * day;
var month=30.4368499 * day;
var year=365.242199 * day;
var daysInMonths=[31,28,31,30,31,30,31,30,31,30,31,30];
var niceFormatStrings=['%M:%S.%#N', '%M:%S.%#N', '%M:%S.%#N', '%M:%S', '%M:%S', '%M:%S', '%M:%S', '%H:%M:%S', '%H:%M:%S', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%a %H:%M', '%a %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%v', '%v', '%v', '%v', '%v', '%v', '%v'];
var niceIntervals=[0.1*second, 0.2*second, 0.5*second, second, 2*second, 5*second, 10*second, 15*second, 30*second, minute, 2*minute, 5*minute, 10*minute, 15*minute, 30*minute, hour, 2*hour, 4*hour, 6*hour, 8*hour, 12*hour, day, 2*day, 3*day, 4*day, 5*day, week, 2*week];
var niceMonthlyIntervals=[];
function bestDateInterval(min, max, titarget){
var badness=Number.MAX_VALUE;
var temp, bestTi, bestfmt;
for (var i=0, l=niceIntervals.length; i < l; i++){
temp=Math.abs(titarget - niceIntervals[i]);
if(temp < badness){
badness=temp;
bestTi=niceIntervals[i];
bestfmt=niceFormatStrings[i];
}}
return [bestTi, bestfmt];
}
$.jqplot.DateAxisRenderer.prototype=new $.jqplot.LinearAxisRenderer();
$.jqplot.DateAxisRenderer.prototype.constructor=$.jqplot.DateAxisRenderer;
$.jqplot.DateTickFormatter=function(format, val){
if(!format){
format='%Y/%m/%d';
}
return $.jsDate.strftime(val, format);
};
$.jqplot.DateAxisRenderer.prototype.init=function(options){
this.tickOptions.formatter=$.jqplot.DateTickFormatter;
this.tickInset=0;
this.drawBaseline=true;
this.baselineWidth=null;
this.baselineColor=null;
this.daTickInterval=null;
this._daTickInterval=null;
$.extend(true, this, options);
var db=this._dataBounds,
stats,
sum,
s,
d,
pd,
sd,
intv;
for (var i=0; i<this._series.length; i++){
stats={intervals:[], frequencies:{}, sortedIntervals:[], min:null, max:null, mean:null};
sum=0;
s=this._series[i];
d=s.data;
pd=s._plotData;
sd=s._stackData;
intv=0;
for (var j=0; j<d.length; j++){
if(this.name=='xaxis'||this.name=='x2axis'){
d[j][0]=new $.jsDate(d[j][0]).getTime();
pd[j][0]=new $.jsDate(d[j][0]).getTime();
sd[j][0]=new $.jsDate(d[j][0]).getTime();
if((d[j][0]!=null&&d[j][0] < db.min)||db.min==null){
db.min=d[j][0];
}
if((d[j][0]!=null&&d[j][0] > db.max)||db.max==null){
db.max=d[j][0];
}
if(j>0){
intv=Math.abs(d[j][0] - d[j-1][0]);
stats.intervals.push(intv);
if(stats.frequencies.hasOwnProperty(intv)){
stats.frequencies[intv] +=1;
}else{
stats.frequencies[intv]=1;
}}
sum +=intv;
}else{
d[j][1]=new $.jsDate(d[j][1]).getTime();
pd[j][1]=new $.jsDate(d[j][1]).getTime();
sd[j][1]=new $.jsDate(d[j][1]).getTime();
if((d[j][1]!=null&&d[j][1] < db.min)||db.min==null){
db.min=d[j][1];
}
if((d[j][1]!=null&&d[j][1] > db.max)||db.max==null){
db.max=d[j][1];
}
if(j>0){
intv=Math.abs(d[j][1] - d[j-1][1]);
stats.intervals.push(intv);
if(stats.frequencies.hasOwnProperty(intv)){
stats.frequencies[intv] +=1;
}else{
stats.frequencies[intv]=1;
}}
}
sum +=intv;
}
if(s.renderer.bands){
if(s.renderer.bands.hiData.length){
var bd=s.renderer.bands.hiData;
for (var j=0, l=bd.length; j < l; j++){
if(this.name==='xaxis'||this.name==='x2axis'){
bd[j][0]=new $.jsDate(bd[j][0]).getTime();
if((bd[j][0]!=null&&bd[j][0] > db.max)||db.max==null){
db.max=bd[j][0];
}}else{
bd[j][1]=new $.jsDate(bd[j][1]).getTime();
if((bd[j][1]!=null&&bd[j][1] > db.max)||db.max==null){
db.max=bd[j][1];
}}
}}
if(s.renderer.bands.lowData.length){
var bd=s.renderer.bands.lowData;
for (var j=0, l=bd.length; j < l; j++){
if(this.name==='xaxis'||this.name==='x2axis'){
bd[j][0]=new $.jsDate(bd[j][0]).getTime();
if((bd[j][0]!=null&&bd[j][0] < db.min)||db.min==null){
db.min=bd[j][0];
}}else{
bd[j][1]=new $.jsDate(bd[j][1]).getTime();
if((bd[j][1]!=null&&bd[j][1] < db.min)||db.min==null){
db.min=bd[j][1];
}}
}}
}
var tempf=0,
tempn=0;
for (var n in stats.frequencies){
stats.sortedIntervals.push({interval:n, frequency:stats.frequencies[n]});
}
stats.sortedIntervals.sort(function(a, b){
return b.frequency - a.frequency;
});
stats.min=$.jqplot.arrayMin(stats.intervals);
stats.max=$.jqplot.arrayMax(stats.intervals);
stats.mean=sum/d.length;
this._intervalStats.push(stats);
stats=sum=s = d=pd=sd=null;
}
db=null;
};
$.jqplot.DateAxisRenderer.prototype.reset=function(){
this.min=this._options.min;
this.max=this._options.max;
this.tickInterval=this._options.tickInterval;
this.numberTicks=this._options.numberTicks;
this._autoFormatString='';
if(this._overrideFormatString&&this.tickOptions&&this.tickOptions.formatString){
this.tickOptions.formatString='';
}
this.daTickInterval=this._daTickInterval;
};
$.jqplot.DateAxisRenderer.prototype.createTicks=function(plot){
var ticks=this._ticks;
var userTicks=this.ticks;
var name=this.name;
var db=this._dataBounds;
var iv=this._intervalStats;
var dim=(this.name.charAt(0)==='x') ? this._plotDimensions.width:this._plotDimensions.height;
var interval;
var min, max;
var pos1, pos2;
var tt, i;
var threshold=30;
var insetMult=1;
var daTickInterval=null;
if(this.tickInterval!=null){
if(Number(this.tickInterval)){
daTickInterval=[Number(this.tickInterval), 'seconds'];
}
else if(typeof this.tickInterval=="string"){
var parts=this.tickInterval.split(' ');
if(parts.length==1){
daTickInterval=[1, parts[0]];
}
else if(parts.length==2){
daTickInterval=[parts[0], parts[1]];
}}
}
var tickInterval=this.tickInterval;
min=new $.jsDate((this.min!=null) ? this.min:db.min).getTime();
max=new $.jsDate((this.max!=null) ? this.max:db.max).getTime();
var cursor=plot.plugins.cursor;
if(cursor&&cursor._zoom&&cursor._zoom.zooming){
this.min=null;
this.max=null;
}
var range=max - min;
if(this.tickOptions==null||!this.tickOptions.formatString){
this._overrideFormatString=true;
}
if(userTicks.length){
for (i=0; i<userTicks.length; i++){
var ut=userTicks[i];
var t=new this.tickRenderer(this.tickOptions);
if(ut.constructor==Array){
t.value=new $.jsDate(ut[0]).getTime();
t.label=ut[1];
if(!this.showTicks){
t.showLabel=false;
t.showMark=false;
}
else if(!this.showTickMarks){
t.showMark=false;
}
t.setTick(t.value, this.name);
this._ticks.push(t);
}else{
t.value=new $.jsDate(ut).getTime();
if(!this.showTicks){
t.showLabel=false;
t.showMark=false;
}
else if(!this.showTickMarks){
t.showMark=false;
}
t.setTick(t.value, this.name);
this._ticks.push(t);
}}
this.numberTicks=userTicks.length;
this.min=this._ticks[0].value;
this.max=this._ticks[this.numberTicks-1].value;
this.daTickInterval=[(this.max - this.min) / (this.numberTicks - 1)/1000, 'seconds'];
}
else if(this.min==null&&this.max==null&&db.min==db.max){
var onePointOpts=$.extend(true, {}, this.tickOptions, {name: this.name, value: null});
var delta=300000;
this.min=db.min - delta;
this.max=db.max + delta;
this.numberTicks=3;
for(var i=this.min;i<=this.max;i+=delta){
onePointOpts.value=i;
var t=new this.tickRenderer(onePointOpts);
if(this._overrideFormatString&&this._autoFormatString!=''){
t.formatString=this._autoFormatString;
}
t.showLabel=false;
t.showMark=false;
this._ticks.push(t);
}
if(this.showTicks){
this._ticks[1].showLabel=true;
}
if(this.showTickMarks){
this._ticks[1].showTickMarks=true;
}}
else if(this.min==null&&this.max==null){
var opts=$.extend(true, {}, this.tickOptions, {name: this.name, value: null});
var nttarget,
titarget;
if(!this.tickInterval&&!this.numberTicks){
var tdim=Math.max(dim, threshold+1);
var spacingFactor=115;
if(this.tickRenderer===$.jqplot.CanvasAxisTickRenderer&&this.tickOptions.angle){
spacingFactor=115 - 40 * Math.abs(Math.sin(this.tickOptions.angle/180*Math.PI));
}
nttarget=Math.ceil((tdim-threshold)/spacingFactor + 1);
titarget=(max - min) / (nttarget - 1);
}
else if(this.tickInterval){
titarget=new $.jsDate(0).add(daTickInterval[0], daTickInterval[1]).getTime();
}
else if(this.numberTicks){
nttarget=this.numberTicks;
titarget=(max - min) / (nttarget - 1);
}
if(titarget <=19*day){
var ret=bestDateInterval(min, max, titarget);
var tempti=ret[0];
this._autoFormatString=ret[1];
min=new $.jsDate(min);
min=Math.floor((min.getTime() - min.getUtcOffset())/tempti) * tempti + min.getUtcOffset();
nttarget=Math.ceil((max - min) / tempti) + 1;
this.min=min;
this.max=min + (nttarget - 1) * tempti;
if(this.max < max){
this.max +=tempti;
nttarget +=1;
}
this.tickInterval=tempti;
this.numberTicks=nttarget;
for (var i=0; i<nttarget; i++){
opts.value=this.min + i * tempti;
t=new this.tickRenderer(opts);
if(this._overrideFormatString&&this._autoFormatString!=''){
t.formatString=this._autoFormatString;
}
if(!this.showTicks){
t.showLabel=false;
t.showMark=false;
}
else if(!this.showTickMarks){
t.showMark=false;
}
this._ticks.push(t);
}
insetMult=this.tickInterval;
}
else if(titarget <=9 * month){
this._autoFormatString='%v';
var intv=Math.round(titarget/month);
if(intv < 1){
intv=1;
}
else if(intv > 6){
intv=6;
}
var mstart=new $.jsDate(min).setDate(1).setHours(0,0,0,0);
var tempmend=new $.jsDate(max);
var mend=new $.jsDate(max).setDate(1).setHours(0,0,0,0);
if(tempmend.getTime()!==mend.getTime()){
mend=mend.add(1, 'month');
}
var nmonths=mend.diff(mstart, 'month');
nttarget=Math.ceil(nmonths/intv) + 1;
this.min=mstart.getTime();
this.max=mstart.clone().add((nttarget - 1) * intv, 'month').getTime();
this.numberTicks=nttarget;
for (var i=0; i<nttarget; i++){
if(i===0){
opts.value=mstart.getTime();
}else{
opts.value=mstart.add(intv, 'month').getTime();
}
t=new this.tickRenderer(opts);
if(this._overrideFormatString&&this._autoFormatString!=''){
t.formatString=this._autoFormatString;
}
if(!this.showTicks){
t.showLabel=false;
t.showMark=false;
}
else if(!this.showTickMarks){
t.showMark=false;
}
this._ticks.push(t);
}
insetMult=intv * month;
}else{
this._autoFormatString='%v';
var intv=Math.round(titarget/year);
if(intv < 1){
intv=1;
}
var mstart=new $.jsDate(min).setMonth(0, 1).setHours(0,0,0,0);
var mend=new $.jsDate(max).add(1, 'year').setMonth(0, 1).setHours(0,0,0,0);
var nyears=mend.diff(mstart, 'year');
nttarget=Math.ceil(nyears/intv) + 1;
this.min=mstart.getTime();
this.max=mstart.clone().add((nttarget - 1) * intv, 'year').getTime();
this.numberTicks=nttarget;
for (var i=0; i<nttarget; i++){
if(i===0){
opts.value=mstart.getTime();
}else{
opts.value=mstart.add(intv, 'year').getTime();
}
t=new this.tickRenderer(opts);
if(this._overrideFormatString&&this._autoFormatString!=''){
t.formatString=this._autoFormatString;
}
if(!this.showTicks){
t.showLabel=false;
t.showMark=false;
}
else if(!this.showTickMarks){
t.showMark=false;
}
this._ticks.push(t);
}
insetMult=intv * year;
}}else{
if(name=='xaxis'||name=='x2axis'){
dim=this._plotDimensions.width;
}else{
dim=this._plotDimensions.height;
}
if(this.min!=null&&this.max!=null&&this.numberTicks!=null){
this.tickInterval=null;
}
if(this.tickInterval!=null&&daTickInterval!=null){
this.daTickInterval=daTickInterval;
}
if(min==max){
var adj=24*60*60*500;
min -=adj;
max +=adj;
}
range=max - min;
var optNumTicks=2 + parseInt(Math.max(0, dim-100)/100, 10);
var rmin, rmax;
rmin=(this.min!=null) ? new $.jsDate(this.min).getTime():min - range/2*(this.padMin - 1);
rmax=(this.max!=null) ? new $.jsDate(this.max).getTime():max + range/2*(this.padMax - 1);
this.min=rmin;
this.max=rmax;
range=this.max - this.min;
if(this.numberTicks==null){
if(this.daTickInterval!=null){
var nc=new $.jsDate(this.max).diff(this.min, this.daTickInterval[1], true);
this.numberTicks=Math.ceil(nc/this.daTickInterval[0]) +1;
this.max=new $.jsDate(this.min).add((this.numberTicks-1) * this.daTickInterval[0], this.daTickInterval[1]).getTime();
}
else if(dim > 200){
this.numberTicks=parseInt(3+(dim-200)/100, 10);
}else{
this.numberTicks=2;
}}
insetMult=range / (this.numberTicks-1)/1000;
if(this.daTickInterval==null){
this.daTickInterval=[insetMult, 'seconds'];
}
for (var i=0; i<this.numberTicks; i++){
var min=new $.jsDate(this.min);
tt=min.add(i*this.daTickInterval[0], this.daTickInterval[1]).getTime();
var t=new this.tickRenderer(this.tickOptions);
if(!this.showTicks){
t.showLabel=false;
t.showMark=false;
}
else if(!this.showTickMarks){
t.showMark=false;
}
t.setTick(tt, this.name);
this._ticks.push(t);
}}
if(this.tickInset){
this.min=this.min - this.tickInset * insetMult;
this.max=this.max + this.tickInset * insetMult;
}
if(this._daTickInterval==null){
this._daTickInterval=this.daTickInterval;
}
ticks=null;
};})(jQuery);
(function($){
/**
*  class: $.jqplot.CategoryAxisRenderer
*  A plugin for jqPlot to render a category style axis, with equal pixel spacing between y data values of a series.
*
*  To use this renderer, include the plugin in your source
*  > <script type="text/javascript" language="javascript" src="plugins/jqplot.categoryAxisRenderer.js"></script>
*
*  and supply the appropriate options to your plot
*
*  > {axes:{xaxis:{renderer:$.jqplot.CategoryAxisRenderer}}}
**/
$.jqplot.CategoryAxisRenderer=function(options){
$.jqplot.LinearAxisRenderer.call(this);
this.sortMergedLabels=false;
};
$.jqplot.CategoryAxisRenderer.prototype=new $.jqplot.LinearAxisRenderer();
$.jqplot.CategoryAxisRenderer.prototype.constructor=$.jqplot.CategoryAxisRenderer;
$.jqplot.CategoryAxisRenderer.prototype.init=function(options){
this.groups=1;
this.groupLabels=[];
this._groupLabels=[];
this._grouped=false;
this._barsPerGroup=null;
this.reverse=false;
$.extend(true, this, {tickOptions:{formatString:'%d'}}, options);
var db=this._dataBounds;
for (var i=0; i<this._series.length; i++){
var s=this._series[i];
if(s.groups){
this.groups=s.groups;
}
var d=s.data;
for (var j=0; j<d.length; j++){
if(this.name=='xaxis'||this.name=='x2axis'){
if(d[j][0] < db.min||db.min==null){
db.min=d[j][0];
}
if(d[j][0] > db.max||db.max==null){
db.max=d[j][0];
}}else{
if(d[j][1] < db.min||db.min==null){
db.min=d[j][1];
}
if(d[j][1] > db.max||db.max==null){
db.max=d[j][1];
}}
}}
if(this.groupLabels.length){
this.groups=this.groupLabels.length;
}};
$.jqplot.CategoryAxisRenderer.prototype.createTicks=function(){
var ticks=this._ticks;
var userTicks=this.ticks;
var name=this.name;
var db=this._dataBounds;
var dim, interval;
var min, max;
var pos1, pos2;
var tt, i;
if(userTicks.length){
if(this.groups > 1&&!this._grouped){
var l=userTicks.length;
var skip=parseInt(l/this.groups, 10);
var count=0;
for (var i=skip; i<l; i+=skip){
userTicks.splice(i+count, 0, ' ');
count++;
}
this._grouped=true;
}
this.min=0.5;
this.max=userTicks.length + 0.5;
var range=this.max - this.min;
this.numberTicks=2*userTicks.length + 1;
for (i=0; i<userTicks.length; i++){
tt=this.min + 2 * i * range / (this.numberTicks-1);
var t=new this.tickRenderer(this.tickOptions);
t.showLabel=false;
t.setTick(tt, this.name);
this._ticks.push(t);
var t=new this.tickRenderer(this.tickOptions);
t.label=userTicks[i];
t.showMark=false;
t.showGridline=false;
t.setTick(tt+0.5, this.name);
this._ticks.push(t);
}
var t=new this.tickRenderer(this.tickOptions);
t.showLabel=false;
t.setTick(tt+1, this.name);
this._ticks.push(t);
}else{
if(name=='xaxis'||name=='x2axis'){
dim=this._plotDimensions.width;
}else{
dim=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 labels=[];
var numcats=0;
var min=0.5;
var max, val;
var isMerged=false;
for (var i=0; i<this._series.length; i++){
var s=this._series[i];
for (var j=0; j<s.data.length; j++){
if(this.name=='xaxis'||this.name=='x2axis'){
val=s.data[j][0];
}else{
val=s.data[j][1];
}
if($.inArray(val, labels)==-1){
isMerged=true;
numcats +=1;
labels.push(val);
}}
}
if(isMerged&&this.sortMergedLabels){
if(typeof labels[0]=="string"){
labels.sort();
}else{
labels.sort(function(a,b){ return a - b; });
}}
this.ticks=labels;
for (var i=0; i<this._series.length; i++){
var s=this._series[i];
for (var j=0; j<s.data.length; j++){
if(this.name=='xaxis'||this.name=='x2axis'){
val=s.data[j][0];
}else{
val=s.data[j][1];
}
var idx=$.inArray(val, labels)+1;
if(this.name=='xaxis'||this.name=='x2axis'){
s.data[j][0]=idx;
}else{
s.data[j][1]=idx;
}}
}
if(this.groups > 1&&!this._grouped){
var l=labels.length;
var skip=parseInt(l/this.groups, 10);
var count=0;
for (var i=skip; i<l; i+=skip+1){
labels[i]=' ';
}
this._grouped=true;
}
max=numcats + 0.5;
if(this.numberTicks==null){
this.numberTicks=2*numcats + 1;
}
var range=max - min;
this.min=min;
this.max=max;
var track=0;
var maxVisibleTicks=parseInt(3+dim/10, 10);
var skip=parseInt(numcats/maxVisibleTicks, 10);
if(this.tickInterval==null){
this.tickInterval=range / (this.numberTicks-1);
}
for (var i=0; i<this.numberTicks; i++){
tt=this.min + i * this.tickInterval;
var t=new this.tickRenderer(this.tickOptions);
if(i/2==parseInt(i/2, 10)){
t.showLabel=false;
t.showMark=true;
}else{
if(skip>0&&track<skip){
t.showLabel=false;
track +=1;
}else{
t.showLabel=true;
track=0;
}
t.label=t.formatter(t.formatString, labels[(i-1)/2]);
t.showMark=false;
t.showGridline=false;
}
t.setTick(tt, this.name);
this._ticks.push(t);
}}
};
$.jqplot.CategoryAxisRenderer.prototype.draw=function(ctx, plot){
if(this.show){
this.renderer.createTicks.call(this);
var dim=0;
var temp;
if(this._elem){
this._elem.emptyForce();
}
this._elem=this._elem||$('<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 elem=this._label.draw(ctx, plot);
elem.appendTo(this._elem);
}
var t=this._ticks;
for (var i=0; i<t.length; i++){
var tick=t[i];
if(tick.showLabel&&(!tick.isMinorTick||this.showMinorTicks)){
var elem=tick.draw(ctx, plot);
elem.appendTo(this._elem);
}}
this._groupLabels=[];
for (var i=0; i<this.groupLabels.length; i++){
var elem=$('<div style="position:absolute;" class="jqplot-'+this.name+'-groupLabel"></div>');
elem.html(this.groupLabels[i]);
this._groupLabels.push(elem);
elem.appendTo(this._elem);
}}
return this._elem;
};
$.jqplot.CategoryAxisRenderer.prototype.set=function(){
var dim=0;
var temp;
var w=0;
var h=0;
var lshow=(this._label==null) ? false:this._label.show;
if(this.show){
var t=this._ticks;
for (var i=0; i<t.length; i++){
var tick=t[i];
if(tick.showLabel&&(!tick.isMinorTick||this.showMinorTicks)){
if(this.name=='xaxis'||this.name=='x2axis'){
temp=tick._elem.outerHeight(true);
}else{
temp=tick._elem.outerWidth(true);
}
if(temp > dim){
dim=temp;
}}
}
var dim2=0;
for (var i=0; i<this._groupLabels.length; i++){
var l=this._groupLabels[i];
if(this.name=='xaxis'||this.name=='x2axis'){
temp=l.outerHeight(true);
}else{
temp=l.outerWidth(true);
}
if(temp > dim2){
dim2=temp;
}}
if(lshow){
w=this._label._elem.outerWidth(true);
h=this._label._elem.outerHeight(true);
}
if(this.name=='xaxis'){
dim +=dim2 + h;
this._elem.css({'height':dim+'px', left:'0px', bottom:'0px'});
}
else if(this.name=='x2axis'){
dim +=dim2 + h;
this._elem.css({'height':dim+'px', left:'0px', top:'0px'});
}
else if(this.name=='yaxis'){
dim +=dim2 + w;
this._elem.css({'width':dim+'px', left:'0px', top:'0px'});
if(lshow&&this._label.constructor==$.jqplot.AxisLabelRenderer){
this._label._elem.css('width', w+'px');
}}else{
dim +=dim2 + w;
this._elem.css({'width':dim+'px', right:'0px', top:'0px'});
if(lshow&&this._label.constructor==$.jqplot.AxisLabelRenderer){
this._label._elem.css('width', w+'px');
}}
}};
$.jqplot.CategoryAxisRenderer.prototype.pack=function(pos, offsets){
var ticks=this._ticks;
var max=this.max;
var min=this.min;
var offmax=offsets.max;
var offmin=offsets.min;
var lshow=(this._label==null) ? false:this._label.show;
var i;
for (var p in pos){
this._elem.css(p, pos[p]);
}
this._offsets=offsets;
var pixellength=offmax - offmin;
var unitlength=max - min;
if(!this.reverse){
this.u2p=function(u){
return (u - min) * pixellength / unitlength + offmin;
};
this.p2u=function(p){
return (p - offmin) * unitlength / pixellength + min;
};
if(this.name=='xaxis'||this.name=='x2axis'){
this.series_u2p=function(u){
return (u - min) * pixellength / unitlength;
};
this.series_p2u=function(p){
return p * unitlength / pixellength + min;
};}else{
this.series_u2p=function(u){
return (u - max) * pixellength / unitlength;
};
this.series_p2u=function(p){
return p * unitlength / pixellength + max;
};}}else{
this.u2p=function(u){
return offmin + (max - u) * pixellength / unitlength;
};
this.p2u=function(p){
return min + (p - offmin) * unitlength / pixellength;
};
if(this.name=='xaxis'||this.name=='x2axis'){
this.series_u2p=function(u){
return (max - u) * pixellength / unitlength;
};
this.series_p2u=function(p){
return p * unitlength / pixellength + max;
};}else{
this.series_u2p=function(u){
return (min - u) * pixellength / unitlength;
};
this.series_p2u=function(p){
return p * unitlength / pixellength + min;
};}}
if(this.show){
if(this.name=='xaxis'||this.name=='x2axis'){
for (i=0; i<ticks.length; i++){
var t=ticks[i];
if(t.show&&t.showLabel){
var shim;
if(t.constructor==$.jqplot.CanvasAxisTickRenderer&&t.angle){
var temp=(this.name=='xaxis') ? 1:-1;
switch (t.labelPosition){
case 'auto':
if(temp * t.angle < 0){
shim=-t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
}else{
shim=-t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
}
break;
case 'end':
shim=-t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
break;
case 'start':
shim=-t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
break;
case 'middle':
shim=-t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
break;
default:
shim=-t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
break;
}}else{
shim=-t.getWidth()/2;
}
var val=this.u2p(t.value) + shim + 'px';
t._elem.css('left', val);
t.pack();
}}
var labeledge=['bottom', 0];
if(lshow){
var w=this._label._elem.outerWidth(true);
this._label._elem.css('left', offmin + pixellength/2 - w/2 + 'px');
if(this.name=='xaxis'){
this._label._elem.css('bottom', '0px');
labeledge=['bottom', this._label._elem.outerHeight(true)];
}else{
this._label._elem.css('top', '0px');
labeledge=['top', this._label._elem.outerHeight(true)];
}
this._label.pack();
}
var step=parseInt(this._ticks.length/this.groups, 10) + 1;
for (i=0; i<this._groupLabels.length; i++){
var mid=0;
var count=0;
for (var j=i*step; j<(i+1)*step; j++){
if(j >=this._ticks.length-1) continue;
if(this._ticks[j]._elem&&this._ticks[j].label!=" "){
var t=this._ticks[j]._elem;
var p=t.position();
mid +=p.left + t.outerWidth(true)/2;
count++;
}}
mid=mid/count;
this._groupLabels[i].css({'left':(mid - this._groupLabels[i].outerWidth(true)/2)});
this._groupLabels[i].css(labeledge[0], labeledge[1]);
}}else{
for (i=0; i<ticks.length; i++){
var t=ticks[i];
if(t.show&&t.showLabel){
var shim;
if(t.constructor==$.jqplot.CanvasAxisTickRenderer&&t.angle){
var temp=(this.name=='yaxis') ? 1:-1;
switch (t.labelPosition){
case 'auto':
case 'end':
if(temp * t.angle < 0){
shim=-t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
}else{
shim=-t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
}
break;
case 'start':
if(t.angle > 0){
shim=-t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
}else{
shim=-t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
}
break;
case 'middle':
shim=-t.getHeight()/2;
break;
default:
shim=-t.getHeight()/2;
break;
}}else{
shim=-t.getHeight()/2;
}
var val=this.u2p(t.value) + shim + 'px';
t._elem.css('top', val);
t.pack();
}}
var labeledge=['left', 0];
if(lshow){
var h=this._label._elem.outerHeight(true);
this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
if(this.name=='yaxis'){
this._label._elem.css('left', '0px');
labeledge=['left', this._label._elem.outerWidth(true)];
}else{
this._label._elem.css('right', '0px');
labeledge=['right', this._label._elem.outerWidth(true)];
}
this._label.pack();
}
var step=parseInt(this._ticks.length/this.groups, 10) + 1;
for (i=0; i<this._groupLabels.length; i++){
var mid=0;
var count=0;
for (var j=i*step; j<(i+1)*step; j++){
if(j >=this._ticks.length-1) continue;
if(this._ticks[j]._elem&&this._ticks[j].label!=" "){
var t=this._ticks[j]._elem;
var p=t.position();
mid +=p.top + t.outerHeight()/2;
count++;
}}
mid=mid/count;
this._groupLabels[i].css({'top':mid - this._groupLabels[i].outerHeight()/2});
this._groupLabels[i].css(labeledge[0], labeledge[1]);
}}
}};})(jQuery);
(function($){
$.jqplot.CanvasTextRenderer=function(options){
this.fontStyle='normal';
this.fontVariant='normal';
this.fontWeight='normal';
this.fontSize='10px';
this.fontFamily='sans-serif';
this.fontStretch=1.0;
this.fillStyle='#666666';
this.angle=0;
this.textAlign='start';
this.textBaseline='alphabetic';
this.text;
this.width;
this.height;
this.pt2px=1.28;
$.extend(true, this, options);
this.normalizedFontSize=this.normalizeFontSize(this.fontSize);
this.setHeight();
};
$.jqplot.CanvasTextRenderer.prototype.init=function(options){
$.extend(true, this, options);
this.normalizedFontSize=this.normalizeFontSize(this.fontSize);
this.setHeight();
};
$.jqplot.CanvasTextRenderer.prototype.normalizeFontSize=function(sz){
sz=String(sz);
var n=parseFloat(sz);
if(sz.indexOf('px') > -1){
return n/this.pt2px;
}
else if(sz.indexOf('pt') > -1){
return n;
}
else if(sz.indexOf('em') > -1){
return n*12;
}
else if(sz.indexOf('%') > -1){
return n*12/100;
}else{
return n/this.pt2px;
}};
$.jqplot.CanvasTextRenderer.prototype.fontWeight2Float=function(w){
if(Number(w)){
return w/400;
}else{
switch (w){
case 'normal':
return 1;
break;
case 'bold':
return 1.75;
break;
case 'bolder':
return 2.25;
break;
case 'lighter':
return 0.75;
break;
default:
return 1;
break;
}}
};
$.jqplot.CanvasTextRenderer.prototype.getText=function(){
return this.text;
};
$.jqplot.CanvasTextRenderer.prototype.setText=function(t, ctx){
this.text=t;
this.setWidth(ctx);
return this;
};
$.jqplot.CanvasTextRenderer.prototype.getWidth=function(ctx){
return this.width;
};
$.jqplot.CanvasTextRenderer.prototype.setWidth=function(ctx, w){
if(!w){
this.width=this.measure(ctx, this.text);
}else{
this.width=w;
}
return this;
};
$.jqplot.CanvasTextRenderer.prototype.getHeight=function(ctx){
return this.height;
};
$.jqplot.CanvasTextRenderer.prototype.setHeight=function(w){
if(!w){
this.height=this.normalizedFontSize * this.pt2px;
}else{
this.height=w;
}
return this;
};
$.jqplot.CanvasTextRenderer.prototype.letter=function (ch){
return this.letters[ch];
};
$.jqplot.CanvasTextRenderer.prototype.ascent=function(){
return this.normalizedFontSize;
};
$.jqplot.CanvasTextRenderer.prototype.descent=function(){
return 7.0*this.normalizedFontSize/25.0;
};
$.jqplot.CanvasTextRenderer.prototype.measure=function(ctx, str){
var total=0;
var len=str.length;
for (var i=0; i < len; i++){
var c=this.letter(str.charAt(i));
if(c){
total +=c.width * this.normalizedFontSize / 25.0 * this.fontStretch;
}}
return total;
};
$.jqplot.CanvasTextRenderer.prototype.draw=function(ctx,str){
var x=0;
var y=this.height*0.72;
var total=0;
var len=str.length;
var mag=this.normalizedFontSize / 25.0;
ctx.save();
var tx, ty;
if((-Math.PI/2 <=this.angle&&this.angle <=0)||(Math.PI*3/2 <=this.angle&&this.angle <=Math.PI*2)){
tx=0;
ty=-Math.sin(this.angle) * this.width;
}
else if((0 < this.angle&&this.angle <=Math.PI/2)||(-Math.PI*2 <=this.angle&&this.angle <=-Math.PI*3/2)){
tx=Math.sin(this.angle) * this.height;
ty=0;
}
else if((-Math.PI < this.angle&&this.angle < -Math.PI/2)||(Math.PI <=this.angle&&this.angle <=Math.PI*3/2)){
tx=-Math.cos(this.angle) * this.width;
ty=-Math.sin(this.angle) * this.width - Math.cos(this.angle) * this.height;
}
else if((-Math.PI*3/2 < this.angle&&this.angle < Math.PI)||(Math.PI/2 < this.angle&&this.angle < Math.PI)){
tx=Math.sin(this.angle) * this.height - Math.cos(this.angle)*this.width;
ty=-Math.cos(this.angle) * this.height;
}
ctx.strokeStyle=this.fillStyle;
ctx.fillStyle=this.fillStyle;
ctx.translate(tx, ty);
ctx.rotate(this.angle);
ctx.lineCap="round";
var fact=(this.normalizedFontSize > 30) ? 2.0:2 + (30 - this.normalizedFontSize)/20;
ctx.lineWidth=fact * mag * this.fontWeight2Float(this.fontWeight);
for(var i=0; i < len; i++){
var c=this.letter(str.charAt(i));
if(!c){
continue;
}
ctx.beginPath();
var penUp=1;
var needStroke=0;
for(var j=0; j < c.points.length; j++){
var a=c.points[j];
if(a[0]==-1&&a[1]==-1){
penUp=1;
continue;
}
if(penUp){
ctx.moveTo(x + a[0]*mag*this.fontStretch, y - a[1]*mag);
penUp=false;
}else{
ctx.lineTo(x + a[0]*mag*this.fontStretch, y - a[1]*mag);
}}
ctx.stroke();
x +=c.width*mag*this.fontStretch;
}
ctx.restore();
return total;
};
$.jqplot.CanvasTextRenderer.prototype.letters={
' ': { width: 16, points: [] },
'!': { width: 10, points: [[5,21],[5,7],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]] },
'"': { width: 16, points: [[4,21],[4,14],[-1,-1],[12,21],[12,14]] },
'#': { width: 21, points: [[11,25],[4,-7],[-1,-1],[17,25],[10,-7],[-1,-1],[4,12],[18,12],[-1,-1],[3,6],[17,6]] },
'$': { width: 20, points: [[8,25],[8,-4],[-1,-1],[12,25],[12,-4],[-1,-1],[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] },
'%': { width: 24, points: [[21,21],[3,0],[-1,-1],[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],[10,20],[13,19],[16,19],[19,20],[21,21],[-1,-1],[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]] },
'&': { width: 26, points: [[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]] },
'\'': { width: 10, points: [[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]] },
'(': { width: 14, points: [[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]] },
')': { width: 14, points: [[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]] },
'*': { width: 16, points: [[8,21],[8,9],[-1,-1],[3,18],[13,12],[-1,-1],[13,18],[3,12]] },
'+': { width: 26, points: [[13,18],[13,0],[-1,-1],[4,9],[22,9]] },
',': { width: 10, points: [[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
'-': { width: 18, points: [[6,9],[12,9]] },
'.': { width: 10, points: [[5,2],[4,1],[5,0],[6,1],[5,2]] },
'/': { width: 22, points: [[20,25],[2,-7]] },
'0': { width: 20, points: [[9,21],[6,20],[4,17],[3,12],[3,9],[4,4],[6,1],[9,0],[11,0],[14,1],[16,4],[17,9],[17,12],[16,17],[14,20],[11,21],[9,21]] },
'1': { width: 20, points: [[6,17],[8,18],[11,21],[11,0]] },
'2': { width: 20, points: [[4,16],[4,17],[5,19],[6,20],[8,21],[12,21],[14,20],[15,19],[16,17],[16,15],[15,13],[13,10],[3,0],[17,0]] },
'3': { width: 20, points: [[5,21],[16,21],[10,13],[13,13],[15,12],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
'4': { width: 20, points: [[13,21],[3,7],[18,7],[-1,-1],[13,21],[13,0]] },
'5': { width: 20, points: [[15,21],[5,21],[4,12],[5,13],[8,14],[11,14],[14,13],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
'6': { width: 20, points: [[16,18],[15,20],[12,21],[10,21],[7,20],[5,17],[4,12],[4,7],[5,3],[7,1],[10,0],[11,0],[14,1],[16,3],[17,6],[17,7],[16,10],[14,12],[11,13],[10,13],[7,12],[5,10],[4,7]] },
'7': { width: 20, points: [[17,21],[7,0],[-1,-1],[3,21],[17,21]] },
'8': { width: 20, points: [[8,21],[5,20],[4,18],[4,16],[5,14],[7,13],[11,12],[14,11],[16,9],[17,7],[17,4],[16,2],[15,1],[12,0],[8,0],[5,1],[4,2],[3,4],[3,7],[4,9],[6,11],[9,12],[13,13],[15,14],[16,16],[16,18],[15,20],[12,21],[8,21]] },
'9': { width: 20, points: [[16,14],[15,11],[13,9],[10,8],[9,8],[6,9],[4,11],[3,14],[3,15],[4,18],[6,20],[9,21],[10,21],[13,20],[15,18],[16,14],[16,9],[15,4],[13,1],[10,0],[8,0],[5,1],[4,3]] },
':': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]] },
';': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
'<': { width: 24, points: [[20,18],[4,9],[20,0]] },
'=': { width: 26, points: [[4,12],[22,12],[-1,-1],[4,6],[22,6]] },
'>': { width: 24, points: [[4,18],[20,9],[4,0]] },
'?': { width: 18, points: [[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]] },
'@': { width: 27, points: [[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]] },
'A': { width: 18, points: [[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]] },
'B': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]] },
'C': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]] },
'D': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]] },
'E': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]] },
'F': { width: 18, points: [[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]] },
'G': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]] },
'H': { width: 22, points: [[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]] },
'I': { width: 8, points: [[4,21],[4,0]] },
'J': { width: 16, points: [[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]] },
'K': { width: 21, points: [[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]] },
'L': { width: 17, points: [[4,21],[4,0],[-1,-1],[4,0],[16,0]] },
'M': { width: 24, points: [[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]] },
'N': { width: 22, points: [[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]] },
'O': { width: 22, points: [[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]] },
'P': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]] },
'Q': { width: 22, points: [[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]] },
'R': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]] },
'S': { width: 20, points: [[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] },
'T': { width: 16, points: [[8,21],[8,0],[-1,-1],[1,21],[15,21]] },
'U': { width: 22, points: [[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]] },
'V': { width: 18, points: [[1,21],[9,0],[-1,-1],[17,21],[9,0]] },
'W': { width: 24, points: [[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]] },
'X': { width: 20, points: [[3,21],[17,0],[-1,-1],[17,21],[3,0]] },
'Y': { width: 18, points: [[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]] },
'Z': { width: 20, points: [[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]] },
'[': { width: 14, points: [[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]] },
'\\': { width: 14, points: [[0,21],[14,-3]] },
']': { width: 14, points: [[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]] },
'^': { width: 16, points: [[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]] },
'_': { width: 16, points: [[0,-2],[16,-2]] },
'`': { width: 10, points: [[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]] },
'a': { width: 19, points: [[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
'b': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]] },
'c': { width: 18, points: [[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
'd': { width: 19, points: [[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
'e': { width: 18, points: [[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
'f': { width: 12, points: [[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]] },
'g': { width: 19, points: [[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
'h': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]] },
'i': { width: 8, points: [[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]] },
'j': { width: 10, points: [[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]] },
'k': { width: 17, points: [[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]] },
'l': { width: 8, points: [[4,21],[4,0]] },
'm': { width: 30, points: [[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]] },
'n': { width: 19, points: [[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]] },
'o': { width: 19, points: [[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]] },
'p': { width: 19, points: [[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]] },
'q': { width: 19, points: [[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
'r': { width: 13, points: [[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]] },
's': { width: 17, points: [[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]] },
't': { width: 12, points: [[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]] },
'u': { width: 19, points: [[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]] },
'v': { width: 16, points: [[2,14],[8,0],[-1,-1],[14,14],[8,0]] },
'w': { width: 22, points: [[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]] },
'x': { width: 17, points: [[3,14],[14,0],[-1,-1],[14,14],[3,0]] },
'y': { width: 16, points: [[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]] },
'z': { width: 17, points: [[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]] },
'{': { width: 14, points: [[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]] },
'|': { width: 8, points: [[4,25],[4,-7]] },
'}': { width: 14, points: [[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]] },
'~': { width: 24, points: [[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]] }};
$.jqplot.CanvasFontRenderer=function(options){
options=options||{};
if(!options.pt2px){
options.pt2px=1.5;
}
$.jqplot.CanvasTextRenderer.call(this, options);
};
$.jqplot.CanvasFontRenderer.prototype=new $.jqplot.CanvasTextRenderer({});
$.jqplot.CanvasFontRenderer.prototype.constructor=$.jqplot.CanvasFontRenderer;
$.jqplot.CanvasFontRenderer.prototype.measure=function(ctx, str){
var fstyle=this.fontSize+' '+this.fontFamily;
ctx.save();
ctx.font=fstyle;
var w=ctx.measureText(str).width;
ctx.restore();
return w;
};
$.jqplot.CanvasFontRenderer.prototype.draw=function(ctx, str){
var x=0;
var y=this.height*0.72;
ctx.save();
var tx, ty;
if((-Math.PI/2 <=this.angle&&this.angle <=0)||(Math.PI*3/2 <=this.angle&&this.angle <=Math.PI*2)){
tx=0;
ty=-Math.sin(this.angle) * this.width;
}
else if((0 < this.angle&&this.angle <=Math.PI/2)||(-Math.PI*2 <=this.angle&&this.angle <=-Math.PI*3/2)){
tx=Math.sin(this.angle) * this.height;
ty=0;
}
else if((-Math.PI < this.angle&&this.angle < -Math.PI/2)||(Math.PI <=this.angle&&this.angle <=Math.PI*3/2)){
tx=-Math.cos(this.angle) * this.width;
ty=-Math.sin(this.angle) * this.width - Math.cos(this.angle) * this.height;
}
else if((-Math.PI*3/2 < this.angle&&this.angle < Math.PI)||(Math.PI/2 < this.angle&&this.angle < Math.PI)){
tx=Math.sin(this.angle) * this.height - Math.cos(this.angle)*this.width;
ty=-Math.cos(this.angle) * this.height;
}
ctx.strokeStyle=this.fillStyle;
ctx.fillStyle=this.fillStyle;
var fstyle=this.fontSize+' '+this.fontFamily;
ctx.font=fstyle;
ctx.translate(tx, ty);
ctx.rotate(this.angle);
ctx.fillText(str, x, y);
ctx.restore();
};})(jQuery);
(function($){
$.jqplot.EnhancedLegendRenderer=function(){
$.jqplot.TableLegendRenderer.call(this);
};
$.jqplot.EnhancedLegendRenderer.prototype=new $.jqplot.TableLegendRenderer();
$.jqplot.EnhancedLegendRenderer.prototype.constructor=$.jqplot.EnhancedLegendRenderer;
$.jqplot.EnhancedLegendRenderer.prototype.init=function(options){
this.numberRows=null;
this.numberColumns=null;
this.seriesToggle='normal';
this.seriesToggleReplot=false;
this.disableIEFading=true;
$.extend(true, this, options);
if(this.seriesToggle){
$.jqplot.postDrawHooks.push(postDraw);
}};
$.jqplot.EnhancedLegendRenderer.prototype.draw=function(offsets, plot){
var legend=this;
if(this.show){
var series=this._series;
var s;
var ss='position:absolute;';
ss +=(this.background) ? 'background:'+this.background+';':'';
ss +=(this.border) ? 'border:'+this.border+';':'';
ss +=(this.fontSize) ? 'font-size:'+this.fontSize+';':'';
ss +=(this.fontFamily) ? 'font-family:'+this.fontFamily+';':'';
ss +=(this.textColor) ? 'color:'+this.textColor+';':'';
ss +=(this.marginTop!=null) ? 'margin-top:'+this.marginTop+';':'';
ss +=(this.marginBottom!=null) ? 'margin-bottom:'+this.marginBottom+';':'';
ss +=(this.marginLeft!=null) ? 'margin-left:'+this.marginLeft+';':'';
ss +=(this.marginRight!=null) ? 'margin-right:'+this.marginRight+';':'';
this._elem=$('<table class="jqplot-table-legend" style="'+ss+'"></table>');
if(this.seriesToggle){
this._elem.css('z-index', '3');
}
var pad=false,
reverse=false,
nr, nc;
if(this.numberRows){
nr=this.numberRows;
if(!this.numberColumns){
nc=Math.ceil(series.length/nr);
}else{
nc=this.numberColumns;
}}
else if(this.numberColumns){
nc=this.numberColumns;
nr=Math.ceil(series.length/this.numberColumns);
}else{
nr=series.length;
nc=1;
}
var i, j, tr, td1, td2, lt, rs, div, div0, div1;
var idx=0;
for (i=series.length-1; i>=0; i--){
if(nc==1&&series[i]._stack||series[i].renderer.constructor==$.jqplot.BezierCurveRenderer){
reverse=true;
}}
for (i=0; i<nr; i++){
tr=$(document.createElement('tr'));
tr.addClass('jqplot-table-legend');
if(reverse){
tr.prependTo(this._elem);
}else{
tr.appendTo(this._elem);
}
for (j=0; j<nc; j++){
if(idx < series.length&&(series[idx].show||series[idx].showLabel)){
s=series[idx];
lt=this.labels[idx]||s.label.toString();
if(lt){
var color=s.color;
if(!reverse){
if(i>0){
pad=true;
}else{
pad=false;
}}else{
if(i==nr -1){
pad=false;
}else{
pad=true;
}}
rs=(pad) ? this.rowSpacing:'0';
td1=$(document.createElement('td'));
td1.addClass('jqplot-table-legend jqplot-table-legend-swatch');
td1.css({textAlign: 'center', paddingTop: rs});
div0=$(document.createElement('div'));
div0.addClass('jqplot-table-legend-swatch-outline');
div1=$(document.createElement('div'));
div1.addClass('jqplot-table-legend-swatch');
div1.css({backgroundColor: color, borderColor: color});
td1.append(div0.append(div1));
td2=$(document.createElement('td'));
td2.addClass('jqplot-table-legend jqplot-table-legend-label');
td2.css('paddingTop', rs);
if(this.escapeHtml){
td2.text(lt);
}else{
td2.html(lt);
}
if(reverse){
if(this.showLabels){td2.prependTo(tr);}
if(this.showSwatches){td1.prependTo(tr);}}else{
if(this.showSwatches){td1.appendTo(tr);}
if(this.showLabels){td2.appendTo(tr);}}
if(this.seriesToggle){
var speed;
if(typeof(this.seriesToggle)==='string'||typeof(this.seriesToggle)==='number'){
if(!$.jqplot.use_excanvas||!this.disableIEFading){
speed=this.seriesToggle;
}}
if(this.showSwatches){
td1.bind('click', {series:s, speed:speed, plot: plot, replot:this.seriesToggleReplot}, handleToggle);
td1.addClass('jqplot-seriesToggle');
}
if(this.showLabels){
td2.bind('click', {series:s, speed:speed, plot: plot, replot:this.seriesToggleReplot}, handleToggle);
td2.addClass('jqplot-seriesToggle');
}
if(!s.show&&s.showLabel){
td1.addClass('jqplot-series-hidden');
td2.addClass('jqplot-series-hidden');
}}
pad=true;
}}
idx++;
}
td1=td2=div0=div1=null;
}}
return this._elem;
};
var handleToggle=function (ev){
var d=ev.data,
s=d.series,
replot=d.replot,
plot=d.plot,
speed=d.speed,
sidx=s.index,
showing=false;
if(s.canvas._elem.is(':hidden')||!s.show){
showing=true;
}
var doLegendToggle=function(){
if(replot){
var opts={};
if($.isPlainObject(replot)){
$.extend(true, opts, replot);
}
plot.replot(opts);
if(showing&&speed){
var s=plot.series[sidx];
if(s.shadowCanvas._elem){
s.shadowCanvas._elem.hide().fadeIn(speed);
}
s.canvas._elem.hide().fadeIn(speed);
s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).hide().fadeIn(speed);
}}else{
var s=plot.series[sidx];
if(s.canvas._elem.is(':hidden')||!s.show){
if(typeof plot.options.legend.showSwatches==='undefined'||plot.options.legend.showSwatches===true){
plot.legend._elem.find('td').eq(sidx * 2).addClass('jqplot-series-hidden');
}
if(typeof plot.options.legend.showLabels==='undefined'||plot.options.legend.showLabels===true){
plot.legend._elem.find('td').eq((sidx * 2) + 1).addClass('jqplot-series-hidden');
}}else{
if(typeof plot.options.legend.showSwatches==='undefined'||plot.options.legend.showSwatches===true){
plot.legend._elem.find('td').eq(sidx * 2).removeClass('jqplot-series-hidden');
}
if(typeof plot.options.legend.showLabels==='undefined'||plot.options.legend.showLabels===true){
plot.legend._elem.find('td').eq((sidx * 2) + 1).removeClass('jqplot-series-hidden');
}}
}};
s.toggleDisplay(ev, doLegendToggle);
};
var postDraw=function (){
if(this.legend.renderer.constructor==$.jqplot.EnhancedLegendRenderer&&this.legend.seriesToggle){
var e=this.legend._elem.detach();
this.eventCanvas._elem.after(e);
}};})(jQuery);
(function($){
$.jqplot.EnhancedPieLegendRenderer=function(){
$.jqplot.TableLegendRenderer.call(this);
};
$.jqplot.EnhancedPieLegendRenderer.prototype=new $.jqplot.TableLegendRenderer();
$.jqplot.EnhancedPieLegendRenderer.prototype.constructor=$.jqplot.EnhancedPieLegendRenderer;
$.jqplot.EnhancedPieLegendRenderer.prototype.init=function(options){
this.numberRows=null;
this.numberColumns=null;
this.seriesToggle='normal';
this.seriesToggleReplot=false;
this.disableIEFading=true;
this.toolTips=[];
$.extend(true, this, options);
if(this.seriesToggle){
$.jqplot.postDrawHooks.push(postDraw);
}};
$.jqplot.EnhancedPieLegendRenderer.prototype.draw=function(offsets, plot){
var legend=this;
if(this.show){
var series=this._series;
var s;
var ss='position:absolute;';
ss +=(this.background) ? 'background:'+this.background+';':'';
ss +=(this.border) ? 'border:'+this.border+';':'';
ss +=(this.fontSize) ? 'font-size:'+this.fontSize+';':'';
ss +=(this.fontFamily) ? 'font-family:'+this.fontFamily+';':'';
ss +=(this.textColor) ? 'color:'+this.textColor+';':'';
ss +=(this.marginTop!=null) ? 'margin-top:'+this.marginTop+';':'';
ss +=(this.marginBottom!=null) ? 'margin-bottom:'+this.marginBottom+';':'';
ss +=(this.marginLeft!=null) ? 'margin-left:'+this.marginLeft+';':'';
ss +=(this.marginRight!=null) ? 'margin-right:'+this.marginRight+';':'';
this._elem=$('<table class="jqplot-table-legend" style="'+ss+'"></table>');
if(this.seriesToggle){
this._elem.css('z-index', '3');
}
var pad=false,
reverse=false,
nr, nc;
var s=series[0];
var slen=s.data.length;
var colorGenerator=new $.jqplot.ColorGenerator(s.seriesColors);
if(this.numberRows){
nr=this.numberRows;
if(!this.numberColumns){
nc=Math.ceil(slen/nr);
}else{
nc=this.numberColumns;
}}
else if(this.numberColumns){
nc=this.numberColumns;
nr=Math.ceil(slen/this.numberColumns);
}else{
nr=slen;
nc=1;
}
var i, j, tr, td1, td2, lt, rs, div, div0, div1;
var idx=0;
for (i=series.length-1; i>=0; i--){
if(nc==1&&series[i]._stack||series[i].renderer.constructor==$.jqplot.BezierCurveRenderer){
reverse=true;
}}
for (i=0; i<nr; i++){
tr=$(document.createElement('tr'));
tr.addClass('jqplot-table-legend');
if(reverse){
tr.prependTo(this._elem);
}else{
tr.appendTo(this._elem);
}
for (j=0; j<nc; j++){
if(idx < slen){
lt=this.labels[idx]||s.data[idx][0].toString();
tt=this.toolTips[idx];
if(lt){
var color=colorGenerator.next();
if(!reverse){
if(i>0){
pad=true;
}else{
pad=false;
}}else{
if(i==nr -1){
pad=false;
}else{
pad=true;
}}
rs=(pad) ? this.rowSpacing:'0';
td1=$(document.createElement('td'));
td1.addClass('jqplot-table-legend jqplot-table-legend-swatch');
td1.css({textAlign: 'center', paddingTop: rs});
div0=$(document.createElement('div'));
div0.addClass('jqplot-table-legend-swatch-outline');
if(tt!==undefined){
div0.attr("title", tt);
}
div1=$(document.createElement('div'));
div1.addClass('jqplot-table-legend-swatch');
div1.css({backgroundColor: color, borderColor: color});
td1.append(div0.append(div1));
td2=$(document.createElement('td'));
td2.addClass('jqplot-table-legend jqplot-table-legend-label');
td2.css('paddingTop', rs);
if(tt!==undefined){
td2.attr("title", tt);
}
if(this.escapeHtml){
td2.text(lt);
}else{
td2.html(lt);
}
if(reverse){
if(this.showLabels){td2.prependTo(tr);}
if(this.showSwatches){td1.prependTo(tr);}}else{
if(this.showSwatches){td1.appendTo(tr);}
if(this.showLabels){td2.appendTo(tr);}}
if(this.seriesToggle){
var speed;
if(typeof(this.seriesToggle)==='string'||typeof(this.seriesToggle)==='number'){
if(!$.jqplot.use_excanvas||!this.disableIEFading){
speed=this.seriesToggle;
}}
if(this.showSwatches){
td1.bind('click', {series:s, index:idx, speed:speed, plot: plot, replot:this.seriesToggleReplot}, handleToggle);
td1.addClass('jqplot-seriesToggle');
}
if(this.showLabels){
td2.bind('click', {series:s, index:idx, speed:speed, plot: plot, replot:this.seriesToggleReplot}, handleToggle);
td2.addClass('jqplot-seriesToggle');
}
if(s.showSlice[idx]===false&&s.showLabel){
td1.addClass('jqplot-series-hidden');
td2.addClass('jqplot-series-hidden');
}}
pad=true;
}}
idx++;
}
td1=td2=div0=div1=null;
}}
return this._elem;
};
var handleToggle=function (ev){
var d=ev.data,
replot=d.replot,
plot=d.plot,
idx=d.index;
d.series.showSlice[idx]=(d.series.showSlice[idx]===false) ? true:false;
var opts={};
if($.isPlainObject(replot)){
$.extend(true, opts, replot);
}
plot.replot(opts);
};
var postDraw=function (){
if(this.legend.renderer.constructor==$.jqplot.EnhancedPieLegendRenderer&&this.legend.seriesToggle){
var e=this.legend._elem.detach();
this.eventCanvas._elem.after(e);
}};})(jQuery);
(function($){
/**
*  class: $.jqplot.LogAxisRenderer
*  A plugin for a jqPlot to render a logarithmic axis.
*
*  To use this renderer, include the plugin in your source
*  > <script type="text/javascript" language="javascript" src="plugins/jqplot.logAxisRenderer.js"></script>
*
*  and supply the appropriate options to your plot
*
*  > {axes:{xaxis:{renderer:$.jqplot.LogAxisRenderer}}}
**/
$.jqplot.LogAxisRenderer=function(){
$.jqplot.LinearAxisRenderer.call(this);
this.axisDefaults={
base:10,
tickDistribution :'power'
};};
$.jqplot.LogAxisRenderer.prototype=new $.jqplot.LinearAxisRenderer();
$.jqplot.LogAxisRenderer.prototype.constructor=$.jqplot.LogAxisRenderer;
$.jqplot.LogAxisRenderer.prototype.init=function(options){
this.drawBaseline=true;
this.minorTicks='auto';
this._scalefact=1.0;
$.extend(true, this, options);
this._autoFormatString='%d';
this._overrideFormatString=false;
for (var d in this.renderer.axisDefaults){
if(this[d]==null){
this[d]=this.renderer.axisDefaults[d];
}}
this.resetDataBounds();
};
$.jqplot.LogAxisRenderer.prototype.createTicks=function(plot){
var ticks=this._ticks;
var userTicks=this.ticks;
var name=this.name;
var db=this._dataBounds;
var dim=(this.name.charAt(0)==='x') ? this._plotDimensions.width:this._plotDimensions.height;
var interval;
var min, max;
var pos1, pos2;
var tt, i;
var threshold=30;
this._scalefact=(Math.max(dim, threshold+1) - threshold)/300;
if(userTicks.length){
for (i=0; i<userTicks.length; i++){
var ut=userTicks[i];
var t=new this.tickRenderer(this.tickOptions);
if(ut.constructor==Array){
t.value=ut[0];
t.label=ut[1];
if(!this.showTicks){
t.showLabel=false;
t.showMark=false;
}
else if(!this.showTickMarks){
t.showMark=false;
}
t.setTick(ut[0], this.name);
this._ticks.push(t);
}
else if($.isPlainObject(ut)){
$.extend(true, t, ut);
t.axis=this.name;
this._ticks.push(t);
}else{
t.value=ut;
if(!this.showTicks){
t.showLabel=false;
t.showMark=false;
}
else if(!this.showTickMarks){
t.showMark=false;
}
t.setTick(ut, this.name);
this._ticks.push(t);
}}
this.numberTicks=userTicks.length;
this.min=this._ticks[0].value;
this.max=this._ticks[this.numberTicks-1].value;
}
else if(this.min==null&&this.max==null){
min=db.min * (2 - this.padMin);
max=db.max * this.padMax;
if(min==max){
var adj=0.05;
min=min*(1-adj);
max=max*(1+adj);
}
if(this.min!=null&&this.min <=0){
throw new Error("Log axis minimum must be greater than 0");
}
if(this.max!=null&&this.max <=0){
throw new Error("Log axis maximum must be greater than 0");
}
function findCeil (val){
var order=Math.pow(10, Math.floor(Math.log(val)/Math.LN10));
return Math.ceil(val/order) * order;
}
function findFloor(val){
var order=Math.pow(10, Math.floor(Math.log(val)/Math.LN10));
return Math.floor(val/order) * order;
}
var rmin, rmax;
rmin=Math.pow(this.base, Math.floor(Math.log(min)/Math.log(this.base)));
rmax=Math.pow(this.base, Math.ceil(Math.log(max)/Math.log(this.base)));
if(rmin===0){
rmin=1;
}
var order=Math.round(Math.log(rmin)/Math.LN10);
if(this.tickOptions==null||!this.tickOptions.formatString){
this._overrideFormatString=true;
}
this.min=rmin;
this.max=rmax;
var range=this.max - this.min;
var minorTicks=(this.minorTicks==='auto') ? 0:this.minorTicks;
var numberTicks;
if(this.numberTicks==null){
if(dim > 140){
numberTicks=Math.round(Math.log(this.max/this.min)/Math.log(this.base) + 1);
if(numberTicks < 2){
numberTicks=2;
}
if(minorTicks===0){
var temp=dim/(numberTicks - 1);
if(temp < 100){
minorTicks=0;
}
else if(temp < 190){
minorTicks=1;
}
else if(temp < 250){
minorTicks=3;
}
else if(temp < 600){
minorTicks=4;
}else{
minorTicks=9;
}}
}else{
numberTicks=2;
if(minorTicks===0){
minorTicks=1;
}
minorTicks=0;
}}else{
numberTicks=this.numberTicks;
}
if(order >=0&&minorTicks!==3){
this._autoFormatString='%d';
}
else if(order <=0&&minorTicks===3){
var temp=-(order - 1);
this._autoFormatString='%.'+ Math.abs(order-1) + 'f';
}
else if(order < 0){
var temp=-order;
this._autoFormatString='%.'+ Math.abs(order) + 'f';
}else{
this._autoFormatString='%d';
}
var to, t, val, tt1, spread, interval;
for (var i=0; i<numberTicks; i++){
tt=Math.pow(this.base, i - numberTicks + 1) * this.max;
t=new this.tickRenderer(this.tickOptions);
if(this._overrideFormatString){
t.formatString=this._autoFormatString;
}
if(!this.showTicks){
t.showLabel=false;
t.showMark=false;
}
else if(!this.showTickMarks){
t.showMark=false;
}
t.setTick(tt, this.name);
this._ticks.push(t);
if(minorTicks&&i<numberTicks-1){
tt1=Math.pow(this.base, i - numberTicks + 2) * this.max;
spread=tt1 - tt;
interval=tt1 / (minorTicks+1);
for (var j=minorTicks-1; j>=0; j--){
val=tt1-interval*(j+1);
t=new this.tickRenderer(this.tickOptions);
if(this._overrideFormatString&&this._autoFormatString!=''){
t.formatString=this._autoFormatString;
}
if(!this.showTicks){
t.showLabel=false;
t.showMark=false;
}
else if(!this.showTickMarks){
t.showMark=false;
}
t.setTick(val, this.name);
this._ticks.push(t);
}}
}}
else if(this.min!=null&&this.max!=null){
var opts=$.extend(true, {}, this.tickOptions, {name: this.name, value: null});
var nt, ti;
if(this.numberTicks==null&&this.tickInterval==null){
var tdim=Math.max(dim, threshold+1);
var nttarget=Math.ceil((tdim-threshold)/35 + 1);
var ret=$.jqplot.LinearTickGenerator.bestConstrainedInterval(this.min, this.max, nttarget);
this._autoFormatString=ret[3];
nt=ret[2];
ti=ret[4];
for (var i=0; i<nt; i++){
opts.value=this.min + i * ti;
t=new this.tickRenderer(opts);
if(this._overrideFormatString&&this._autoFormatString!=''){
t.formatString=this._autoFormatString;
}
if(!this.showTicks){
t.showLabel=false;
t.showMark=false;
}
else if(!this.showTickMarks){
t.showMark=false;
}
this._ticks.push(t);
}}
else if(this.numberTicks!=null&&this.tickInterval!=null){
nt=this.numberTicks;
for (var i=0; i<nt; i++){
opts.value=this.min + i * this.tickInterval;
t=new this.tickRenderer(opts);
if(this._overrideFormatString&&this._autoFormatString!=''){
t.formatString=this._autoFormatString;
}
if(!this.showTicks){
t.showLabel=false;
t.showMark=false;
}
else if(!this.showTickMarks){
t.showMark=false;
}
this._ticks.push(t);
}}
}};
$.jqplot.LogAxisRenderer.prototype.pack=function(pos, offsets){
var lb=parseInt(this.base, 10);
var ticks=this._ticks;
var trans=function (v){ return Math.log(v)/Math.log(lb); };
var invtrans=function (v){ return Math.pow(Math.E, (Math.log(lb)*v)); };
var max=trans(this.max);
var min=trans(this.min);
var offmax=offsets.max;
var offmin=offsets.min;
var lshow=(this._label==null) ? false:this._label.show;
for (var p in pos){
this._elem.css(p, pos[p]);
}
this._offsets=offsets;
var pixellength=offmax - offmin;
var unitlength=max - min;
this.p2u=function(p){
return invtrans((p - offmin) * unitlength / pixellength + min);
};
this.u2p=function(u){
return (trans(u) - min) * pixellength / unitlength + offmin;
};
if(this.name=='xaxis'||this.name=='x2axis'){
this.series_u2p=function(u){
return (trans(u) - min) * pixellength / unitlength;
};
this.series_p2u=function(p){
return invtrans(p * unitlength / pixellength + min);
};}else{
this.series_u2p=function(u){
return (trans(u) - max) * pixellength / unitlength;
};
this.series_p2u=function(p){
return invtrans(p * unitlength / pixellength + max);
};}
if(this.show){
if(this.name=='xaxis'||this.name=='x2axis'){
for (var i=0; i<ticks.length; i++){
var t=ticks[i];
if(t.show&&t.showLabel){
var shim;
if(t.constructor==$.jqplot.CanvasAxisTickRenderer&&t.angle){
switch (t.labelPosition){
case 'auto':
if(t.angle < 0){
shim=-t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
}else{
shim=-t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
}
break;
case 'end':
shim=-t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
break;
case 'start':
shim=-t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
break;
case 'middle':
shim=-t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
break;
default:
shim=-t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
break;
}}else{
shim=-t.getWidth()/2;
}
var val=this.u2p(t.value) + shim + 'px';
t._elem.css('left', val);
t.pack();
}}
if(lshow){
var w=this._label._elem.outerWidth(true);
this._label._elem.css('left', offmin + pixellength/2 - w/2 + 'px');
if(this.name=='xaxis'){
this._label._elem.css('bottom', '0px');
}else{
this._label._elem.css('top', '0px');
}
this._label.pack();
}}else{
for (var i=0; i<ticks.length; i++){
var t=ticks[i];
if(t.show&&t.showLabel){
var shim;
if(t.constructor==$.jqplot.CanvasAxisTickRenderer&&t.angle){
switch (t.labelPosition){
case 'auto':
case 'end':
if(t.angle < 0){
shim=-t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
}else{
shim=-t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
}
break;
case 'start':
if(t.angle > 0){
shim=-t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
}else{
shim=-t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
}
break;
case 'middle':
shim=-t.getHeight()/2;
break;
default:
shim=-t.getHeight()/2;
break;
}}else{
shim=-t.getHeight()/2;
}
var val=this.u2p(t.value) + shim + 'px';
t._elem.css('top', val);
t.pack();
}}
if(lshow){
var h=this._label._elem.outerHeight(true);
this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
if(this.name=='yaxis'){
this._label._elem.css('left', '0px');
}else{
this._label._elem.css('right', '0px');
}
this._label.pack();
}}
}};})(jQuery);
(function($){
$.jqplot.BarRenderer=function(){
$.jqplot.LineRenderer.call(this);
};
$.jqplot.BarRenderer.prototype=new $.jqplot.LineRenderer();
$.jqplot.BarRenderer.prototype.constructor=$.jqplot.BarRenderer;
$.jqplot.BarRenderer.prototype.init=function(options, plot){
this.barPadding=8;
this.barMargin=10;
this.barDirection='vertical';
this.barWidth=null;
this.shadowOffset=2;
this.shadowDepth=5;
this.shadowAlpha=0.08;
this.waterfall=false;
this.groups=1;
this.varyBarColor=false;
this.highlightMouseOver=true;
this.highlightMouseDown=false;
this.highlightColors=[];
this.transposedData=true;
this.renderer.animation={
show: false,
direction: 'down',
speed: 3000,
_supported: true
};
this._type='bar';
if(options.highlightMouseDown&&options.highlightMouseOver==null){
options.highlightMouseOver=false;
}
$.extend(true, this, options);
$.extend(true, this.renderer, options);
this.fill=true;
if(this.barDirection==='horizontal'&&this.rendererOptions.animation&&this.rendererOptions.animation.direction==null){
this.renderer.animation.direction='left';
}
if(this.waterfall){
this.fillToZero=false;
this.disableStack=true;
}
if(this.barDirection=='vertical'){
this._primaryAxis='_xaxis';
this._stackAxis='y';
this.fillAxis='y';
}else{
this._primaryAxis='_yaxis';
this._stackAxis='x';
this.fillAxis='x';
}
this._highlightedPoint=null;
this._plotSeriesInfo=null;
this._dataColors=[];
this._barPoints=[];
var opts={lineJoin:'miter', lineCap:'round', fill:true, isarc:false, strokeStyle:this.color, fillStyle:this.color, closePath:this.fill};
this.renderer.shapeRenderer.init(opts);
var sopts={lineJoin:'miter', lineCap:'round', fill:true, isarc:false, angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, depth:this.shadowDepth, closePath:this.fill};
this.renderer.shadowRenderer.init(sopts);
plot.postInitHooks.addOnce(postInit);
plot.postDrawHooks.addOnce(postPlotDraw);
plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
};
function barPreInit(target, data, seriesDefaults, options){
if(this.rendererOptions.barDirection=='horizontal'){
this._stackAxis='x';
this._primaryAxis='_yaxis';
}
if(this.rendererOptions.waterfall==true){
this._data=$.extend(true, [], this.data);
var sum=0;
var pos=(!this.rendererOptions.barDirection||this.rendererOptions.barDirection==='vertical'||this.transposedData===false) ? 1:0;
for(var i=0; i<this.data.length; i++){
sum +=this.data[i][pos];
if(i>0){
this.data[i][pos] +=this.data[i-1][pos];
}}
this.data[this.data.length]=(pos==1) ? [this.data.length+1, sum]:[sum, this.data.length+1];
this._data[this._data.length]=(pos==1) ? [this._data.length+1, sum]:[sum, this._data.length+1];
}
if(this.rendererOptions.groups > 1){
this.breakOnNull=true;
var l=this.data.length;
var skip=parseInt(l/this.rendererOptions.groups, 10);
var count=0;
for (var i=skip; i<l; i+=skip){
this.data.splice(i+count, 0, [null, null]);
this._plotData.splice(i+count, 0, [null, null]);
this._stackData.splice(i+count, 0, [null, null]);
count++;
}
for (i=0; i<this.data.length; i++){
if(this._primaryAxis=='_xaxis'){
this.data[i][0]=i+1;
this._plotData[i][0]=i+1;
this._stackData[i][0]=i+1;
}else{
this.data[i][1]=i+1;
this._plotData[i][1]=i+1;
this._stackData[i][1]=i+1;
}}
}}
$.jqplot.preSeriesInitHooks.push(barPreInit);
$.jqplot.BarRenderer.prototype.calcSeriesNumbers=function(){
var nvals=0;
var nseries=0;
var paxis=this[this._primaryAxis];
var s, series, pos;
for (var i=0; i < paxis._series.length; i++){
series=paxis._series[i];
if(series===this){
pos=i;
}
if(series.renderer.constructor==$.jqplot.BarRenderer){
nvals +=series.data.length;
nseries +=1;
}}
return [nvals, nseries, pos];
};
$.jqplot.BarRenderer.prototype.setBarWidth=function(){
var i;
var nvals=0;
var nseries=0;
var paxis=this[this._primaryAxis];
var s, series, pos;
var temp=this._plotSeriesInfo=this.renderer.calcSeriesNumbers.call(this);
nvals=temp[0];
nseries=temp[1];
var nticks=paxis.numberTicks;
var nbins=(nticks-1)/2;
if(paxis.name=='xaxis'||paxis.name=='x2axis'){
if(this._stack){
this.barWidth=(paxis._offsets.max - paxis._offsets.min) / nvals * nseries - this.barMargin;
}else{
this.barWidth=((paxis._offsets.max - paxis._offsets.min)/nbins  - this.barPadding * (nseries-1) - this.barMargin*2)/nseries;
}}else{
if(this._stack){
this.barWidth=(paxis._offsets.min - paxis._offsets.max) / nvals * nseries - this.barMargin;
}else{
this.barWidth=((paxis._offsets.min - paxis._offsets.max)/nbins  - this.barPadding * (nseries-1) - this.barMargin*2)/nseries;
}}
return [nvals, nseries];
};
function computeHighlightColors (colors){
var ret=[];
for (var i=0; i<colors.length; i++){
var rgba=$.jqplot.getColorComponents(colors[i]);
var newrgb=[rgba[0], rgba[1], rgba[2]];
var sum=newrgb[0] + newrgb[1] + newrgb[2];
for (var j=0; j<3; j++){
newrgb[j]=(sum > 570) ?  newrgb[j] * 0.8:newrgb[j] + 0.3 * (255 - newrgb[j]);
newrgb[j]=parseInt(newrgb[j], 10);
}
ret.push('rgb('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+')');
}
return ret;
}
function getStart(sidx, didx, comp, plot, axis){
var seriesIndex=sidx,
prevSeriesIndex=sidx - 1,
start,
prevVal,
aidx=(axis==='x') ? 0:1;
if(seriesIndex > 0){
prevVal=plot.series[prevSeriesIndex]._plotData[didx][aidx];
if((comp * prevVal) < 0){
start=getStart(prevSeriesIndex, didx, comp, plot, axis);
}else{
start=plot.series[prevSeriesIndex].gridData[didx][aidx];
}}else{
start=(aidx===0) ? plot.series[seriesIndex]._xaxis.series_u2p(0):plot.series[seriesIndex]._yaxis.series_u2p(0);
}
return start;
}
$.jqplot.BarRenderer.prototype.draw=function(ctx, gridData, options, plot){
var i;
var opts=$.extend({}, options);
var shadow=(opts.shadow!=undefined) ? opts.shadow:this.shadow;
var showLine=(opts.showLine!=undefined) ? opts.showLine:this.showLine;
var fill=(opts.fill!=undefined) ? opts.fill:this.fill;
var xaxis=this.xaxis;
var yaxis=this.yaxis;
var xp=this._xaxis.series_u2p;
var yp=this._yaxis.series_u2p;
var pointx, pointy;
this._dataColors=[];
this._barPoints=[];
if(this.barWidth==null||this.rendererOptions.barWidth==null){//check pull request https://bitbucket.org/cleonello/jqplot/pull-request/61/fix-for-issue-513/diff
this.renderer.setBarWidth.call(this);
}
var temp=this._plotSeriesInfo=this.renderer.calcSeriesNumbers.call(this);
var nvals=temp[0];
var nseries=temp[1];
var pos=temp[2];
var points=[];
if(this._stack){
this._barNudge=0;
}else{
this._barNudge=(-Math.abs(nseries/2 - 0.5) + pos) * (this.barWidth + this.barPadding);
}
if(showLine){
var negativeColors=new $.jqplot.ColorGenerator(this.negativeSeriesColors);
var positiveColors=new $.jqplot.ColorGenerator(this.seriesColors);
var alphaColors=new $.jqplot.ColorGenerator(this.seriesAlphaColors);
var negativeColor=negativeColors.get(this.index);
if(! this.useNegativeColors){
negativeColor=opts.fillStyle;
}
var positiveColor=opts.fillStyle;
var base;
var xstart;
var ystart;
if(this.barDirection=='vertical'){
for (var i=0; i<gridData.length; i++){
if(!this._stack&&this.data[i][1]==null){
continue;
}
points=[];
base=gridData[i][0] + this._barNudge;
if(this._stack&&this._prevGridData.length){
ystart=getStart(this.index, i, this._plotData[i][1], plot, 'y');
}else{
if(this.fillToZero){
ystart=this._yaxis.series_u2p(0);
}
else if(this.waterfall&&i > 0&&i < this.gridData.length-1){
ystart=this.gridData[i-1][1];
}
else if(this.waterfall&&i==0&&i < this.gridData.length-1){
if(this._yaxis.min <=0&&this._yaxis.max >=0){
ystart=this._yaxis.series_u2p(0);
}
else if(this._yaxis.min > 0){
ystart=ctx.canvas.height;
}else{
ystart=0;
}}
else if(this.waterfall&&i==this.gridData.length - 1){
if(this._yaxis.min <=0&&this._yaxis.max >=0){
ystart=this._yaxis.series_u2p(0);
}
else if(this._yaxis.min > 0){
ystart=ctx.canvas.height;
}else{
ystart=0;
}}else{
ystart=ctx.canvas.height;
}}
if((this.fillToZero&&this._plotData[i][1] < 0)||(this.waterfall&&this._data[i][1] < 0)){
if(this.varyBarColor&&!this._stack){
if(this.useNegativeColors){
opts.fillStyle=negativeColors.next();
}else{
if(i>this.startAlpha){
opts.fillStyle=alphaColors.next();
}else{
opts.fillStyle=positiveColors.next();
}}
}else{
opts.fillStyle=negativeColor;
}}else{
if(this.varyBarColor&&!this._stack){
opts.fillStyle=positiveColors.next();
}else{
opts.fillStyle=positiveColor;
}}
if(!this.fillToZero||this._plotData[i][1] >=0){
points.push([base-this.barWidth/2, ystart]);
points.push([base-this.barWidth/2, gridData[i][1]]);
points.push([base+this.barWidth/2, gridData[i][1]]);
points.push([base+this.barWidth/2, ystart]);
}else{
points.push([base-this.barWidth/2, gridData[i][1]]);
points.push([base-this.barWidth/2, ystart]);
points.push([base+this.barWidth/2, ystart]);
points.push([base+this.barWidth/2, gridData[i][1]]);
}
this._barPoints.push(points);
if(shadow&&!this._stack){
var sopts=$.extend(true, {}, opts);
delete sopts.fillStyle;
this.renderer.shadowRenderer.draw(ctx, points, sopts);
}
var clr=opts.fillStyle||this.color;
if(i>this.startAlpha){
clr=clr.replace(",1)", ",0.3)");
opts.fillStyle=clr;
}
this._dataColors.push(clr);
this.renderer.shapeRenderer.draw(ctx, points, opts);
}}
else if(this.barDirection=='horizontal'){
for (var i=0; i<gridData.length; i++){
if(!this._stack&&this.data[i][0]==null){
continue;
}
points=[];
base=gridData[i][1] - this._barNudge;
xstart;
if(this._stack&&this._prevGridData.length){
xstart=getStart(this.index, i, this._plotData[i][0], plot, 'x');
}else{
if(this.fillToZero){
xstart=this._xaxis.series_u2p(0);
}
else if(this.waterfall&&i > 0&&i < this.gridData.length-1){
xstart=this.gridData[i-1][0];
}
else if(this.waterfall&&i==0&&i < this.gridData.length-1){
if(this._xaxis.min <=0&&this._xaxis.max >=0){
xstart=this._xaxis.series_u2p(0);
}
else if(this._xaxis.min > 0){
xstart=0;
}else{
xstart=0;
}}
else if(this.waterfall&&i==this.gridData.length - 1){
if(this._xaxis.min <=0&&this._xaxis.max >=0){
xstart=this._xaxis.series_u2p(0);
}
else if(this._xaxis.min > 0){
xstart=0;
}else{
xstart=ctx.canvas.width;
}}else{
xstart=0;
}}
if((this.fillToZero&&this._plotData[i][0] < 0)||(this.waterfall&&this._data[i][0] < 0)){
if(this.varyBarColor&&!this._stack){
if(this.useNegativeColors){
opts.fillStyle=negativeColors.next();
}else{
opts.fillStyle=positiveColors.next();
}}else{
opts.fillStyle=negativeColor;
}}else{
if(this.varyBarColor&&!this._stack){
opts.fillStyle=positiveColors.next();
}else{
opts.fillStyle=positiveColor;
}}
if(!this.fillToZero||this._plotData[i][0] >=0){
points.push([xstart, base + this.barWidth / 2]);
points.push([xstart, base - this.barWidth / 2]);
points.push([gridData[i][0], base - this.barWidth / 2]);
points.push([gridData[i][0], base + this.barWidth / 2]);
}else{
points.push([gridData[i][0], base + this.barWidth / 2]);
points.push([gridData[i][0], base - this.barWidth / 2]);
points.push([xstart, base - this.barWidth / 2]);
points.push([xstart, base + this.barWidth / 2]);
}
this._barPoints.push(points);
if(shadow&&!this._stack){
var sopts=$.extend(true, {}, opts);
delete sopts.fillStyle;
this.renderer.shadowRenderer.draw(ctx, points, sopts);
}
var clr=opts.fillStyle||this.color;
this._dataColors.push(clr);
this.renderer.shapeRenderer.draw(ctx, points, opts);
}}
}
if(this.highlightColors.length==0){
this.highlightColors=$.jqplot.computeHighlightColors(this._dataColors);
}
else if(typeof(this.highlightColors)=='string'){
var temp=this.highlightColors;
this.highlightColors=[];
for (var i=0; i<this._dataColors.length; i++){
this.highlightColors.push(temp);
}}
};
$.jqplot.BarRenderer.prototype.drawShadow=function(ctx, gridData, options, plot){
var i;
var opts=(options!=undefined) ? options:{};
var shadow=(opts.shadow!=undefined) ? opts.shadow:this.shadow;
var showLine=(opts.showLine!=undefined) ? opts.showLine:this.showLine;
var fill=(opts.fill!=undefined) ? opts.fill:this.fill;
var xaxis=this.xaxis;
var yaxis=this.yaxis;
var xp=this._xaxis.series_u2p;
var yp=this._yaxis.series_u2p;
var pointx, points, pointy, nvals, nseries, pos;
if(this._stack&&this.shadow){
if(this.barWidth==null){
this.renderer.setBarWidth.call(this);
}
var temp=this._plotSeriesInfo=this.renderer.calcSeriesNumbers.call(this);
nvals=temp[0];
nseries=temp[1];
pos=temp[2];
if(this._stack){
this._barNudge=0;
}else{
this._barNudge=(-Math.abs(nseries/2 - 0.5) + pos) * (this.barWidth + this.barPadding);
}
if(showLine){
if(this.barDirection=='vertical'){
for (var i=0; i<gridData.length; i++){
if(this.data[i][1]==null){
continue;
}
points=[];
var base=gridData[i][0] + this._barNudge;
var ystart;
if(this._stack&&this._prevGridData.length){
ystart=getStart(this.index, i, this._plotData[i][1], plot, 'y');
}else{
if(this.fillToZero){
ystart=this._yaxis.series_u2p(0);
}else{
ystart=ctx.canvas.height;
}}
points.push([base-this.barWidth/2, ystart]);
points.push([base-this.barWidth/2, gridData[i][1]]);
points.push([base+this.barWidth/2, gridData[i][1]]);
points.push([base+this.barWidth/2, ystart]);
this.renderer.shadowRenderer.draw(ctx, points, opts);
}}
else if(this.barDirection=='horizontal'){
for (var i=0; i<gridData.length; i++){
if(this.data[i][0]==null){
continue;
}
points=[];
var base=gridData[i][1] - this._barNudge;
var xstart;
if(this._stack&&this._prevGridData.length){
xstart=getStart(this.index, i, this._plotData[i][0], plot, 'x');
}else{
if(this.fillToZero){
xstart=this._xaxis.series_u2p(0);
}else{
xstart=0;
}}
points.push([xstart, base+this.barWidth/2]);
points.push([gridData[i][0], base+this.barWidth/2]);
points.push([gridData[i][0], base-this.barWidth/2]);
points.push([xstart, base-this.barWidth/2]);
this.renderer.shadowRenderer.draw(ctx, points, opts);
}}
}}
};
function postInit(target, data, options){
for (var i=0; i<this.series.length; i++){
if(this.series[i].renderer.constructor==$.jqplot.BarRenderer){
if(this.series[i].highlightMouseOver){
this.series[i].highlightMouseDown=false;
}}
}}
function postPlotDraw(){
if(this.plugins.barRenderer&&this.plugins.barRenderer.highlightCanvas){
this.plugins.barRenderer.highlightCanvas.resetCanvas();
this.plugins.barRenderer.highlightCanvas=null;
}
this.plugins.barRenderer={highlightedSeriesIndex:null};
this.plugins.barRenderer.highlightCanvas=new $.jqplot.GenericCanvas();
this.eventCanvas._elem.before(this.plugins.barRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-barRenderer-highlight-canvas', this._plotDimensions, this));
this.plugins.barRenderer.highlightCanvas.setContext();
this.eventCanvas._elem.bind('mouseleave', {plot:this}, function (ev){ unhighlight(ev.data.plot); });
}
function highlight (plot, sidx, pidx, points){
var s=plot.series[sidx];
var canvas=plot.plugins.barRenderer.highlightCanvas;
canvas._ctx.clearRect(0,0,canvas._ctx.canvas.width, canvas._ctx.canvas.height);
s._highlightedPoint=pidx;
plot.plugins.barRenderer.highlightedSeriesIndex=sidx;
var opts={fillStyle: s.highlightColors[pidx]};
s.renderer.shapeRenderer.draw(canvas._ctx, points, opts);
canvas=null;
}
function unhighlight (plot){
var canvas=plot.plugins.barRenderer.highlightCanvas;
canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
for (var i=0; i<plot.series.length; i++){
plot.series[i]._highlightedPoint=null;
}
plot.plugins.barRenderer.highlightedSeriesIndex=null;
plot.target.trigger('jqplotDataUnhighlight');
canvas=null;
}
function handleMove(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
var evt1=jQuery.Event('jqplotDataMouseOver');
evt1.pageX=ev.pageX;
evt1.pageY=ev.pageY;
plot.target.trigger(evt1, ins);
if(plot.series[ins[0]].show&&plot.series[ins[0]].highlightMouseOver &&
!(ins[0]==plot.plugins.barRenderer.highlightedSeriesIndex&&ins[1]==plot.series[ins[0]]._highlightedPoint)){
var evt=jQuery.Event('jqplotDataHighlight');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
plot.target.trigger(evt, ins);
highlight (plot, neighbor.seriesIndex, neighbor.pointIndex, neighbor.points);
}}
else if(neighbor==null){
unhighlight (plot);
}}
function handleMouseDown(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
if(plot.series[ins[0]].highlightMouseDown&&!(ins[0]==plot.plugins.barRenderer.highlightedSeriesIndex&&ins[1]==plot.series[ins[0]]._highlightedPoint)){
var evt=jQuery.Event('jqplotDataHighlight');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
plot.target.trigger(evt, ins);
highlight (plot, neighbor.seriesIndex, neighbor.pointIndex, neighbor.points);
}}
else if(neighbor==null){
unhighlight (plot);
}}
function handleMouseUp(ev, gridpos, datapos, neighbor, plot){
var idx=plot.plugins.barRenderer.highlightedSeriesIndex;
if(idx!=null&&plot.series[idx].highlightMouseDown){
unhighlight(plot);
}}
function handleClick(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
var evt=jQuery.Event('jqplotDataClick');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
plot.target.trigger(evt, ins);
}}
function handleRightClick(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
var idx=plot.plugins.barRenderer.highlightedSeriesIndex;
if(idx!=null&&plot.series[idx].highlightMouseDown){
unhighlight(plot);
}
var evt=jQuery.Event('jqplotDataRightClick');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
plot.target.trigger(evt, ins);
}}
})(jQuery);
(function($){
/**
* Class: $.jqplot.PieRenderer
* Plugin renderer to draw a pie chart.
* x values, if present, will be used as slice labels.
* y values give slice size.
*
* To use this renderer, you need to include the
* pie renderer plugin, for example:
*
* > <script type="text/javascript" src="plugins/jqplot.pieRenderer.js"></script>
*
* Properties described here are passed into the $.jqplot function
* as options on the series renderer.  For example:
*
* > plot2=$.jqplot('chart2', [s1, s2], {
* >     seriesDefaults: {
* >         renderer:$.jqplot.PieRenderer,
* >         rendererOptions:{
* >              sliceMargin: 2,
* >              startAngle: -90
* >          }
* >      }
* > });
*
* A pie plot will trigger events on the plot target
* according to user interaction.  All events return the event object,
* the series index, the point (slice) index, and the point data for
* the appropriate slice.
*
* 'jqplotDataMouseOver' - triggered when user mouseing over a slice.
* 'jqplotDataHighlight' - triggered the first time user mouses over a slice,
*   if highlighting is enabled.
* 'jqplotDataUnhighlight' - triggered when a user moves the mouse out of
*   a highlighted slice.
* 'jqplotLegendHighlight' - triggered the first time user mouses over a legend,
*   if highlighting is enabled.
* 'jqplotLegendUnhighlight' - triggered when a user moves the mouse out of
*   a highlighted legend.
* 'jqplotDataClick' - triggered when the user clicks on a slice.
* 'jqplotDataRightClick' - tiggered when the user right clicks on a slice if
* the "captureRightClick" option is set to true on the plot.
*/
$.jqplot.PieRenderer=function(){
$.jqplot.LineRenderer.call(this);
};
$.jqplot.PieRenderer.prototype=new $.jqplot.LineRenderer();
$.jqplot.PieRenderer.prototype.constructor=$.jqplot.PieRenderer;
$.jqplot.PieRenderer.prototype.init=function(options, plot){
this.diameter=null;
this.padding=20;
this.sliceMargin=0;
this.fill=true;
this.shadowOffset=2;
this.shadowAlpha=0.07;
this.shadowDepth=5;
this.highlightMouseOver=true;
this.highlightMouseDown=false;
this.highlightColors=[];
this.dataLabels='percent';
this.showDataLabels=false;
this.dataLabelFormatString=null;
this.dataLabelThreshold=3;
this.dataLabelPositionFactor=0.52;
this.dataLabelNudge=2;
this.dataLabelCenterOn=true;
this.startAngle=0;
this.tickRenderer=$.jqplot.PieTickRenderer;
this.showSlice=[];
this._drawData=true;
this._type='pie';
if(options.highlightMouseDown&&options.highlightMouseOver==null){
options.highlightMouseOver=false;
}
$.extend(true, this, options);
if(this.sliceMargin < 0){
this.sliceMargin=0;
}
this._diameter=null;
this._radius=null;
this._sliceAngles=[];
this._highlightedPoint=null;
if(this.highlightColors.length==0){
for (var i=0; i<this.seriesColors.length; i++){
var rgba=$.jqplot.getColorComponents(this.seriesColors[i]);
var newrgb=[rgba[0], rgba[1], rgba[2]];
var sum=newrgb[0] + newrgb[1] + newrgb[2];
for (var j=0; j<3; j++){
newrgb[j]=(sum > 570) ?  newrgb[j] * 0.8:newrgb[j] + 0.3 * (255 - newrgb[j]);
newrgb[j]=parseInt(newrgb[j], 10);
}
this.highlightColors.push('rgb('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+')');
}}
this.highlightColorGenerator=new $.jqplot.ColorGenerator(this.highlightColors);
plot.postParseOptionsHooks.addOnce(postParseOptions);
plot.postInitHooks.addOnce(postInit);
plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
plot.postDrawHooks.addOnce(postPlotDraw);
};
$.jqplot.PieRenderer.prototype.setGridData=function(plot){
var stack=[];
var td=[];
var sa=this.startAngle/180*Math.PI;
var tot=0;
this._drawData=false;
for (var i=0; i<this.data.length; i++){
if(this.data[i][1]!=0){
this._drawData=true;
if(this.showSlice[i]===undefined){
this.showSlice[i]=true;
}}
stack.push(this.data[i][1]);
td.push([this.data[i][0]]);
if(i>0){
stack[i] +=stack[i-1];
}
tot +=this.data[i][1];
}
var fact=Math.PI*2/stack[stack.length - 1];
for (var i=0; i<stack.length; i++){
td[i][1]=stack[i] * fact;
td[i][2]=this.data[i][1]/tot;
}
this.gridData=td;
};
$.jqplot.PieRenderer.prototype.makeGridData=function(data, plot){
var stack=[];
var td=[];
var tot=0;
var sa=this.startAngle/180*Math.PI;
this._drawData=false;
for (var i=0; i<data.length; i++){
if(this.data[i][1]!=0){
this._drawData=true;
}
stack.push(data[i][1]);
td.push([data[i][0]]);
if(i>0){
stack[i] +=stack[i-1];
}
tot +=data[i][1];
}
var fact=Math.PI*2/stack[stack.length - 1];
for (var i=0; i<stack.length; i++){
td[i][1]=stack[i] * fact;
td[i][2]=data[i][1]/tot;
}
return td;
};
function calcRadiusAdjustment(ang){
return Math.sin((ang - (ang-Math.PI) / 8 / Math.PI)/2.0);
}
function calcRPrime(ang1, ang2, sliceMargin, fill, lineWidth){
var rprime=0;
var ang=ang2 - ang1;
var absang=Math.abs(ang);
var sm=sliceMargin;
if(fill==false){
sm +=lineWidth;
}
if(sm > 0&&absang > 0.01&&absang < 6.282){
rprime=parseFloat(sm) / 2.0 / calcRadiusAdjustment(ang);
}
return rprime;
}
$.jqplot.PieRenderer.prototype.drawSlice=function (ctx, ang1, ang2, color, isShadow){
if(this._drawData){
var r=this._radius;
var fill=this.fill;
var lineWidth=this.lineWidth;
var sm=this.sliceMargin;
if(this.fill==false){
sm +=this.lineWidth;
}
ctx.save();
ctx.translate(this._center[0], this._center[1]);
var rprime=calcRPrime(ang1, ang2, this.sliceMargin, this.fill, this.lineWidth);
var transx=rprime * Math.cos((ang1 + ang2) / 2.0);
var transy=rprime * Math.sin((ang1 + ang2) / 2.0);
if((ang2 - ang1) <=Math.PI){
r -=rprime;
}else{
r +=rprime;
}
ctx.translate(transx, transy);
if(isShadow){
for (var i=0, l=this.shadowDepth; i<l; i++){
ctx.save();
ctx.translate(this.shadowOffset*Math.cos(this.shadowAngle/180*Math.PI), this.shadowOffset*Math.sin(this.shadowAngle/180*Math.PI));
doDraw(r);
}
for (var i=0, l=this.shadowDepth; i<l; i++){
ctx.restore();
}}else{
doDraw(r);
}
ctx.restore();
}
function doDraw (rad){
if(ang2 > 6.282 + this.startAngle){
ang2=6.282 + this.startAngle;
if(ang1 > ang2){
ang1=6.281 + this.startAngle;
}}
if(ang1 >=ang2){
return;
}
ctx.beginPath();
ctx.fillStyle=color;
ctx.strokeStyle=color;
ctx.lineWidth=lineWidth;
ctx.arc(0, 0, rad, ang1, ang2, false);
ctx.lineTo(0,0);
ctx.closePath();
if(fill){
ctx.fill();
}else{
ctx.stroke();
}}
};
$.jqplot.PieRenderer.prototype.draw=function (ctx, gd, options, plot){
var i;
var opts=(options!=undefined) ? options:{};
var offx=0;
var offy=0;
var trans=1;
var colorGenerator=new $.jqplot.ColorGenerator(this.seriesColors);
var sliceColor;
if(options.legendInfo&&options.legendInfo.placement=='insideGrid'){
var li=options.legendInfo;
switch (li.location){
case 'nw':
offx=li.width + li.xoffset;
break;
case 'w':
offx=li.width + li.xoffset;
break;
case 'sw':
offx=li.width + li.xoffset;
break;
case 'ne':
offx=li.width + li.xoffset;
trans=-1;
break;
case 'e':
offx=li.width + li.xoffset;
trans=-1;
break;
case 'se':
offx=li.width + li.xoffset;
trans=-1;
break;
case 'n':
offy=li.height + li.yoffset;
break;
case 's':
offy=li.height + li.yoffset;
trans=-1;
break;
default:
break;
}}
var shadow=(opts.shadow!=undefined) ? opts.shadow:this.shadow;
var fill=(opts.fill!=undefined) ? opts.fill:this.fill;
var cw=parseInt(ctx.canvas.style.width);
var ch=parseInt(ctx.canvas.style.height);
var w=cw - offx - 2 * this.padding;
var h=ch - offy - 2 * this.padding;
var mindim=Math.min(w,h);
var d=mindim;
this._sliceAngles=[];
var sm=this.sliceMargin;
if(this.fill==false){
sm +=this.lineWidth;
}
var rprime;
var maxrprime=0;
var ang, ang1, ang2, shadowColor;
var sa=this.startAngle / 180 * Math.PI;
for (var i=0, l=gd.length; i<l; i++){
ang1=(i==0) ? sa:gd[i-1][1] + sa;
ang2=gd[i][1] + sa;
this._sliceAngles.push([ang1, ang2]);
rprime=calcRPrime(ang1, ang2, this.sliceMargin, this.fill, this.lineWidth);
if(Math.abs(ang2-ang1) > Math.PI){
maxrprime=Math.max(rprime, maxrprime);
}}
if(this.diameter!=null&&this.diameter > 0){
this._diameter=this.diameter - 2*maxrprime;
}else{
this._diameter=d - 2*maxrprime;
}
if(this._diameter < 6){
$.jqplot.log('Diameter of pie too small, not rendering.');
return;
}
var r=this._radius=this._diameter/2;
this._center=[(cw - trans * offx)/2 + trans * offx + maxrprime * Math.cos(sa), (ch - trans*offy)/2 + trans * offy + maxrprime * Math.sin(sa)];
if(this.shadow){
for (var i=0, l=gd.length; i<l; i++){
shadowColor='rgba(0,0,0,'+this.shadowAlpha+')';
this.renderer.drawSlice.call (this, ctx, this._sliceAngles[i][0], this._sliceAngles[i][1], shadowColor, true);
}}
for (var i=0; i<gd.length; i++){
sliceColor=colorGenerator.next();
if(this.showSlice[i]){
this.renderer.drawSlice.call (this, ctx, this._sliceAngles[i][0], this._sliceAngles[i][1], sliceColor, false);
if(this.showDataLabels&&gd[i][2]*100 >=this.dataLabelThreshold){
var fstr, avgang=(this._sliceAngles[i][0] + this._sliceAngles[i][1])/2, label;
if(this.dataLabels=='label'){
fstr=this.dataLabelFormatString||'%s';
label=$.jqplot.sprintf(fstr, gd[i][0]);
}
else if(this.dataLabels=='value'){
fstr=this.dataLabelFormatString||'%d';
label=$.jqplot.sprintf(fstr, this.data[i][1]);
}
else if(this.dataLabels=='percent'){
fstr=this.dataLabelFormatString||'%d%%';
label=$.jqplot.sprintf(fstr, gd[i][2]*100);
}
else if(this.dataLabels.constructor==Array){
fstr=this.dataLabelFormatString||'%s';
label=$.jqplot.sprintf(fstr, this.dataLabels[i]);
}
var fact=(this._radius) * this.dataLabelPositionFactor + this.sliceMargin + this.dataLabelNudge;
var x=this._center[0] + Math.cos(avgang) * fact + this.canvas._offsets.left;
var y=this._center[1] + Math.sin(avgang) * fact + this.canvas._offsets.top;
var labelelem=$('<div class="jqplot-pie-series jqplot-data-label" style="position:absolute;">' + label + '</div>').insertBefore(plot.eventCanvas._elem);
if(this.dataLabelCenterOn){
x -=labelelem.width()/2;
y -=labelelem.height()/2;
}else{
x -=labelelem.width() * Math.sin(avgang/2);
y -=labelelem.height()/2;
}
x=Math.round(x);
y=Math.round(y);
labelelem.css({left: x, top: y});
}}
}};
$.jqplot.PieAxisRenderer=function(){
$.jqplot.LinearAxisRenderer.call(this);
};
$.jqplot.PieAxisRenderer.prototype=new $.jqplot.LinearAxisRenderer();
$.jqplot.PieAxisRenderer.prototype.constructor=$.jqplot.PieAxisRenderer;
$.jqplot.PieAxisRenderer.prototype.init=function(options){
this.tickRenderer=$.jqplot.PieTickRenderer;
$.extend(true, this, options);
this._dataBounds={min:0, max:100};
this.min=0;
this.max=100;
this.showTicks=false;
this.ticks=[];
this.showMark=false;
this.show=false;
};
$.jqplot.PieLegendRenderer=function(){
$.jqplot.TableLegendRenderer.call(this);
};
$.jqplot.PieLegendRenderer.prototype=new $.jqplot.TableLegendRenderer();
$.jqplot.PieLegendRenderer.prototype.constructor=$.jqplot.PieLegendRenderer;
$.jqplot.PieLegendRenderer.prototype.init=function(options){
this.numberRows=null;
this.numberColumns=null;
this.width=null;
$.extend(true, this, options);
};
$.jqplot.PieLegendRenderer.prototype.draw=function(){
var legend=this;
if(this.show){
var series=this._series;
this._elem=$(document.createElement('table'));
this._elem.addClass('jqplot-table-legend');
var ss={position:'absolute'};
if(this.background){
ss['background']=this.background;
}
if(this.border){
ss['border']=this.border;
}
if(this.fontSize){
ss['fontSize']=this.fontSize;
}
if(this.fontFamily){
ss['fontFamily']=this.fontFamily;
}
if(this.textColor){
ss['textColor']=this.textColor;
}
if(this.marginTop!=null){
ss['marginTop']=this.marginTop;
}
if(this.marginBottom!=null){
ss['marginBottom']=this.marginBottom;
}
if(this.marginLeft!=null){
ss['marginLeft']=this.marginLeft;
}
if(this.marginRight!=null){
ss['marginRight']=this.marginRight;
}
this._elem.css(ss);
var pad=false,
reverse=false,
nr,
nc;
var s=series[0];
var colorGenerator=new $.jqplot.ColorGenerator(s.seriesColors);
if(s.show){
var pd=s.data;
if(this.numberRows){
nr=this.numberRows;
if(!this.numberColumns){
nc=Math.ceil(pd.length/nr);
}else{
nc=this.numberColumns;
}}
else if(this.numberColumns){
nc=this.numberColumns;
nr=Math.ceil(pd.length/this.numberColumns);
}else{
nr=pd.length;
nc=1;
}
var i, j;
var tr, td1, td2;
var lt, tt, rs, color;
var idx=0;
var div0, div1;
for (i=0; i<nr; i++){
tr=$(document.createElement('tr'));
tr.addClass('jqplot-table-legend');
if(reverse){
tr.prependTo(this._elem);
}else{
tr.appendTo(this._elem);
}
for (j=0; j<nc; j++){
if(idx < pd.length){
tt='';
if(this.labels[idx]){
lt=this.labels[idx];
}else{
if(typeof pd[idx][0]==='object'){
lt=pd[idx][0][0].toString();
tt=pd[idx][0][1].toString();
}else{
lt=pd[idx][0].toString();
}}
color=colorGenerator.next();
if(!reverse){
if(i>0){
pad=true;
}else{
pad=false;
}}else{
if(i==nr -1){
pad=false;
}else{
pad=true;
}}
rs=(pad) ? this.rowSpacing:'0';
td1=$(document.createElement('td'));
td1.addClass('jqplot-table-legend jqplot-table-legend-swatch');
td1.css({textAlign: 'center', paddingTop: rs});
div0=$(document.createElement('div'));
div0.addClass('jqplot-table-legend-swatch-outline');
if(tt!==''){
div0.attr("title", tt);
}
div1=$(document.createElement('div'));
div1.addClass('jqplot-table-legend-swatch');
div1.css({backgroundColor: color, borderColor: color});
td1.append(div0.append(div1));
td2=$(document.createElement('td'));
td2.addClass('jqplot-table-legend jqplot-table-legend-label');
td2.css('paddingTop', rs);
if(this.escapeHtml){
td2.text(lt);
}else{
td2.html('<a title="' + tt + '">' + lt + "</a>");
}
if(reverse){
td2.prependTo(tr);
td1.prependTo(tr);
}else{
td1.appendTo(tr);
td2.appendTo(tr);
}
pad=true;
}
idx++;
}}
}}
return this._elem;
};
$.jqplot.PieRenderer.prototype.handleMove=function(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
plot.target.trigger('jqplotDataMouseOver', ins);
if(plot.series[ins[0]].highlightMouseOver&&!(ins[0]==plot.plugins.pieRenderer.highlightedSeriesIndex&&ins[1]==plot.series[ins[0]]._highlightedPoint)){
plot.target.trigger('jqplotDataHighlight', ins);
highlight (plot, ins[0], ins[1]);
}}
else if(neighbor==null){
unhighlight (plot);
}};
function preInit(target, data, options){
options=options||{};
options.axesDefaults=options.axesDefaults||{};
options.legend=options.legend||{};
options.seriesDefaults=options.seriesDefaults||{};
var setopts=false;
if(options.seriesDefaults.renderer==$.jqplot.PieRenderer){
setopts=true;
}
else if(options.series){
for (var i=0; i < options.series.length; i++){
if(options.series[i].renderer==$.jqplot.PieRenderer){
setopts=true;
}}
}
if(setopts){
options.axesDefaults.renderer=$.jqplot.PieAxisRenderer;
options.legend.renderer=options.legend.renderer||$.jqplot.PieLegendRenderer;
options.legend.preDraw=true;
options.seriesDefaults.pointLabels={show: false};}}
function postInit(target, data, options){
for (var i=0; i<this.series.length; i++){
if(this.series[i].renderer.constructor==$.jqplot.PieRenderer){
if(this.series[i].highlightMouseOver){
this.series[i].highlightMouseDown=false;
}}
}}
function postParseOptions(options){
for (var i=0; i<this.series.length; i++){
this.series[i].seriesColors=this.seriesColors;
this.series[i].colorGenerator=$.jqplot.colorGenerator;
}}
function highlight (plot, sidx, pidx){
if(plot.series[sidx].showSlice[pidx]){
var s=plot.series[sidx];
var canvas=plot.plugins.pieRenderer.highlightCanvas;
canvas._ctx.clearRect(0,0,canvas._ctx.canvas.width, canvas._ctx.canvas.height);
s._highlightedPoint=pidx;
plot.plugins.pieRenderer.highlightedSeriesIndex=sidx;
s.renderer.drawSlice.call(s, canvas._ctx, s._sliceAngles[pidx][0], s._sliceAngles[pidx][1], s.highlightColorGenerator.get(pidx), false);
}}
function unhighlight (plot){
var canvas=plot.plugins.pieRenderer.highlightCanvas;
canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
for (var i=0; i<plot.series.length; i++){
plot.series[i]._highlightedPoint=null;
}
plot.plugins.pieRenderer.highlightedSeriesIndex=null;
plot.target.trigger('jqplotDataUnhighlight');
}
function handleMove(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
var evt1=jQuery.Event('jqplotDataMouseOver');
evt1.pageX=ev.pageX;
evt1.pageY=ev.pageY;
plot.target.trigger(evt1, ins);
if(plot.series[ins[0]].highlightMouseOver&&!(ins[0]==plot.plugins.pieRenderer.highlightedSeriesIndex&&ins[1]==plot.series[ins[0]]._highlightedPoint)){
var evt=jQuery.Event('jqplotDataHighlight');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
plot.target.trigger(evt, ins);
highlight (plot, ins[0], ins[1]);
}}
else if(neighbor==null){
unhighlight (plot);
}}
function handleMouseDown(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
if(plot.series[ins[0]].highlightMouseDown&&!(ins[0]==plot.plugins.pieRenderer.highlightedSeriesIndex&&ins[1]==plot.series[ins[0]]._highlightedPoint)){
var evt=jQuery.Event('jqplotDataHighlight');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
plot.target.trigger(evt, ins);
highlight (plot, ins[0], ins[1]);
}}
else if(neighbor==null){
unhighlight (plot);
}}
function handleMouseUp(ev, gridpos, datapos, neighbor, plot){
var idx=plot.plugins.pieRenderer.highlightedSeriesIndex;
if(idx!=null&&plot.series[idx].highlightMouseDown){
unhighlight(plot);
}}
function handleClick(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
var evt=jQuery.Event('jqplotDataClick');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
plot.target.trigger(evt, ins);
}}
function handleRightClick(ev, gridpos, datapos, neighbor, plot){
if(neighbor){
var ins=[neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
var idx=plot.plugins.pieRenderer.highlightedSeriesIndex;
if(idx!=null&&plot.series[idx].highlightMouseDown){
unhighlight(plot);
}
var evt=jQuery.Event('jqplotDataRightClick');
evt.which=ev.which;
evt.pageX=ev.pageX;
evt.pageY=ev.pageY;
plot.target.trigger(evt, ins);
}}
function postPlotDraw(){
if(this.plugins.pieRenderer&&this.plugins.pieRenderer.highlightCanvas){
this.plugins.pieRenderer.highlightCanvas.resetCanvas();
this.plugins.pieRenderer.highlightCanvas=null;
}
this.plugins.pieRenderer={highlightedSeriesIndex:null};
this.plugins.pieRenderer.highlightCanvas=new $.jqplot.GenericCanvas();
var labels=$(this.targetId+' .jqplot-data-label');
if(labels.length){
$(labels[0]).before(this.plugins.pieRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-pieRenderer-highlight-canvas', this._plotDimensions, this));
}else{
this.eventCanvas._elem.before(this.plugins.pieRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-pieRenderer-highlight-canvas', this._plotDimensions, this));
}
var hctx=this.plugins.pieRenderer.highlightCanvas.setContext();
this.eventCanvas._elem.bind('mouseleave', {plot:this}, function (ev){ unhighlight(ev.data.plot); });
}
$.jqplot.preInitHooks.push(preInit);
$.jqplot.PieTickRenderer=function(){
$.jqplot.AxisTickRenderer.call(this);
};
$.jqplot.PieTickRenderer.prototype=new $.jqplot.AxisTickRenderer();
$.jqplot.PieTickRenderer.prototype.constructor=$.jqplot.PieTickRenderer;
})(jQuery);
jQuery(function ($){
$(document).ready(function(){
if(jQuery('.postbox-container #right-sortables').html()==""){
jQuery('.postbox-container #right-sortables').hide();
}
if(jQuery('.postbox-container #left-sortables').html()==""){
jQuery('.postbox-container #left-sortables').hide();
}
$('body').on('click', '.linkRemoveData', function(e){
e.preventDefault();
$(this).parents('tr').remove();
});
$('.linkReferralViewDetails, .linkReferralVisitorDetails, .linkReferralLocationDetails').click(function(e){
e.preventDefault();
$('tr[id^=wsmRowChild_]').remove();
var parentRow=$(this).parents(".wsmReferralRow");
var childRowId=$(parentRow).attr('id').replace('wsmRowParent_', 'wsmRowChild_');
var animation='<div class="wsmSpinner"><div class="wsmRect1"></div><div class="wsmRect2"></div><div class="wsmRect3"></div><div class="wsmRect4"></div><div class="wsmRect5"></div></div>';
if($("#"+childRowId).length){
$("#"+childRowId).html(animation);
}else{
if($('.wsmTableContainer').hasClass('wsmContentURLStats')){
parentRow.after("<tr id='"+childRowId+"'><td  colspan=\"5\">"+animation+"</td></tr>");
}else if($('.wsmTableContainer').hasClass('wsmLocationList')){
parentRow.after("<tr id='"+childRowId+"'><td  colspan=\"6\">"+animation+"</td></tr>");
}else{
parentRow.after("<tr id='"+childRowId+"'><td  colspan=\"4\">"+animation+"</td></tr>");
}}
$.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: jQuery(this).data('referrak_param'),
})
.done(function(strResponse){
$("#"+childRowId).find('td').html(strResponse);
if($('.wsmTableContainer').hasClass('wsmContentURLStats')){
generate_referral_detail_graph('referral_chart', ['First Time Visitor','Visitors', 'Hits']);
}else{
generate_referral_detail_graph('referral_chart', ['First Time Visitor','Visitors','Page Views']);
}});
});
if($('.currenttime').length){
startTime();
}});
function generate_referral_detail_graph($id, $labels){
var $chart_panel_id=$id;
var _bpageViews=$('#'+ $id).data('pageviews');
var _bvisitors=$('#'+ $id).data('visitors');
var _bfirstVisitors=$('#'+ $id).data('firsttimevisitors');
var _bnewVisitor=$('#'+ $id).data('newvisitor');
var _maxy=$('#'+ $id).data('maxy');
var _legendIndex=[];
var bcolors=$('#'+ $id).data('colors');
var keyLabels=$labels;
var _arrLineData=[_bfirstVisitors,_bvisitors,_bpageViews];
var seriesRenderrer=[{yaxis:'yaxis'},{yaxis:'yaxis'},{yaxis:'yaxis'}, {yaxis:'y2axis'}];
var $height=$('#'+ $id).data('height');
var $width=$('#'+ $id).data('width');
var $numberTicks=$('#'+ $id).data('totalpageviews');
var $tDays=$('#'+ $id).data('tdays');
var _bOptions={
series:seriesRenderrer,
seriesColors :bcolors,
height: $height,
widht: $width,
gridPadding:{
right:40,
left:40,
top:20,
bottom:60
},
captureRightClick: true,
seriesDefaults: {
rendererOptions: {
smooth: true
}},
axes:{
xaxis:{
renderer:jQuery.jqplot.DateAxisRenderer,
tickRenderer:jQuery.jqplot.CanvasAxisTickRenderer,
tickOptions:{
formatString:'%a %e %b',
fontSize:'10px'
},
numberTicks: $numberTicks,
tickInterval: $tDays +' days'
},
yaxis:{
min:0,
max:(parseInt(_maxy) + 200),
tickOptions: {
formatString: '%d'
}},
y2axis: {
padMin: 0,
min:0,
autoscale:true,
tickOptions: {
showGridline: false,
}}
},
legend: {
labels :keyLabels,
show: true,
location: 'nw',
placement: 'inside',
renderer: jQuery.jqplot.EnhancedLegendRenderer,
rendererOptions: {
numberRows: 1,
seriesToggle:true
}},
highlighter: {
tooltipLocation: 'ne',
useAxesFormatters: true,
sizeAdjust: 2.5,
show:true,
formatString:'%s, %P',
tooltipContentEditor:function(str, seriesIndex, pointIndex, plot){
return '<span style=\'background:'+ bcolors[seriesIndex] +'\'></span>'+ plot.legend.labels[seriesIndex] + ': ' + plot.data[seriesIndex][pointIndex][1];
}},
cursor :{
show:false,
followMouse:false,
useAxesFormatters:false
}};
plot_id=jQuery.jqplot($chart_panel_id , _arrLineData,_bOptions);
if(typeof wsmMoveLegend!='function'){
wsmMoveLegend=function(parent){
parent.find('.wsmTopChartBar').each(function(){
legendDiv=jQuery(this).children('.wsmChartLegend');
legendDiv.empty();
parent.find('table.jqplot-table-legend').appendTo(legendDiv);
legendDiv.children('table.jqplot-table-legend').removeAttr('style');
});
}}
wsmMoveLegend(jQuery('#'+ $chart_panel_id).parents('.postbox'));
jQuery(window).on('resize',function(){
plot_id.replot();
wsmMoveLegend(jQuery('#'+ $chart_panel_id).parents('.postbox'));
});
return;
var topButtons=jQuery('#'+ $chart_panel_id).siblings('.wsmTopChartBar').find('.wsmButton');
topButtons.on('click',function(e){
e.preventDefault();
jQuery(this).siblings().removeClass('active');
bchart=jQuery(this).data('chart');
nBLabels=keyLabels.slice();
bSeriesData=_arrLineData.slice();
switch(bchart){
case 'Bounce':
break;
case 'Ppv':
nBLabels.push('Page Views Per Visit');
bSeriesData.push(_bppv);
break;
case 'Nvis':
nBLabels.push('New Visitors');
bSeriesData.push(_bnewVisitor);
break;
case 'Online':
break;
default:
break;
}
jQuery('#'+ $chart_panel_id).empty();
_bOptions.legend.labels=nBLabels;
jQuery(this).addClass('active');
plot_id=jQuery.jqplot($chart_panel_id, bSeriesData,_bOptions);
wsmMoveLegend(jQuery('#'+ $chart_panel_id).parents('.postbox'));
});
jQuery('#'+ $chart_panel_id).parent().find('.".P_PREFIX."ChartLegend').on('click','table.jqplot-table-legend tr td', function(event, mode){
if(mode!='code'){
var tI=_legendIndex.indexOf(jQuery(this).index());
if(tI==-1){
_legendIndex.push(jQuery(this).index());
}else{
_legendIndex.splice(tI, 1);
}}
});
}
function shuffle_color($id, array){
if(jQuery('.post_stats_graph').length==0){
return array;
}
console.log(jQuery('#'+$id).length);
return jQuery('#' + $id).data('colors');
var currentIndex=array.length, temporaryValue, randomIndex;
while (0!==currentIndex){
randomIndex=Math.floor(Math.random() * currentIndex);
currentIndex -=1;
temporaryValue=array[currentIndex];
array[currentIndex]=array[randomIndex];
array[randomIndex]=temporaryValue;
}
return array;
}
function generate_referral_visitor_info_graph($id, $content){
var colors=['#4573a7','#aa4644','#89a54e','#806a9b','#3d97af','#d9853c','#91a7ce','#a47c7c','#5cb85c','#74d6fe'];
colors=shuffle_color($id, colors);
jQuery.jqplot.config.enablePlugins=true;
var data=$content;
if(data!=null&&$.isArray(data)!=false&&data.length > 0&&$.isArray(data[0])!=false&&data[0].length > 0){
data.map(function(subArr,index){data[index]=[subArr[0],parseInt(subArr[1])]});
}
legend_visible=true;
if(jQuery('.post_stats_graph').length){
legend_visible=false;
}
if(data!=null&&$.isArray(data)!=false&&data.length > 0&&$.isArray(data[0])!=false&&data[0].length > 0){
$("#"+$id).html("");
var piePlot=jQuery.jqplot($id , [data], {
seriesColors :colors,
height: 220,
textColor: "#ffffff",
fontFamily:'-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif',
grid:{
drawBorder: false,
drawGridlines: false,
background: '#ffffff',
shadow:false
},
seriesDefaults: {
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
showDataLabels: false,
padding: 2,
sliceMargin: 3,
shadow: false,
diameter: 180
},
pointLabels: { show: true }},
legend: {
show: legend_visible,
location :'e',
marginRight:10,
border:'none'
},
highlighter: {
show: true,
useAxesFormatters: false,
tooltipFormatString: '%s',
tooltipContentEditor:function(str, seriesIndex, pointIndex, plot){
var result=str.split(',');
var ind=parseInt(result.length)-1;
result.splice(ind,1);
var str=result.join();
return str;
/*var label=str.split(",");
console.log(str);
return label[0];*/
}},
cursor :{
show:false,
followMouse:false,
useAxesFormatters:false
}});
piePlot.replot();
jQuery(window).on('resize',function(){
piePlot.replot();
});
}}
if($('.stats_submenu a.active').length){
$($('.stats_submenu a.active').attr('href')).show();
generate_referral_visitor_info_graph('visitor_info_graph', $('.stats_submenu a.active').data('graph'));
}
$(window).load(function(){
if($('#country_visitor_info_graph').length){
generate_referral_visitor_info_graph('country_visitor_info_graph', $('#country_visitor_info_graph').data('graph'));
}
if($(".each_visior_info_graph").length){
$(".each_visior_info_graph").each(function(){
generate_referral_visitor_info_graph($(this).attr('id'), $(this).data('graph'));
});
}});
$('.stats_submenu a').click(function(e){
e.preventDefault();
generate_referral_visitor_info_graph('visitor_info_graph', $(this).data('graph'));
$('.stats_submenu a').removeClass('active');
$(this).addClass('active');
$('.vistor_panel_data').hide();
$($(this).attr('href')).show();
})
$('.save_ipadress').click(function(e){
e.preventDefault();
$('.update_message').removeClass('updated').removeClass('error');
if($('#ipadress').val()==''){
$('.update_message').removeClass('updated').addClass('error').html('Please enter I.P. address');
return false;
}
$.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: $('#wsmmainMetboxForm').serialize(),
})
.done(function(strResponse){
response=$.parseJSON(strResponse);
if(response.status){
$('#ipadress').val('');
$('#tblIPList').append(response.data);
$('.update_message').removeClass('error').addClass('updated');
}else{
$('.update_message').removeClass('updated').addClass('error');
}
$('.update_message').html(response.message);
});
});
$('#tblIPList').on('click', '.deleteIP', function(e){
e.preventDefault();
$('.update_message').removeClass('updated').removeClass('error');
var idaddress=$(this).data('ipaddress');
var currentRow=$(this).data('row');
if(!confirm('Are you sure want to delete '+idaddress+' ip address?')){
return false;
}
$.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: 'action=deleteIpAddress&ip='+ idaddress,
})
.done(function(strResponse){
response=$.parseJSON(strResponse);
if(response.status){
var count=1;
$('#tblIPList #row_'+currentRow).remove();
if($('#tblIPList tr[id^=row_]').length){
$('#tblIPList tr[id^=row_]').each(function(){
$(this).find('td').first().html(count);
count++;
});
}else{
$('#tblIPList').append('<tr><td align="center" colspan="3">No records found.</td></tr>');
}}
$('.update_message').removeClass('error').addClass('updated').html(response.message);
});
});
$('#tblIPList').on('click', 'input[type="checkbox"]', function(e){
$('.update_message').removeClass('updated').removeClass('error');
var $idaddress=$(this).data('ipaddress');
var $status=0;
if($(this).is(':checked')){
$status=1;
}
$.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: 'action=updateIpAddress&ip='+ $idaddress +'&status='+ $status,
})
.done(function(strResponse){
response=$.parseJSON(strResponse);
if(!response.status){
$('.update_message').removeClass('updated').addClass('error').html(response.message);
}});
});
$("#site_dashboard_widget_handler_1, #site_dashboard_widget_handler_2").sortable({
connectWith: ".site_dashboard_widget_handler",
handle: ".handle",
create: function(event, ui){
if($('#site_dashboard_widget_handler_1 input').length){
var widgetName='';
var seperator='';
$('#site_dashboard_widget_handler_1  input').each(function(){
widgetName=widgetName + seperator + $(this).val();
seperator=', ';
});
$('input[name="wsmSiteDashboardNormalWidgets"]').val(widgetName);
}
if($('#site_dashboard_widget_handler_2 input').length){
var widgetName='';
var seperator='';
$('#site_dashboard_widget_handler_2  input').each(function(){
widgetName=widgetName + seperator + $(this).val();
seperator=', ';
});
$('input[name="wsmSiteDashboardSideWidgets"]').val(widgetName);
}},
update: function(event, ui){
if($(ui.item).parents('.site_dashboard_widget_handler').attr('id')=='site_dashboard_widget_handler_1'){
$(ui.item).find('input[type="checkbox"]').attr('name', 'wsmDashboard_widget[normal][]');
}else{
$(ui.item).find('input[type="checkbox"]').attr('name', 'wsmDashboard_widget[side][]');
}
if($('#site_dashboard_widget_handler_1 input').length){
var widgetName='';
var seperator='';
$('#site_dashboard_widget_handler_1  input').each(function(){
widgetName=widgetName + seperator + $(this).val();
seperator=', ';
});
$('input[name="wsmSiteDashboardNormalWidgets"]').val(widgetName);
}
if($('#site_dashboard_widget_handler_2 input').length){
var widgetName='';
var seperator='';
$('#site_dashboard_widget_handler_2  input').each(function(){
widgetName=widgetName + seperator + $(this).val();
seperator=', ';
});
console.log(widgetName);
$('input[name="wsmSiteDashboardSideWidgets"]').val(widgetName);
}}
}).disableSelection();
$("#site_plugin_widget_handler_1, #site_plugin_widget_handler_2").sortable({
connectWith: ".site_plugin_widget_handler",
handle: ".handle",
create: function(event, ui){
if($('#site_plugin_widget_handler_1 input').length){
var widgetName='';
var seperator='';
$('#site_plugin_widget_handler_1  input').each(function(){
widgetName=widgetName + seperator + $(this).val();
seperator=', ';
});
$('input[name="wsmSitePluginNormalWidgets"]').val(widgetName);
}
if($('#site_plugin_widget_handler_2 input').length){
var widgetName='';
var seperator='';
$('#site_plugin_widget_handler_2  input').each(function(){
widgetName=widgetName + seperator + $(this).val();
seperator=', ';
});
$('input[name="wsmSitePluginSideWidgets"]').val(widgetName);
}},
update: function(event, ui){
if($(ui.item).parents('.site_dashboard_widget_handler').attr('id')=='site_plugin_widget_handler_1'){
$(ui.item).find('input[type="checkbox"]').attr('name', 'wsmPlugin_widget[normal][]');
}else{
$(ui.item).find('input[type="checkbox"]').attr('name', 'wsmPlugin_widget[side][]');
}
if($('#site_plugin_widget_handler_1 input').length){
var widgetName='';
var seperator='';
$('#site_plugin_widget_handler_1  input').each(function(){
widgetName=widgetName + seperator + $(this).val();
seperator=', ';
});
$('input[name="wsmSitePluginNormalWidgets"]').val(widgetName);
}else{
$('input[name="wsmSitePluginNormalWidgets"]').val('');
}
if($('#site_plugin_widget_handler_2 input').length){
var widgetName='';
var seperator='';
$('#site_plugin_widget_handler_2  input').each(function(){
widgetName=widgetName + seperator + $(this).val();
seperator=', ';
});
$('input[name="wsmSitePluginSideWidgets"]').val(widgetName);
}else{
$('input[name="wsmSitePluginSideWidgets"]').val('');
}}
}).disableSelection();
$('.li-section li > a, .sublist-section li > a').on('click', function(e){
e.preventDefault();
var href=$(this).attr('href');
if(jQuery(this).parents("ul.sublist-section").length){
var url=jQuery(this).parents("ul.sublist-section").attr('data-url');
var curURL=document.location.href
curURL=curURL.replace(window.location.hash,'');
if(url==curURL){
}else{
document.location=url+href;
}}
$('.li-section li > a').removeClass("active");
$('.sublist-section li > a').removeClass("active");
$('.li-section li >a[href="'+href+'"]').addClass('active');
$('.sublist-section li >a[href="'+href+'"]').addClass('active');
$('.li-section-table table.form-table').not(this).hide();
$('.li-section-table table'+href).show();
$('table#ipexclusion').hide();
$('.wrap .submit #submit').show();
$('#tab-li-active').val(href);
if(href=="#ipexclusion"){
$('table'+href).show();
$('.wrap .submit #submit').hide();
$('.wrap .submit').css("padding","0");
}
if(href=="#shortcodelist"){
$('.wrap .submit #submit').hide();
$('.wrap .submit').css("padding","0");
}});
$(window).load(function(){
if(window.location.hash){
jQuery('.sublist-section li > a[href="'+window.location.hash+'"]').trigger("click");
}});
if(typeof wsm_widgets!="undefined"&&wsm_widgets){
for (i=0; i < wsm_widgets.length; i++){
if(jQuery('#'+wsm_widgets[i]).length){
jQuery('#'+wsm_widgets[i]).prepend('<a href="'+wsm_widget_links[i]+'" class="wsm_widget_link"><span class="dashicons dashicons-migrate"></span></a>')
}}
}
$(".send_test_mail").click(function(e){
e.preventDefault();
$.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: {
action:'send_test_mail',
report: '1'
},
success:function(strResponse){
console.log(strResponse);
}});
});
});
function startTime(){
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
m=checkTime(m);
s=checkTime(s);
jQuery('.currenttime').html(h + ":" + m + ":" + s);
var t=setTimeout(startTime, 500);
}
function checkTime(i){
if(i < 10){i="0" + i};
return i;
}
jQuery(document).on('click','.wsm_ip_info',function(e){
e.preventDefault();
jQuery('.wsm_userdata_list').html('');
jQuery('.wmc_img_loader').show();
jQuery('#wsm-userlist-datalists').addClass('wsm-show-modal');
jQuery('.wsm_ip_name').html('');
console.log(jQuery(this).data('ip'));
jQuery('.wsm_ip_name').html('('+jQuery(this).data('ip')+')');
jQuery('.header_user_list_popup').attr('data-ip',jQuery(this).data('ip'))
jQuery.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: {
action:'users_ip_info_lists',
ip:jQuery(this).data('ip'),
},
success:function(response){
jQuery('.wmc_img_loader').hide();
jQuery('.wsm_userdata_list').html(response);
}});
});
jQuery(document).on('click','.wsm-close-button',function(){
jQuery(this).parents('.wsm-modal').removeClass('wsm-show-modal');
});
jQuery(document).on('click','.wsm_pagination_ip_list .page-numbers',function(e){
e.preventDefault();
jQuery('.wsm_loader_ip_details_list').show();
jQuery.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: {
action:'users_ip_info_lists',
ip:jQuery('.header_user_list_popup').data('ip'),
pagenum:jQuery(this).attr('href'),
},
success:function(response){
jQuery('.wsm_userdata_list').html('');
jQuery('.wsm_userdata_list').html(response);
jQuery('.wsm_loader_ip_details_list').hide();
}});
});
jQuery(document).on('click','.wsm_userIP_list_pagination .page-numbers, .wsm_recent_ip_search_btn',function(e){
e.preventDefault();
var search_val='';
if(jQuery(this).attr('type')=='submit'){
search_val=jQuery('#search_by_recent_id').val();
}
jQuery('.wsm_loader_ip_list').show();
var get_page_num=jQuery(this).html();
if(jQuery(this).hasClass('next')){
get_page_num=jQuery('.wsm_userIP_list_pagination .page-numbers.current').html();
get_page_num=parseInt(get_page_num) + 1;
}
if(jQuery(this).hasClass('prev')){
get_page_num=jQuery('.wsm_userIP_list_pagination .page-numbers.current').html();
get_page_num=parseInt(get_page_num) - 1;
}
jQuery.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: {
action:'wsm_users_ip_pagination',
pagenum:get_page_num,
search_by:jQuery('#search_by_recent_id').val()
},
success:function(response){
jQuery('.wsm_Ip_userinfo_div').html('');
jQuery('.wsm_Ip_userinfo_div').html(response);
jQuery('.wsm_loader_ip_list').hide();
jQuery('#search_by_recent_id').val(search_val);
}});
});
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i(t.L={})}(this,function(t){"use strict";function i(t){var i,e,n,o;for(e=1,n=arguments.length;e<n;e++){o=arguments[e];for(i in o)t[i]=o[i]}return t}function e(t,i){var e=Array.prototype.slice;if(t.bind)return t.bind.apply(t,e.call(arguments,1));var n=e.call(arguments,2);return function(){return t.apply(i,n.length?n.concat(e.call(arguments)):arguments)}}function n(t){return t._leaflet_id=t._leaflet_id||++ei,t._leaflet_id}function o(t,i,e){var n,o,s,r;return r=function(){n=!1,o&&(s.apply(e,o),o=!1)},s=function(){n?o=arguments:(t.apply(e,arguments),setTimeout(r,i),n=!0)}}function s(t,i,e){var n=i[1],o=i[0],s=n-o;return t===n&&e?t:((t-o)%s+s)%s+o}function r(){return!1}function a(t,i){var e=Math.pow(10,void 0===i?6:i);return Math.round(t*e)/e}function h(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function u(t){return h(t).split(/\s+/)}function l(t,i){t.hasOwnProperty("options")||(t.options=t.options?ii(t.options):{});for(var e in i)t.options[e]=i[e];return t.options}function c(t,i,e){var n=[];for(var o in t)n.push(encodeURIComponent(e?o.toUpperCase():o)+"="+encodeURIComponent(t[o]));return(i&&-1!==i.indexOf("?")?"&":"?")+n.join("&")}function _(t,i){return t.replace(ni,function(t,e){var n=i[e];if(void 0===n)throw new Error("No value provided for variable "+t);return"function"==typeof n&&(n=n(i)),n})}function d(t,i){for(var e=0;e<t.length;e++)if(t[e]===i)return e;return-1}function p(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}function m(t){var i=+new Date,e=Math.max(0,16-(i-ri));return ri=i+e,window.setTimeout(t,e)}function f(t,i,n){if(!n||ai!==m)return ai.call(window,e(t,i));t.call(i)}function g(t){t&&hi.call(window,t)}function v(){}function y(t){if("undefined"!=typeof L&&L&&L.Mixin){t=oi(t)?t:[t];for(var i=0;i<t.length;i++)t[i]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}}function x(t,i,e){this.x=e?Math.round(t):t,this.y=e?Math.round(i):i}function w(t,i,e){return t instanceof x?t:oi(t)?new x(t[0],t[1]):void 0===t||null===t?t:"object"==typeof t&&"x"in t&&"y"in t?new x(t.x,t.y):new x(t,i,e)}function P(t,i){if(t)for(var e=i?[t,i]:t,n=0,o=e.length;n<o;n++)this.extend(e[n])}function b(t,i){return!t||t instanceof P?t:new P(t,i)}function T(t,i){if(t)for(var e=i?[t,i]:t,n=0,o=e.length;n<o;n++)this.extend(e[n])}function z(t,i){return t instanceof T?t:new T(t,i)}function M(t,i,e){if(isNaN(t)||isNaN(i))throw new Error("Invalid LatLng object: ("+t+", "+i+")");this.lat=+t,this.lng=+i,void 0!==e&&(this.alt=+e)}function C(t,i,e){return t instanceof M?t:oi(t)&&"object"!=typeof t[0]?3===t.length?new M(t[0],t[1],t[2]):2===t.length?new M(t[0],t[1]):null:void 0===t||null===t?t:"object"==typeof t&&"lat"in t?new M(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===i?null:new M(t,i,e)}function S(t,i,e,n){if(oi(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=i,this._c=e,this._d=n}function Z(t,i,e,n){return new S(t,i,e,n)}function E(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function k(t,i){var e,n,o,s,r,a,h="";for(e=0,o=t.length;e<o;e++){for(n=0,s=(r=t[e]).length;n<s;n++)a=r[n],h+=(n?"L":"M")+a.x+" "+a.y;h+=i?Ji?"z":"x":""}return h||"M0 0"}function B(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}function A(t,i,e,n){return"touchstart"===i?O(t,e,n):"touchmove"===i?W(t,e,n):"touchend"===i&&H(t,e,n),this}function I(t,i,e){var n=t["_leaflet_"+i+e];return"touchstart"===i?t.removeEventListener(te,n,!1):"touchmove"===i?t.removeEventListener(ie,n,!1):"touchend"===i&&(t.removeEventListener(ee,n,!1),t.removeEventListener(ne,n,!1)),this}function O(t,i,n){var o=e(function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(oe.indexOf(t.target.tagName)<0))return;Pt(t)}j(t,i)});t["_leaflet_touchstart"+n]=o,t.addEventListener(te,o,!1),re||(document.documentElement.addEventListener(te,R,!0),document.documentElement.addEventListener(ie,N,!0),document.documentElement.addEventListener(ee,D,!0),document.documentElement.addEventListener(ne,D,!0),re=!0)}function R(t){se[t.pointerId]=t,ae++}function N(t){se[t.pointerId]&&(se[t.pointerId]=t)}function D(t){delete se[t.pointerId],ae--}function j(t,i){t.touches=[];for(var e in se)t.touches.push(se[e]);t.changedTouches=[t],i(t)}function W(t,i,e){var n=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&j(t,i)};t["_leaflet_touchmove"+e]=n,t.addEventListener(ie,n,!1)}function H(t,i,e){var n=function(t){j(t,i)};t["_leaflet_touchend"+e]=n,t.addEventListener(ee,n,!1),t.addEventListener(ne,n,!1)}function F(t,i,e){function n(t){var i;if(Vi){if(!bi||"mouse"===t.pointerType)return;i=ae}else i=t.touches.length;if(!(i>1)){var e=Date.now(),n=e-(s||e);r=t.touches?t.touches[0]:t,a=n>0&&n<=h,s=e}}function o(t){if(a&&!r.cancelBubble){if(Vi){if(!bi||"mouse"===t.pointerType)return;var e,n,o={};for(n in r)e=r[n],o[n]=e&&e.bind?e.bind(r):e;r=o}r.type="dblclick",i(r),s=null}}var s,r,a=!1,h=250;return t[le+he+e]=n,t[le+ue+e]=o,t[le+"dblclick"+e]=i,t.addEventListener(he,n,!1),t.addEventListener(ue,o,!1),t.addEventListener("dblclick",i,!1),this}function U(t,i){var e=t[le+he+i],n=t[le+ue+i],o=t[le+"dblclick"+i];return t.removeEventListener(he,e,!1),t.removeEventListener(ue,n,!1),bi||t.removeEventListener("dblclick",o,!1),this}function V(t){return"string"==typeof t?document.getElementById(t):t}function q(t,i){var e=t.style[i]||t.currentStyle&&t.currentStyle[i];if((!e||"auto"===e)&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);e=n?n[i]:null}return"auto"===e?null:e}function G(t,i,e){var n=document.createElement(t);return n.className=i||"",e&&e.appendChild(n),n}function K(t){var i=t.parentNode;i&&i.removeChild(t)}function Y(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function X(t){var i=t.parentNode;i&&i.lastChild!==t&&i.appendChild(t)}function J(t){var i=t.parentNode;i&&i.firstChild!==t&&i.insertBefore(t,i.firstChild)}function $(t,i){if(void 0!==t.classList)return t.classList.contains(i);var e=et(t);return e.length>0&&new RegExp("(^|\\s)"+i+"(\\s|$)").test(e)}function Q(t,i){if(void 0!==t.classList)for(var e=u(i),n=0,o=e.length;n<o;n++)t.classList.add(e[n]);else if(!$(t,i)){var s=et(t);it(t,(s?s+" ":"")+i)}}function tt(t,i){void 0!==t.classList?t.classList.remove(i):it(t,h((" "+et(t)+" ").replace(" "+i+" "," ")))}function it(t,i){void 0===t.className.baseVal?t.className=i:t.className.baseVal=i}function et(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function nt(t,i){"opacity"in t.style?t.style.opacity=i:"filter"in t.style&&ot(t,i)}function ot(t,i){var e=!1,n="DXImageTransform.Microsoft.Alpha";try{e=t.filters.item(n)}catch(t){if(1===i)return}i=Math.round(100*i),e?(e.Enabled=100!==i,e.Opacity=i):t.style.filter+=" progid:"+n+"(opacity="+i+")"}function st(t){for(var i=document.documentElement.style,e=0;e<t.length;e++)if(t[e]in i)return t[e];return!1}function rt(t,i,e){var n=i||new x(0,0);t.style[ce]=(Ri?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(e?" scale("+e+")":"")}function at(t,i){t._leaflet_pos=i,ji?rt(t,i):(t.style.left=i.x+"px",t.style.top=i.y+"px")}function ht(t){return t._leaflet_pos||new x(0,0)}function ut(){mt(window,"dragstart",Pt)}function lt(){ft(window,"dragstart",Pt)}function ct(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(_t(),me=t,fe=t.style.outline,t.style.outline="none",mt(window,"keydown",_t))}function _t(){me&&(me.style.outline=fe,me=void 0,fe=void 0,ft(window,"keydown",_t))}function dt(t){do{t=t.parentNode}while(!(t.offsetWidth&&t.offsetHeight||t===document.body));return t}function pt(t){var i=t.getBoundingClientRect();return{x:i.width/t.offsetWidth||1,y:i.height/t.offsetHeight||1,boundingClientRect:i}}function mt(t,i,e,n){if("object"==typeof i)for(var o in i)gt(t,o,i[o],e);else for(var s=0,r=(i=u(i)).length;s<r;s++)gt(t,i[s],e,n);return this}function ft(t,i,e,n){if("object"==typeof i)for(var o in i)vt(t,o,i[o],e);else if(i)for(var s=0,r=(i=u(i)).length;s<r;s++)vt(t,i[s],e,n);else{for(var a in t[ye])vt(t,a,t[ye][a]);delete t[ye]}return this}function gt(t,i,e,o){var s=i+n(e)+(o?"_"+n(o):"");if(t[ye]&&t[ye][s])return this;var r=function(i){return e.call(o||t,i||window.event)},a=r;Vi&&0===i.indexOf("touch")?A(t,i,r,s):!qi||"dblclick"!==i||!F||Vi&&Ei?"addEventListener"in t?"mousewheel"===i?t.addEventListener("onwheel"in t?"wheel":"mousewheel",r,!1):"mouseenter"===i||"mouseleave"===i?(r=function(i){i=i||window.event,Ct(t,i)&&a(i)},t.addEventListener("mouseenter"===i?"mouseover":"mouseout",r,!1)):("click"===i&&zi&&(r=function(t){St(t,a)}),t.addEventListener(i,r,!1)):"attachEvent"in t&&t.attachEvent("on"+i,r):F(t,r,s),t[ye]=t[ye]||{},t[ye][s]=r}function vt(t,i,e,o){var s=i+n(e)+(o?"_"+n(o):""),r=t[ye]&&t[ye][s];if(!r)return this;Vi&&0===i.indexOf("touch")?I(t,i,s):!qi||"dblclick"!==i||!U||Vi&&Ei?"removeEventListener"in t?"mousewheel"===i?t.removeEventListener("onwheel"in t?"wheel":"mousewheel",r,!1):t.removeEventListener("mouseenter"===i?"mouseover":"mouseleave"===i?"mouseout":i,r,!1):"detachEvent"in t&&t.detachEvent("on"+i,r):U(t,s),t[ye][s]=null}function yt(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Mt(t),this}function xt(t){return gt(t,"mousewheel",yt),this}function wt(t){return mt(t,"mousedown touchstart dblclick",yt),gt(t,"click",zt),this}function Pt(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Lt(t){return Pt(t),yt(t),this}function bt(t,i){if(!i)return new x(t.clientX,t.clientY);var e=pt(i),n=e.boundingClientRect;return new x((t.clientX-n.left)/e.x-i.clientLeft,(t.clientY-n.top)/e.y-i.clientTop)}function Tt(t){return bi?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/xe:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}function zt(t){we[t.type]=!0}function Mt(t){var i=we[t.type];return we[t.type]=!1,i}function Ct(t,i){var e=i.relatedTarget;if(!e)return!0;try{for(;e&&e!==t;)e=e.parentNode}catch(t){return!1}return e!==t}function St(t,i){var e=t.timeStamp||t.originalEvent&&t.originalEvent.timeStamp,n=ge&&e-ge;n&&n>100&&n<500||t.target._simulatedClick&&!t._simulated?Lt(t):(ge=e,i(t))}function Zt(t,i){if(!i||!t.length)return t.slice();var e=i*i;return t=At(t,e),t=kt(t,e)}function Et(t,i,e){return Math.sqrt(Dt(t,i,e,!0))}function kt(t,i){var e=t.length,n=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(e);n[0]=n[e-1]=1,Bt(t,n,i,0,e-1);var o,s=[];for(o=0;o<e;o++)n[o]&&s.push(t[o]);return s}function Bt(t,i,e,n,o){var s,r,a,h=0;for(r=n+1;r<=o-1;r++)(a=Dt(t[r],t[n],t[o],!0))>h&&(s=r,h=a);h>e&&(i[s]=1,Bt(t,i,e,n,s),Bt(t,i,e,s,o))}function At(t,i){for(var e=[t[0]],n=1,o=0,s=t.length;n<s;n++)Nt(t[n],t[o])>i&&(e.push(t[n]),o=n);return o<s-1&&e.push(t[s-1]),e}function It(t,i,e,n,o){var s,r,a,h=n?ke:Rt(t,e),u=Rt(i,e);for(ke=u;;){if(!(h|u))return[t,i];if(h&u)return!1;a=Rt(r=Ot(t,i,s=h||u,e,o),e),s===h?(t=r,h=a):(i=r,u=a)}}function Ot(t,i,e,n,o){var s,r,a=i.x-t.x,h=i.y-t.y,u=n.min,l=n.max;return 8&e?(s=t.x+a*(l.y-t.y)/h,r=l.y):4&e?(s=t.x+a*(u.y-t.y)/h,r=u.y):2&e?(s=l.x,r=t.y+h*(l.x-t.x)/a):1&e&&(s=u.x,r=t.y+h*(u.x-t.x)/a),new x(s,r,o)}function Rt(t,i){var e=0;return t.x<i.min.x?e|=1:t.x>i.max.x&&(e|=2),t.y<i.min.y?e|=4:t.y>i.max.y&&(e|=8),e}function Nt(t,i){var e=i.x-t.x,n=i.y-t.y;return e*e+n*n}function Dt(t,i,e,n){var o,s=i.x,r=i.y,a=e.x-s,h=e.y-r,u=a*a+h*h;return u>0&&((o=((t.x-s)*a+(t.y-r)*h)/u)>1?(s=e.x,r=e.y):o>0&&(s+=a*o,r+=h*o)),a=t.x-s,h=t.y-r,n?a*a+h*h:new x(s,r)}function jt(t){return!oi(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function Wt(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),jt(t)}function Ht(t,i,e){var n,o,s,r,a,h,u,l,c,_=[1,4,2,8];for(o=0,u=t.length;o<u;o++)t[o]._code=Rt(t[o],i);for(r=0;r<4;r++){for(l=_[r],n=[],o=0,s=(u=t.length)-1;o<u;s=o++)a=t[o],h=t[s],a._code&l?h._code&l||((c=Ot(h,a,l,i,e))._code=Rt(c,i),n.push(c)):(h._code&l&&((c=Ot(h,a,l,i,e))._code=Rt(c,i),n.push(c)),n.push(a));t=n}return t}function Ft(t,i){var e,n,o,s,r="Feature"===t.type?t.geometry:t,a=r?r.coordinates:null,h=[],u=i&&i.pointToLayer,l=i&&i.coordsToLatLng||Ut;if(!a&&!r)return null;switch(r.type){case"Point":return e=l(a),u?u(t,e):new $e(e);case"MultiPoint":for(o=0,s=a.length;o<s;o++)e=l(a[o]),h.push(u?u(t,e):new $e(e));return new Ke(h);case"LineString":case"MultiLineString":return n=Vt(a,"LineString"===r.type?0:1,l),new nn(n,i);case"Polygon":case"MultiPolygon":return n=Vt(a,"Polygon"===r.type?1:2,l),new on(n,i);case"GeometryCollection":for(o=0,s=r.geometries.length;o<s;o++){var c=Ft({geometry:r.geometries[o],type:"Feature",properties:t.properties},i);c&&h.push(c)}return new Ke(h);default:throw new Error("Invalid GeoJSON object.")}}function Ut(t){return new M(t[1],t[0],t[2])}function Vt(t,i,e){for(var n,o=[],s=0,r=t.length;s<r;s++)n=i?Vt(t[s],i-1,e):(e||Ut)(t[s]),o.push(n);return o}function qt(t,i){return i="number"==typeof i?i:6,void 0!==t.alt?[a(t.lng,i),a(t.lat,i),a(t.alt,i)]:[a(t.lng,i),a(t.lat,i)]}function Gt(t,i,e,n){for(var o=[],s=0,r=t.length;s<r;s++)o.push(i?Gt(t[s],i-1,e,n):qt(t[s],n));return!i&&e&&o.push(o[0]),o}function Kt(t,e){return t.feature?i({},t.feature,{geometry:e}):Yt(e)}function Yt(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}function Xt(t,i){return new sn(t,i)}function Jt(t,i){return new mn(t,i)}function $t(t){return Xi?new vn(t):null}function Qt(t){return Ji||$i?new Pn(t):null}var ti=Object.freeze;Object.freeze=function(t){return t};var ii=Object.create||function(){function t(){}return function(i){return t.prototype=i,new t}}(),ei=0,ni=/\{ *([\w_-]+) *\}/g,oi=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},si="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",ri=0,ai=window.requestAnimationFrame||p("RequestAnimationFrame")||m,hi=window.cancelAnimationFrame||p("CancelAnimationFrame")||p("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)},ui=(Object.freeze||Object)({freeze:ti,extend:i,create:ii,bind:e,lastId:ei,stamp:n,throttle:o,wrapNum:s,falseFn:r,formatNum:a,trim:h,splitWords:u,setOptions:l,getParamString:c,template:_,isArray:oi,indexOf:d,emptyImageUrl:si,requestFn:ai,cancelFn:hi,requestAnimFrame:f,cancelAnimFrame:g});v.extend=function(t){var e=function(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},n=e.__super__=this.prototype,o=ii(n);o.constructor=e,e.prototype=o;for(var s in this)this.hasOwnProperty(s)&&"prototype"!==s&&"__super__"!==s&&(e[s]=this[s]);return t.statics&&(i(e,t.statics),delete t.statics),t.includes&&(y(t.includes),i.apply(null,[o].concat(t.includes)),delete t.includes),o.options&&(t.options=i(ii(o.options),t.options)),i(o,t),o._initHooks=[],o.callInitHooks=function(){if(!this._initHooksCalled){n.callInitHooks&&n.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,i=o._initHooks.length;t<i;t++)o._initHooks[t].call(this)}},e},v.include=function(t){return i(this.prototype,t),this},v.mergeOptions=function(t){return i(this.prototype.options,t),this},v.addInitHook=function(t){var i=Array.prototype.slice.call(arguments,1),e="function"==typeof t?t:function(){this[t].apply(this,i)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(e),this};var li={on:function(t,i,e){if("object"==typeof t)for(var n in t)this._on(n,t[n],i);else for(var o=0,s=(t=u(t)).length;o<s;o++)this._on(t[o],i,e);return this},off:function(t,i,e){if(t)if("object"==typeof t)for(var n in t)this._off(n,t[n],i);else for(var o=0,s=(t=u(t)).length;o<s;o++)this._off(t[o],i,e);else delete this._events;return this},_on:function(t,i,e){this._events=this._events||{};var n=this._events[t];n||(n=[],this._events[t]=n),e===this&&(e=void 0);for(var o={fn:i,ctx:e},s=n,r=0,a=s.length;r<a;r++)if(s[r].fn===i&&s[r].ctx===e)return;s.push(o)},_off:function(t,i,e){var n,o,s;if(this._events&&(n=this._events[t]))if(i){if(e===this&&(e=void 0),n)for(o=0,s=n.length;o<s;o++){var a=n[o];if(a.ctx===e&&a.fn===i)return a.fn=r,this._firingCount&&(this._events[t]=n=n.slice()),void n.splice(o,1)}}else{for(o=0,s=n.length;o<s;o++)n[o].fn=r;delete this._events[t]}},fire:function(t,e,n){if(!this.listens(t,n))return this;var o=i({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var s=this._events[t];if(s){this._firingCount=this._firingCount+1||1;for(var r=0,a=s.length;r<a;r++){var h=s[r];h.fn.call(h.ctx||this,o)}this._firingCount--}}return n&&this._propagateEvent(o),this},listens:function(t,i){var e=this._events&&this._events[t];if(e&&e.length)return!0;if(i)for(var n in this._eventParents)if(this._eventParents[n].listens(t,i))return!0;return!1},once:function(t,i,n){if("object"==typeof t){for(var o in t)this.once(o,t[o],i);return this}var s=e(function(){this.off(t,i,n).off(t,s,n)},this);return this.on(t,i,n).on(t,s,n)},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[n(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[n(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,i({layer:t.target,propagatedFrom:t.target},t),!0)}};li.addEventListener=li.on,li.removeEventListener=li.clearAllEventListeners=li.off,li.addOneTimeEventListener=li.once,li.fireEvent=li.fire,li.hasEventListeners=li.listens;var ci=v.extend(li),_i=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};x.prototype={clone:function(){return new x(this.x,this.y)},add:function(t){return this.clone()._add(w(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(w(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new x(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new x(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=_i(this.x),this.y=_i(this.y),this},distanceTo:function(t){var i=(t=w(t)).x-this.x,e=t.y-this.y;return Math.sqrt(i*i+e*e)},equals:function(t){return(t=w(t)).x===this.x&&t.y===this.y},contains:function(t){return t=w(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+a(this.x)+", "+a(this.y)+")"}},P.prototype={extend:function(t){return t=w(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new x((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new x(this.min.x,this.max.y)},getTopRight:function(){return new x(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var i,e;return(t="number"==typeof t[0]||t instanceof x?w(t):b(t))instanceof P?(i=t.min,e=t.max):i=e=t,i.x>=this.min.x&&e.x<=this.max.x&&i.y>=this.min.y&&e.y<=this.max.y},intersects:function(t){t=b(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>=i.x&&n.x<=e.x,r=o.y>=i.y&&n.y<=e.y;return s&&r},overlaps:function(t){t=b(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>i.x&&n.x<e.x,r=o.y>i.y&&n.y<e.y;return s&&r},isValid:function(){return!(!this.min||!this.max)}},T.prototype={extend:function(t){var i,e,n=this._southWest,o=this._northEast;if(t instanceof M)i=t,e=t;else{if(!(t instanceof T))return t?this.extend(C(t)||z(t)):this;if(i=t._southWest,e=t._northEast,!i||!e)return this}return n||o?(n.lat=Math.min(i.lat,n.lat),n.lng=Math.min(i.lng,n.lng),o.lat=Math.max(e.lat,o.lat),o.lng=Math.max(e.lng,o.lng)):(this._southWest=new M(i.lat,i.lng),this._northEast=new M(e.lat,e.lng)),this},pad:function(t){var i=this._southWest,e=this._northEast,n=Math.abs(i.lat-e.lat)*t,o=Math.abs(i.lng-e.lng)*t;return new T(new M(i.lat-n,i.lng-o),new M(e.lat+n,e.lng+o))},getCenter:function(){return new M((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new M(this.getNorth(),this.getWest())},getSouthEast:function(){return new M(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof M||"lat"in t?C(t):z(t);var i,e,n=this._southWest,o=this._northEast;return t instanceof T?(i=t.getSouthWest(),e=t.getNorthEast()):i=e=t,i.lat>=n.lat&&e.lat<=o.lat&&i.lng>=n.lng&&e.lng<=o.lng},intersects:function(t){t=z(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=i.lat&&n.lat<=e.lat,r=o.lng>=i.lng&&n.lng<=e.lng;return s&&r},overlaps:function(t){t=z(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>i.lat&&n.lat<e.lat,r=o.lng>i.lng&&n.lng<e.lng;return s&&r},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,i){return!!t&&(t=z(t),this._southWest.equals(t.getSouthWest(),i)&&this._northEast.equals(t.getNorthEast(),i))},isValid:function(){return!(!this._southWest||!this._northEast)}},M.prototype={equals:function(t,i){return!!t&&(t=C(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===i?1e-9:i))},toString:function(t){return"LatLng("+a(this.lat,t)+", "+a(this.lng,t)+")"},distanceTo:function(t){return pi.distance(this,C(t))},wrap:function(){return pi.wrapLatLng(this)},toBounds:function(t){var i=180*t/40075017,e=i/Math.cos(Math.PI/180*this.lat);return z([this.lat-i,this.lng-e],[this.lat+i,this.lng+e])},clone:function(){return new M(this.lat,this.lng,this.alt)}};var di={latLngToPoint:function(t,i){var e=this.projection.project(t),n=this.scale(i);return this.transformation._transform(e,n)},pointToLatLng:function(t,i){var e=this.scale(i),n=this.transformation.untransform(t,e);return this.projection.unproject(n)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var i=this.projection.bounds,e=this.scale(t);return new P(this.transformation.transform(i.min,e),this.transformation.transform(i.max,e))},infinite:!1,wrapLatLng:function(t){var i=this.wrapLng?s(t.lng,this.wrapLng,!0):t.lng;return new M(this.wrapLat?s(t.lat,this.wrapLat,!0):t.lat,i,t.alt)},wrapLatLngBounds:function(t){var i=t.getCenter(),e=this.wrapLatLng(i),n=i.lat-e.lat,o=i.lng-e.lng;if(0===n&&0===o)return t;var s=t.getSouthWest(),r=t.getNorthEast();return new T(new M(s.lat-n,s.lng-o),new M(r.lat-n,r.lng-o))}},pi=i({},di,{wrapLng:[-180,180],R:6371e3,distance:function(t,i){var e=Math.PI/180,n=t.lat*e,o=i.lat*e,s=Math.sin((i.lat-t.lat)*e/2),r=Math.sin((i.lng-t.lng)*e/2),a=s*s+Math.cos(n)*Math.cos(o)*r*r,h=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*h}}),mi={R:6378137,MAX_LATITUDE:85.0511287798,project:function(t){var i=Math.PI/180,e=this.MAX_LATITUDE,n=Math.max(Math.min(e,t.lat),-e),o=Math.sin(n*i);return new x(this.R*t.lng*i,this.R*Math.log((1+o)/(1-o))/2)},unproject:function(t){var i=180/Math.PI;return new M((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*i,t.x*i/this.R)},bounds:function(){var t=6378137*Math.PI;return new P([-t,-t],[t,t])}()};S.prototype={transform:function(t,i){return this._transform(t.clone(),i)},_transform:function(t,i){return i=i||1,t.x=i*(this._a*t.x+this._b),t.y=i*(this._c*t.y+this._d),t},untransform:function(t,i){return i=i||1,new x((t.x/i-this._b)/this._a,(t.y/i-this._d)/this._c)}};var fi,gi,vi,yi=i({},pi,{code:"EPSG:3857",projection:mi,transformation:function(){var t=.5/(Math.PI*mi.R);return Z(t,.5,-t,.5)}()}),xi=i({},yi,{code:"EPSG:900913"}),wi=document.documentElement.style,Pi="ActiveXObject"in window,Li=Pi&&!document.addEventListener,bi="msLaunchUri"in navigator&&!("documentMode"in document),Ti=B("webkit"),zi=B("android"),Mi=B("android 2")||B("android 3"),Ci=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),Si=zi&&B("Google")&&Ci<537&&!("AudioNode"in window),Zi=!!window.opera,Ei=B("chrome"),ki=B("gecko")&&!Ti&&!Zi&&!Pi,Bi=!Ei&&B("safari"),Ai=B("phantom"),Ii="OTransition"in wi,Oi=0===navigator.platform.indexOf("Win"),Ri=Pi&&"transition"in wi,Ni="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Mi,Di="MozPerspective"in wi,ji=!window.L_DISABLE_3D&&(Ri||Ni||Di)&&!Ii&&!Ai,Wi="undefined"!=typeof orientation||B("mobile"),Hi=Wi&&Ti,Fi=Wi&&Ni,Ui=!window.PointerEvent&&window.MSPointerEvent,Vi=!(!window.PointerEvent&&!Ui),qi=!window.L_NO_TOUCH&&(Vi||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),Gi=Wi&&Zi,Ki=Wi&&ki,Yi=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Xi=!!document.createElement("canvas").getContext,Ji=!(!document.createElementNS||!E("svg").createSVGRect),$i=!Ji&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var i=t.firstChild;return i.style.behavior="url(#default#VML)",i&&"object"==typeof i.adj}catch(t){return!1}}(),Qi=(Object.freeze||Object)({ie:Pi,ielt9:Li,edge:bi,webkit:Ti,android:zi,android23:Mi,androidStock:Si,opera:Zi,chrome:Ei,gecko:ki,safari:Bi,phantom:Ai,opera12:Ii,win:Oi,ie3d:Ri,webkit3d:Ni,gecko3d:Di,any3d:ji,mobile:Wi,mobileWebkit:Hi,mobileWebkit3d:Fi,msPointer:Ui,pointer:Vi,touch:qi,mobileOpera:Gi,mobileGecko:Ki,retina:Yi,canvas:Xi,svg:Ji,vml:$i}),te=Ui?"MSPointerDown":"pointerdown",ie=Ui?"MSPointerMove":"pointermove",ee=Ui?"MSPointerUp":"pointerup",ne=Ui?"MSPointerCancel":"pointercancel",oe=["INPUT","SELECT","OPTION"],se={},re=!1,ae=0,he=Ui?"MSPointerDown":Vi?"pointerdown":"touchstart",ue=Ui?"MSPointerUp":Vi?"pointerup":"touchend",le="_leaflet_",ce=st(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),_e=st(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),de="webkitTransition"===_e||"OTransition"===_e?_e+"End":"transitionend";if("onselectstart"in document)fi=function(){mt(window,"selectstart",Pt)},gi=function(){ft(window,"selectstart",Pt)};else{var pe=st(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);fi=function(){if(pe){var t=document.documentElement.style;vi=t[pe],t[pe]="none"}},gi=function(){pe&&(document.documentElement.style[pe]=vi,vi=void 0)}}var me,fe,ge,ve=(Object.freeze||Object)({TRANSFORM:ce,TRANSITION:_e,TRANSITION_END:de,get:V,getStyle:q,create:G,remove:K,empty:Y,toFront:X,toBack:J,hasClass:$,addClass:Q,removeClass:tt,setClass:it,getClass:et,setOpacity:nt,testProp:st,setTransform:rt,setPosition:at,getPosition:ht,disableTextSelection:fi,enableTextSelection:gi,disableImageDrag:ut,enableImageDrag:lt,preventOutline:ct,restoreOutline:_t,getSizedParentNode:dt,getScale:pt}),ye="_leaflet_events",xe=Oi&&Ei?2*window.devicePixelRatio:ki?window.devicePixelRatio:1,we={},Pe=(Object.freeze||Object)({on:mt,off:ft,stopPropagation:yt,disableScrollPropagation:xt,disableClickPropagation:wt,preventDefault:Pt,stop:Lt,getMousePosition:bt,getWheelDelta:Tt,fakeStop:zt,skipped:Mt,isExternalTarget:Ct,addListener:mt,removeListener:ft}),Le=ci.extend({run:function(t,i,e,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=e||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=ht(t),this._offset=i.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=f(this._animate,this),this._step()},_step:function(t){var i=+new Date-this._startTime,e=1e3*this._duration;i<e?this._runFrame(this._easeOut(i/e),t):(this._runFrame(1),this._complete())},_runFrame:function(t,i){var e=this._startPos.add(this._offset.multiplyBy(t));i&&e._round(),at(this._el,e),this.fire("step")},_complete:function(){g(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),be=ci.extend({options:{crs:yi,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,i){i=l(this,i),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=e(this._onResize,this),this._initEvents(),i.maxBounds&&this.setMaxBounds(i.maxBounds),void 0!==i.zoom&&(this._zoom=this._limitZoom(i.zoom)),i.center&&void 0!==i.zoom&&this.setView(C(i.center),i.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=_e&&ji&&!Gi&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),mt(this._proxy,de,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,n){return e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(C(t),e,this.options.maxBounds),n=n||{},this._stop(),this._loaded&&!n.reset&&!0!==n&&(void 0!==n.animate&&(n.zoom=i({animate:n.animate},n.zoom),n.pan=i({animate:n.animate,duration:n.duration},n.pan)),this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,n.zoom):this._tryAnimatedPan(t,n.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(t,e),this)},setZoom:function(t,i){return this._loaded?this.setView(this.getCenter(),t,{zoom:i}):(this._zoom=t,this)},zoomIn:function(t,i){return t=t||(ji?this.options.zoomDelta:1),this.setZoom(this._zoom+t,i)},zoomOut:function(t,i){return t=t||(ji?this.options.zoomDelta:1),this.setZoom(this._zoom-t,i)},setZoomAround:function(t,i,e){var n=this.getZoomScale(i),o=this.getSize().divideBy(2),s=(t instanceof x?t:this.latLngToContainerPoint(t)).subtract(o).multiplyBy(1-1/n),r=this.containerPointToLatLng(o.add(s));return this.setView(r,i,{zoom:e})},_getBoundsCenterZoom:function(t,i){i=i||{},t=t.getBounds?t.getBounds():z(t);var e=w(i.paddingTopLeft||i.padding||[0,0]),n=w(i.paddingBottomRight||i.padding||[0,0]),o=this.getBoundsZoom(t,!1,e.add(n));if((o="number"==typeof i.maxZoom?Math.min(i.maxZoom,o):o)===1/0)return{center:t.getCenter(),zoom:o};var s=n.subtract(e).divideBy(2),r=this.project(t.getSouthWest(),o),a=this.project(t.getNorthEast(),o);return{center:this.unproject(r.add(a).divideBy(2).add(s),o),zoom:o}},fitBounds:function(t,i){if(!(t=z(t)).isValid())throw new Error("Bounds are not valid.");var e=this._getBoundsCenterZoom(t,i);return this.setView(e.center,e.zoom,i)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,i){return this.setView(t,this._zoom,{pan:i})},panBy:function(t,i){if(t=w(t).round(),i=i||{},!t.x&&!t.y)return this.fire("moveend");if(!0!==i.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new Le,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),i.noMoveStart||this.fire("movestart"),!1!==i.animate){Q(this._mapPane,"leaflet-pan-anim");var e=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,e,i.duration||.25,i.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,i,e){function n(t){var i=(g*g-m*m+(t?-1:1)*x*x*v*v)/(2*(t?g:m)*x*v),e=Math.sqrt(i*i+1)-i;return e<1e-9?-18:Math.log(e)}function o(t){return(Math.exp(t)-Math.exp(-t))/2}function s(t){return(Math.exp(t)+Math.exp(-t))/2}function r(t){return o(t)/s(t)}function a(t){return m*(s(w)/s(w+y*t))}function h(t){return m*(s(w)*r(w+y*t)-o(w))/x}function u(t){return 1-Math.pow(1-t,1.5)}function l(){var e=(Date.now()-P)/b,n=u(e)*L;e<=1?(this._flyToFrame=f(l,this),this._move(this.unproject(c.add(_.subtract(c).multiplyBy(h(n)/v)),p),this.getScaleZoom(m/a(n),p),{flyTo:!0})):this._move(t,i)._moveEnd(!0)}if(!1===(e=e||{}).animate||!ji)return this.setView(t,i,e);this._stop();var c=this.project(this.getCenter()),_=this.project(t),d=this.getSize(),p=this._zoom;t=C(t),i=void 0===i?p:i;var m=Math.max(d.x,d.y),g=m*this.getZoomScale(p,i),v=_.distanceTo(c)||1,y=1.42,x=y*y,w=n(0),P=Date.now(),L=(n(1)-w)/y,b=e.duration?1e3*e.duration:1e3*L*.8;return this._moveStart(!0,e.noMoveStart),l.call(this),this},flyToBounds:function(t,i){var e=this._getBoundsCenterZoom(t,i);return this.flyTo(e.center,e.zoom,i)},setMaxBounds:function(t){return(t=z(t)).isValid()?(this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off("moveend",this._panInsideMaxBounds))},setMinZoom:function(t){var i=this.options.minZoom;return this.options.minZoom=t,this._loaded&&i!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var i=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&i!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,i){this._enforcingBounds=!0;var e=this.getCenter(),n=this._limitCenter(e,this._zoom,z(t));return e.equals(n)||this.panTo(n,i),this._enforcingBounds=!1,this},panInside:function(t,i){var e=w((i=i||{}).paddingTopLeft||i.padding||[0,0]),n=w(i.paddingBottomRight||i.padding||[0,0]),o=this.getCenter(),s=this.project(o),r=this.project(t),a=this.getPixelBounds(),h=a.getSize().divideBy(2),u=b([a.min.add(e),a.max.subtract(n)]);if(!u.contains(r)){this._enforcingBounds=!0;var l=s.subtract(r),c=w(r.x+l.x,r.y+l.y);(r.x<u.min.x||r.x>u.max.x)&&(c.x=s.x-l.x,l.x>0?c.x+=h.x-e.x:c.x-=h.x-n.x),(r.y<u.min.y||r.y>u.max.y)&&(c.y=s.y-l.y,l.y>0?c.y+=h.y-e.y:c.y-=h.y-n.y),this.panTo(this.unproject(c),i),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=i({animate:!1,pan:!0},!0===t?{animate:!0}:t);var n=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var o=this.getSize(),s=n.divideBy(2).round(),r=o.divideBy(2).round(),a=s.subtract(r);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(e(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:n,newSize:o})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=i({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var n=e(this._handleGeolocationResponse,this),o=e(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(n,o,t):navigator.geolocation.getCurrentPosition(n,o,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var i=t.code,e=t.message||(1===i?"permission denied":2===i?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:i,message:"Geolocation error: "+e+"."})},_handleGeolocationResponse:function(t){var i=new M(t.coords.latitude,t.coords.longitude),e=i.toBounds(2*t.coords.accuracy),n=this._locateOptions;if(n.setView){var o=this.getBoundsZoom(e);this.setView(i,n.maxZoom?Math.min(o,n.maxZoom):o)}var s={latlng:i,bounds:e,timestamp:t.timestamp};for(var r in t.coords)"number"==typeof t.coords[r]&&(s[r]=t.coords[r]);this.fire("locationfound",s)},addHandler:function(t,i){if(!i)return this;var e=this[t]=new i(this);return this._handlers.push(e),this.options[t]&&e.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),K(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(g(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var t;for(t in this._layers)this._layers[t].remove();for(t in this._panes)K(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,i){var e=G("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),i||this._mapPane);return t&&(this._panes[t]=e),e},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new T(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,i,e){t=z(t),e=w(e||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),a=t.getSouthEast(),h=this.getSize().subtract(e),u=b(this.project(a,n),this.project(r,n)).getSize(),l=ji?this.options.zoomSnap:1,c=h.x/u.x,_=h.y/u.y,d=i?Math.max(c,_):Math.min(c,_);return n=this.getScaleZoom(d,n),l&&(n=Math.round(n/(l/100))*(l/100),n=i?Math.ceil(n/l)*l:Math.floor(n/l)*l),Math.max(o,Math.min(s,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new x(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,i){var e=this._getTopLeftPoint(t,i);return new P(e,e.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,i){var e=this.options.crs;return i=void 0===i?this._zoom:i,e.scale(t)/e.scale(i)},getScaleZoom:function(t,i){var e=this.options.crs;i=void 0===i?this._zoom:i;var n=e.zoom(t*e.scale(i));return isNaN(n)?1/0:n},project:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.latLngToPoint(C(t),i)},unproject:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.pointToLatLng(w(t),i)},layerPointToLatLng:function(t){var i=w(t).add(this.getPixelOrigin());return this.unproject(i)},latLngToLayerPoint:function(t){return this.project(C(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(C(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(z(t))},distance:function(t,i){return this.options.crs.distance(C(t),C(i))},containerPointToLayerPoint:function(t){return w(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return w(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var i=this.containerPointToLayerPoint(w(t));return this.layerPointToLatLng(i)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(C(t)))},mouseEventToContainerPoint:function(t){return bt(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var i=this._container=V(t);if(!i)throw new Error("Map container not found.");if(i._leaflet_id)throw new Error("Map container is already initialized.");mt(i,"scroll",this._onScroll,this),this._containerId=n(i)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&ji,Q(t,"leaflet-container"+(qi?" leaflet-touch":"")+(Yi?" leaflet-retina":"")+(Li?" leaflet-oldie":"")+(Bi?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var i=q(t,"position");"absolute"!==i&&"relative"!==i&&"fixed"!==i&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),at(this._mapPane,new x(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Q(t.markerPane,"leaflet-zoom-hide"),Q(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,i){at(this._mapPane,new x(0,0));var e=!this._loaded;this._loaded=!0,i=this._limitZoom(i),this.fire("viewprereset");var n=this._zoom!==i;this._moveStart(n,!1)._move(t,i)._moveEnd(n),this.fire("viewreset"),e&&this.fire("load")},_moveStart:function(t,i){return t&&this.fire("zoomstart"),i||this.fire("movestart"),this},_move:function(t,i,e){void 0===i&&(i=this._zoom);var n=this._zoom!==i;return this._zoom=i,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(n||e&&e.pinch)&&this.fire("zoom",e),this.fire("move",e)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return g(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){at(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[n(this._container)]=this;var i=t?ft:mt;i(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress",this._handleDOMEvent,this),this.options.trackResize&&i(window,"resize",this._onResize,this),ji&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){g(this._resizeRequest),this._resizeRequest=f(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,i){for(var e,o=[],s="mouseout"===i||"mouseover"===i,r=t.target||t.srcElement,a=!1;r;){if((e=this._targets[n(r)])&&("click"===i||"preclick"===i)&&!t._simulated&&this._draggableMoved(e)){a=!0;break}if(e&&e.listens(i,!0)){if(s&&!Ct(r,t))break;if(o.push(e),s)break}if(r===this._container)break;r=r.parentNode}return o.length||a||s||!Ct(r,t)||(o=[this]),o},_handleDOMEvent:function(t){if(this._loaded&&!Mt(t)){var i=t.type;"mousedown"!==i&&"keypress"!==i||ct(t.target||t.srcElement),this._fireDOMEvent(t,i)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,n){if("click"===t.type){var o=i({},t);o.type="preclick",this._fireDOMEvent(o,o.type,n)}if(!t._stopped&&(n=(n||[]).concat(this._findEventTargets(t,e))).length){var s=n[0];"contextmenu"===e&&s.listens(e,!0)&&Pt(t);var r={originalEvent:t};if("keypress"!==t.type){var a=s.getLatLng&&(!s._radius||s._radius<=10);r.containerPoint=a?this.latLngToContainerPoint(s.getLatLng()):this.mouseEventToContainerPoint(t),r.layerPoint=this.containerPointToLayerPoint(r.containerPoint),r.latlng=a?s.getLatLng():this.layerPointToLatLng(r.layerPoint)}for(var h=0;h<n.length;h++)if(n[h].fire(e,r,!0),r.originalEvent._stopped||!1===n[h].options.bubblingMouseEvents&&-1!==d(this._mouseEvents,e))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,i=this._handlers.length;t<i;t++)this._handlers[t].disable()},whenReady:function(t,i){return this._loaded?t.call(i||this,{target:this}):this.on("load",t,i),this},_getMapPanePos:function(){return ht(this._mapPane)||new x(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,i){return(t&&void 0!==i?this._getNewPixelOrigin(t,i):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,i){var e=this.getSize()._divideBy(2);return this.project(t,i)._subtract(e)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,i,e){var n=this._getNewPixelOrigin(e,i);return this.project(t,i)._subtract(n)},_latLngBoundsToNewLayerBounds:function(t,i,e){var n=this._getNewPixelOrigin(e,i);return b([this.project(t.getSouthWest(),i)._subtract(n),this.project(t.getNorthWest(),i)._subtract(n),this.project(t.getSouthEast(),i)._subtract(n),this.project(t.getNorthEast(),i)._subtract(n)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,i,e){if(!e)return t;var n=this.project(t,i),o=this.getSize().divideBy(2),s=new P(n.subtract(o),n.add(o)),r=this._getBoundsOffset(s,e,i);return r.round().equals([0,0])?t:this.unproject(n.add(r),i)},_limitOffset:function(t,i){if(!i)return t;var e=this.getPixelBounds(),n=new P(e.min.add(t),e.max.add(t));return t.add(this._getBoundsOffset(n,i))},_getBoundsOffset:function(t,i,e){var n=b(this.project(i.getNorthEast(),e),this.project(i.getSouthWest(),e)),o=n.min.subtract(t.min),s=n.max.subtract(t.max);return new x(this._rebound(o.x,-s.x),this._rebound(o.y,-s.y))},_rebound:function(t,i){return t+i>0?Math.round(t-i)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(i))},_limitZoom:function(t){var i=this.getMinZoom(),e=this.getMaxZoom(),n=ji?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(i,Math.min(e,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){tt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,i){var e=this._getCenterOffset(t)._trunc();return!(!0!==(i&&i.animate)&&!this.getSize().contains(e))&&(this.panBy(e,i),!0)},_createAnimProxy:function(){var t=this._proxy=G("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(t){var i=ce,e=this._proxy.style[i];rt(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),e===this._proxy.style[i]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",function(){var t=this.getCenter(),i=this.getZoom();rt(this._proxy,this.project(t,i),this.getZoomScale(i,1))},this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){K(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,i,e){if(this._animatingZoom)return!0;if(e=e||{},!this._zoomAnimated||!1===e.animate||this._nothingToAnimate()||Math.abs(i-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(i),o=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==e.animate&&!this.getSize().contains(o))&&(f(function(){this._moveStart(!0,!1)._animateZoom(t,i,!0)},this),!0)},_animateZoom:function(t,i,n,o){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=i,Q(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:i,noUpdate:o}),setTimeout(e(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&tt(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),f(function(){this._moveEnd(!0)},this))}}),Te=v.extend({options:{position:"topright"},initialize:function(t){l(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var i=this._map;return i&&i.removeControl(this),this.options.position=t,i&&i.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var i=this._container=this.onAdd(t),e=this.getPosition(),n=t._controlCorners[e];return Q(i,"leaflet-control"),-1!==e.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this},remove:function(){return this._map?(K(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),ze=function(t){return new Te(t)};be.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){function t(t,o){var s=e+t+" "+e+o;i[t+o]=G("div",s,n)}var i=this._controlCorners={},e="leaflet-",n=this._controlContainer=G("div",e+"control-container",this._container);t("top","left"),t("top","right"),t("bottom","left"),t("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)K(this._controlCorners[t]);K(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Me=Te.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,i,e,n){return e<n?-1:n<e?1:0}},initialize:function(t,i,e){l(this,e),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1;for(var n in t)this._addLayer(t[n],n);for(n in i)this._addLayer(i[n],n,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var i=0;i<this._layers.length;i++)this._layers[i].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return Te.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,i){return this._addLayer(t,i),this._map?this._update():this},addOverlay:function(t,i){return this._addLayer(t,i,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var i=this._getLayer(n(t));return i&&this._layers.splice(this._layers.indexOf(i),1),this._map?this._update():this},expand:function(){Q(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(Q(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):tt(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return tt(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",i=this._container=G("div",t),e=this.options.collapsed;i.setAttribute("aria-haspopup",!0),wt(i),xt(i);var n=this._section=G("section",t+"-list");e&&(this._map.on("click",this.collapse,this),zi||mt(i,{mouseenter:this.expand,mouseleave:this.collapse},this));var o=this._layersLink=G("a",t+"-toggle",i);o.href="#",o.title="Layers",qi?(mt(o,"click",Lt),mt(o,"click",this.expand,this)):mt(o,"focus",this.expand,this),e||this.expand (),this._baseLayersList=G("div",t+"-base",n),this._separator=G("div",t+"-separator",n),this._overlaysList=G("div",t+"-overlays",n),i.appendChild(n)},_getLayer:function(t){for(var i=0;i<this._layers.length;i++)if(this._layers[i]&&n(this._layers[i].layer)===t)return this._layers[i]},_addLayer:function(t,i,n){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:i,overlay:n}),this.options.sortLayers&&this._layers.sort(e(function(t,i){return this.options.sortFunction(t.layer,i.layer,t.name,i.name)},this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Y(this._baseLayersList),Y(this._overlaysList),this._layerControlInputs=[];var t,i,e,n,o=0;for(e=0;e<this._layers.length;e++)n=this._layers[e],this._addItem(n),i=i||n.overlay,t=t||!n.overlay,o+=n.overlay?0:1;return this.options.hideSingleBase&&(t=t&&o>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=i&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var i=this._getLayer(n(t.target)),e=i.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;e&&this._map.fire(e,i)},_createRadioElement:function(t,i){var e='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(i?' checked="checked"':"")+"/>",n=document.createElement("div");return n.innerHTML=e,n.firstChild},_addItem:function(t){var i,e=document.createElement("label"),o=this._map.hasLayer(t.layer);t.overlay?((i=document.createElement("input")).type="checkbox",i.className="leaflet-control-layers-selector",i.defaultChecked=o):i=this._createRadioElement("leaflet-base-layers",o),this._layerControlInputs.push(i),i.layerId=n(t.layer),mt(i,"click",this._onInputClick,this);var s=document.createElement("span");s.innerHTML=" "+t.name;var r=document.createElement("div");return e.appendChild(r),r.appendChild(i),r.appendChild(s),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){var t,i,e=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=e.length-1;s>=0;s--)t=e[s],i=this._getLayer(t.layerId).layer,t.checked?n.push(i):t.checked||o.push(i);for(s=0;s<o.length;s++)this._map.hasLayer(o[s])&&this._map.removeLayer(o[s]);for(s=0;s<n.length;s++)this._map.hasLayer(n[s])||this._map.addLayer(n[s]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t,i,e=this._layerControlInputs,n=this._map.getZoom(),o=e.length-1;o>=0;o--)t=e[o],i=this._getLayer(t.layerId).layer,t.disabled=void 0!==i.options.minZoom&&n<i.options.minZoom||void 0!==i.options.maxZoom&&n>i.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand (),this},_expand:function(){return this.expand ()},_collapse:function(){return this.collapse()}}),Ce=Te.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"&#x2212;",zoomOutTitle:"Zoom out"},onAdd:function(t){var i="leaflet-control-zoom",e=G("div",i+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,i+"-in",e,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,i+"-out",e,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),e},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,i,e,n,o){var s=G("a",e,n);return s.innerHTML=t,s.href="#",s.title=i,s.setAttribute("role","button"),s.setAttribute("aria-label",i),wt(s),mt(s,"click",Lt),mt(s,"click",o,this),mt(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,i="leaflet-disabled";tt(this._zoomInButton,i),tt(this._zoomOutButton,i),(this._disabled||t._zoom===t.getMinZoom())&&Q(this._zoomOutButton,i),(this._disabled||t._zoom===t.getMaxZoom())&&Q(this._zoomInButton,i)}});be.mergeOptions({zoomControl:!0}),be.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ce,this.addControl(this.zoomControl))});var Se=Te.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var i=G("div","leaflet-control-scale"),e=this.options;return this._addScales(e,"leaflet-control-scale-line",i),t.on(e.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,i,e){t.metric&&(this._mScale=G("div",i,e)),t.imperial&&(this._iScale=G("div",i,e))},_update:function(){var t=this._map,i=t.getSize().y/2,e=t.distance(t.containerPointToLatLng([0,i]),t.containerPointToLatLng([this.options.maxWidth,i]));this._updateScales(e)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var i=this._getRoundNum(t),e=i<1e3?i+" m":i/1e3+" km";this._updateScale(this._mScale,e,i/t)},_updateImperial:function(t){var i,e,n,o=3.2808399*t;o>5280?(i=o/5280,e=this._getRoundNum(i),this._updateScale(this._iScale,e+" mi",e/i)):(n=this._getRoundNum(o),this._updateScale(this._iScale,n+" ft",n/o))},_updateScale:function(t,i,e){t.style.width=Math.round(this.options.maxWidth*e)+"px",t.innerHTML=i},_getRoundNum:function(t){var i=Math.pow(10,(Math.floor(t)+"").length-1),e=t/i;return e=e>=10?10:e>=5?5:e>=3?3:e>=2?2:1,i*e}}),Ze=Te.extend({options:{position:"bottomright",prefix:'<a href="http://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'},initialize:function(t){l(this,t),this._attributions={}},onAdd:function(t){t.attributionControl=this,this._container=G("div","leaflet-control-attribution"),wt(this._container);for(var i in t._layers)t._layers[i].getAttribution&&this.addAttribution(t._layers[i].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var i in this._attributions)this._attributions[i]&&t.push(i);var e=[];this.options.prefix&&e.push(this.options.prefix),t.length&&e.push(t.join(", ")),this._container.innerHTML=e.join(" | ")}}});be.mergeOptions({attributionControl:!0}),be.addInitHook(function(){this.options.attributionControl&&(new Ze).addTo(this)});Te.Layers=Me,Te.Zoom=Ce,Te.Scale=Se,Te.Attribution=Ze,ze.layers=function(t,i,e){return new Me(t,i,e)},ze.zoom=function(t){return new Ce(t)},ze.scale=function(t){return new Se(t)},ze.attribution=function(t){return new Ze(t)};var Ee=v.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Ee.addTo=function(t,i){return t.addHandler(i,this),this};var ke,Be={Events:li},Ae=qi?"touchstart mousedown":"mousedown",Ie={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},Oe={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},Re=ci.extend({options:{clickTolerance:3},initialize:function(t,i,e,n){l(this,n),this._element=t,this._dragStartTarget=i||t,this._preventOutline=e},enable:function(){this._enabled||(mt(this._dragStartTarget,Ae,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Re._dragging===this&&this.finishDrag(),ft(this._dragStartTarget,Ae,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!$(this._element,"leaflet-zoom-anim")&&!(Re._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(Re._dragging=this,this._preventOutline&&ct(this._element),ut(),fi(),this._moving)))){this.fire("down");var i=t.touches?t.touches[0]:t,e=dt(this._element);this._startPoint=new x(i.clientX,i.clientY),this._parentScale=pt(e),mt(document,Oe[t.type],this._onMove,this),mt(document,Ie[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var i=t.touches&&1===t.touches.length?t.touches[0]:t,e=new x(i.clientX,i.clientY)._subtract(this._startPoint);(e.x||e.y)&&(Math.abs(e.x)+Math.abs(e.y)<this.options.clickTolerance||(e.x/=this._parentScale.x,e.y/=this._parentScale.y,Pt(t),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=ht(this._element).subtract(e),Q(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Q(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(e),this._moving=!0,g(this._animRequest),this._lastEvent=t,this._animRequest=f(this._updatePosition,this,!0)))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),at(this._element,this._newPos),this.fire("drag",t)},_onUp:function(t){!t._simulated&&this._enabled&&this.finishDrag()},finishDrag:function(){tt(document.body,"leaflet-dragging"),this._lastTarget&&(tt(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null);for(var t in Oe)ft(document,Oe[t],this._onMove,this),ft(document,Ie[t],this._onUp,this);lt(),gi(),this._moved&&this._moving&&(g(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1,Re._dragging=!1}}),Ne=(Object.freeze||Object)({simplify:Zt,pointToSegmentDistance:Et,closestPointOnSegment:function(t,i,e){return Dt(t,i,e)},clipSegment:It,_getEdgeIntersection:Ot,_getBitCode:Rt,_sqClosestPointOnSegment:Dt,isFlat:jt,_flat:Wt}),De=(Object.freeze||Object)({clipPolygon:Ht}),je={project:function(t){return new x(t.lng,t.lat)},unproject:function(t){return new M(t.y,t.x)},bounds:new P([-180,-90],[180,90])},We={R:6378137,R_MINOR:6356752.314245179,bounds:new P([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var i=Math.PI/180,e=this.R,n=t.lat*i,o=this.R_MINOR/e,s=Math.sqrt(1-o*o),r=s*Math.sin(n),a=Math.tan(Math.PI/4-n/2)/Math.pow((1-r)/(1+r),s/2);return n=-e*Math.log(Math.max(a,1e-10)),new x(t.lng*i*e,n)},unproject:function(t){for(var i,e=180/Math.PI,n=this.R,o=this.R_MINOR/n,s=Math.sqrt(1-o*o),r=Math.exp(-t.y/n),a=Math.PI/2-2*Math.atan(r),h=0,u=.1;h<15&&Math.abs(u)>1e-7;h++)i=s*Math.sin(a),i=Math.pow((1-i)/(1+i),s/2),a+=u=Math.PI/2-2*Math.atan(r*i)-a;return new M(a*e,t.x*e/n)}},He=(Object.freeze||Object)({LonLat:je,Mercator:We,SphericalMercator:mi}),Fe=i({},pi,{code:"EPSG:3395",projection:We,transformation:function(){var t=.5/(Math.PI*We.R);return Z(t,.5,-t,.5)}()}),Ue=i({},pi,{code:"EPSG:4326",projection:je,transformation:Z(1/180,1,-1/180,.5)}),Ve=i({},di,{projection:je,transformation:Z(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,i){var e=i.lng-t.lng,n=i.lat-t.lat;return Math.sqrt(e*e+n*n)},infinite:!0});di.Earth=pi,di.EPSG3395=Fe,di.EPSG3857=yi,di.EPSG900913=xi,di.EPSG4326=Ue,di.Simple=Ve;var qe=ci.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[n(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[n(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var i=t.target;if(i.hasLayer(this)){if(this._map=i,this._zoomAnimated=i._zoomAnimated,this.getEvents){var e=this.getEvents();i.on(e,this),this.once("remove",function(){i.off(e,this)},this)}this.onAdd(i),this.getAttribution&&i.attributionControl&&i.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),i.fire("layeradd",{layer:this})}}});be.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var i=n(t);return this._layers[i]?this:(this._layers[i]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t),this)},removeLayer:function(t){var i=n(t);return this._layers[i]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[i],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&n(t)in this._layers},eachLayer:function(t,i){for(var e in this._layers)t.call(i,this._layers[e]);return this},_addLayers:function(t){for(var i=0,e=(t=t?oi(t)?t:[t]:[]).length;i<e;i++)this.addLayer(t[i])},_addZoomLimit:function(t){!isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[n(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var i=n(t);this._zoomBoundLayers[i]&&(delete this._zoomBoundLayers[i],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,i=-1/0,e=this._getZoomSpan();for(var n in this._zoomBoundLayers){var o=this._zoomBoundLayers[n].options;t=void 0===o.minZoom?t:Math.min(t,o.minZoom),i=void 0===o.maxZoom?i:Math.max(i,o.maxZoom)}this._layersMaxZoom=i===-1/0?void 0:i,this._layersMinZoom=t===1/0?void 0:t,e!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Ge=qe.extend({initialize:function(t,i){l(this,i),this._layers={};var e,n;if(t)for(e=0,n=t.length;e<n;e++)this.addLayer(t[e])},addLayer:function(t){var i=this.getLayerId(t);return this._layers[i]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var i=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[i]&&this._map.removeLayer(this._layers[i]),delete this._layers[i],this},hasLayer:function(t){return!!t&&(t in this._layers||this.getLayerId(t)in this._layers)},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var i,e,n=Array.prototype.slice.call(arguments,1);for(i in this._layers)(e=this._layers[i])[t]&&e[t].apply(e,n);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,i){for(var e in this._layers)t.call(i,this._layers[e]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return n(t)}}),Ke=Ge.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Ge.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Ge.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new T;for(var i in this._layers){var e=this._layers[i];t.extend(e.getBounds?e.getBounds():e.getLatLng())}return t}}),Ye=v.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(t){l(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,i){var e=this._getIconUrl(t);if(!e){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(e,i&&"IMG"===i.tagName?i:null);return this._setIconStyles(n,t),n},_setIconStyles:function(t,i){var e=this.options,n=e[i+"Size"];"number"==typeof n&&(n=[n,n]);var o=w(n),s=w("shadow"===i&&e.shadowAnchor||e.iconAnchor||o&&o.divideBy(2,!0));t.className="leaflet-marker-"+i+" "+(e.className||""),s&&(t.style.marginLeft=-s.x+"px",t.style.marginTop=-s.y+"px"),o&&(t.style.width=o.x+"px",t.style.height=o.y+"px")},_createImg:function(t,i){return i=i||document.createElement("img"),i.src=t,i},_getIconUrl:function(t){return Yi&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}}),Xe=Ye.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return Xe.imagePath||(Xe.imagePath=this._detectIconPath()),(this.options.imagePath||Xe.imagePath)+Ye.prototype._getIconUrl.call(this,t)},_detectIconPath:function(){var t=G("div","leaflet-default-icon-path",document.body),i=q(t,"background-image")||q(t,"backgroundImage");return document.body.removeChild(t),i=null===i||0!==i.indexOf("url")?"":i.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")}}),Je=Ee.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new Re(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Q(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&tt(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var i=this._marker,e=i._map,n=this._marker.options.autoPanSpeed,o=this._marker.options.autoPanPadding,s=ht(i._icon),r=e.getPixelBounds(),a=e.getPixelOrigin(),h=b(r.min._subtract(a).add(o),r.max._subtract(a).subtract(o));if(!h.contains(s)){var u=w((Math.max(h.max.x,s.x)-h.max.x)/(r.max.x-h.max.x)-(Math.min(h.min.x,s.x)-h.min.x)/(r.min.x-h.min.x),(Math.max(h.max.y,s.y)-h.max.y)/(r.max.y-h.max.y)-(Math.min(h.min.y,s.y)-h.min.y)/(r.min.y-h.min.y)).multiplyBy(n);e.panBy(u,{animate:!1}),this._draggable._newPos._add(u),this._draggable._startPos._add(u),at(i._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=f(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup().fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(g(this._panRequest),this._panRequest=f(this._adjustPan.bind(this,t)))},_onDrag:function(t){var i=this._marker,e=i._shadow,n=ht(i._icon),o=i._map.layerPointToLatLng(n);e&&at(e,n),i._latlng=o,t.latlng=o,t.oldLatLng=this._oldLatLng,i.fire("move",t).fire("drag",t)},_onDragEnd:function(t){g(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),$e=qe.extend({options:{icon:new Xe,interactive:!0,keyboard:!0,title:"",alt:"",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",bubblingMouseEvents:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,i){l(this,i),this._latlng=C(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var i=this._latlng;return this._latlng=C(t),this.update(),this.fire("move",{oldLatLng:i,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,i="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),e=t.icon.createIcon(this._icon),n=!1;e!==this._icon&&(this._icon&&this._removeIcon(),n=!0,t.title&&(e.title=t.title),"IMG"===e.tagName&&(e.alt=t.alt||"")),Q(e,i),t.keyboard&&(e.tabIndex="0"),this._icon=e,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex});var o=t.icon.createShadow(this._shadow),s=!1;o!==this._shadow&&(this._removeShadow(),s=!0),o&&(Q(o,i),o.alt=""),this._shadow=o,t.opacity<1&&this._updateOpacity(),n&&this.getPane().appendChild(this._icon),this._initInteraction(),o&&s&&this.getPane("shadowPane").appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),K(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&K(this._shadow),this._shadow=null},_setPos:function(t){at(this._icon,t),this._shadow&&at(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon.style.zIndex=this._zIndex+t},_animateZoom:function(t){var i=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(i)},_initInteraction:function(){if(this.options.interactive&&(Q(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Je)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Je(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;nt(this._icon,t),this._shadow&&nt(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}}),Qe=qe.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return l(this,t),this._renderer&&this._renderer._updateStyle(this),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),tn=Qe.extend({options:{fill:!0,radius:10},initialize:function(t,i){l(this,i),this._latlng=C(t),this._radius=this.options.radius},setLatLng:function(t){return this._latlng=C(t),this.redraw(),this.fire("move",{latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var i=t&&t.radius||this._radius;return Qe.prototype.setStyle.call(this,t),this.setRadius(i),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,i=this._radiusY||t,e=this._clickTolerance(),n=[t+e,i+e];this._pxBounds=new P(this._point.subtract(n),this._point.add(n))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}}),en=tn.extend({initialize:function(t,e,n){if("number"==typeof e&&(e=i({},n,{radius:e})),l(this,e),this._latlng=C(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new T(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:Qe.prototype.setStyle,_project:function(){var t=this._latlng.lng,i=this._latlng.lat,e=this._map,n=e.options.crs;if(n.distance===pi.distance){var o=Math.PI/180,s=this._mRadius/pi.R/o,r=e.project([i+s,t]),a=e.project([i-s,t]),h=r.add(a).divideBy(2),u=e.unproject(h).lat,l=Math.acos((Math.cos(s*o)-Math.sin(i*o)*Math.sin(u*o))/(Math.cos(i*o)*Math.cos(u*o)))/o;(isNaN(l)||0===l)&&(l=s/Math.cos(Math.PI/180*i)),this._point=h.subtract(e.getPixelOrigin()),this._radius=isNaN(l)?0:h.x-e.project([u,t-l]).x,this._radiusY=h.y-r.y}else{var c=n.unproject(n.project(this._latlng).subtract([this._mRadius,0]));this._point=e.latLngToLayerPoint(this._latlng),this._radius=this._point.x-e.latLngToLayerPoint(c).x}this._updateBounds()}}),nn=Qe.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,i){l(this,i),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var i,e,n=1/0,o=null,s=Dt,r=0,a=this._parts.length;r<a;r++)for(var h=this._parts[r],u=1,l=h.length;u<l;u++){var c=s(t,i=h[u-1],e=h[u],!0);c<n&&(n=c,o=s(t,i,e))}return o&&(o.distance=Math.sqrt(n)),o},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,i,e,n,o,s,r,a=this._rings[0],h=a.length;if(!h)return null;for(t=0,i=0;t<h-1;t++)i+=a[t].distanceTo(a[t+1])/2;if(0===i)return this._map.layerPointToLatLng(a[0]);for(t=0,n=0;t<h-1;t++)if(o=a[t],s=a[t+1],e=o.distanceTo(s),(n+=e)>i)return r=(n-i)/e,this._map.layerPointToLatLng([s.x-r*(s.x-o.x),s.y-r*(s.y-o.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,i){return i=i||this._defaultShape(),t=C(t),i.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new T,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return jt(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var i=[],e=jt(t),n=0,o=t.length;n<o;n++)e?(i[n]=C(t[n]),this._bounds.extend(i[n])):i[n]=this._convertLatLngs(t[n]);return i},_project:function(){var t=new P;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t);var i=this._clickTolerance(),e=new x(i,i);this._bounds.isValid()&&t.isValid()&&(t.min._subtract(e),t.max._add(e),this._pxBounds=t)},_projectLatlngs:function(t,i,e){var n,o,s=t[0]instanceof M,r=t.length;if(s){for(o=[],n=0;n<r;n++)o[n]=this._map.latLngToLayerPoint(t[n]),e.extend(o[n]);i.push(o)}else for(n=0;n<r;n++)this._projectLatlngs(t[n],i,e)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var i,e,n,o,s,r,a,h=this._parts;for(i=0,n=0,o=this._rings.length;i<o;i++)for(e=0,s=(a=this._rings[i]).length;e<s-1;e++)(r=It(a[e],a[e+1],t,e,!0))&&(h[n]=h[n]||[],h[n].push(r[0]),r[1]===a[e+1]&&e!==s-2||(h[n].push(r[1]),n++))}},_simplifyPoints:function(){for(var t=this._parts,i=this.options.smoothFactor,e=0,n=t.length;e<n;e++)t[e]=Zt(t[e],i)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,i){var e,n,o,s,r,a,h=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(e=0,s=this._parts.length;e<s;e++)for(n=0,o=(r=(a=this._parts[e]).length)-1;n<r;o=n++)if((i||0!==n)&&Et(t,a[o],a[n])<=h)return!0;return!1}});nn._flat=Wt;var on=nn.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,i,e,n,o,s,r,a,h,u=this._rings[0],l=u.length;if(!l)return null;for(s=r=a=0,t=0,i=l-1;t<l;i=t++)e=u[t],n=u[i],o=e.y*n.x-n.y*e.x,r+=(e.x+n.x)*o,a+=(e.y+n.y)*o,s+=3*o;return h=0===s?u[0]:[r/s,a/s],this._map.layerPointToLatLng(h)},_convertLatLngs:function(t){var i=nn.prototype._convertLatLngs.call(this,t),e=i.length;return e>=2&&i[0]instanceof M&&i[0].equals(i[e-1])&&i.pop(),i},_setLatLngs:function(t){nn.prototype._setLatLngs.call(this,t),jt(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return jt(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,i=this.options.weight,e=new x(i,i);if(t=new P(t.min.subtract(e),t.max.add(e)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var n,o=0,s=this._rings.length;o<s;o++)(n=Ht(this._rings[o],t,!0)).length&&this._parts.push(n)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var i,e,n,o,s,r,a,h,u=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(o=0,a=this._parts.length;o<a;o++)for(s=0,r=(h=(i=this._parts[o]).length)-1;s<h;r=s++)e=i[s],n=i[r],e.y>t.y!=n.y>t.y&&t.x<(n.x-e.x)*(t.y-e.y)/(n.y-e.y)+e.x&&(u=!u);return u||nn.prototype._containsPoint.call(this,t,!0)}}),sn=Ke.extend({initialize:function(t,i){l(this,i),this._layers={},t&&this.addData(t)},addData:function(t){var i,e,n,o=oi(t)?t:t.features;if(o){for(i=0,e=o.length;i<e;i++)((n=o[i]).geometries||n.geometry||n.features||n.coordinates)&&this.addData(n);return this}var s=this.options;if(s.filter&&!s.filter(t))return this;var r=Ft(t,s);return r?(r.feature=Yt(t),r.defaultOptions=r.options,this.resetStyle(r),s.onEachFeature&&s.onEachFeature(t,r),this.addLayer(r)):this},resetStyle:function(t){return t.options=i({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this},setStyle:function(t){return this.eachLayer(function(i){this._setLayerStyle(i,t)},this)},_setLayerStyle:function(t,i){"function"==typeof i&&(i=i(t.feature)),t.setStyle&&t.setStyle(i)}}),rn={toGeoJSON:function(t){return Kt(this,{type:"Point",coordinates:qt(this.getLatLng(),t)})}};$e.include(rn),en.include(rn),tn.include(rn),nn.include({toGeoJSON:function(t){var i=!jt(this._latlngs),e=Gt(this._latlngs,i?1:0,!1,t);return Kt(this,{type:(i?"Multi":"")+"LineString",coordinates:e})}}),on.include({toGeoJSON:function(t){var i=!jt(this._latlngs),e=i&&!jt(this._latlngs[0]),n=Gt(this._latlngs,e?2:i?1:0,!0,t);return i||(n=[n]),Kt(this,{type:(e?"Multi":"")+"Polygon",coordinates:n})}}),Ge.include({toMultiPoint:function(t){var i=[];return this.eachLayer(function(e){i.push(e.toGeoJSON(t).geometry.coordinates)}),Kt(this,{type:"MultiPoint",coordinates:i})},toGeoJSON:function(t){var i=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===i)return this.toMultiPoint(t);var e="GeometryCollection"===i,n=[];return this.eachLayer(function(i){if(i.toGeoJSON){var o=i.toGeoJSON(t);if(e)n.push(o.geometry);else{var s=Yt(o);"FeatureCollection"===s.type?n.push.apply(n,s.features):n.push(s)}}}),e?Kt(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}});var an=Xt,hn=qe.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,i,e){this._url=t,this._bounds=z(i),l(this,e)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Q(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){K(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&X(this._image),this},bringToBack:function(){return this._map&&J(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=z(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,i=this._image=t?this._url:G("img");Q(i,"leaflet-image-layer"),this._zoomAnimated&&Q(i,"leaflet-zoom-animated"),this.options.className&&Q(i,this.options.className),i.onselectstart=r,i.onmousemove=r,i.onload=e(this.fire,this,"load"),i.onerror=e(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=i.src:(i.src=this._url,i.alt=this.options.alt)},_animateZoom:function(t){var i=this._map.getZoomScale(t.zoom),e=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;rt(this._image,e,i)},_reset:function(){var t=this._image,i=new P(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),e=i.getSize();at(t,i.min),t.style.width=e.x+"px",t.style.height=e.y+"px"},_updateOpacity:function(){nt(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),un=hn.extend({options:{autoplay:!0,loop:!0},_initImage:function(){var t="VIDEO"===this._url.tagName,i=this._image=t?this._url:G("video");if(Q(i,"leaflet-image-layer"),this._zoomAnimated&&Q(i,"leaflet-zoom-animated"),i.onselectstart=r,i.onmousemove=r,i.onloadeddata=e(this.fire,this,"load"),t){for(var n=i.getElementsByTagName("source"),o=[],s=0;s<n.length;s++)o.push(n[s].src);this._url=n.length>0?o:[i.src]}else{oi(this._url)||(this._url=[this._url]),i.autoplay=!!this.options.autoplay,i.loop=!!this.options.loop;for(var a=0;a<this._url.length;a++){var h=G("source");h.src=this._url[a],i.appendChild(h)}}}}),ln=qe.extend({options:{offset:[0,7],className:"",pane:"popupPane"},initialize:function(t,i){l(this,t),this._source=i},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&nt(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&nt(this._container,1),this.bringToFront()},onRemove:function(t){t._fadeAnimated?(nt(this._container,0),this._removeTimeout=setTimeout(e(K,void 0,this._container),200)):K(this._container)},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=C(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&X(this._container),this},bringToBack:function(){return this._map&&J(this._container),this},_updateContent:function(){if(this._content){var t=this._contentNode,i="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof i)t.innerHTML=i;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(i)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),i=w(this.options.offset),e=this._getAnchor();this._zoomAnimated?at(this._container,t.add(e)):i=i.add(t).add(e);var n=this._containerBottom=-i.y,o=this._containerLeft=-Math.round(this._containerWidth/2)+i.x;this._container.style.bottom=n+"px",this._container.style.left=o+"px"}},_getAnchor:function(){return[0,0]}}),cn=ln.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t.openPopup(this),this},onAdd:function(t){ln.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Qe||this._source.on("preclick",yt))},onRemove:function(t){ln.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Qe||this._source.off("preclick",yt))},getEvents:function(){var t=ln.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this._close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t="leaflet-popup",i=this._container=G("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),e=this._wrapper=G("div",t+"-content-wrapper",i);if(this._contentNode=G("div",t+"-content",e),wt(e),xt(this._contentNode),mt(e,"contextmenu",yt),this._tipContainer=G("div",t+"-tip-container",i),this._tip=G("div",t+"-tip",this._tipContainer),this.options.closeButton){var n=this._closeButton=G("a",t+"-close-button",i);n.href="#close",n.innerHTML="&#215;",mt(n,"click",this._onCloseButtonClick,this)}},_updateLayout:function(){var t=this._contentNode,i=t.style;i.width="",i.whiteSpace="nowrap";var e=t.offsetWidth;e=Math.min(e,this.options.maxWidth),e=Math.max(e,this.options.minWidth),i.width=e+1+"px",i.whiteSpace="",i.height="";var n=t.offsetHeight,o=this.options.maxHeight;o&&n>o?(i.height=o+"px",Q(t,"leaflet-popup-scrolled")):tt(t,"leaflet-popup-scrolled"),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var i=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),e=this._getAnchor();at(this._container,i.add(e))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,i=parseInt(q(this._container,"marginBottom"),10)||0,e=this._container.offsetHeight+i,n=this._containerWidth,o=new x(this._containerLeft,-e-this._containerBottom);o._add(ht(this._container));var s=t.layerPointToContainerPoint(o),r=w(this.options.autoPanPadding),a=w(this.options.autoPanPaddingTopLeft||r),h=w(this.options.autoPanPaddingBottomRight||r),u=t.getSize(),l=0,c=0;s.x+n+h.x>u.x&&(l=s.x+n-u.x+h.x),s.x-l-a.x<0&&(l=s.x-a.x),s.y+e+h.y>u.y&&(c=s.y+e-u.y+h.y),s.y-c-a.y<0&&(c=s.y-a.y),(l||c)&&t.fire("autopanstart").panBy([l,c])}},_onCloseButtonClick:function(t){this._close(),Lt(t)},_getAnchor:function(){return w(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});be.mergeOptions({closePopupOnClick:!0}),be.include({openPopup:function(t,i,e){return t instanceof cn||(t=new cn(e).setContent(t)),i&&t.setLatLng(i),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),qe.include({bindPopup:function(t,i){return t instanceof cn?(l(t,i),this._popup=t,t._source=this):(this._popup&&!i||(this._popup=new cn(i,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,i){if(t instanceof qe||(i=t,t=this),t instanceof Ke)for(var e in this._layers){t=this._layers[e];break}return i||(i=t.getCenter?t.getCenter():t.getLatLng()),this._popup&&this._map&&(this._popup._source=t,this._popup.update(),this._map.openPopup(this._popup,i)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var i=t.layer||t.target;this._popup&&this._map&&(Lt(t),i instanceof Qe?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===i?this.closePopup():this.openPopup(i,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var _n=ln.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){ln.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){ln.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=ln.prototype.getEvents.call(this);return qi&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=G("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var i=this._map,e=this._container,n=i.latLngToContainerPoint(i.getCenter()),o=i.layerPointToContainerPoint(t),s=this.options.direction,r=e.offsetWidth,a=e.offsetHeight,h=w(this.options.offset),u=this._getAnchor();"top"===s?t=t.add(w(-r/2+h.x,-a+h.y+u.y,!0)):"bottom"===s?t=t.subtract(w(r/2-h.x,-h.y,!0)):"center"===s?t=t.subtract(w(r/2+h.x,a/2-u.y+h.y,!0)):"right"===s||"auto"===s&&o.x<n.x?(s="right",t=t.add(w(h.x+u.x,u.y-a/2+h.y,!0))):(s="left",t=t.subtract(w(r+u.x-h.x,a/2-u.y-h.y,!0))),tt(e,"leaflet-tooltip-right"),tt(e,"leaflet-tooltip-left"),tt(e,"leaflet-tooltip-top"),tt(e,"leaflet-tooltip-bottom"),Q(e,"leaflet-tooltip-"+s),at(e,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&nt(this._container,t)},_animateZoom:function(t){var i=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(i)},_getAnchor:function(){return w(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}});be.include({openTooltip:function(t,i,e){return t instanceof _n||(t=new _n(e).setContent(t)),i&&t.setLatLng(i),this.hasLayer(t)?this:this.addLayer(t)},closeTooltip:function(t){return t&&this.removeLayer(t),this}}),qe.include({bindTooltip:function(t,i){return t instanceof _n?(l(t,i),this._tooltip=t,t._source=this):(this._tooltip&&!i||(this._tooltip=new _n(i,this)),this._tooltip.setContent(t)),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var i=t?"off":"on",e={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?e.add=this._openTooltip:(e.mouseover=this._openTooltip,e.mouseout=this.closeTooltip,this._tooltip.options.sticky&&(e.mousemove=this._moveTooltip),qi&&(e.click=this._openTooltip)),this[i](e),this._tooltipHandlersAdded=!t}},openTooltip:function(t,i){if(t instanceof qe||(i=t,t=this),t instanceof Ke)for(var e in this._layers){t=this._layers[e];break}return i||(i=t.getCenter?t.getCenter():t.getLatLng()),this._tooltip&&this._map&&(this._tooltip._source=t,this._tooltip.update(),this._map.openTooltip(this._tooltip,i),this._tooltip.options.interactive&&this._tooltip._container&&(Q(this._tooltip._container,"leaflet-clickable"),this.addInteractiveTarget(this._tooltip._container))),this},closeTooltip:function(){return this._tooltip&&(this._tooltip._close(),this._tooltip.options.interactive&&this._tooltip._container&&(tt(this._tooltip._container,"leaflet-clickable"),this.removeInteractiveTarget(this._tooltip._container))),this},toggleTooltip:function(t){return this._tooltip&&(this._tooltip._map?this.closeTooltip():this.openTooltip(t)),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_openTooltip:function(t){var i=t.layer||t.target;this._tooltip&&this._map&&this.openTooltip(i,this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var i,e,n=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(i=this._map.mouseEventToContainerPoint(t.originalEvent),e=this._map.containerPointToLayerPoint(i),n=this._map.layerPointToLatLng(e)),this._tooltip.setLatLng(n)}});var dn=Ye.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var i=t&&"DIV"===t.tagName?t:document.createElement("div"),e=this.options;if(i.innerHTML=!1!==e.html?e.html:"",e.bgPos){var n=w(e.bgPos);i.style.backgroundPosition=-n.x+"px "+-n.y+"px"}return this._setIconStyles(i,"icon"),i},createShadow:function(){return null}});Ye.Default=Xe;var pn=qe.extend({options:{tileSize:256,opacity:1,updateWhenIdle:Wi,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){l(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView(),this._update()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),K(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(X(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(J(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllTiles(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=o(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof x?t:new x(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var i,e=this.getPane().children,n=-t(-1/0,1/0),o=0,s=e.length;o<s;o++)i=e[o].style.zIndex,e[o]!==this._container&&i&&(n=t(n,+i));isFinite(n)&&(this.options.zIndex=n+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!Li){nt(this._container,this.options.opacity);var t=+new Date,i=!1,e=!1;for(var n in this._tiles){var o=this._tiles[n];if(o.current&&o.loaded){var s=Math.min(1,(t-o.loaded)/200);nt(o.el,s),s<1?i=!0:(o.active?e=!0:this._onOpaqueTile(o),o.active=!0)}}e&&!this._noPrune&&this._pruneTiles(),i&&(g(this._fadeFrame),this._fadeFrame=f(this._updateOpacity,this))}},_onOpaqueTile:r,_initContainer:function(){this._container||(this._container=G("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,i=this.options.maxZoom;if(void 0!==t){for(var e in this._levels)this._levels[e].el.children.length||e===t?(this._levels[e].el.style.zIndex=i-Math.abs(t-e),this._onUpdateLevel(e)):(K(this._levels[e].el),this._removeTilesAtZoom(e),this._onRemoveLevel(e),delete this._levels[e]);var n=this._levels[t],o=this._map;return n||((n=this._levels[t]={}).el=G("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=i,n.origin=o.project(o.unproject(o.getPixelOrigin()),t).round(),n.zoom=t,this._setZoomTransform(n,o.getCenter(),o.getZoom()),n.el.offsetWidth,this._onCreateLevel(n)),this._level=n,n}},_onUpdateLevel:r,_onRemoveLevel:r,_onCreateLevel:r,_pruneTiles:function(){if(this._map){var t,i,e=this._map.getZoom();if(e>this.options.maxZoom||e<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(i=this._tiles[t]).retain=i.current;for(t in this._tiles)if((i=this._tiles[t]).current&&!i.active){var n=i.coords;this._retainParent(n.x,n.y,n.z,n.z-5)||this._retainChildren(n.x,n.y,n.z,n.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var i in this._tiles)this._tiles[i].coords.z===t&&this._removeTile(i)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)K(this._levels[t].el),this._onRemoveLevel(t),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,i,e,n){var o=Math.floor(t/2),s=Math.floor(i/2),r=e-1,a=new x(+o,+s);a.z=+r;var h=this._tileCoordsToKey(a),u=this._tiles[h];return u&&u.active?(u.retain=!0,!0):(u&&u.loaded&&(u.retain=!0),r>n&&this._retainParent(o,s,r,n))},_retainChildren:function(t,i,e,n){for(var o=2*t;o<2*t+2;o++)for(var s=2*i;s<2*i+2;s++){var r=new x(o,s);r.z=e+1;var a=this._tileCoordsToKey(r),h=this._tiles[a];h&&h.active?h.retain=!0:(h&&h.loaded&&(h.retain=!0),e+1<n&&this._retainChildren(o,s,e+1,n))}},_resetView:function(t){var i=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),i,i)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var i=this.options;return void 0!==i.minNativeZoom&&t<i.minNativeZoom?i.minNativeZoom:void 0!==i.maxNativeZoom&&i.maxNativeZoom<t?i.maxNativeZoom:t},_setView:function(t,i,e,n){var o=this._clampZoom(Math.round(i));(void 0!==this.options.maxZoom&&o>this.options.maxZoom||void 0!==this.options.minZoom&&o<this.options.minZoom)&&(o=void 0);var s=this.options.updateWhenZooming&&o!==this._tileZoom;n&&!s||(this._tileZoom=o,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==o&&this._update(t),e||this._pruneTiles(),this._noPrune=!!e),this._setZoomTransforms(t,i)},_setZoomTransforms:function(t,i){for(var e in this._levels)this._setZoomTransform(this._levels[e],t,i)},_setZoomTransform:function(t,i,e){var n=this._map.getZoomScale(e,t.zoom),o=t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(i,e)).round();ji?rt(t.el,o,n):at(t.el,o)},_resetGrid:function(){var t=this._map,i=t.options.crs,e=this._tileSize=this.getTileSize(),n=this._tileZoom,o=this._map.getPixelWorldBounds(this._tileZoom);o&&(this._globalTileRange=this._pxBoundsToTileRange(o)),this._wrapX=i.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,i.wrapLng[0]],n).x/e.x),Math.ceil(t.project([0,i.wrapLng[1]],n).x/e.y)],this._wrapY=i.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([i.wrapLat[0],0],n).y/e.x),Math.ceil(t.project([i.wrapLat[1],0],n).y/e.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var i=this._map,e=i._animatingZoom?Math.max(i._animateToZoom,i.getZoom()):i.getZoom(),n=i.getZoomScale(e,this._tileZoom),o=i.project(t,this._tileZoom).floor(),s=i.getSize().divideBy(2*n);return new P(o.subtract(s),o.add(s))},_update:function(t){var i=this._map;if(i){var e=this._clampZoom(i.getZoom());if(void 0===t&&(t=i.getCenter()),void 0!==this._tileZoom){var n=this._getTiledPixelBounds(t),o=this._pxBoundsToTileRange(n),s=o.getCenter(),r=[],a=this.options.keepBuffer,h=new P(o.getBottomLeft().subtract([a,-a]),o.getTopRight().add([a,-a]));if(!(isFinite(o.min.x)&&isFinite(o.min.y)&&isFinite(o.max.x)&&isFinite(o.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var u in this._tiles){var l=this._tiles[u].coords;l.z===this._tileZoom&&h.contains(new x(l.x,l.y))||(this._tiles[u].current=!1)}if(Math.abs(e-this._tileZoom)>1)this._setView(t,e);else{for(var c=o.min.y;c<=o.max.y;c++)for(var _=o.min.x;_<=o.max.x;_++){var d=new x(_,c);if(d.z=this._tileZoom,this._isValidTile(d)){var p=this._tiles[this._tileCoordsToKey(d)];p?p.current=!0:r.push(d)}}if(r.sort(function(t,i){return t.distanceTo(s)-i.distanceTo(s)}),0!==r.length){this._loading||(this._loading=!0,this.fire("loading"));var m=document.createDocumentFragment();for(_=0;_<r.length;_++)this._addTile(r[_],m);this._level.el.appendChild(m)}}}}},_isValidTile:function(t){var i=this._map.options.crs;if(!i.infinite){var e=this._globalTileRange;if(!i.wrapLng&&(t.x<e.min.x||t.x>e.max.x)||!i.wrapLat&&(t.y<e.min.y||t.y>e.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return z(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var i=this._map,e=this.getTileSize(),n=t.scaleBy(e),o=n.add(e);return[i.unproject(n,t.z),i.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var i=this._tileCoordsToNwSe(t),e=new T(i[0],i[1]);return this.options.noWrap||(e=this._map.wrapLatLngBounds(e)),e},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var i=t.split(":"),e=new x(+i[0],+i[1]);return e.z=+i[2],e},_removeTile:function(t){var i=this._tiles[t];i&&(K(i.el),delete this._tiles[t],this.fire("tileunload",{tile:i.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){Q(t,"leaflet-tile");var i=this.getTileSize();t.style.width=i.x+"px",t.style.height=i.y+"px",t.onselectstart=r,t.onmousemove=r,Li&&this.options.opacity<1&&nt(t,this.options.opacity),zi&&!Mi&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,i){var n=this._getTilePos(t),o=this._tileCoordsToKey(t),s=this.createTile(this._wrapCoords(t),e(this._tileReady,this,t));this._initTile(s),this.createTile.length<2&&f(e(this._tileReady,this,t,null,s)),at(s,n),this._tiles[o]={el:s,coords:t,current:!0},i.appendChild(s),this.fire("tileloadstart",{tile:s,coords:t})},_tileReady:function(t,i,n){i&&this.fire("tileerror",{error:i,tile:n,coords:t});var o=this._tileCoordsToKey(t);(n=this._tiles[o])&&(n.loaded=+new Date,this._map._fadeAnimated?(nt(n.el,0),g(this._fadeFrame),this._fadeFrame=f(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),i||(Q(n.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:n.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Li||!this._map._fadeAnimated?f(this._pruneTiles,this):setTimeout(e(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var i=new x(this._wrapX?s(t.x,this._wrapX):t.x,this._wrapY?s(t.y,this._wrapY):t.y);return i.z=t.z,i},_pxBoundsToTileRange:function(t){var i=this.getTileSize();return new P(t.min.unscaleBy(i).floor(),t.max.unscaleBy(i).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}}),mn=pn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,i){this._url=t,(i=l(this,i)).detectRetina&&Yi&&i.maxZoom>0&&(i.tileSize=Math.floor(i.tileSize/2),i.zoomReverse?(i.zoomOffset--,i.minZoom++):(i.zoomOffset++,i.maxZoom--),i.minZoom=Math.max(0,i.minZoom)),"string"==typeof i.subdomains&&(i.subdomains=i.subdomains.split("")),zi||this.on("tileunload",this._onTileRemove)},setUrl:function(t,i){return this._url===t&&void 0===i&&(i=!0),this._url=t,i||this.redraw(),this},createTile:function(t,i){var n=document.createElement("img");return mt(n,"load",e(this._tileOnLoad,this,i,n)),mt(n,"error",e(this._tileOnError,this,i,n)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(n.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),n.alt="",n.setAttribute("role","presentation"),n.src=this.getTileUrl(t),n},getTileUrl:function(t){var e={r:Yi?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var n=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=n),e["-y"]=n}return _(this._url,i(e,this.options))},_tileOnLoad:function(t,i){Li?setTimeout(e(t,this,null,i),0):t(null,i)},_tileOnError:function(t,i,e){var n=this.options.errorTileUrl;n&&i.getAttribute("src")!==n&&(i.src=n),t(e,i)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,i=this.options.maxZoom,e=this.options.zoomReverse,n=this.options.zoomOffset;return e&&(t=i-t),t+n},_getSubdomain:function(t){var i=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[i]},_abortLoading:function(){var t,i;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((i=this._tiles[t].el).onload=r,i.onerror=r,i.complete||(i.src=si,K(i),delete this._tiles[t]))},_removeTile:function(t){var i=this._tiles[t];if(i)return Si||i.el.setAttribute("src",si),pn.prototype._removeTile.call(this,t)},_tileReady:function(t,i,e){if(this._map&&(!e||e.getAttribute("src")!==si))return pn.prototype._tileReady.call(this,t,i,e)}}),fn=mn.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var n=i({},this.defaultWmsParams);for(var o in e)o in this.options||(n[o]=e[o]);var s=(e=l(this,e)).detectRetina&&Yi?2:1,r=this.getTileSize();n.width=r.x*s,n.height=r.y*s,this.wmsParams=n},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var i=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[i]=this._crs.code,mn.prototype.onAdd.call(this,t)},getTileUrl:function(t){var i=this._tileCoordsToNwSe(t),e=this._crs,n=b(e.project(i[0]),e.project(i[1])),o=n.min,s=n.max,r=(this._wmsVersion>=1.3&&this._crs===Ue?[o.y,o.x,s.y,s.x]:[o.x,o.y,s.x,s.y]).join(","),a=mn.prototype.getTileUrl.call(this,t);return a+c(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+r},setParams:function(t,e){return i(this.wmsParams,t),e||this.redraw(),this}});mn.WMS=fn,Jt.wms=function(t,i){return new fn(t,i)};var gn=qe.extend({options:{padding:.1,tolerance:0},initialize:function(t){l(this,t),n(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&Q(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,i){var e=this._map.getZoomScale(i,this._zoom),n=ht(this._container),o=this._map.getSize().multiplyBy(.5+this.options.padding),s=this._map.project(this._center,i),r=this._map.project(t,i).subtract(s),a=o.multiplyBy(-e).add(n).add(o).subtract(r);ji?rt(this._container,a,e):at(this._container,a)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var t in this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,i=this._map.getSize(),e=this._map.containerPointToLayerPoint(i.multiplyBy(-t)).round();this._bounds=new P(e,e.add(i.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),vn=gn.extend({getEvents:function(){var t=gn.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){gn.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");mt(t,"mousemove",o(this._onMouseMove,32,this),this),mt(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),mt(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){g(this._redrawRequest),delete this._ctx,K(this._container),ft(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){this._redrawBounds=null;for(var t in this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){gn.prototype._update.call(this);var t=this._bounds,i=this._container,e=t.getSize(),n=Yi?2:1;at(i,t.min),i.width=n*e.x,i.height=n*e.y,i.style.width=e.x+"px",i.style.height=e.y+"px",Yi&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){gn.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[n(t)]=t;var i=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=i),this._drawLast=i,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var i=t._order,e=i.next,o=i.prev;e?e.prev=o:this._drawLast=o,o?o.next=e:this._drawFirst=e,delete t._order,delete this._layers[n(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var i,e,n=t.options.dashArray.split(/[, ]+/),o=[];for(e=0;e<n.length;e++){if(i=Number(n[e]),isNaN(i))return;o.push(i)}t.options._dashArray=o}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||f(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var i=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new P,this._redrawBounds.extend(t._pxBounds.min.subtract([i,i])),this._redrawBounds.extend(t._pxBounds.max.add([i,i]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var i=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,i.x,i.y)}else this._ctx.clearRect(0,0,this._container.width,this._container.height)},_draw:function(){var t,i=this._redrawBounds;if(this._ctx.save(),i){var e=i.getSize();this._ctx.beginPath(),this._ctx.rect(i.min.x,i.min.y,e.x,e.y),this._ctx.clip()}this._drawing=!0;for(var n=this._drawFirst;n;n=n.next)t=n.layer,(!i||t._pxBounds&&t._pxBounds.intersects(i))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,i){if(this._drawing){var e,n,o,s,r=t._parts,a=r.length,h=this._ctx;if(a){for(h.beginPath(),e=0;e<a;e++){for(n=0,o=r[e].length;n<o;n++)s=r[e][n],h[n?"lineTo":"moveTo"](s.x,s.y);i&&h.closePath()}this._fillStroke(h,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var i=t._point,e=this._ctx,n=Math.max(Math.round(t._radius),1),o=(Math.max(Math.round(t._radiusY),1)||n)/n;1!==o&&(e.save(),e.scale(1,o)),e.beginPath(),e.arc(i.x,i.y/o,n,0,2*Math.PI,!1),1!==o&&e.restore(),this._fillStroke(e,t)}},_fillStroke:function(t,i){var e=i.options;e.fill&&(t.globalAlpha=e.fillOpacity,t.fillStyle=e.fillColor||e.color,t.fill(e.fillRule||"evenodd")),e.stroke&&0!==e.weight&&(t.setLineDash&&t.setLineDash(i.options&&i.options._dashArray||[]),t.globalAlpha=e.opacity,t.lineWidth=e.weight,t.strokeStyle=e.color,t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.stroke())},_onClick:function(t){for(var i,e,n=this._map.mouseEventToLayerPoint(t),o=this._drawFirst;o;o=o.next)(i=o.layer).options.interactive&&i._containsPoint(n)&&!this._map._draggableMoved(i)&&(e=i);e&&(zt(t),this._fireEvent([e],t))},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var i=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,i)}},_handleMouseOut:function(t){var i=this._hoveredLayer;i&&(tt(this._container,"leaflet-interactive"),this._fireEvent([i],t,"mouseout"),this._hoveredLayer=null)},_handleMouseHover:function(t,i){for(var e,n,o=this._drawFirst;o;o=o.next)(e=o.layer).options.interactive&&e._containsPoint(i)&&(n=e);n!==this._hoveredLayer&&(this._handleMouseOut(t),n&&(Q(this._container,"leaflet-interactive"),this._fireEvent([n],t,"mouseover"),this._hoveredLayer=n)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t)},_fireEvent:function(t,i,e){this._map._fireDOMEvent(i,e||i.type,t)},_bringToFront:function(t){var i=t._order;if(i){var e=i.next,n=i.prev;e&&(e.prev=n,n?n.next=e:e&&(this._drawFirst=e),i.prev=this._drawLast,this._drawLast.next=i,i.next=null,this._drawLast=i,this._requestRedraw(t))}},_bringToBack:function(t){var i=t._order;if(i){var e=i.next,n=i.prev;n&&(n.next=e,e?e.prev=n:n&&(this._drawLast=n),i.prev=null,i.next=this._drawFirst,this._drawFirst.prev=i,this._drawFirst=i,this._requestRedraw(t))}}}),yn=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),xn={_initContainer:function(){this._container=G("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(gn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var i=t._container=yn("shape");Q(i,"leaflet-vml-shape "+(this.options.className||"")),i.coordsize="1 1",t._path=yn("path"),i.appendChild(t._path),this._updateStyle(t),this._layers[n(t)]=t},_addPath:function(t){var i=t._container;this._container.appendChild(i),t.options.interactive&&t.addInteractiveTarget(i)},_removePath:function(t){var i=t._container;K(i),t.removeInteractiveTarget(i),delete this._layers[n(t)]},_updateStyle:function(t){var i=t._stroke,e=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(i||(i=t._stroke=yn("stroke")),o.appendChild(i),i.weight=n.weight+"px",i.color=n.color,i.opacity=n.opacity,n.dashArray?i.dashStyle=oi(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):i.dashStyle="",i.endcap=n.lineCap.replace("butt","flat"),i.joinstyle=n.lineJoin):i&&(o.removeChild(i),t._stroke=null),n.fill?(e||(e=t._fill=yn("fill")),o.appendChild(e),e.color=n.fillColor||n.color,e.opacity=n.fillOpacity):e&&(o.removeChild(e),t._fill=null)},_updateCircle:function(t){var i=t._point.round(),e=Math.round(t._radius),n=Math.round(t._radiusY||e);this._setPath(t,t._empty()?"M0 0":"AL "+i.x+","+i.y+" "+e+","+n+" 0,23592600")},_setPath:function(t,i){t._path.v=i},_bringToFront:function(t){X(t._container)},_bringToBack:function(t){J(t._container)}},wn=$i?yn:E,Pn=gn.extend({getEvents:function(){var t=gn.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=wn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=wn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){K(this._container),ft(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){gn.prototype._update.call(this);var t=this._bounds,i=t.getSize(),e=this._container;this._svgSize&&this._svgSize.equals(i)||(this._svgSize=i,e.setAttribute("width",i.x),e.setAttribute("height",i.y)),at(e,t.min),e.setAttribute("viewBox",[t.min.x,t.min.y,i.x,i.y].join(" ")),this.fire("update")}},_initPath:function(t){var i=t._path=wn("path");t.options.className&&Q(i,t.options.className),t.options.interactive&&Q(i,"leaflet-interactive"),this._updateStyle(t),this._layers[n(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){K(t._path),t.removeInteractiveTarget(t._path),delete this._layers[n(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var i=t._path,e=t.options;i&&(e.stroke?(i.setAttribute("stroke",e.color),i.setAttribute("stroke-opacity",e.opacity),i.setAttribute("stroke-width",e.weight),i.setAttribute("stroke-linecap",e.lineCap),i.setAttribute("stroke-linejoin",e.lineJoin),e.dashArray?i.setAttribute("stroke-dasharray",e.dashArray):i.removeAttribute("stroke-dasharray"),e.dashOffset?i.setAttribute("stroke-dashoffset",e.dashOffset):i.removeAttribute("stroke-dashoffset")):i.setAttribute("stroke","none"),e.fill?(i.setAttribute("fill",e.fillColor||e.color),i.setAttribute("fill-opacity",e.fillOpacity),i.setAttribute("fill-rule",e.fillRule||"evenodd")):i.setAttribute("fill","none"))},_updatePoly:function(t,i){this._setPath(t,k(t._parts,i))},_updateCircle:function(t){var i=t._point,e=Math.max(Math.round(t._radius),1),n="a"+e+","+(Math.max(Math.round(t._radiusY),1)||e)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(i.x-e)+","+i.y+n+2*e+",0 "+n+2*-e+",0 ";this._setPath(t,o)},_setPath:function(t,i){t._path.setAttribute("d",i)},_bringToFront:function(t){X(t._path)},_bringToBack:function(t){J(t._path)}});$i&&Pn.include(xn),be.include({getRenderer:function(t){var i=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return i||(i=this._renderer=this._createRenderer()),this.hasLayer(i)||this.addLayer(i),i},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var i=this._paneRenderers[t];return void 0===i&&(i=this._createRenderer({pane:t}),this._paneRenderers[t]=i),i},_createRenderer:function(t){return this.options.preferCanvas&&$t(t)||Qt(t)}});var Ln=on.extend({initialize:function(t,i){on.prototype.initialize.call(this,this._boundsToLatLngs(t),i)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return t=z(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});Pn.create=wn,Pn.pointsToPath=k,sn.geometryToLayer=Ft,sn.coordsToLatLng=Ut,sn.coordsToLatLngs=Vt,sn.latLngToCoords=qt,sn.latLngsToCoords=Gt,sn.getFeature=Kt,sn.asFeature=Yt,be.mergeOptions({boxZoom:!0});var bn=Ee.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){mt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){ft(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){K(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),fi(),ut(),this._startPoint=this._map.mouseEventToContainerPoint(t),mt(document,{contextmenu:Lt,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=G("div","leaflet-zoom-box",this._container),Q(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var i=new P(this._point,this._startPoint),e=i.getSize();at(this._box,i.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(K(this._box),tt(this._container,"leaflet-crosshair")),gi(),lt(),ft(document,{contextmenu:Lt,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(e(this._resetState,this),0);var i=new T(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(i).fire("boxzoomend",{boxZoomBounds:i})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});be.addInitHook("addHandler","boxZoom",bn),be.mergeOptions({doubleClickZoom:!0});var Tn=Ee.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var i=this._map,e=i.getZoom(),n=i.options.zoomDelta,o=t.originalEvent.shiftKey?e-n:e+n;"center"===i.options.doubleClickZoom?i.setZoom(o):i.setZoomAround(t.containerPoint,o)}});be.addInitHook("addHandler","doubleClickZoom",Tn),be.mergeOptions({dragging:!0,inertia:!Mi,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var zn=Ee.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new Re(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}Q(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){tt(this._map._container,"leaflet-grab"),tt(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var i=z(this._map.options.maxBounds);this._offsetLimit=b(this._map.latLngToContainerPoint(i.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(i.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var i=this._lastTime=+new Date,e=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(e),this._times.push(i),this._prunePositions(i)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),i=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=i.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,i){return t-(t-i)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),i=this._offsetLimit;t.x<i.min.x&&(t.x=this._viscousLimit(t.x,i.min.x)),t.y<i.min.y&&(t.y=this._viscousLimit(t.y,i.min.y)),t.x>i.max.x&&(t.x=this._viscousLimit(t.x,i.max.x)),t.y>i.max.y&&(t.y=this._viscousLimit(t.y,i.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,i=Math.round(t/2),e=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-i+e)%t+i-e,s=(n+i+e)%t-i-e,r=Math.abs(o+e)<Math.abs(s+e)?o:s;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=r},_onDragEnd:function(t){var i=this._map,e=i.options,n=!e.inertia||this._times.length<2;if(i.fire("dragend",t),n)i.fire("moveend");else{this._prunePositions(+new Date);var o=this._lastPos.subtract(this._positions[0]),s=(this._lastTime-this._times[0])/1e3,r=e.easeLinearity,a=o.multiplyBy(r/s),h=a.distanceTo([0,0]),u=Math.min(e.inertiaMaxSpeed,h),l=a.multiplyBy(u/h),c=u/(e.inertiaDeceleration*r),_=l.multiplyBy(-c/2).round();_.x||_.y?(_=i._limitOffset(_,i.options.maxBounds),f(function(){i.panBy(_,{duration:c,easeLinearity:r,noMoveStart:!0,animate:!0})})):i.fire("moveend")}}});be.addInitHook("addHandler","dragging",zn),be.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Mn=Ee.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),mt(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),ft(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,i=document.documentElement,e=t.scrollTop||i.scrollTop,n=t.scrollLeft||i.scrollLeft;this._map._container.focus(),window.scrollTo(n,e)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var i,e,n=this._panKeys={},o=this.keyCodes;for(i=0,e=o.left.length;i<e;i++)n[o.left[i]]=[-1*t,0];for(i=0,e=o.right.length;i<e;i++)n[o.right[i]]=[t,0];for(i=0,e=o.down.length;i<e;i++)n[o.down[i]]=[0,t];for(i=0,e=o.up.length;i<e;i++)n[o.up[i]]=[0,-1*t]},_setZoomDelta:function(t){var i,e,n=this._zoomKeys={},o=this.keyCodes;for(i=0,e=o.zoomIn.length;i<e;i++)n[o.zoomIn[i]]=t;for(i=0,e=o.zoomOut.length;i<e;i++)n[o.zoomOut[i]]=-t},_addHooks:function(){mt(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){ft(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var i,e=t.keyCode,n=this._map;if(e in this._panKeys)n._panAnim&&n._panAnim._inProgress||(i=this._panKeys[e],t.shiftKey&&(i=w(i).multiplyBy(3)),n.panBy(i),n.options.maxBounds&&n.panInsideBounds(n.options.maxBounds));else if(e in this._zoomKeys)n.setZoom(n.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[e]);else{if(27!==e||!n._popup||!n._popup.options.closeOnEscapeKey)return;n.closePopup()}Lt(t)}}});be.addInitHook("addHandler","keyboard",Mn),be.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var Cn=Ee.extend({addHooks:function(){mt(this._map._container,"mousewheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){ft(this._map._container,"mousewheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var i=Tt(t),n=this._map.options.wheelDebounceTime;this._delta+=i,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var o=Math.max(n-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(e(this._performZoom,this),o),Lt(t)},_performZoom:function(){var t=this._map,i=t.getZoom(),e=this._map.options.zoomSnap||0;t._stop();var n=this._delta/(4*this._map.options.wheelPxPerZoomLevel),o=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,s=e?Math.ceil(o/e)*e:o,r=t._limitZoom(i+(this._delta>0?s:-s))-i;this._delta=0,this._startTime=null,r&&("center"===t.options.scrollWheelZoom?t.setZoom(i+r):t.setZoomAround(this._lastMousePos,i+r))}});be.addInitHook("addHandler","scrollWheelZoom",Cn),be.mergeOptions({tap:!0,tapTolerance:15});var Sn=Ee.extend({addHooks:function(){mt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){ft(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(Pt(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var i=t.touches[0],n=i.target;this._startPos=this._newPos=new x(i.clientX,i.clientY),n.tagName&&"a"===n.tagName.toLowerCase()&&Q(n,"leaflet-active"),this._holdTimeout=setTimeout(e(function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",i))},this),1e3),this._simulateEvent("mousedown",i),mt(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),ft(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var i=t.changedTouches[0],e=i.target;e&&e.tagName&&"a"===e.tagName.toLowerCase()&&tt(e,"leaflet-active"),this._simulateEvent("mouseup",i),this._isTapValid()&&this._simulateEvent("click",i)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var i=t.touches[0];this._newPos=new x(i.clientX,i.clientY),this._simulateEvent("mousemove",i)},_simulateEvent:function(t,i){var e=document.createEvent("MouseEvents");e._simulated=!0,i.target._simulatedClick=!0,e.initMouseEvent(t,!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),i.target.dispatchEvent(e)}});qi&&!Vi&&be.addInitHook("addHandler","tap",Sn),be.mergeOptions({touchZoom:qi&&!Mi,bounceAtZoomLimits:!0});var Zn=Ee.extend({addHooks:function(){Q(this._map._container,"leaflet-touch-zoom"),mt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){tt(this._map._container,"leaflet-touch-zoom"),ft(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var i=this._map;if(t.touches&&2===t.touches.length&&!i._animatingZoom&&!this._zooming){var e=i.mouseEventToContainerPoint(t.touches[0]),n=i.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=i.getSize()._divideBy(2),this._startLatLng=i.containerPointToLatLng(this._centerPoint),"center"!==i.options.touchZoom&&(this._pinchStartLatLng=i.containerPointToLatLng(e.add(n)._divideBy(2))),this._startDist=e.distanceTo(n),this._startZoom=i.getZoom(),this._moved=!1,this._zooming=!0,i._stop(),mt(document,"touchmove",this._onTouchMove,this),mt(document,"touchend",this._onTouchEnd,this),Pt(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var i=this._map,n=i.mouseEventToContainerPoint(t.touches[0]),o=i.mouseEventToContainerPoint(t.touches[1]),s=n.distanceTo(o)/this._startDist;if(this._zoom=i.getScaleZoom(s,this._startZoom),!i.options.bounceAtZoomLimits&&(this._zoom<i.getMinZoom()&&s<1||this._zoom>i.getMaxZoom()&&s>1)&&(this._zoom=i._limitZoom(this._zoom)),"center"===i.options.touchZoom){if(this._center=this._startLatLng,1===s)return}else{var r=n._add(o)._divideBy(2)._subtract(this._centerPoint);if(1===s&&0===r.x&&0===r.y)return;this._center=i.unproject(i.project(this._pinchStartLatLng,this._zoom).subtract(r),this._zoom)}this._moved||(i._moveStart(!0,!1),this._moved=!0),g(this._animRequest);var a=e(i._move,i,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=f(a,this,!0),Pt(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,g(this._animRequest),ft(document,"touchmove",this._onTouchMove),ft(document,"touchend",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});be.addInitHook("addHandler","touchZoom",Zn),be.BoxZoom=bn,be.DoubleClickZoom=Tn,be.Drag=zn,be.Keyboard=Mn,be.ScrollWheelZoom=Cn,be.Tap=Sn,be.TouchZoom=Zn,Object.freeze=ti,t.version="1.4.0+HEAD.3337f36",t.Control=Te,t.control=ze,t.Browser=Qi,t.Evented=ci,t.Mixin=Be,t.Util=ui,t.Class=v,t.Handler=Ee,t.extend=i,t.bind=e,t.stamp=n,t.setOptions=l,t.DomEvent=Pe,t.DomUtil=ve,t.PosAnimation=Le,t.Draggable=Re,t.LineUtil=Ne,t.PolyUtil=De,t.Point=x,t.point=w,t.Bounds=P,t.bounds=b,t.Transformation=S,t.transformation=Z,t.Projection=He,t.LatLng=M,t.latLng=C,t.LatLngBounds=T,t.latLngBounds=z,t.CRS=di,t.GeoJSON=sn,t.geoJSON=Xt,t.geoJson=an,t.Layer=qe,t.LayerGroup=Ge,t.layerGroup=function(t,i){return new Ge(t,i)},t.FeatureGroup=Ke,t.featureGroup=function(t){return new Ke(t)},t.ImageOverlay=hn,t.imageOverlay=function(t,i,e){return new hn(t,i,e)},t.VideoOverlay=un,t.videoOverlay=function(t,i,e){return new un(t,i,e)},t.DivOverlay=ln,t.Popup=cn,t.popup=function(t,i){return new cn(t,i)},t.Tooltip=_n,t.tooltip=function(t,i){return new _n(t,i)},t.Icon=Ye,t.icon=function(t){return new Ye(t)},t.DivIcon=dn,t.divIcon=function(t){return new dn(t)},t.Marker=$e,t.marker=function(t,i){return new $e(t,i)},t.TileLayer=mn,t.tileLayer=Jt,t.GridLayer=pn,t.gridLayer=function(t){return new pn(t)},t.SVG=Pn,t.svg=Qt,t.Renderer=gn,t.Canvas=vn,t.canvas=$t,t.Path=Qe,t.CircleMarker=tn,t.circleMarker=function(t,i){return new tn(t,i)},t.Circle=en,t.circle=function(t,i,e){return new en(t,i,e)},t.Polyline=nn,t.polyline=function(t,i){return new nn(t,i)},t.Polygon=on,t.polygon=function(t,i){return new on(t,i)},t.Rectangle=Ln,t.rectangle=function(t,i){return new Ln(t,i)},t.Map=be,t.map=function(t,i){return new be(t,i)};var En=window.L;t.noConflict=function(){return window.L=En,this},window.L=t});