@@ -22,7 +22,7 @@ export function group({x, y, out = "fill", ...options} = {}) {
22
22
}
23
23
24
24
function group1 ( x = identity , { domain, normalize, z, fill, stroke, ...options } = { } ) {
25
- const k = normalize === true ? 100 : + normalize ;
25
+ const k = normalize === true || normalize === "z" ? 100 : + normalize ;
26
26
const [ X , setX ] = lazyChannel ( x ) ;
27
27
const [ Y , setY ] = lazyChannel ( `Frequency${ k === 100 ? " (%)" : "" } ` ) ;
28
28
const [ Z , setZ ] = maybeLazyChannel ( z ) ;
@@ -50,11 +50,12 @@ function group1(x = identity, {domain, normalize, z, fill, stroke, ...options} =
50
50
const BZ = Z && setZ ( [ ] ) ;
51
51
const BF = F && setF ( [ ] ) ;
52
52
const BS = S && setS ( [ ] ) ;
53
- const n = data . length ;
53
+ let n = data . length ;
54
54
let i = 0 ;
55
55
for ( const facet of facets ) {
56
56
const groupFacet = [ ] ;
57
57
for ( const I of G ? grouper ( facet , i => G [ i ] ) . values ( ) : [ facet ] ) {
58
+ if ( normalize === "z" ) n = I . length ;
58
59
for ( const [ x , f ] of sort ( grouper ( I , i => X [ i ] ) , first ) ) {
59
60
if ( ! defined ( x ) ) continue ;
60
61
const l = f . length ;
@@ -81,7 +82,7 @@ function group2(xv, yv, {z, fill, stroke, domain, normalize, ...options} = {}) {
81
82
let { value : x , domain : xdomain } = { domain, ...maybeValue ( xv ) } ;
82
83
let { value : y , domain : ydomain } = { domain, ...maybeValue ( yv ) } ;
83
84
( [ x , y ] = maybeTuple ( x , y ) ) ;
84
- const k = normalize === true ? 100 : + normalize ;
85
+ const k = normalize === true || normalize === "z" ? 100 : + normalize ;
85
86
const [ X , setX ] = lazyChannel ( x ) ;
86
87
const [ Y , setY ] = lazyChannel ( y ) ;
87
88
const [ L , setL ] = lazyChannel ( `Frequency${ k === 100 ? " (%)" : "" } ` ) ;
@@ -113,11 +114,12 @@ function group2(xv, yv, {z, fill, stroke, domain, normalize, ...options} = {}) {
113
114
const BZ = Z && setZ ( [ ] ) ;
114
115
const BF = F && setF ( [ ] ) ;
115
116
const BS = S && setS ( [ ] ) ;
116
- const n = data . length ;
117
+ let n = data . length ;
117
118
let i = 0 ;
118
119
for ( const facet of facets ) {
119
120
const groupFacet = [ ] ;
120
121
for ( const I of G ? grouper ( facet , i => G [ i ] ) . values ( ) : [ facet ] ) {
122
+ if ( normalize === "z" ) n = I . length ;
121
123
for ( const [ y , fy ] of sort ( grouper ( I , i => Y [ i ] ) , first ) ) {
122
124
if ( ! ydefined ( y ) ) continue ;
123
125
for ( const [ x , f ] of sort ( grouper ( fy , i => X [ i ] ) , first ) ) {
0 commit comments