11import { path , symbolCircle } from "d3" ;
22import { create } from "../context.js" ;
3- import { positive } from "../defined.js" ;
3+ import { negative , positive } from "../defined.js" ;
44import { identity , maybeFrameAnchor , maybeNumberChannel , maybeTuple } from "../options.js" ;
55import { Mark } from "../plot.js" ;
66import {
@@ -68,6 +68,8 @@ export class Dot extends Mark {
6868 const { x : X , y : Y , r : R , rotate : A , symbol : S } = channels ;
6969 const [ cx , cy ] = applyFrameAnchor ( this , dimensions ) ;
7070 const circle = this . symbol === symbolCircle ;
71+ const { r} = this ;
72+ if ( negative ( r ) ) index = [ ] ;
7173 return create ( "svg:g" , context )
7274 . call ( applyIndirectStyles , this , scales , dimensions , context )
7375 . call ( applyTransform , this , { x : X && x , y : Y && y } )
@@ -84,7 +86,7 @@ export class Dot extends Mark {
8486 selection
8587 . attr ( "cx" , X ? ( i ) => X [ i ] : cx )
8688 . attr ( "cy" , Y ? ( i ) => Y [ i ] : cy )
87- . attr ( "r" , R ? ( i ) => R [ i ] : this . r ) ;
89+ . attr ( "r" , R ? ( i ) => R [ i ] : r ) ;
8890 }
8991 : ( selection ) => {
9092 const translate =
@@ -106,8 +108,8 @@ export class Dot extends Mark {
106108 )
107109 . attr ( "d" , ( i ) => {
108110 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 ) ;
111113 return p ;
112114 } ) ;
113115 }
0 commit comments