Skip to content

Commit

Permalink
Merge pull request #18 from franshej/fix/zero_lims
Browse files Browse the repository at this point in the history
Fix zero lims
  • Loading branch information
franshej committed Sep 24, 2023
2 parents efbb788 + fbf91a2 commit 98195da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.2.1 (2023-09-24)

### Fixed
- Zero lims.
- Add tracepoint.

## 1.2.0 (2023-09-16)

### Added
Expand Down
13 changes: 8 additions & 5 deletions include/include_internal/cmp_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,14 @@ static std::vector<float> getLinearTicks_V2(
const auto delta = base_value * multiplier;
std::vector<float> ticks;

const auto log_lim_min_floor = std::floor(log10(abs(lim.min)));
const auto base_value_min = pow(10.f, log_lim_min_floor);
auto multiplier_min = std::floor(lim.min / base_value_min);
multiplier_min = multiplier_min == 0 ? 1 : multiplier_min;
auto lim_min_round = base_value_min * multiplier_min;
auto lim_min_round = lim.min;
if (lim.min != 0) {
const auto log_lim_min_floor = std::floor(log10(abs(lim.min)));
const auto base_value_min = pow(10.f, log_lim_min_floor);
auto multiplier_min = std::floor(lim.min / base_value_min);
multiplier_min = multiplier_min == 0 ? 1 : multiplier_min;
lim_min_round = base_value_min * multiplier_min;
}

if (lim_min_round < lim.min - delta) {
const auto div = lim.min - delta - lim_min_round;
Expand Down

0 comments on commit 98195da

Please sign in to comment.