Skip to content

Commit

Permalink
[all] Fix bug 67828 (#85)
Browse files Browse the repository at this point in the history
Date Ax had some additional space between labels, new variable spaceBetweenLabels created
Co-authored-by: ansaraidarbek <[email protected]>
Co-committed-by: ansaraidarbek <[email protected]>
  • Loading branch information
ansaraidarbek authored and GoshaZotov committed Sep 26, 2024
1 parent d35af99 commit 3b03266
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions common/Drawings/Format/ChartSpace.js
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,6 @@ function(window, undefined) {

// update the max height
fMaxHeight = Math.max(fMaxHeight, fBoxH);
console.log(fMaxHeight);

var fX1, fY0, fXC, fYC;
fY0 = fAxisY + fDistance;
Expand Down Expand Up @@ -11717,6 +11716,9 @@ function(window, undefined) {
this.bCalculated = false;
this.fLabelHeight = null;
this.fLabelWidth = null;
// alpha stands for the amount of additional space that label should have, other than the width of its content;
// left space + right space = this.fSpaceBetweenLabels
this.fSpaceBetweenLabels = (this.nAxisType === AscDFH.historyitem_type_DateAx) ? 1.939 : 0;
}

CLabelsParameters.prototype.calculate = function (oLabelsBox, fAxisLength, fRectHeight, nIndex) {
Expand Down Expand Up @@ -11902,7 +11904,7 @@ function(window, undefined) {

if (this.fLabelWidth) {
// toDo test configurations for different number labels on excel: finalTestCatAxis
const labelCount = fAxisLength > 0 && fAxisLength >= this.fLabelWidth ? Math.floor(fAxisLength / this.fLabelWidth) : 1;
const labelCount = fAxisLength > 0 && fAxisLength >= this.fLabelWidth ? Math.floor((fAxisLength + this.fSpaceBetweenLabels) / (this.fLabelWidth + this.fSpaceBetweenLabels)) : 1;
nLblTickSkip = Math.ceil(this.nLabelsCount / labelCount);

// date ax skips labels by significant days
Expand Down Expand Up @@ -11952,10 +11954,10 @@ function(window, undefined) {
// multiplier is the square root of 2;
// diagonal rectangle with h is equal to root(2) * h;
const fUpdatedLabelHight = 1.41421356237 * this.fLabelHeight;
const diagonalLabelWidth = fUpdatedLabelHight * updatedLabelsCount;
const diagonalLabelWidth = (fUpdatedLabelHight + this.fSpaceBetweenLabels) * updatedLabelsCount;

// diagonal angle is 45 degree
if (diagonalLabelWidth && diagonalLabelWidth <= fAxisLength) {
if (diagonalLabelWidth && diagonalLabelWidth <= (fAxisLength + this.fSpaceBetweenLabels)) {
this.fLabelWidth = fUpdatedLabelHight;
this.rot = -45 * this.degree;
return;
Expand Down

0 comments on commit 3b03266

Please sign in to comment.