From 0bc11f9f6f31c4f052e4f26e797a307a18a3f84c Mon Sep 17 00:00:00 2001 From: Alex de Mulder Date: Thu, 30 Jul 2015 20:39:51 +0200 Subject: [PATCH] Fixed #1140, labels and points correctly stack. --- dist/vis.js | 10 ++++++++-- lib/timeline/component/graph2d_types/bar.js | 8 +++++++- lib/timeline/component/graph2d_types/points.js | 11 ++++++----- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/dist/vis.js b/dist/vis.js index 9fc5e0f1..fff79531 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -5,7 +5,7 @@ * A dynamic, browser-based visualization library. * * @version 4.6.1-SNAPSHOT - * @date 2015-07-27 + * @date 2015-07-30 * * @license * Copyright (C) 2011-2014 Almende B.V, http://almende.com @@ -25795,7 +25795,13 @@ return /******/ (function(modules) { // webpackBootstrap DOMutil.drawBar(combinedData[i].x + drawData.offset, combinedData[i].y - heightOffset, drawData.width, group.zeroPosition - combinedData[i].y, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style); // draw points if (group.options.drawPoints.enabled === true) { - Points.draw([combinedData[i]], group, framework, drawData.offset); + var pointData = { + x: combinedData[i].x + drawData.offset, + y: combinedData[i].y - heightOffset, + groupId: combinedData[i].groupId, + label: combinedData[i].label + }; + Points.draw([pointData], group, framework, drawData.offset); //DOMutil.drawPoint(combinedData[i].x + drawData.offset, combinedData[i].y, group, framework.svgElements, framework.svg); } } diff --git a/lib/timeline/component/graph2d_types/bar.js b/lib/timeline/component/graph2d_types/bar.js index c5474b94..19b18b3f 100644 --- a/lib/timeline/component/graph2d_types/bar.js +++ b/lib/timeline/component/graph2d_types/bar.js @@ -119,7 +119,13 @@ 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 + ' vis-bar', framework.svgElements, framework.svg, group.style); // draw points if (group.options.drawPoints.enabled === true) { - Points.draw([combinedData[i]], group, framework, drawData.offset); + let pointData = { + x:combinedData[i].x + drawData.offset, + y:combinedData[i].y - heightOffset, + groupId: combinedData[i].groupId, + label: combinedData[i].label, + }; + Points.draw([pointData], group, framework, drawData.offset); //DOMutil.drawPoint(combinedData[i].x + drawData.offset, combinedData[i].y, group, framework.svgElements, framework.svg); } } diff --git a/lib/timeline/component/graph2d_types/points.js b/lib/timeline/component/graph2d_types/points.js index f407fddc..f54df328 100644 --- a/lib/timeline/component/graph2d_types/points.js +++ b/lib/timeline/component/graph2d_types/points.js @@ -37,11 +37,12 @@ Points.draw = function (dataset, group, framework, offset) { if (!callback) { // draw the point the simple way. DOMutil.drawPoint(dataset[i].x + offset, dataset[i].y, getGroupTemplate(), framework.svgElements, framework.svg, dataset[i].label); - } else { - var callbackResult = callback(dataset[i], group, framework); // result might be true, false or an object - if (callbackResult === true || typeof callbackResult === 'object') { - DOMutil.drawPoint(dataset[i].x + offset, dataset[i].y, getGroupTemplate(callbackResult), framework.svgElements, framework.svg, dataset[i].label); - } + } + else { + var callbackResult = callback(dataset[i], group, framework); // result might be true, false or an object + if (callbackResult === true || typeof callbackResult === 'object') { + DOMutil.drawPoint(dataset[i].x + offset, dataset[i].y, getGroupTemplate(callbackResult), framework.svgElements, framework.svg, dataset[i].label); + } } }