Browse Source

merged pull request #464

v3_develop
Alex de Mulder 10 years ago
parent
commit
eeb70e4dc2
4 changed files with 243 additions and 228 deletions
  1. +185
    -198
      dist/vis.js
  2. +1
    -1
      dist/vis.map
  3. +15
    -15
      dist/vis.min.js
  4. +42
    -14
      lib/network/Network.js

+ 185
- 198
dist/vis.js View File

@ -4,8 +4,8 @@
* *
* A dynamic, browser-based visualization library. * A dynamic, browser-based visualization library.
* *
* @version 3.7.1-SNAPSHOT
* @date 2014-11-25
* @version 3.7.0
* @date 2014-11-21
* *
* @license * @license
* Copyright (C) 2011-2014 Almende B.V, http://almende.com * Copyright (C) 2011-2014 Almende B.V, http://almende.com
@ -7475,7 +7475,7 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {Date} [end] The end date * @param {Date} [end] The end date
* @param {Number} [minimumStep] Optional. Minimum step size in milliseconds * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds
*/ */
function DataStep(start, end, minimumStep, containerHeight, customRange, alignZeros) {
function DataStep(start, end, minimumStep, containerHeight, customRange) {
// variables // variables
this.current = 0; this.current = 0;
@ -7491,8 +7491,6 @@ return /******/ (function(modules) { // webpackBootstrap
this.majorSteps = [1, 2, 5, 10]; this.majorSteps = [1, 2, 5, 10];
this.minorSteps = [0.25, 0.5, 1, 2]; this.minorSteps = [0.25, 0.5, 1, 2];
this.alignZeros = alignZeros;
this.setRange(start, end, minimumStep, containerHeight, customRange); this.setRange(start, end, minimumStep, containerHeight, customRange);
} }
@ -7517,10 +7515,9 @@ return /******/ (function(modules) { // webpackBootstrap
this._end += 1; this._end += 1;
} }
if (this.autoScale == true) {
if (this.autoScale) {
this.setMinimumStep(minimumStep, containerHeight); this.setMinimumStep(minimumStep, containerHeight);
} }
this.setFirst(customRange); this.setFirst(customRange);
}; };
@ -7573,23 +7570,16 @@ return /******/ (function(modules) { // webpackBootstrap
if (customRange === undefined) { if (customRange === undefined) {
customRange = {}; customRange = {};
} }
var niceStart = customRange.min === undefined ? this._start - (this.scale * 2 * this.minorSteps[this.stepIndex]) : customRange.min; var niceStart = customRange.min === undefined ? this._start - (this.scale * 2 * this.minorSteps[this.stepIndex]) : customRange.min;
var niceEnd = customRange.max === undefined ? this._end + (this.scale * this.minorSteps[this.stepIndex]) : customRange.max; var niceEnd = customRange.max === undefined ? this._end + (this.scale * this.minorSteps[this.stepIndex]) : customRange.max;
this.marginEnd = customRange.max === undefined ? this.roundToMinor(niceEnd) : customRange.max; this.marginEnd = customRange.max === undefined ? this.roundToMinor(niceEnd) : customRange.max;
this.marginStart = customRange.min === undefined ? this.roundToMinor(niceStart) : customRange.min; this.marginStart = customRange.min === undefined ? this.roundToMinor(niceStart) : customRange.min;
// if we need to align the zero's we need to make sure that there is a zero to use.
if (this.alignZeros == true && (this.marginEnd - this.marginStart) % this.step != 0) {
this.marginEnd += this.marginEnd % this.step;
}
this.deadSpace = this.roundToMinor(niceEnd) - niceEnd + this.roundToMinor(niceStart) - niceStart; this.deadSpace = this.roundToMinor(niceEnd) - niceEnd + this.roundToMinor(niceStart) - niceStart;
this.marginRange = this.marginEnd - this.marginStart; this.marginRange = this.marginEnd - this.marginStart;
this.current = this.marginEnd; this.current = this.marginEnd;
}; };
DataStep.prototype.roundToMinor = function(value) { DataStep.prototype.roundToMinor = function(value) {
@ -8014,8 +8004,8 @@ return /******/ (function(modules) { // webpackBootstrap
var changed = (this.start != newStart || this.end != newEnd); var changed = (this.start != newStart || this.end != newEnd);
// if the new range does NOT overlap with the old range, emit checkRangedItems to avoid not showing ranged items (ranged meaning has end time, not neccesarily of type Range) // if the new range does NOT overlap with the old range, emit checkRangedItems to avoid not showing ranged items (ranged meaning has end time, not neccesarily of type Range)
if (!((newStart >= this.start && newStart <= this.end) || (newEnd >= this.start && newEnd <= this.end)) &&
!((this.start >= newStart && this.start <= newEnd) || (this.end >= newStart && this.end <= newEnd) )) {
if (!((newStart >= this.start && newStart <= this.start) || (newEnd >= this.start && newEnd <= this.end)) &&
!((this.start >= newStart && this.start <= newEnd) || (this.end >= newStart && this.end <= newEnd) )) {
this.body.emitter.emit('checkRangedItems'); this.body.emitter.emit('checkRangedItems');
} }
@ -9529,7 +9519,6 @@ return /******/ (function(modules) { // webpackBootstrap
iconWidth: 20, iconWidth: 20,
width: '40px', width: '40px',
visible: true, visible: true,
alignZeros: true,
customRange: { customRange: {
left: {min:undefined, max:undefined}, left: {min:undefined, max:undefined},
right: {min:undefined, max:undefined} right: {min:undefined, max:undefined}
@ -9567,8 +9556,6 @@ return /******/ (function(modules) { // webpackBootstrap
this.stepPixels = 25; this.stepPixels = 25;
this.stepPixelsForced = 25; this.stepPixelsForced = 25;
this.zeroCrossing = -1;
this.lineOffset = 0; this.lineOffset = 0;
this.master = true; this.master = true;
this.svgElements = {}; this.svgElements = {};
@ -9630,8 +9617,7 @@ return /******/ (function(modules) { // webpackBootstrap
'visible', 'visible',
'customRange', 'customRange',
'title', 'title',
'format',
'alignZeros'
'format'
]; ];
util.selectiveExtend(fields, this.options, options); util.selectiveExtend(fields, this.options, options);
@ -9743,11 +9729,6 @@ return /******/ (function(modules) { // webpackBootstrap
* @param end * @param end
*/ */
DataAxis.prototype.setRange = function (start, end) { DataAxis.prototype.setRange = function (start, end) {
if (this.master == false && this.options.alignZeros == true && this.zeroCrossing != -1) {
if (start > 0) {
start = 0;
}
}
this.range.start = start; this.range.start = start;
this.range.end = end; this.range.end = end;
}; };
@ -9845,26 +9826,16 @@ return /******/ (function(modules) { // webpackBootstrap
// calculate range and step (step such that we have space for 7 characters per label) // calculate range and step (step such that we have space for 7 characters per label)
var minimumStep = this.master ? this.props.majorCharHeight || 10 : this.stepPixelsForced; var minimumStep = this.master ? this.props.majorCharHeight || 10 : this.stepPixelsForced;
var step = new DataStep(
this.range.start,
this.range.end,
minimumStep,
this.dom.frame.offsetHeight,
this.options.customRange[this.options.orientation],
this.master == false && this.options.alignZeros // doess the step have to align zeros? only if not master and the options is on
);
var step = new DataStep(this.range.start, this.range.end, minimumStep, this.dom.frame.offsetHeight, this.options.customRange[this.options.orientation]);
this.step = step; this.step = step;
// get the distance in pixels for a step // get the distance in pixels for a step
// dead space is space that is "left over" after a step // dead space is space that is "left over" after a step
var stepPixels = (this.dom.frame.offsetHeight - (step.deadSpace * (this.dom.frame.offsetHeight / step.marginRange))) / (((step.marginRange - step.deadSpace) / step.step)); var stepPixels = (this.dom.frame.offsetHeight - (step.deadSpace * (this.dom.frame.offsetHeight / step.marginRange))) / (((step.marginRange - step.deadSpace) / step.step));
this.stepPixels = stepPixels; this.stepPixels = stepPixels;
var amountOfSteps = this.height / stepPixels; var amountOfSteps = this.height / stepPixels;
var stepDifference = 0; var stepDifference = 0;
// the slave axis needs to use the same horizontal lines as the master axis.
if (this.master == false) { if (this.master == false) {
stepPixels = this.stepPixelsForced; stepPixels = this.stepPixelsForced;
stepDifference = Math.round((this.dom.frame.offsetHeight / stepPixels) - amountOfSteps); stepDifference = Math.round((this.dom.frame.offsetHeight / stepPixels) - amountOfSteps);
@ -9872,16 +9843,6 @@ return /******/ (function(modules) { // webpackBootstrap
step.previous(); step.previous();
} }
amountOfSteps = this.height / stepPixels; amountOfSteps = this.height / stepPixels;
if (this.zeroCrossing != -1 && this.options.alignZeros == true) {
var zeroStepDifference = (step.marginEnd / step.step) - this.zeroCrossing;
if (zeroStepDifference > 0) {
for (var i = 0; i < zeroStepDifference; i++) {step.next();}
}
else if (zeroStepDifference < 0) {
for (var i = 0; i < -zeroStepDifference; i++) {step.previous();}
}
}
} }
else { else {
amountOfSteps += 0.25; amountOfSteps += 0.25;
@ -9923,10 +9884,6 @@ return /******/ (function(modules) { // webpackBootstrap
this._redrawLine(y, orientation, 'grid horizontal minor', this.options.minorLinesOffset, this.props.minorLineWidth); this._redrawLine(y, orientation, 'grid horizontal minor', this.options.minorLinesOffset, this.props.minorLineWidth);
} }
if (this.master == true && step.current == 0) {
this.zeroCrossing = max;
}
max++; max++;
} }
@ -10079,7 +10036,7 @@ return /******/ (function(modules) { // webpackBootstrap
// determine the char width and height on the minor axis // determine the char width and height on the minor axis
if (!('minorCharHeight' in this.props)) { if (!('minorCharHeight' in this.props)) {
var textMinor = document.createTextNode('0'); var textMinor = document.createTextNode('0');
var measureCharMinor = document.createElement('div');
var measureCharMinor = document.createElement('DIV');
measureCharMinor.className = 'yAxis minor measure'; measureCharMinor.className = 'yAxis minor measure';
measureCharMinor.appendChild(textMinor); measureCharMinor.appendChild(textMinor);
this.dom.frame.appendChild(measureCharMinor); this.dom.frame.appendChild(measureCharMinor);
@ -10092,7 +10049,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (!('majorCharHeight' in this.props)) { if (!('majorCharHeight' in this.props)) {
var textMajor = document.createTextNode('0'); var textMajor = document.createTextNode('0');
var measureCharMajor = document.createElement('div');
var measureCharMajor = document.createElement('DIV');
measureCharMajor.className = 'yAxis major measure'; measureCharMajor.className = 'yAxis major measure';
measureCharMajor.appendChild(textMajor); measureCharMajor.appendChild(textMajor);
this.dom.frame.appendChild(measureCharMajor); this.dom.frame.appendChild(measureCharMajor);
@ -10105,7 +10062,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (!('titleCharHeight' in this.props)) { if (!('titleCharHeight' in this.props)) {
var textTitle = document.createTextNode('0'); var textTitle = document.createTextNode('0');
var measureCharTitle = document.createElement('div');
var measureCharTitle = document.createElement('DIV');
measureCharTitle.className = 'yAxis title measure'; measureCharTitle.className = 'yAxis title measure';
measureCharTitle.appendChild(textTitle); measureCharTitle.appendChild(textTitle);
this.dom.frame.appendChild(measureCharTitle); this.dom.frame.appendChild(measureCharTitle);
@ -12297,7 +12254,7 @@ return /******/ (function(modules) { // webpackBootstrap
// except when old selection is empty and new selection is still empty // except when old selection is empty and new selection is still empty
if (newSelection.length > 0 || oldSelection.length > 0) { if (newSelection.length > 0 || oldSelection.length > 0) {
this.body.emitter.emit('select', { this.body.emitter.emit('select', {
items: newSelection
items: this.getSelection()
}); });
} }
}; };
@ -12322,7 +12279,7 @@ return /******/ (function(modules) { // webpackBootstrap
var itemData = me.itemsData.get(item.id); // get a clone of the data from the dataset var itemData = me.itemsData.get(item.id); // get a clone of the data from the dataset
this.options.onUpdate(itemData, function (itemData) { this.options.onUpdate(itemData, function (itemData) {
if (itemData) { if (itemData) {
me.itemsData.getDataSet().update(itemData);
me.itemsData.update(itemData);
} }
}); });
} }
@ -12352,7 +12309,7 @@ return /******/ (function(modules) { // webpackBootstrap
// execute async handler to customize (or cancel) adding an item // execute async handler to customize (or cancel) adding an item
this.options.onAdd(newItem, function (item) { this.options.onAdd(newItem, function (item) {
if (item) { if (item) {
me.itemsData.getDataSet().add(item);
me.itemsData.add(item);
// TODO: need to trigger a redraw? // TODO: need to trigger a redraw?
} }
}); });
@ -12373,42 +12330,15 @@ return /******/ (function(modules) { // webpackBootstrap
if (item) { if (item) {
// multi select items // multi select items
selection = this.getSelection(); // current selection selection = this.getSelection(); // current selection
var shiftKey = event.gesture.touches[0] && event.gesture.touches[0].shiftKey || false;
if (shiftKey) {
// select all items between the old selection and the tapped item
// determine the selection range
var index = selection.indexOf(item.id);
if (index == -1) {
// item is not yet selected -> select it
selection.push(item.id); selection.push(item.id);
var range = ItemSet._getItemRange(this.itemsData.get(selection, this.itemOptions));
// select all items within the selection range
selection = [];
for (var id in this.items) {
if (this.items.hasOwnProperty(id)) {
var _item = this.items[id];
var start = _item.data.start;
var end = (_item.data.end !== undefined) ? _item.data.end : start;
if (start >= range.min && end <= range.max) {
selection.push(_item.id); // do not use id but item.id, id itself is stringified
}
}
}
} }
else { else {
// add/remove this item from the current selection
var index = selection.indexOf(item.id);
if (index == -1) {
// item is not yet selected -> select it
selection.push(item.id);
}
else {
// item is already selected -> deselect it
selection.splice(index, 1);
}
// item is already selected -> deselect it
selection.splice(index, 1);
} }
this.setSelection(selection); this.setSelection(selection);
this.body.emitter.emit('select', { this.body.emitter.emit('select', {
@ -12417,39 +12347,6 @@ return /******/ (function(modules) { // webpackBootstrap
} }
}; };
/**
* Calculate the time range of a list of items
* @param {Array.<Object>} itemsData
* @return {{min: Date, max: Date}} Returns the range of the provided items
* @private
*/
ItemSet._getItemRange = function(itemsData) {
var max = null;
var min = null;
itemsData.forEach(function (data) {
if (min == null || data.start < min) {
min = data.start;
}
if (data.end != undefined) {
if (max == null || data.end > max) {
max = data.end;
}
}
else {
if (max == null || data.start > max) {
max = data.start;
}
}
});
return {
min: min,
max: max
}
};
/** /**
* Find an item from an event target: * Find an item from an event target:
* searches for the attribute 'timeline-item' in the event target's element tree * searches for the attribute 'timeline-item' in the event target's element tree
@ -12776,7 +12673,6 @@ return /******/ (function(modules) { // webpackBootstrap
icons: false, icons: false,
width: '40px', width: '40px',
visible: true, visible: true,
alignZeros: true,
customRange: { customRange: {
left: {min:undefined, max:undefined}, left: {min:undefined, max:undefined},
right: {min:undefined, max:undefined} right: {min:undefined, max:undefined}
@ -13578,7 +13474,6 @@ return /******/ (function(modules) { // webpackBootstrap
changeCalled = this.yAxisLeft.redraw() || changeCalled; changeCalled = this.yAxisLeft.redraw() || changeCalled;
this.yAxisRight.stepPixelsForced = this.yAxisLeft.stepPixels; this.yAxisRight.stepPixelsForced = this.yAxisLeft.stepPixels;
this.yAxisRight.zeroCrossing = this.yAxisLeft.zeroCrossing;
changeCalled = this.yAxisRight.redraw() || changeCalled; changeCalled = this.yAxisRight.redraw() || changeCalled;
} }
else { else {
@ -15490,6 +15385,7 @@ return /******/ (function(modules) { // webpackBootstrap
type: "continuous", type: "continuous",
roundness: 0.5 roundness: 0.5
}, },
dynamicSmoothCurves: true,
maxVelocity: 30, maxVelocity: 30,
minVelocity: 0.1, // px/s minVelocity: 0.1, // px/s
stabilize: true, // stabilize before displaying the network stabilize: true, // stabilize before displaying the network
@ -15514,7 +15410,8 @@ return /******/ (function(modules) { // webpackBootstrap
hideNodesOnDrag: false, hideNodesOnDrag: false,
width : '100%', width : '100%',
height : '100%', height : '100%',
selectable: true
selectable: true,
pixelRatio:1
}; };
this.constants = util.extend({}, this.defaultOptions); this.constants = util.extend({}, this.defaultOptions);
@ -15572,7 +15469,6 @@ return /******/ (function(modules) { // webpackBootstrap
this.startedStabilization = false; this.startedStabilization = false;
this.stabilized = false; this.stabilized = false;
this.stabilizationIterations = null; this.stabilizationIterations = null;
this.draggingNodes = false;
// containers for nodes and edges // containers for nodes and edges
this.calculationNodes = {}; this.calculationNodes = {};
@ -15871,10 +15767,9 @@ return /******/ (function(modules) { // webpackBootstrap
if (options) { if (options) {
var prop; var prop;
var fields = ['nodes','edges','smoothCurves','hierarchicalLayout','clustering','navigation',
'keyboard','dataManipulation','onAdd','onEdit','onEditEdge','onConnect','onDelete','clickToUse'
var fields = ['nodes','edges','smoothCurves','hierarchicalLayout','clustering','navigation','keyboard','dataManipulation',
'onAdd','onEdit','onEditEdge','onConnect','onDelete','clickToUse'
]; ];
// extend all but the values in fields
util.selectiveNotDeepExtend(fields,this.constants, options); util.selectiveNotDeepExtend(fields,this.constants, options);
util.selectiveNotDeepExtend(['color'],this.constants.nodes, options.nodes); util.selectiveNotDeepExtend(['color'],this.constants.nodes, options.nodes);
util.selectiveNotDeepExtend(['color','length'],this.constants.edges, options.edges); util.selectiveNotDeepExtend(['color','length'],this.constants.edges, options.edges);
@ -16005,6 +15900,8 @@ return /******/ (function(modules) { // webpackBootstrap
this.start(); this.start();
}; };
/** /**
* Create the main frame for the Network. * Create the main frame for the Network.
* This function is executed once when a Network object is created. The frame * This function is executed once when a Network object is created. The frame
@ -16023,10 +15920,15 @@ return /******/ (function(modules) { // webpackBootstrap
this.frame.style.position = 'relative'; this.frame.style.position = 'relative';
this.frame.style.overflow = 'hidden'; this.frame.style.overflow = 'hidden';
// create the network canvas (HTML canvas element)
this.frame.canvas = document.createElement( 'canvas' );
//////////////////////////////////////////////////////////////////
this.frame.canvas = document.createElement("canvas");
this.frame.canvas.style.position = 'relative'; this.frame.canvas.style.position = 'relative';
this.frame.appendChild(this.frame.canvas); this.frame.appendChild(this.frame.canvas);
if (!this.frame.canvas.getContext) { if (!this.frame.canvas.getContext) {
var noCanvas = document.createElement( 'DIV' ); var noCanvas = document.createElement( 'DIV' );
noCanvas.style.color = 'red'; noCanvas.style.color = 'red';
@ -16035,6 +15937,23 @@ return /******/ (function(modules) { // webpackBootstrap
noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
this.frame.canvas.appendChild(noCanvas); this.frame.canvas.appendChild(noCanvas);
} }
else {
var ctx = this.frame.canvas.getContext("2d");
this.constants.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio ||
ctx.mozBackingStorePixelRatio ||
ctx.msBackingStorePixelRatio ||
ctx.oBackingStorePixelRatio ||
ctx.backingStorePixelRatio || 1);
this.frame.canvas.getContext("2d").setTransform(this.constants.pixelRatio, 0, 0, this.constants.pixelRatio, 0, 0);
}
//////////////////////////////////////////////////////////////////
var me = this; var me = this;
this.drag = {}; this.drag = {};
@ -16162,10 +16081,8 @@ return /******/ (function(modules) { // webpackBootstrap
drag.selection = []; drag.selection = [];
drag.translation = this._getTranslation(); drag.translation = this._getTranslation();
drag.nodeId = null; drag.nodeId = null;
this.draggingNodes = false;
if (node != null && this.constants.dragNodes == true) { if (node != null && this.constants.dragNodes == true) {
this.draggingNodes = true;
drag.nodeId = node.id; drag.nodeId = node.id;
// select the clicked node if not yet selected // select the clicked node if not yet selected
if (!node.isSelected()) { if (!node.isSelected()) {
@ -16292,13 +16209,7 @@ return /******/ (function(modules) { // webpackBootstrap
else { else {
this._redraw(); this._redraw();
} }
if (this.draggingNodes == false) {
this.emit("dragEnd",{nodeIds:[]});
}
else {
this.emit("dragEnd",{nodeIds:this.getSelection().nodes});
}
this.emit("dragEnd",{nodeIds:this.getSelection().nodes});
} }
/** /**
* handle tap/click event: select/unselect a node * handle tap/click event: select/unselect a node
@ -16629,8 +16540,8 @@ return /******/ (function(modules) { // webpackBootstrap
this.frame.canvas.style.width = '100%'; this.frame.canvas.style.width = '100%';
this.frame.canvas.style.height = '100%'; this.frame.canvas.style.height = '100%';
this.frame.canvas.width = this.frame.canvas.clientWidth;
this.frame.canvas.height = this.frame.canvas.clientHeight;
this.frame.canvas.width = this.frame.canvas.clientWidth * this.constants.pixelRatio;
this.frame.canvas.height = this.frame.canvas.clientHeight * this.constants.pixelRatio;
this.constants.width = width; this.constants.width = width;
this.constants.height = height; this.constants.height = height;
@ -16641,18 +16552,18 @@ return /******/ (function(modules) { // webpackBootstrap
// this would adapt the width of the canvas to the width from 100% if and only if // this would adapt the width of the canvas to the width from 100% if and only if
// there is a change. // there is a change.
if (this.frame.canvas.width != this.frame.canvas.clientWidth) {
this.frame.canvas.width = this.frame.canvas.clientWidth;
if (this.frame.canvas.width != this.frame.canvas.clientWidth * this.constants.pixelRatio) {
this.frame.canvas.width = this.frame.canvas.clientWidth * this.constants.pixelRatio;
emitEvent = true; emitEvent = true;
} }
if (this.frame.canvas.height != this.frame.canvas.clientHeight) {
this.frame.canvas.height = this.frame.canvas.clientHeight;
if (this.frame.canvas.height != this.frame.canvas.clientHeight * this.constants.pixelRatio) {
this.frame.canvas.height = this.frame.canvas.clientHeight * this.constants.pixelRatio;
emitEvent = true; emitEvent = true;
} }
} }
if (emitEvent == true) { if (emitEvent == true) {
this.emit('resize', {width:this.frame.canvas.width,height:this.frame.canvas.height, oldWidth: oldWidth, oldHeight: oldHeight});
this.emit('resize', {width:this.frame.canvas.width * this.constants.pixelRatio,height:this.frame.canvas.height * this.constants.pixelRatio, oldWidth: oldWidth * this.constants.pixelRatio, oldHeight: oldHeight * this.constants.pixelRatio});
} }
}; };
@ -17001,9 +16912,12 @@ return /******/ (function(modules) { // webpackBootstrap
*/ */
Network.prototype._redraw = function() { Network.prototype._redraw = function() {
var ctx = this.frame.canvas.getContext('2d'); var ctx = this.frame.canvas.getContext('2d');
ctx.setTransform(this.constants.pixelRatio, 0, 0, this.constants.pixelRatio, 0, 0);
// clear the canvas // clear the canvas
var w = this.frame.canvas.width;
var h = this.frame.canvas.height;
var w = this.frame.canvas.width * this.constants.pixelRatio;
var h = this.frame.canvas.height * this.constants.pixelRatio;
ctx.clearRect(0, 0, w, h); ctx.clearRect(0, 0, w, h);
// set scaling and translation // set scaling and translation
@ -17016,8 +16930,8 @@ return /******/ (function(modules) { // webpackBootstrap
"y": this._YconvertDOMtoCanvas(0) "y": this._YconvertDOMtoCanvas(0)
}; };
this.canvasBottomRight = { this.canvasBottomRight = {
"x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth),
"y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight)
"x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth * this.constants.pixelRatio),
"y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight * this.constants.pixelRatio)
}; };
@ -21301,6 +21215,9 @@ return /******/ (function(modules) { // webpackBootstrap
var DataSet = __webpack_require__(3); var DataSet = __webpack_require__(3);
var DataView = __webpack_require__(4); var DataView = __webpack_require__(4);
var Range = __webpack_require__(17); var Range = __webpack_require__(17);
var TimeAxis = __webpack_require__(30);
var CurrentTime = __webpack_require__(21);
var CustomTime = __webpack_require__(22);
var ItemSet = __webpack_require__(27); var ItemSet = __webpack_require__(27);
var Activator = __webpack_require__(55); var Activator = __webpack_require__(55);
var DateUtil = __webpack_require__(15); var DateUtil = __webpack_require__(15);
@ -21450,8 +21367,6 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
this.touch = {}; // store state information needed for touch events this.touch = {}; // store state information needed for touch events
this.redrawCount = 0;
// attach the root panel to the provided container // attach the root panel to the provided container
if (!container) throw new Error('No container provided'); if (!container) throw new Error('No container provided');
container.appendChild(this.dom.root); container.appendChild(this.dom.root);
@ -21889,15 +21804,7 @@ return /******/ (function(modules) { // webpackBootstrap
}); });
if (resized) { if (resized) {
// keep repainting until all sizes are settled // keep repainting until all sizes are settled
var MAX_REDRAWS = 2; // maximum number of consecutive redraws
if (this.redrawCount < MAX_REDRAWS) {
this.redrawCount++;
this.redraw();
}
else {
console.log('WARNING: infinite loop in redraw?')
}
this.redrawCount = 0;
this.redraw();
} }
this.emit("finishedRedraw"); this.emit("finishedRedraw");
@ -22824,7 +22731,7 @@ return /******/ (function(modules) { // webpackBootstrap
DOMutil.drawBar(combinedData[i].x + drawData.offset, combinedData[i].y - heightOffset, drawData.width, group.zeroPosition - combinedData[i].y, group.className + ' bar', framework.svgElements, framework.svg); DOMutil.drawBar(combinedData[i].x + drawData.offset, combinedData[i].y - heightOffset, drawData.width, group.zeroPosition - combinedData[i].y, group.className + ' bar', framework.svgElements, framework.svg);
// draw points // draw points
if (group.options.drawPoints.enabled == true) { if (group.options.drawPoints.enabled == true) {
Points.draw(combinedData, group, framework, drawData.offset);
Points.draw(dataset, group, framework, drawData.offset);
} }
} }
}; };
@ -23712,7 +23619,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global, module) {//! moment.js var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global, module) {//! moment.js
//! version : 2.8.3
//! version : 2.8.4
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT //! license : MIT
//! momentjs.com //! momentjs.com
@ -23723,7 +23630,7 @@ return /******/ (function(modules) { // webpackBootstrap
************************************/ ************************************/
var moment, var moment,
VERSION = '2.8.3',
VERSION = '2.8.4',
// the global-scope this is NOT the global object in Node.js // the global-scope this is NOT the global object in Node.js
globalScope = typeof global !== 'undefined' ? global : this, globalScope = typeof global !== 'undefined' ? global : this,
oldGlobalMoment, oldGlobalMoment,
@ -23746,7 +23653,7 @@ return /******/ (function(modules) { // webpackBootstrap
momentProperties = [], momentProperties = [],
// check for nodeJS // check for nodeJS
hasModule = (typeof module !== 'undefined' && module.exports),
hasModule = (typeof module !== 'undefined' && module && module.exports),
// ASP.NET json date format regex // ASP.NET json date format regex
aspNetJsonRegex = /^\/?Date\((\-?\d+)/i, aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
@ -23757,8 +23664,8 @@ return /******/ (function(modules) { // webpackBootstrap
isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/, isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,
// format tokens // format tokens
formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,
formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
// parsing token regexes // parsing token regexes
parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99 parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99
@ -23769,8 +23676,8 @@ return /******/ (function(modules) { // webpackBootstrap
parseTokenWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, // any word (or two) characters or numbers including two/three word month in arabic. parseTokenWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, // any word (or two) characters or numbers including two/three word month in arabic.
parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
parseTokenT = /T/i, // T (ISO separator) parseTokenT = /T/i, // T (ISO separator)
parseTokenOffsetMs = /[\+\-]?\d+/, // 1234567890123
parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
parseTokenOrdinal = /\d{1,2}/,
//strict parsing regexes //strict parsing regexes
parseTokenOneDigit = /\d/, // 0 - 9 parseTokenOneDigit = /\d/, // 0 - 9
@ -23985,6 +23892,9 @@ return /******/ (function(modules) { // webpackBootstrap
zz : function () { zz : function () {
return this.zoneName(); return this.zoneName();
}, },
x : function () {
return this.valueOf();
},
X : function () { X : function () {
return this.unix(); return this.unix();
}, },
@ -24411,7 +24321,10 @@ return /******/ (function(modules) { // webpackBootstrap
overflow = overflow =
m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH : m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH :
m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE : m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE :
m._a[HOUR] < 0 || m._a[HOUR] > 23 ? HOUR :
m._a[HOUR] < 0 || m._a[HOUR] > 24 ||
(m._a[HOUR] === 24 && (m._a[MINUTE] !== 0 ||
m._a[SECOND] !== 0 ||
m._a[MILLISECOND] !== 0)) ? HOUR :
m._a[MINUTE] < 0 || m._a[MINUTE] > 59 ? MINUTE : m._a[MINUTE] < 0 || m._a[MINUTE] > 59 ? MINUTE :
m._a[SECOND] < 0 || m._a[SECOND] > 59 ? SECOND : m._a[SECOND] < 0 || m._a[SECOND] > 59 ? SECOND :
m._a[MILLISECOND] < 0 || m._a[MILLISECOND] > 999 ? MILLISECOND : m._a[MILLISECOND] < 0 || m._a[MILLISECOND] > 999 ? MILLISECOND :
@ -24438,7 +24351,8 @@ return /******/ (function(modules) { // webpackBootstrap
if (m._strict) { if (m._strict) {
m._isValid = m._isValid && m._isValid = m._isValid &&
m._pf.charsLeftOver === 0 && m._pf.charsLeftOver === 0 &&
m._pf.unusedTokens.length === 0;
m._pf.unusedTokens.length === 0 &&
m._pf.bigHour === undefined;
} }
} }
return m._isValid; return m._isValid;
@ -24490,8 +24404,18 @@ return /******/ (function(modules) { // webpackBootstrap
// Return a moment from input, that is local/utc/zone equivalent to model. // Return a moment from input, that is local/utc/zone equivalent to model.
function makeAs(input, model) { function makeAs(input, model) {
return model._isUTC ? moment(input).zone(model._offset || 0) :
moment(input).local();
var res, diff;
if (model._isUTC) {
res = model.clone();
diff = (moment.isMoment(input) || isDate(input) ?
+input : +moment(input)) - (+res);
// Use low-level api, because this fn is low-level api.
res._d.setTime(+res._d + diff);
moment.updateOffset(res, false);
return res;
} else {
return moment(input).local();
}
} }
/************************************ /************************************
@ -24511,6 +24435,9 @@ return /******/ (function(modules) { // webpackBootstrap
this['_' + i] = prop; this['_' + i] = prop;
} }
} }
// Lenient ordinal parsing accepts just a number in addition to
// number + (possibly) stuff coming from _ordinalParseLenient.
this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + /\d{1,2}/.source);
}, },
_months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), _months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
@ -24523,22 +24450,32 @@ return /******/ (function(modules) { // webpackBootstrap
return this._monthsShort[m.month()]; return this._monthsShort[m.month()];
}, },
monthsParse : function (monthName) {
monthsParse : function (monthName, format, strict) {
var i, mom, regex; var i, mom, regex;
if (!this._monthsParse) { if (!this._monthsParse) {
this._monthsParse = []; this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
} }
for (i = 0; i < 12; i++) { for (i = 0; i < 12; i++) {
// make the regex if we don't have it already // make the regex if we don't have it already
if (!this._monthsParse[i]) {
mom = moment.utc([2000, i]);
mom = moment.utc([2000, i]);
if (strict && !this._longMonthsParse[i]) {
this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
}
if (!strict && !this._monthsParse[i]) {
regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
} }
// test the regex // test the regex
if (this._monthsParse[i].test(monthName)) {
if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
return i;
} else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
return i;
} else if (!strict && this._monthsParse[i].test(monthName)) {
return i; return i;
} }
} }
@ -24581,6 +24518,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, },
_longDateFormat : { _longDateFormat : {
LTS : 'h:mm:ss A',
LT : 'h:mm A', LT : 'h:mm A',
L : 'MM/DD/YYYY', L : 'MM/DD/YYYY',
LL : 'MMMM D, YYYY', LL : 'MMMM D, YYYY',
@ -24621,9 +24559,9 @@ return /******/ (function(modules) { // webpackBootstrap
lastWeek : '[Last] dddd [at] LT', lastWeek : '[Last] dddd [at] LT',
sameElse : 'L' sameElse : 'L'
}, },
calendar : function (key, mom) {
calendar : function (key, mom, now) {
var output = this._calendar[key]; var output = this._calendar[key];
return typeof output === 'function' ? output.apply(mom) : output;
return typeof output === 'function' ? output.apply(mom, [now]) : output;
}, },
_relativeTime : { _relativeTime : {
@ -24658,6 +24596,7 @@ return /******/ (function(modules) { // webpackBootstrap
return this._ordinal.replace('%d', number); return this._ordinal.replace('%d', number);
}, },
_ordinal : '%d', _ordinal : '%d',
_ordinalParse : /\d{1,2}/,
preparse : function (string) { preparse : function (string) {
return string; return string;
@ -24799,6 +24738,8 @@ return /******/ (function(modules) { // webpackBootstrap
case 'a': case 'a':
case 'A': case 'A':
return config._locale._meridiemParse; return config._locale._meridiemParse;
case 'x':
return parseTokenOffsetMs;
case 'X': case 'X':
return parseTokenTimestampMs; return parseTokenTimestampMs;
case 'Z': case 'Z':
@ -24833,7 +24774,7 @@ return /******/ (function(modules) { // webpackBootstrap
case 'E': case 'E':
return parseTokenOneOrTwoDigits; return parseTokenOneOrTwoDigits;
case 'Do': case 'Do':
return parseTokenOrdinal;
return strict ? config._locale._ordinalParse : config._locale._ordinalParseLenient;
default : default :
a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), 'i')); a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), 'i'));
return a; return a;
@ -24870,7 +24811,7 @@ return /******/ (function(modules) { // webpackBootstrap
break; break;
case 'MMM' : // fall through to MMMM case 'MMM' : // fall through to MMMM
case 'MMMM' : case 'MMMM' :
a = config._locale.monthsParse(input);
a = config._locale.monthsParse(input, token, config._strict);
// if we didn't find a month name, mark the date as invalid. // if we didn't find a month name, mark the date as invalid.
if (a != null) { if (a != null) {
datePartArray[MONTH] = a; datePartArray[MONTH] = a;
@ -24887,7 +24828,8 @@ return /******/ (function(modules) { // webpackBootstrap
break; break;
case 'Do' : case 'Do' :
if (input != null) { if (input != null) {
datePartArray[DATE] = toInt(parseInt(input, 10));
datePartArray[DATE] = toInt(parseInt(
input.match(/\d{1,2}/)[0], 10));
} }
break; break;
// DAY OF YEAR // DAY OF YEAR
@ -24912,11 +24854,13 @@ return /******/ (function(modules) { // webpackBootstrap
case 'A' : case 'A' :
config._isPm = config._locale.isPM(input); config._isPm = config._locale.isPM(input);
break; break;
// 24 HOUR
case 'H' : // fall through to hh
case 'HH' : // fall through to hh
// HOUR
case 'h' : // fall through to hh case 'h' : // fall through to hh
case 'hh' : case 'hh' :
config._pf.bigHour = true;
/* falls through */
case 'H' : // fall through to HH
case 'HH' :
datePartArray[HOUR] = toInt(input); datePartArray[HOUR] = toInt(input);
break; break;
// MINUTE // MINUTE
@ -24936,6 +24880,10 @@ return /******/ (function(modules) { // webpackBootstrap
case 'SSSS' : case 'SSSS' :
datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000); datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000);
break; break;
// UNIX OFFSET (MILLISECONDS)
case 'x':
config._d = new Date(toInt(input));
break;
// UNIX TIMESTAMP WITH MS // UNIX TIMESTAMP WITH MS
case 'X': case 'X':
config._d = new Date(parseFloat(input) * 1000); config._d = new Date(parseFloat(input) * 1000);
@ -25072,12 +25020,25 @@ return /******/ (function(modules) { // webpackBootstrap
config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
} }
// Check for 24:00:00.000
if (config._a[HOUR] === 24 &&
config._a[MINUTE] === 0 &&
config._a[SECOND] === 0 &&
config._a[MILLISECOND] === 0) {
config._nextDay = true;
config._a[HOUR] = 0;
}
config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input); config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input);
// Apply timezone offset from input. The actual zone can be changed // Apply timezone offset from input. The actual zone can be changed
// with parseZone. // with parseZone.
if (config._tzm != null) { if (config._tzm != null) {
config._d.setUTCMinutes(config._d.getUTCMinutes() + config._tzm); config._d.setUTCMinutes(config._d.getUTCMinutes() + config._tzm);
} }
if (config._nextDay) {
config._a[HOUR] = 24;
}
} }
function dateFromObject(config) { function dateFromObject(config) {
@ -25091,7 +25052,7 @@ return /******/ (function(modules) { // webpackBootstrap
config._a = [ config._a = [
normalizedInput.year, normalizedInput.year,
normalizedInput.month, normalizedInput.month,
normalizedInput.day,
normalizedInput.day || normalizedInput.date,
normalizedInput.hour, normalizedInput.hour,
normalizedInput.minute, normalizedInput.minute,
normalizedInput.second, normalizedInput.second,
@ -25164,6 +25125,10 @@ return /******/ (function(modules) { // webpackBootstrap
config._pf.unusedInput.push(string); config._pf.unusedInput.push(string);
} }
// clear _12h flag if hour is <= 12
if (config._pf.bigHour === true && config._a[HOUR] <= 12) {
config._pf.bigHour = undefined;
}
// handle am pm // handle am pm
if (config._isPm && config._a[HOUR] < 12) { if (config._isPm && config._a[HOUR] < 12) {
config._a[HOUR] += 12; config._a[HOUR] += 12;
@ -25172,7 +25137,6 @@ return /******/ (function(modules) { // webpackBootstrap
if (config._isPm === false && config._a[HOUR] === 12) { if (config._isPm === false && config._a[HOUR] === 12) {
config._a[HOUR] = 0; config._a[HOUR] = 0;
} }
dateFromConfig(config); dateFromConfig(config);
checkOverflow(config); checkOverflow(config);
} }
@ -25432,7 +25396,8 @@ return /******/ (function(modules) { // webpackBootstrap
function makeMoment(config) { function makeMoment(config) {
var input = config._i, var input = config._i,
format = config._f;
format = config._f,
res;
config._locale = config._locale || moment.localeData(config._l); config._locale = config._locale || moment.localeData(config._l);
@ -25456,7 +25421,14 @@ return /******/ (function(modules) { // webpackBootstrap
makeDateFromInput(config); makeDateFromInput(config);
} }
return new Moment(config);
res = new Moment(config);
if (res._nextDay) {
// Adding is smart enough around DST
res.add(1, 'd');
res._nextDay = undefined;
}
return res;
} }
moment = function (input, format, locale, strict) { moment = function (input, format, locale, strict) {
@ -25488,7 +25460,7 @@ return /******/ (function(modules) { // webpackBootstrap
'release. Please refer to ' + 'release. Please refer to ' +
'https://github.com/moment/moment/issues/1407 for more info.', 'https://github.com/moment/moment/issues/1407 for more info.',
function (config) { function (config) {
config._d = new Date(config._i);
config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
} }
); );
@ -25800,7 +25772,12 @@ return /******/ (function(modules) { // webpackBootstrap
toISOString : function () { toISOString : function () {
var m = moment(this).utc(); var m = moment(this).utc();
if (0 < m.year() && m.year() <= 9999) { if (0 < m.year() && m.year() <= 9999) {
return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
if ('function' === typeof Date.prototype.toISOString) {
// native implementation is ~50x faster, use it when we can
return this.toDate().toISOString();
} else {
return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
}
} else { } else {
return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
} }
@ -25919,7 +25896,7 @@ return /******/ (function(modules) { // webpackBootstrap
diff < 1 ? 'sameDay' : diff < 1 ? 'sameDay' :
diff < 2 ? 'nextDay' : diff < 2 ? 'nextDay' :
diff < 7 ? 'nextWeek' : 'sameElse'; diff < 7 ? 'nextWeek' : 'sameElse';
return this.format(this.localeData().calendar(format, this));
return this.format(this.localeData().calendar(format, this, moment(now)));
}, },
isLeapYear : function () { isLeapYear : function () {
@ -25988,36 +25965,45 @@ return /******/ (function(modules) { // webpackBootstrap
endOf: function (units) { endOf: function (units) {
units = normalizeUnits(units); units = normalizeUnits(units);
if (units === undefined || units === 'millisecond') {
return this;
}
return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
}, },
isAfter: function (input, units) { isAfter: function (input, units) {
var inputMs;
units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond'); units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
if (units === 'millisecond') { if (units === 'millisecond') {
input = moment.isMoment(input) ? input : moment(input); input = moment.isMoment(input) ? input : moment(input);
return +this > +input; return +this > +input;
} else { } else {
return +this.clone().startOf(units) > +moment(input).startOf(units);
inputMs = moment.isMoment(input) ? +input : +moment(input);
return inputMs < +this.clone().startOf(units);
} }
}, },
isBefore: function (input, units) { isBefore: function (input, units) {
var inputMs;
units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond'); units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
if (units === 'millisecond') { if (units === 'millisecond') {
input = moment.isMoment(input) ? input : moment(input); input = moment.isMoment(input) ? input : moment(input);
return +this < +input; return +this < +input;
} else { } else {
return +this.clone().startOf(units) < +moment(input).startOf(units);
inputMs = moment.isMoment(input) ? +input : +moment(input);
return +this.clone().endOf(units) < inputMs;
} }
}, },
isSame: function (input, units) { isSame: function (input, units) {
var inputMs;
units = normalizeUnits(units || 'millisecond'); units = normalizeUnits(units || 'millisecond');
if (units === 'millisecond') { if (units === 'millisecond') {
input = moment.isMoment(input) ? input : moment(input); input = moment.isMoment(input) ? input : moment(input);
return +this === +input; return +this === +input;
} else { } else {
return +this.clone().startOf(units) === +makeAs(input, this).startOf(units);
inputMs = +moment(input);
return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units));
} }
}, },
@ -26194,7 +26180,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, },
lang : deprecate( lang : deprecate(
'moment().lang() is deprecated. Use moment().localeData() instead.',
'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
function (key) { function (key) {
if (key === undefined) { if (key === undefined) {
return this.localeData(); return this.localeData();
@ -26415,7 +26401,7 @@ return /******/ (function(modules) { // webpackBootstrap
return units === 'month' ? months : months / 12; return units === 'month' ? months : months / 12;
} else { } else {
// handle milliseconds separately because of floating point math errors (issue #1867) // handle milliseconds separately because of floating point math errors (issue #1867)
days = this._days + yearsToDays(this._months / 12);
days = this._days + Math.round(yearsToDays(this._months / 12));
switch (units) { switch (units) {
case 'week': return days / 7 + this._milliseconds / 6048e5; case 'week': return days / 7 + this._milliseconds / 6048e5;
case 'day': return days + this._milliseconds / 864e5; case 'day': return days + this._milliseconds / 864e5;
@ -26517,6 +26503,7 @@ return /******/ (function(modules) { // webpackBootstrap
// Set default locale, other locale will inherit from English. // Set default locale, other locale will inherit from English.
moment.locale('en', { moment.locale('en', {
ordinalParse: /\d{1,2}(th|st|nd|rd)/,
ordinal : function (number) { ordinal : function (number) {
var b = number % 10, var b = number % 10,
output = (toInt(number % 100 / 10) === 1) ? 'th' : output = (toInt(number % 100 / 10) === 1) ? 'th' :

+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


+ 15
- 15
dist/vis.min.js
File diff suppressed because it is too large
View File


+ 42
- 14
lib/network/Network.js View File

@ -211,7 +211,8 @@ function Network (container, data, options) {
hideNodesOnDrag: false, hideNodesOnDrag: false,
width : '100%', width : '100%',
height : '100%', height : '100%',
selectable: true
selectable: true,
pixelRatio:1
}; };
this.constants = util.extend({}, this.defaultOptions); this.constants = util.extend({}, this.defaultOptions);
@ -702,6 +703,8 @@ Network.prototype.setOptions = function (options) {
this.start(); this.start();
}; };
/** /**
* Create the main frame for the Network. * Create the main frame for the Network.
* This function is executed once when a Network object is created. The frame * This function is executed once when a Network object is created. The frame
@ -720,10 +723,15 @@ Network.prototype._create = function () {
this.frame.style.position = 'relative'; this.frame.style.position = 'relative';
this.frame.style.overflow = 'hidden'; this.frame.style.overflow = 'hidden';
// create the network canvas (HTML canvas element)
this.frame.canvas = document.createElement( 'canvas' );
//////////////////////////////////////////////////////////////////
this.frame.canvas = document.createElement("canvas");
this.frame.canvas.style.position = 'relative'; this.frame.canvas.style.position = 'relative';
this.frame.appendChild(this.frame.canvas); this.frame.appendChild(this.frame.canvas);
if (!this.frame.canvas.getContext) { if (!this.frame.canvas.getContext) {
var noCanvas = document.createElement( 'DIV' ); var noCanvas = document.createElement( 'DIV' );
noCanvas.style.color = 'red'; noCanvas.style.color = 'red';
@ -732,6 +740,23 @@ Network.prototype._create = function () {
noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
this.frame.canvas.appendChild(noCanvas); this.frame.canvas.appendChild(noCanvas);
} }
else {
var ctx = this.frame.canvas.getContext("2d");
this.constants.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio ||
ctx.mozBackingStorePixelRatio ||
ctx.msBackingStorePixelRatio ||
ctx.oBackingStorePixelRatio ||
ctx.backingStorePixelRatio || 1);
this.frame.canvas.getContext("2d").setTransform(this.constants.pixelRatio, 0, 0, this.constants.pixelRatio, 0, 0);
}
//////////////////////////////////////////////////////////////////
var me = this; var me = this;
this.drag = {}; this.drag = {};
@ -1326,8 +1351,8 @@ Network.prototype.setSize = function(width, height) {
this.frame.canvas.style.width = '100%'; this.frame.canvas.style.width = '100%';
this.frame.canvas.style.height = '100%'; this.frame.canvas.style.height = '100%';
this.frame.canvas.width = this.frame.canvas.clientWidth;
this.frame.canvas.height = this.frame.canvas.clientHeight;
this.frame.canvas.width = this.frame.canvas.clientWidth * this.constants.pixelRatio;
this.frame.canvas.height = this.frame.canvas.clientHeight * this.constants.pixelRatio;
this.constants.width = width; this.constants.width = width;
this.constants.height = height; this.constants.height = height;
@ -1338,18 +1363,18 @@ Network.prototype.setSize = function(width, height) {
// this would adapt the width of the canvas to the width from 100% if and only if // this would adapt the width of the canvas to the width from 100% if and only if
// there is a change. // there is a change.
if (this.frame.canvas.width != this.frame.canvas.clientWidth) {
this.frame.canvas.width = this.frame.canvas.clientWidth;
if (this.frame.canvas.width != this.frame.canvas.clientWidth * this.constants.pixelRatio) {
this.frame.canvas.width = this.frame.canvas.clientWidth * this.constants.pixelRatio;
emitEvent = true; emitEvent = true;
} }
if (this.frame.canvas.height != this.frame.canvas.clientHeight) {
this.frame.canvas.height = this.frame.canvas.clientHeight;
if (this.frame.canvas.height != this.frame.canvas.clientHeight * this.constants.pixelRatio) {
this.frame.canvas.height = this.frame.canvas.clientHeight * this.constants.pixelRatio;
emitEvent = true; emitEvent = true;
} }
} }
if (emitEvent == true) { if (emitEvent == true) {
this.emit('resize', {width:this.frame.canvas.width,height:this.frame.canvas.height, oldWidth: oldWidth, oldHeight: oldHeight});
this.emit('resize', {width:this.frame.canvas.width * this.constants.pixelRatio,height:this.frame.canvas.height * this.constants.pixelRatio, oldWidth: oldWidth * this.constants.pixelRatio, oldHeight: oldHeight * this.constants.pixelRatio});
} }
}; };
@ -1698,9 +1723,12 @@ Network.prototype.redraw = function() {
*/ */
Network.prototype._redraw = function() { Network.prototype._redraw = function() {
var ctx = this.frame.canvas.getContext('2d'); var ctx = this.frame.canvas.getContext('2d');
ctx.setTransform(this.constants.pixelRatio, 0, 0, this.constants.pixelRatio, 0, 0);
// clear the canvas // clear the canvas
var w = this.frame.canvas.width;
var h = this.frame.canvas.height;
var w = this.frame.canvas.width * this.constants.pixelRatio;
var h = this.frame.canvas.height * this.constants.pixelRatio;
ctx.clearRect(0, 0, w, h); ctx.clearRect(0, 0, w, h);
// set scaling and translation // set scaling and translation
@ -1713,8 +1741,8 @@ Network.prototype._redraw = function() {
"y": this._YconvertDOMtoCanvas(0) "y": this._YconvertDOMtoCanvas(0)
}; };
this.canvasBottomRight = { this.canvasBottomRight = {
"x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth),
"y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight)
"x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth * this.constants.pixelRatio),
"y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight * this.constants.pixelRatio)
}; };

Loading…
Cancel
Save