1
1
import { path , symbolCircle } from "d3" ;
2
2
import { create } from "../context.js" ;
3
- import { positive } from "../defined.js" ;
3
+ import { negative , positive } from "../defined.js" ;
4
4
import { identity , maybeFrameAnchor , maybeNumberChannel , maybeTuple } from "../options.js" ;
5
5
import { Mark } from "../plot.js" ;
6
6
import {
@@ -68,6 +68,8 @@ export class Dot extends Mark {
68
68
const { x : X , y : Y , r : R , rotate : A , symbol : S } = channels ;
69
69
const [ cx , cy ] = applyFrameAnchor ( this , dimensions ) ;
70
70
const circle = this . symbol === symbolCircle ;
71
+ const { r} = this ;
72
+ if ( negative ( r ) ) index = [ ] ;
71
73
return create ( "svg:g" , context )
72
74
. call ( applyIndirectStyles , this , scales , dimensions , context )
73
75
. call ( applyTransform , this , { x : X && x , y : Y && y } )
@@ -84,7 +86,7 @@ export class Dot extends Mark {
84
86
selection
85
87
. attr ( "cx" , X ? ( i ) => X [ i ] : cx )
86
88
. attr ( "cy" , Y ? ( i ) => Y [ i ] : cy )
87
- . attr ( "r" , R ? ( i ) => R [ i ] : this . r ) ;
89
+ . attr ( "r" , R ? ( i ) => R [ i ] : r ) ;
88
90
}
89
91
: ( selection ) => {
90
92
const translate =
@@ -106,8 +108,8 @@ export class Dot extends Mark {
106
108
)
107
109
. attr ( "d" , ( i ) => {
108
110
const p = path ( ) ,
109
- r = R ? R [ i ] : this . r ;
110
- ( S ? S [ i ] : this . symbol ) . draw ( p , r * r * Math . PI ) ;
111
+ radius = R ? R [ i ] : r ;
112
+ ( S ? S [ i ] : this . symbol ) . draw ( p , radius * radius * Math . PI ) ;
111
113
return p ;
112
114
} ) ;
113
115
}
0 commit comments