@@ -19,7 +19,7 @@ export class Dot extends Mark {
19
19
...style
20
20
} = { }
21
21
) {
22
- const [ vsize , csize = vsize == null ? 3 : undefined ] = maybeNumber ( size ) ;
22
+ const [ vsize , csize = vsize == null ? 27 : undefined ] = maybeNumber ( size ) ;
23
23
const [ vfill , cfill = vfill == null ? "none" : undefined ] = maybeColor ( fill ) ;
24
24
const [ vstroke , cstroke = vstroke == null && cfill === "none" ? "currentColor" : undefined ] = maybeColor ( stroke ) ;
25
25
super (
@@ -46,10 +46,10 @@ export class Dot extends Mark {
46
46
render (
47
47
I ,
48
48
{ x, y, size, color} ,
49
- { x : X , y : Y , z : Z , size : R , title : L , fill : F , stroke : S }
49
+ { x : X , y : Y , z : Z , size : A , title : L , fill : F , stroke : S }
50
50
) {
51
51
let index = filter ( I , X , Y , F , S ) ;
52
- if ( R ) index = index . filter ( i => positive ( R [ i ] ) ) ;
52
+ if ( A ) index = index . filter ( i => positive ( A [ i ] ) ) ;
53
53
if ( Z ) index . sort ( ( i , j ) => ascending ( Z [ i ] , Z [ j ] ) ) ;
54
54
return create ( "svg:g" )
55
55
. call ( applyIndirectStyles , this )
@@ -60,7 +60,7 @@ export class Dot extends Mark {
60
60
. call ( applyDirectStyles , this )
61
61
. attr ( "cx" , i => x ( X [ i ] ) )
62
62
. attr ( "cy" , i => y ( Y [ i ] ) )
63
- . attr ( "r" , R ? i => size ( R [ i ] ) : this . size )
63
+ . attr ( "r" , A ? i => radius ( size ( A [ i ] ) ) : radius ( this . size ) )
64
64
. attr ( "fill" , F && ( i => color ( F [ i ] ) ) )
65
65
. attr ( "stroke" , S && ( i => color ( S [ i ] ) ) )
66
66
. call ( L ? text => text
@@ -71,6 +71,10 @@ export class Dot extends Mark {
71
71
}
72
72
}
73
73
74
+ function radius ( area ) {
75
+ return Math . sqrt ( area / 3 ) ;
76
+ }
77
+
74
78
export function dot ( data , options ) {
75
79
return new Dot ( data , options ) ;
76
80
}
0 commit comments