5
5
import React , { Component } from 'react' ;
6
6
import PropTypes from 'prop-types' ;
7
7
import * as d3 from 'd3' ;
8
- import * as _d3Tip from "d3-tip"
8
+ import d3Tip from "d3-tip" ;
9
9
10
10
let root = { } ;
11
11
let duration = 750 ;
@@ -91,11 +91,11 @@ class Chart extends Component {
91
91
. attr ( "r" , 15 )
92
92
93
93
//creating a d3.tip method where the html has a function that returns the data we passed into tip.show from line 120
94
- const d3Tip = _d3Tip . bind ( d3 )
95
94
let tip = d3Tip ( )
96
95
. attr ( "class" , "d3-tip" )
97
96
. html ( function ( d ) { return "State Snapshot: " + d ; } )
98
- //invoking tooltip for nodes
97
+
98
+ //invoking tooltip for nodes
99
99
node . call ( tip )
100
100
101
101
node
@@ -116,51 +116,12 @@ class Chart extends Component {
116
116
117
117
//applying tooltip on mouseover and removes it when mouse cursor moves away
118
118
node
119
- // .on('mouseover', mouseover)
120
- // .on('mouseout', mouseout)
121
- // .on('mousemove', d => mousemove(d));
122
119
. on ( 'mouseover' , function ( d ) {
123
120
// without JSON.stringify, data will display as object Object
124
- tip . show ( JSON . stringify ( d . data . stateSnaphot ) )
121
+ console . log ( 'this is inside mouseover fxnality' , JSON . stringify ( d . data . stateSnaphot ) )
122
+ tip . show ( JSON . stringify ( d . data ) , this )
125
123
} )
126
124
. on ( 'mouseout' , tip . hide )
127
-
128
- // function mousemove(d) {
129
- // div
130
- // .text(JSON.stringify(d.data.stateSnapshot))
131
- // }
132
-
133
- // // Show state on mouse over
134
- // function mouseover() {
135
- // div
136
- // .transition()
137
- // .duration(300)
138
- // .style('display', 'block')
139
- // .style('opacity', 1);
140
- // }
141
-
142
- // function mouseout() {
143
- // div
144
- // .transition()
145
- // .duration(3000)
146
- // .style('opacity', 1e-6)
147
- // .style('display', 'none');
148
- // }
149
-
150
- // function tipMouseover() {
151
- // div
152
- // .transition()
153
- // .duration(300)
154
- // .style('opacity', 1);
155
- // }
156
-
157
- // function tipMouseout() {
158
- // div
159
- // .transition()
160
- // .duration(3000)
161
- // .style('opacity', 1e-6)
162
- // .style('display', 'none');
163
- // }
164
125
165
126
function reinfeldTidierAlgo ( x , y ) {
166
127
return [ ( y = + y ) * Math . cos ( x -= Math . PI / 2 ) , y * Math . sin ( x ) ] ;
0 commit comments