Browse Source

Fixed #1585: Allow bar groups to exclude from stacking

codeClimate
Ludo Stellingwerff 8 years ago
parent
commit
5e8b98d4b6
3 changed files with 4 additions and 3 deletions
  1. +1
    -0
      HISTORY.md
  2. +2
    -2
      lib/timeline/component/GraphGroup.js
  3. +1
    -1
      lib/timeline/component/graph2d_types/bar.js

+ 1
- 0
HISTORY.md View File

@ -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.

+ 2
- 2
lib/timeline/component/GraphGroup.js View File

@ -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

+ 1
- 1
lib/timeline/component/graph2d_types/bar.js View File

@ -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;

Loading…
Cancel
Save