From 1aca8e6a670c32b9e03683ad907e473f920b2e6a Mon Sep 17 00:00:00 2001 From: Martin Lepadusch Date: Wed, 11 Mar 2015 13:04:21 +0100 Subject: [PATCH 1/3] Show labels on Bargraph --- lib/timeline/component/graph2d_types/bar.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/timeline/component/graph2d_types/bar.js b/lib/timeline/component/graph2d_types/bar.js index 3dee4b21..4c351308 100644 --- a/lib/timeline/component/graph2d_types/bar.js +++ b/lib/timeline/component/graph2d_types/bar.js @@ -58,7 +58,8 @@ Bargraph.draw = function (groupIds, processedGroupData, framework) { combinedData.push({ x: processedGroupData[groupIds[i]][j].x, y: processedGroupData[groupIds[i]][j].y, - groupId: groupIds[i] + groupId: groupIds[i], + label: processedGroupData[groupIds[i]][j].label, }); barPoints += 1; } @@ -114,7 +115,7 @@ Bargraph.draw = function (groupIds, processedGroupData, framework) { 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 if (group.options.drawPoints.enabled == true) { - DOMutil.drawPoint(combinedData[i].x + drawData.offset, combinedData[i].y, group, framework.svgElements, framework.svg); + DOMutil.drawPoint(combinedData[i].x + drawData.offset, combinedData[i].y, group, framework.svgElements, framework.svg, combinedData[i].label); } } }; @@ -226,4 +227,4 @@ Bargraph._getStackedBarYRange = function (intersections, combinedData) { return {min: yMin, max: yMax}; }; -module.exports = Bargraph; \ No newline at end of file +module.exports = Bargraph; From 95b09a4f77cb81e325ad12d96626c07381098923 Mon Sep 17 00:00:00 2001 From: NotSqrt Date: Thu, 12 Mar 2015 12:11:49 +0100 Subject: [PATCH 2/3] Missing link in index --- examples/graph2d/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/graph2d/index.html b/examples/graph2d/index.html index 560f9d3f..83eeaf42 100644 --- a/examples/graph2d/index.html +++ b/examples/graph2d/index.html @@ -25,6 +25,7 @@

16_bothAxis_titles.html

17_dynamicStyling.html

18_scatterplot.html

+

19_labels.html

From 0b90860fd9ce69653b498b775d8b53ebf6600be2 Mon Sep 17 00:00:00 2001 From: Jos de Jong Date: Thu, 12 Mar 2015 11:46:54 +0000 Subject: [PATCH 3/3] Fixed #708: wrong group detected when page is scrolled. --- HISTORY.md | 1 + lib/timeline/component/ItemSet.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index afbb81fc..3ed67675 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -13,6 +13,7 @@ http://visjs.org - Orientation can now be configured separately for axis and items. - Fixed #654: removed unnecessary minimum height for groups, takes the height of the group label as minimum height now. +- Fixed #708: detecting wrong group when page is scrolled. ## 2015-03-05, version 3.11.0 diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index 17cc7410..5e5aa61b 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -1115,7 +1115,7 @@ ItemSet.prototype._onDragStart = function (event) { if (dragLeftItem) { props = { item: dragLeftItem, - initialX: event.gesture.center.clientX + initialX: event.gesture.center.pageX }; if (me.options.editable.updateTime) { @@ -1130,7 +1130,7 @@ ItemSet.prototype._onDragStart = function (event) { else if (dragRightItem) { props = { item: dragRightItem, - initialX: event.gesture.center.clientX + initialX: event.gesture.center.pageX }; if (me.options.editable.updateTime) { @@ -1147,7 +1147,7 @@ ItemSet.prototype._onDragStart = function (event) { var item = me.items[id]; var props = { item: item, - initialX: event.gesture.center.clientX + initialX: event.gesture.center.pageX }; if (me.options.editable.updateTime) { @@ -1214,7 +1214,7 @@ ItemSet.prototype._onDragStartAddItem = function (event) { var props = { item: newItem, end: end.valueOf(), - initialX: event.gesture.center.clientX + initialX: event.gesture.center.pageX }; this.touchParams.itemProps = [props]; @@ -1241,7 +1241,7 @@ ItemSet.prototype._onDrag = function (event) { // move this.touchParams.itemProps.forEach(function (props) { var newProps = {}; - var current = me.body.util.toTime(event.gesture.center.clientX - xOffset); + var current = me.body.util.toTime(event.gesture.center.pageX - xOffset); var initial = me.body.util.toTime(props.initialX - xOffset); var offset = current - initial; @@ -1607,23 +1607,23 @@ ItemSet.prototype.itemFromTarget = function(event) { * @return {Group | null} group */ ItemSet.prototype.groupFromTarget = function(event) { - var clientY = event.gesture ? event.gesture.center.clientY : event.clientY; + var pageY = event.gesture ? event.gesture.center.pageY : event.pageY; for (var i = 0; i < this.groupIds.length; i++) { var groupId = this.groupIds[i]; var group = this.groups[groupId]; var foreground = group.dom.foreground; var top = util.getAbsoluteTop(foreground); - if (clientY > top && clientY < top + foreground.offsetHeight) { + if (pageY > top && pageY < top + foreground.offsetHeight) { return group; } if (this.options.orientation === 'top') { - if (i === this.groupIds.length - 1 && clientY > top) { + if (i === this.groupIds.length - 1 && pageY > top) { return group; } } else { - if (i === 0 && clientY < top + foreground.offset) { + if (i === 0 && pageY < top + foreground.offset) { return group; } }