|
|
- /**
- * vis.js
- * https://github.com/almende/vis
- *
- * A dynamic, browser-based visualization library.
- *
- * @version 0.0.8
- * @date 2013-05-21
- *
- * @license
- * Copyright (C) 2011-2013 Almende B.V, http://almende.com
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
- (function(t){if("function"==typeof bootstrap)bootstrap("vis",t);else if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeVis=t}else"undefined"!=typeof window?window.vis=t():global.vis=t()})(function(){var t;return function(t,e,i){function n(i,r){if(!e[i]){if(!t[i]){var o="function"==typeof require&&require;if(!r&&o)return o(i,!0);if(s)return s(i,!0);throw Error("Cannot find module '"+i+"'")}var a=e[i]={exports:{}};t[i][0].call(a.exports,function(e){var s=t[i][1][e];return n(s?s:e)},a,a.exports)}return e[i].exports}for(var s="function"==typeof require&&require,r=0;i.length>r;r++)n(i[r]);return n}({1:[function(e,i,n){function s(t){if(this.id=T.randomUUID(),this.options=t||{},this.data={},this.fieldId=this.options.fieldId||"id",this.fieldTypes={},this.options.fieldTypes)for(var e in this.options.fieldTypes)if(this.options.fieldTypes.hasOwnProperty(e)){var i=this.options.fieldTypes[e];this.fieldTypes[e]="Date"==i||"ISODate"==i||"ASPDate"==i?"Date":i}this.subscribers={},this.internalIds={}}function r(t,e){this.id=T.randomUUID(),this.data=null,this.ids={},this.options=e||{},this.fieldId="id",this.subscribers={};var i=this;this.listener=function(){i._onEvent.apply(i,arguments)},this.setData(t)}function o(t,e){this.parent=t,this.options={order:function(t,e){if(t instanceof y){if(e instanceof y){var i=t.data.end-t.data.start,n=e.data.end-e.data.start;return i-n||t.data.start-e.data.start}return-1}return e instanceof y?1:t.data.start-e.data.start}},this.ordered=[],this.setOptions(e)}function a(t){this.id=T.randomUUID(),this.start=0,this.end=0,this.options={min:null,max:null,zoomMin:null,zoomMax:null},this.setOptions(t),this.listeners=[]}function h(){this.subscriptions=[]}function p(){this.id=T.randomUUID(),this.components={},this.repaintTimer=void 0,this.reflowTimer=void 0}function u(){this.id=null,this.parent=null,this.depends=null,this.controller=null,this.options=null,this.frame=null,this.top=0,this.left=0,this.width=0,this.height=0}function c(t,e,i){this.id=T.randomUUID(),this.parent=t,this.depends=e,this.options={},this.setOptions(i)}function d(t,e){this.id=T.randomUUID(),this.container=t,this.options={autoResize:!0},this.listeners={},this.setOptions(e)}function l(t,e,i){this.id=T.randomUUID(),this.parent=t,this.depends=e,this.dom={majorLines:[],majorTexts:[],minorLines:[],minorTexts:[],redundant:{majorLines:[],majorTexts:[],minorLines:[],minorTexts:[]}},this.props={range:{start:0,end:0,minimumStep:0},lineTop:0},this.options={orientation:"bottom",showMinorLabels:!0,showMajorLabels:!0},this.conversion=null,this.range=null,this.setOptions(i)}function f(t,e,i){this.id=T.randomUUID(),this.parent=t,this.depends=e,this.options={style:"box",align:"center",orientation:"bottom",margin:{axis:20,item:10},padding:5},this.dom={};var n=this;this.itemsData=null,this.range=null,this.listeners={add:function(t,e,i){i!=n.id&&n._onAdd(e.items)},update:function(t,e,i){i!=n.id&&n._onUpdate(e.items)},remove:function(t,e,i){i!=n.id&&n._onRemove(e.items)}},this.items={},this.queue={},this.stack=new o(this),this.conversion=null,i&&this.setOptions(i)}function m(t,e,i){this.parent=t,this.data=e,this.dom=null,this.options=i,this.selected=!1,this.visible=!1,this.top=0,this.left=0,this.width=0,this.height=0}function g(t,e,i){this.props={dot:{left:0,top:0,width:0,height:0},line:{top:0,left:0,width:0,height:0}},m.call(this,t,e,i)}function v(t,e,i){this.props={dot:{top:0,width:0,height:0},content:{height:0,marginLeft:0}},m.call(this,t,e,i)}function y(t,e,i){this.props={content:{left:0,width:0}},m.call(this,t,e,i)}function w(t,e,i){this.id=T.randomUUID(),this.parent=t,this.depends=e,this.options={},this.range=null,this.itemsData=null,this.groupsData=null,this.groups=[],this.queue={};var n=this;this.listeners={add:function(t,e){n._onAdd(e.items)},update:function(t,e){n._onUpdate(e.items)},remove:function(t,e){n._onRemove(e.items)}},i&&this.setOptions(i)}function b(t,e,i){var n=this;if(this.options={orientation:"bottom",zoomMin:10,zoomMax:31536e10,mov
- else{if("zoom"!=e)throw new TypeError('Unknown event "'+e+'". '+'Choose "move" or "zoom".');n={component:t,event:e,direction:i,callback:function(t){s._onMouseWheel(t,n)},params:{}},t.on("mousewheel",n.callback),s.listeners.push(n)}},a.prototype.on=function(t,e){D.addListener(this,t,e)},a.prototype._trigger=function(t){D.trigger(this,t,{start:this.start,end:this.end})},a.prototype.setRange=function(t,e){var i=this._applyRange(t,e);i&&(this._trigger("rangechange"),this._trigger("rangechanged"))},a.prototype._applyRange=function(t,e){var i,n=null!=t?T.cast(t,"Number"):this.start,s=null!=e?T.cast(e,"Number"):this.end;if(isNaN(n))throw Error('Invalid start "'+t+'"');if(isNaN(s))throw Error('Invalid end "'+e+'"');if(n>s&&(s=n),null!=this.options.min){var r=this.options.min.valueOf();r>n&&(i=r-n,n+=i,s+=i)}if(null!=this.options.max){var o=this.options.max.valueOf();s>o&&(i=s-o,n-=i,s-=i)}if(null!=this.options.zoomMin){var a=this.options.zoomMin.valueOf();0>a&&(a=0),a>s-n&&(this.end-this.start>a?(i=a-(s-n),n-=i/2,s+=i/2):(n=this.start,s=this.end))}if(null!=this.options.zoomMax){var h=this.options.zoomMax.valueOf();0>h&&(h=0),s-n>h&&(h>this.end-this.start?(i=s-n-h,n+=i/2,s-=i/2):(n=this.start,s=this.end))}var p=this.start!=n||this.end!=s;return this.start=n,this.end=s,p},a.prototype.getRange=function(){return{start:this.start,end:this.end}},a.prototype.conversion=function(t){return this.start,this.end,a.conversion(this.start,this.end,t)},a.conversion=function(t,e,i){return 0!=i&&0!=e-t?{offset:t,factor:i/(e-t)}:{offset:0,factor:1}},a.prototype._onMouseDown=function(t,e){t=t||window.event;var i=e.params,n=t.which?1==t.which:1==t.button;if(n){i.mouseX=T.getPageX(t),i.mouseY=T.getPageY(t),i.previousLeft=0,i.previousOffset=0,i.moved=!1,i.start=this.start,i.end=this.end;var s=e.component.frame;s&&(s.style.cursor="move");var r=this;i.onMouseMove||(i.onMouseMove=function(t){r._onMouseMove(t,e)},T.addEventListener(document,"mousemove",i.onMouseMove)),i.onMouseUp||(i.onMouseUp=function(t){r._onMouseUp(t,e)},T.addEventListener(document,"mouseup",i.onMouseUp)),T.preventDefault(t)}},a.prototype._onMouseMove=function(t,e){t=t||window.event;var i=e.params,n=T.getPageX(t),s=T.getPageY(t);void 0==i.mouseX&&(i.mouseX=n),void 0==i.mouseY&&(i.mouseY=s);var r=n-i.mouseX,o=s-i.mouseY,a="horizontal"==e.direction?r:o;Math.abs(a)>=1&&(i.moved=!0);var h=i.end-i.start,p="horizontal"==e.direction?e.component.width:e.component.height,u=-a/p*h;this._applyRange(i.start+u,i.end+u),this._trigger("rangechange"),T.preventDefault(t)},a.prototype._onMouseUp=function(t,e){t=t||window.event;var i=e.params;e.component.frame&&(e.component.frame.style.cursor="auto"),i.onMouseMove&&(T.removeEventListener(document,"mousemove",i.onMouseMove),i.onMouseMove=null),i.onMouseUp&&(T.removeEventListener(document,"mouseup",i.onMouseUp),i.onMouseUp=null),i.moved&&this._trigger("rangechanged")},a.prototype._onMouseWheel=function(t,e){t=t||window.event;var i=0;if(t.wheelDelta?i=t.wheelDelta/120:t.detail&&(i=-t.detail/3),i){var n=this,s=function(){var s=i/5,r=null,o=e.component.frame;if(o){var a,h;if("horizontal"==e.direction){a=e.component.width,h=n.conversion(a);var p=T.getAbsoluteLeft(o),u=T.getPageX(t);r=(u-p)/h.factor+h.offset}else{a=e.component.height,h=n.conversion(a);var c=T.getAbsoluteTop(o),d=T.getPageY(t);r=(c+a-d-c)/h.factor+h.offset}}n.zoom(s,r)};s()}T.preventDefault(t)},a.prototype.zoom=function(t,e){null==e&&(e=(this.start+this.end)/2),t>=1&&(t=.9),-1>=t&&(t=-.9),0>t&&(t/=1+t);var i=this.start-e,n=this.end-e,s=this.start-i*t,r=this.end-n*t;this.setRange(s,r)},a.prototype.move=function(t){var e=this.end-this.start,i=this.start+e*t,n=this.end+e*t;this.start=i,this.end=n},h.prototype.on=function(t,e,i){var n=t instanceof RegExp?t:RegExp(t.replace("*","\\w+")),s={id:T.randomUUID(),event:t,regexp:n,callback:"function"==typeof e?e:null,target:i};return this.subscriptions.push(s),s.id},h.prototype.off=function(t){for(var e=0;this.subscriptions.length>e;){var i=this.subscriptions[e],n=!0;if(t instanceof Object)for(var s in t)t.hasOwnProperty(s)&&t[s]!==i[s]&&(n=!1);else n=i.id
- },w.prototype._onAdd=function(t){this._toQueue(t,"add")},w.prototype._onRemove=function(t){this._toQueue(t,"remove")},w.prototype._toQueue=function(t,e){var i=this.queue;t.forEach(function(t){i[t]=e}),this.controller&&this.requestRepaint()},b.prototype.setOptions=function(t){T.extend(this.options,t),this.timeaxis.setOptions({orientation:this.options.orientation,showMinorLabels:this.options.showMinorLabels,showMajorLabels:this.options.showMajorLabels}),this.range.setOptions({min:this.options.min,max:this.options.max,zoomMin:this.options.zoomMin,zoomMax:this.options.zoomMax});var e,i,n,s,r=this;if(e="top"==this.options.orientation?function(){return r.timeaxis.height}:function(){return r.main.height-r.timeaxis.height-r.content.height},this.options.height?(n=this.options.height,i=function(){return r.main.height-r.timeaxis.height}):(n=function(){return r.timeaxis.height+r.content.height},i=null),this.options.maxHeight){if(!T.isNumber(this.options.maxHeight))throw new TypeError("Number expected for property maxHeight");s=function(){return r.options.maxHeight-r.timeaxis.height}}this.main.setOptions({height:n}),this.content.setOptions({orientation:this.options.orientation,top:e,height:i,maxHeight:s}),this.controller.repaint()},b.prototype.setItems=function(t){var e,i=null==this.itemsData;if(t?t instanceof s&&(e=t):e=null,t instanceof s||(e=new s({fieldTypes:{start:"Date",end:"Date"}}),e.add(t)),this.itemsData=e,this.content.setItems(e),i&&(void 0==this.options.start||void 0==this.options.end)){var n=this.getItemRange(),r=n.min,o=n.max;if(null!=r&&null!=o){var a=o.valueOf()-r.valueOf();r=new Date(r.valueOf()-.05*a),o=new Date(o.valueOf()+.05*a)}void 0!=this.options.start&&(r=new Date(this.options.start.valueOf())),void 0!=this.options.end&&(o=new Date(this.options.end.valueOf())),(null!=r||null!=o)&&this.range.setRange(r,o)}},b.prototype.setGroups=function(t){this.groupsData=t;var e=this.groupsData?w:f;this.content instanceof e||(this.content&&(this.content.hide(),this.content.setItems&&this.content.setItems(),this.content.setGroups&&this.content.setGroups(),this.controller.remove(this.content)),this.content=new e(this.main,[this.timeaxis]),this.content.setRange&&this.content.setRange(this.range),this.content.setItems&&this.content.setItems(this.itemsData),this.content.setGroups&&this.content.setGroups(this.groupsData),this.controller.add(this.content),this.setOptions(this.options))},b.prototype.getItemRange=function(){var t=this.itemsData,e=null,i=null;if(t){var n=t.min("start");e=n?n.start.valueOf():null;var s=t.max("start");s&&(i=s.start.valueOf());var r=t.max("end");r&&(i=null==i?r.end.valueOf():Math.max(i,r.end.valueOf()))}return{min:null!=e?new Date(e):null,max:null!=i?new Date(i):null}};var _={util:T,events:D,Controller:p,DataSet:s,DataView:r,Range:a,Stack:o,TimeStep:TimeStep,EventBus:h,components:{items:{Item:m,ItemBox:g,ItemPoint:v,ItemRange:y},Component:u,Panel:c,RootPanel:d,ItemSet:f,TimeAxis:l},Timeline:b};n!==void 0&&(n=_),i!==void 0&&i.exports!==void 0&&(i.exports=_),"function"==typeof t&&t(function(){return _}),"undefined"!=typeof window&&(window.vis=_),T.loadCss("/* vis.js stylesheet */\n\n.graph {\n position: relative;\n border: 1px solid #bfbfbf;\n}\n\n.graph .panel {\n position: absolute;\n}\n\n.graph .groupset {\n position: absolute;\n padding: 0;\n margin: 0;\n}\n\n\n.graph .itemset {\n position: absolute;\n padding: 0;\n margin: 0;\n overflow: hidden;\n}\n\n.graph .background {\n}\n\n.graph .foreground {\n}\n\n.graph .itemset-axis {\n position: absolute;\n}\n\n.graph .groupset .itemset-axis {\n border-top: 1px solid #bfbfbf;\n}\n\n.graph .groupset .itemset-axis:last-child {\n border-top: none;\n}\n\n\n.graph .item {\n position: absolute;\n color: #1A1A1A;\n border-color: #97B0F8;\n background-color: #D5DDF6;\n display: inline-block;\n}\n\n.graph .item.selected {\n border-color: #FFC200;\n background-color: #FFF785;\n z-index: 999;\n}\n\n.graph .item.cluster {\n /* TODO: use another color or pattern? */\n background: #97B0F8 url('img/cluste
|