1+ /* eslint-disable @typescript-eslint/no-explicit-any */
2+ /* eslint-disable max-len */
3+ /* eslint-disable @typescript-eslint/ban-types */
4+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
15/* eslint-disable eqeqeq */
26/* eslint-disable react/prop-types */
37/* eslint-disable no-mixed-operators */
1014/* eslint-disable no-use-before-define */
1115/* eslint-disable react/no-string-refs */
1216
13-
1417import React , { Component } from 'react' ;
1518import * as d3 from 'd3' ;
1619
@@ -19,15 +22,22 @@ import * as d3 from 'd3';
1922 */
2023const colors = [ '#95B6B7' , '#475485' , '#519331' , '#AA5039' , '#8B2F5F' , '#C5B738' , '#858DFF' , '#FF8D02' , '#FFCD51' , '#ACDAE6' , '#FC997E' , '#CF93AD' , '#AA3939' , '#AA6C39' , '#226666' , '#2C4870' ] ;
2124
25+ const filter = ( data :any [ ] ) => {
26+ console . log ( 'data from filter' , data )
27+ if ( data [ 0 ] . children && data [ 0 ] . state === 'stateless' ) {
28+ return filter ( data [ 0 ] . children ) ;
29+ }
30+ return JSON . stringify ( data [ 0 ] . state ) ;
31+ } ;
32+
2233interface ChartProps {
2334 hierarchy : Record < string , unknown > ;
2435}
2536
2637let root = { } ;
2738class Chart extends Component {
2839 /**
29- *
30- * @method maked3Tree :Creates a new D3 Tree
40+ * @method maked3Tree :Creates a new D3 Tree
3141 */
3242 constructor ( props :ChartProps ) {
3343 super ( props ) ;
@@ -80,6 +90,7 @@ class Chart extends Component {
8090
8191 // if we consider the container for our radial node graph as a box encapsulating
8292 // half of this container width is essentially the radius of our radial node graph
93+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
8394 const radius = width / 2 ;
8495
8596 // d3.hierarchy constructs a root node from the specified hierarchical data
@@ -145,11 +156,12 @@ class Chart extends Component {
145156 . duration ( 50 )
146157 . style ( 'opacity' , 0.9 ) ;
147158
148- tooltipDiv . html ( JSON . stringify ( d . data . stateSnapshot . children [ 0 ] . state ) , this )
159+ tooltipDiv . html ( filter ( d . data . stateSnapshot . children ) , this )
149160 . style ( 'left' , ( d3 . event . pageX - 90 ) + 'px' )
150161 . style ( 'top' , ( d3 . event . pageY - 65 ) + 'px' ) ;
151162 } )
152163 // eslint-disable-next-line no-unused-vars
164+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
153165 . on ( 'mouseout' , function ( d :any ) {
154166 d3 . select ( this )
155167 . transition ( )
0 commit comments