Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/scale/Interval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ class IntervalScale<SETTING extends Dictionary<unknown> = Dictionary<unknown>> e
if (extent[0] === extent[1]) {
if (extent[0] !== 0) {
// Expand extent
const expandSize = extent[0];
// Note that extents can be both negative. See #13154
const expandSize = Math.abs(extent[0]);
// In the fowllowing case
// Axis has been fixed max 100
// Plus data are all 100 and axis extent are [100, 100].
Expand Down
7 changes: 4 additions & 3 deletions src/scale/Log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ class LogScale extends Scale {
}

setExtent(start: number, end: number): void {
const base = this.base;
start = mathLog(start) / mathLog(base);
end = mathLog(end) / mathLog(base);
const base = mathLog(this.base);
// log(-Infinity) is NaN, so safe guard here
start = mathLog(Math.max(0, start)) / base;
end = mathLog(Math.max(0, end)) / base;
intervalScaleProto.setExtent.call(this, start, end);
}

Expand Down
33 changes: 32 additions & 1 deletion test/logScale.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.