Skip to content

Commit

Permalink
Merge pull request #136 from philips-emr/partogram-axisCustom-fix
Browse files Browse the repository at this point in the history
Ajuste axis custom do Partograma
  • Loading branch information
masborchardt authored Sep 13, 2023
2 parents 7d6eacf + 02225bb commit ec80935
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
9 changes: 4 additions & 5 deletions dist/vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* A dynamic, browser-based visualization library.
*
* @version 4.15.4
* @date 2023-07-20
* @date 2023-09-13
*
* @license
* Copyright (C) 2011-2016 Almende B.V, http://almende.com
Expand Down Expand Up @@ -30868,14 +30868,13 @@ return /******/ (function(modules) { // webpackBootstrap

var amountLabels = length;
var position = lineHeight - this.props.minorCharHeight;
var internHeight = lineHeight - this.props.minorCharHeight * 2;
var amountLabelsToFit = Math.floor(internHeight / this.props.minorCharHeight);
var amountLabelsToFit = Math.floor(position / this.props.minorCharHeight);

// Divides the number of labels to fit the available height
while (amountLabels > amountLabelsToFit) {
amountLabels = Math.floor((amountLabels - 2) / 2);
}
var intervalHeight = Math.floor(internHeight / amountLabels);
var intervalHeight = Math.floor(position / (amountLabels - 1));

// Print top and bottom labels
var firstItem = group.group.axisCustomLabel[0];
Expand All @@ -30887,7 +30886,7 @@ return /******/ (function(modules) { // webpackBootstrap

// Print middle labels
group.group.axisCustomLabel.slice().reverse().filter(function (a, i) {
return i > 0 && i % Math.floor(length / amountLabels) === 0;
return i > 0 && i < amountLabels - 1 && i % Math.floor(length / amountLabels) === 0;
}).forEach(function (axisCustomLabel) {
position = position - intervalHeight;
var label = axisCustomLabel.alternativeLabel ? axisCustomLabel.alternativeLabel : axisCustomLabel.y;
Expand Down
2 changes: 1 addition & 1 deletion dist/vis.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/vis.min.js

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions lib/timeline/component/timeline-chart/DrawLabels.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,13 @@ class DrawLabels {
const { length } = group.group.axisCustomLabel;
let amountLabels = length;
let position = lineHeight - this.props.minorCharHeight;
const internHeight = lineHeight - this.props.minorCharHeight * 2;
const amountLabelsToFit = Math.floor(internHeight / this.props.minorCharHeight);
const amountLabelsToFit = Math.floor(position / this.props.minorCharHeight);

// Divides the number of labels to fit the available height
while (amountLabels > amountLabelsToFit) {
amountLabels = Math.floor((amountLabels - 2) / 2);
}
const intervalHeight = Math.floor(internHeight / amountLabels);
const intervalHeight = Math.floor(position / (amountLabels - 1));

// Print top and bottom labels
const firstItem = group.group.axisCustomLabel[0];
Expand All @@ -179,7 +178,7 @@ class DrawLabels {

// Print middle labels
group.group.axisCustomLabel.slice().reverse()
.filter((a, i) => i > 0 && i % Math.floor(length / amountLabels) === 0)
.filter((a, i) => i > 0 && i < (amountLabels - 1) && i % Math.floor(length / amountLabels) === 0)
.forEach(axisCustomLabel => {
position = position - intervalHeight;
const label = axisCustomLabel.alternativeLabel ? axisCustomLabel.alternativeLabel : axisCustomLabel.y;
Expand Down

0 comments on commit ec80935

Please sign in to comment.