@flourish/chart-layout
Advanced tools
Comparing version 3.0.1 to 3.0.2
{ | ||
"name": "@flourish/chart-layout", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Create axes", | ||
@@ -5,0 +5,0 @@ "main": "chart-layout.js", |
@@ -0,1 +1,4 @@ | ||
# 3.0.2 | ||
* Improve fallback range for log scales | ||
# 3.0.1 | ||
@@ -2,0 +5,0 @@ * Fix `defaultDatetimeParser` function |
import { scaleLinear, scaleLog, scalePoint, scaleTime } from "d3-scale"; | ||
var LOG_SCALE_FACTOR = 1000; | ||
function getPointScale(data) { | ||
@@ -60,6 +62,6 @@ var scale = scalePoint().domain(data.unique()).padding(0.5); | ||
if (extent[0] <= 0) { | ||
if (extent[1] > 0) extent[0] = extent[1] / 10; | ||
if (extent[1] > 0) extent[0] = Math.min(1, extent[1]/LOG_SCALE_FACTOR); | ||
else extent[0] = 1; | ||
} | ||
if (extent[1] <= 0) extent = 10 * extent[0]; | ||
if (extent[1] <= extent[0]) extent[1] = LOG_SCALE_FACTOR * extent[0]; | ||
var scale = scaleLog().domain(extent).nice(); | ||
@@ -66,0 +68,0 @@ var domain = scale.domain(); |
Sorry, the diff of this file is too big to display
359531
9078