@vx/legend
Advanced tools
Comparing version 0.0.140 to 0.0.141
@@ -79,3 +79,5 @@ 'use strict'; | ||
function format(labelFormat, value, i) { | ||
return labelFormat(value, i) || ''; | ||
var formattedValue = labelFormat(value, i); | ||
if (formattedValue === 0) return '0'; | ||
return formattedValue || ''; | ||
} | ||
@@ -89,8 +91,13 @@ return function (d, i) { | ||
var delimiter = ' ' + labelDelimiter + ' '; | ||
var value = x1; | ||
if (!x0) { | ||
var value = void 0; | ||
if (x0 !== 0 && !x0 && (x1 === 0 || !!x1)) { | ||
// lower threshold | ||
value = x1 - 1; | ||
delimiter = labelLower; | ||
} | ||
if (!x1) { | ||
} else if ((x0 === 0 || !!x0) && (x1 === 0 || !!x1)) { | ||
// threshold step | ||
value = x0; | ||
} else if (!x1 && (x0 === 0 || !!x0)) { | ||
// upper threshold | ||
value = x0 + scale.domain()[1]; | ||
x1 = x0; | ||
@@ -97,0 +104,0 @@ x0 = undefined; |
{ | ||
"name": "@vx/legend", | ||
"version": "0.0.140", | ||
"version": "0.0.141", | ||
"description": "vx legend", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -51,3 +51,5 @@ import React from 'react'; | ||
function format(labelFormat, value, i) { | ||
return labelFormat(value, i) || ''; | ||
const formattedValue = labelFormat(value, i); | ||
if (formattedValue === 0) return '0'; | ||
return formattedValue || ''; | ||
} | ||
@@ -57,8 +59,13 @@ return (d, i) => { | ||
let delimiter = ` ${labelDelimiter} `; | ||
let value = x1; | ||
if (!x0) { | ||
let value; | ||
if (x0 !== 0 && !x0 && (x1 === 0 || !!x1)) { | ||
// lower threshold | ||
value = x1 - 1; | ||
delimiter = labelLower; | ||
} | ||
if (!x1) { | ||
} else if ((x0 === 0 || !!x0) && (x1 === 0 || !!x1)) { | ||
// threshold step | ||
value = x0; | ||
} else if (!x1 && (x0 === 0 || !!x0)) { | ||
// upper threshold | ||
value = x0 + scale.domain()[1]; | ||
x1 = x0; | ||
@@ -65,0 +72,0 @@ x0 = undefined; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52622
1444