Browse Source

Fix bar graph Y-axis scale with stacking bar graphs.

newShading
Ludo Stellingwerff 9 years ago
parent
commit
9ebdaa9d15
2 changed files with 3 additions and 2 deletions
  1. +1
    -0
      lib/timeline/component/LineGraph.js
  2. +2
    -2
      lib/timeline/component/graph2d_types/bar.js

+ 1
- 0
lib/timeline/component/LineGraph.js View File

@ -1014,6 +1014,7 @@ LineGraph.prototype._convertXcoordinates = function (datapoints) {
var toScreen = this.body.util.toScreen; var toScreen = this.body.util.toScreen;
for (var i = 0; i < datapoints.length; i++) { for (var i = 0; i < datapoints.length; i++) {
datapoints[i].screen_x = toScreen(datapoints[i].x) + this.props.width; datapoints[i].screen_x = toScreen(datapoints[i].x) + this.props.width;
datapoints[i].screen_y = datapoints[i].y; //starting point for range calculations
} }
}; };

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

@ -73,7 +73,7 @@ Bargraph.draw = function (groupIds, processedGroupData, framework) {
intersections[key].resolved += 1; intersections[key].resolved += 1;
if (group.options.stack === true) { if (group.options.stack === true) {
if (combinedData[i].y < group.zeroPosition) {
if (combinedData[i].screen_y < group.zeroPosition) {
heightOffset = intersections[key].accumulatedNegative; heightOffset = intersections[key].accumulatedNegative;
intersections[key].accumulatedNegative += group.zeroPosition - combinedData[i].screen_y; intersections[key].accumulatedNegative += group.zeroPosition - combinedData[i].screen_y;
} }
@ -96,7 +96,7 @@ Bargraph.draw = function (groupIds, processedGroupData, framework) {
screen_x:combinedData[i].screen_x, screen_x:combinedData[i].screen_x,
screen_y:combinedData[i].screen_y - heightOffset, screen_y:combinedData[i].screen_y - heightOffset,
groupId: combinedData[i].groupId, groupId: combinedData[i].groupId,
label: combinedData[i].label,
label: combinedData[i].label
}; };
Points.draw([pointData], group, framework, drawData.offset); Points.draw([pointData], group, framework, drawData.offset);
//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);

Loading…
Cancel
Save