From 5e8b98d4b65afad9b8df92f47edba4dcaee30033 Mon Sep 17 00:00:00 2001 From: Ludo Stellingwerff Date: Thu, 21 Jan 2016 13:03:39 +0100 Subject: [PATCH] Fixed #1585: Allow bar groups to exclude from stacking --- HISTORY.md | 1 + lib/timeline/component/GraphGroup.js | 4 ++-- lib/timeline/component/graph2d_types/bar.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index b384777c..f53eab11 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -24,6 +24,7 @@ http://visjs.org ### Graph2d +- Fixed #1585: Allow bar groups to exclude from stacking - Fixed #1580: Invisible timeline/graph should not be drawn, as most inputs are invalid - Fixed #1177: Fix custom range of slaved right axis. - Fixed #1592: Emit a "changed" event after each redraw. diff --git a/lib/timeline/component/GraphGroup.js b/lib/timeline/component/GraphGroup.js index 289c4f00..20f52e9f 100644 --- a/lib/timeline/component/GraphGroup.js +++ b/lib/timeline/component/GraphGroup.js @@ -16,7 +16,7 @@ var Points = require('./graph2d_types/points'); */ function GraphGroup(group, groupId, options, groupsUsingDefaultStyles) { this.id = groupId; - var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'drawPoints', 'shaded', 'interpolation', 'zIndex']; + var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'drawPoints', 'shaded', 'interpolation', 'zIndex','excludeFromStacking', 'excludeFromLegend']; this.options = util.selectiveBridgeObject(fields, options); this.usingDefaultStyle = group.className === undefined; this.groupsUsingDefaultStyles = groupsUsingDefaultStyles; @@ -65,7 +65,7 @@ GraphGroup.prototype.setZeroPosition = function (pos) { */ GraphGroup.prototype.setOptions = function (options) { if (options !== undefined) { - var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'excludeFromLegend', 'excludeFromStacking', 'zIndex']; + var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'zIndex','excludeFromStacking', 'excludeFromLegend']; util.selectiveDeepExtend(fields, this.options, options); // if the group's drawPoints is a function delegate the callback to the onRender property diff --git a/lib/timeline/component/graph2d_types/bar.js b/lib/timeline/component/graph2d_types/bar.js index ac22a289..32b3d36e 100644 --- a/lib/timeline/component/graph2d_types/bar.js +++ b/lib/timeline/component/graph2d_types/bar.js @@ -113,7 +113,7 @@ Bargraph.draw = function (groupIds, processedGroupData, framework) { drawData = Bargraph._getSafeDrawData(coreDistance, group, minWidth); intersections[key].resolved += 1; - if (group.options.stack === true) { + if (group.options.stack === true && group.options.excludeFromStacking !== true) { if (combinedData[i].screen_y < group.zeroPosition) { heightOffset = intersections[key].accumulatedNegative; intersections[key].accumulatedNegative += group.zeroPosition - combinedData[i].screen_y;