Whether it is possible to highlight the SVG element(D3) setting the function of the svg?

Made a chart on d3.js and there is an event on mouse over
var myChart = d3.select(this.refs.chart).append("svg")
.selectAll("rect")
.on('mouseover', function(d){

...
 d3.select(this)//I want the same but the functions on the page
 .style('opacity', 0.5)
 })

Visit the table in which you want to make a hover on a row with values and that would be allocated to the corresponding column. The index can be used .data(dataArray) or something else...

How to make a selection through the function?
July 12th 19 at 16:58
1 answer
July 12th 19 at 17:00
Solution
The SVG element is a page element and any child element can be accessed through selectors.
document.querySelector('svg text.my-text')
After receiving the item, you can assign event handlers.
Then I do not understand how to do it (didn't work with svg). text.my-text where these attributes take?
In html looks like this:
<rect width="106.2" height="94.86666666666666" x="108.2" y="260.8833333333333" style="fill: rgb(93, 120, 117);"></rect>

How it is possible using the values of the x-axis to choose? - Madalyn commented on July 12th 19 at 17:03
: It was an example. For this rect you can specify class='my-text', to make it easier to find querySelector('svg rect.my-text'). If using x then so querySelector('svg rect[x="108.2"]') - Darron commented on July 12th 19 at 17:06
: class will not help me, as much, id rather... but with x="108.2" you misunderstood me a bit, these values are dynamic. is it possible using d3.svg.axis select (0..9)? Mess in my head) - Madalyn commented on July 12th 19 at 17:09
: I don't use d3. You can select all the rect elements, and then filter in its function by attribute - Darron commented on July 12th 19 at 17:12
: thank you. made using id. left to figure out how onClick color here and there to change, and only there - Madalyn commented on July 12th 19 at 17:15

Find more questions by tags JavaScriptSVGjQuery