Skip to content

Commit

Permalink
Fix/axes crosses (#2530)
Browse files Browse the repository at this point in the history
* [se] Fix calculate nullPositionOx by axes crosses


Co-authored-by: Kvaigone <[email protected]>
  • Loading branch information
GoshaZotov and Kvaigone authored Feb 2, 2022
1 parent 9be00a1 commit a3b72c6
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions common/Charts/ChartsDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3878,12 +3878,14 @@ CChartsDrawer.prototype =
result = !result;
}

if ((_valAx.crossAx.crosses === AscFormat.CROSSES_MAX && val > 0) ||
(_valAx.crossAx.crosses === AscFormat.CROSSES_MIN && val < 0)) {
result = !result;
} else if (_valAx.crossAx.crossesAt) {
if ((val > 0 && val < _valAx.crossAx.crossesAt) || (val < 0 && val > _valAx.crossAx.crossesAt)) {
if (!(this.calcProp.subType === "stacked") && !(this.calcProp.subType === "stackedPer")) {
if ((_valAx.crossAx.crosses === AscFormat.CROSSES_MAX && val > 0) ||
(_valAx.crossAx.crosses === AscFormat.CROSSES_MIN && val < 0)) {
result = !result;
} else if (_valAx.crossAx.crossesAt) {
if ((val > 0 && val < _valAx.crossAx.crossesAt) || (val < 0 && val > _valAx.crossAx.crossesAt)) {
result = !result;
}
}
}

Expand Down Expand Up @@ -6276,7 +6278,8 @@ drawBarChart.prototype = {
switch (type) {
case AscFormat.BAR_SHAPE_PYRAMID:
case AscFormat.BAR_SHAPE_PYRAMIDTOMAX: {
nullPositionOX = this.catAx.posY * this.chartProp.pxToMM;
var nullPositionOX = this.subType === "stacked" ? this.cChartDrawer.getPositionZero(this.valAx) :
this.catAx.posY * this.chartProp.pxToMM;
paths = this.cChartDrawer.calculatePyramid(false, this.subType, startX, startY, height, gapDepth,
individualBarWidth, perspectiveDepth, val, nullPositionOX, maxH, minH);

Expand All @@ -6290,7 +6293,8 @@ drawBarChart.prototype = {
}
case AscFormat.BAR_SHAPE_CONE:
case AscFormat.BAR_SHAPE_CONETOMAX: {
nullPositionOX = this.catAx.posY * this.chartProp.pxToMM;
var nullPositionOX = this.subType === "stacked" ? this.cChartDrawer.getPositionZero(this.valAx) :
this.catAx.posY * this.chartProp.pxToMM;
paths = this.cChartDrawer._calculateCylinder(startX, startY, individualBarWidth, height, val, gapDepth,
perspectiveDepth, this.subType !== "standard", false, this.subType, nullPositionOX, maxH, minH);
break;
Expand Down Expand Up @@ -9060,11 +9064,12 @@ drawHBarChart.prototype = {
point8 = this.cChartDrawer._convertAndTurnPoint(x8, y8, z8);

var points = [point1, point2, point3, point4, point5, point6, point7, point8];
var nullPositionOX;

switch (type) {
case AscFormat.BAR_SHAPE_PYRAMID:
case AscFormat.BAR_SHAPE_PYRAMIDTOMAX: {
nullPositionOX = this.catAx.posX * this.chartProp.pxToMM;
var nullPositionOX = this.subType === "stacked" ? this.cChartDrawer.getPositionZero(this.valAx) :
this.catAx.posX * this.chartProp.pxToMM;
paths = this.cChartDrawer.calculatePyramid(true, this.subType, newStartX, newStartY, width, DiffGapDepth,
individualBarHeight, perspectiveDepth, val, nullPositionOX, maxH, minH);
paths2 = this.cChartDrawer.calculateRect3D(points, val, null, true);
Expand All @@ -9077,7 +9082,8 @@ drawHBarChart.prototype = {
}
case AscFormat.BAR_SHAPE_CONE:
case AscFormat.BAR_SHAPE_CONETOMAX: {
nullPositionOX = this.catAx.posX * this.chartProp.pxToMM;
var nullPositionOX = this.subType === "stacked" ? this.cChartDrawer.getPositionZero(this.valAx) :
this.catAx.posX * this.chartProp.pxToMM;
paths = this.cChartDrawer._calculateCylinder(newStartX, newStartY, individualBarHeight, width, val, DiffGapDepth, perspectiveDepth, true, true,
this.subType, nullPositionOX, maxH, minH);
paths2 = this.cChartDrawer.calculateRect3D(points, val, null, true);
Expand Down

0 comments on commit a3b72c6

Please sign in to comment.